File indexing completed on 2024-12-22 04:12:52

0001 /*
0002  *  SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_MODEL_INDEX_CONVERTER_TEST_H
0008 #define __KIS_MODEL_INDEX_CONVERTER_TEST_H
0009 
0010 #include <simpletest.h>
0011 
0012 #include "empty_nodes_test.h"
0013 
0014 class KisDummiesFacadeBase;
0015 class KisNodeModel;
0016 class KisModelIndexConverterBase;
0017 
0018 
0019 class KisModelIndexConverterTest : public QObject, public TestUtil::EmptyNodesTest
0020 {
0021     Q_OBJECT
0022 private Q_SLOTS:
0023     void init();
0024     void cleanup();
0025 
0026     void testIndexFromDummy();
0027     void testIndexFromAddedAllowedDummy();
0028     void testIndexFromAddedDeniedDummy();
0029     void testDummyFromRow();
0030     void testRowCount();
0031 
0032     void testIndexFromDummyShowGlobalSelection();
0033     void testIndexFromAddedAllowedDummyShowGlobalSelection();
0034     void testIndexFromAddedDeniedDummyShowGlobalSelection();
0035     void testDummyFromRowShowGlobalSelection();
0036     void testRowCountShowGlobalSelection();
0037 
0038     void testIndexFromDummyShowAll();
0039     void testIndexFromAddedAllowedDummyShowAll();
0040     void testIndexFromAddedDeniedDummyShowAll();
0041     void testDummyFromRowShowAll();
0042     void testRowCountShowAll();
0043 
0044 private:
0045     inline void checkIndexFromDummy(KisNodeSP node, int row);
0046     inline void checkInvalidIndexFromDummy(KisNodeSP node);
0047     inline void checkIndexFromAddedAllowedDummy(KisNodeSP parent, int index, int parentRow, int childRow, bool parentValid);
0048     inline void checkIndexFromAddedDeniedDummy(KisNodeSP parent, int index, int parentRow, int childRow, bool parentValid);
0049     inline void checkIndexFromAddedDummy(KisNodeSP parent, int index, const QString &type, int parentRow, int childRow, bool parentValid);
0050     inline void checkInvalidIndexFromAddedAllowedDummy(KisNodeSP parent, int index);
0051     inline void checkInvalidIndexFromAddedDeniedDummy(KisNodeSP parent, int index);
0052     inline void checkInvalidIndexFromAddedDummy(KisNodeSP parent, int index, const QString &type);
0053     inline void checkDummyFromRow(KisNodeSP parent, int row, KisNodeSP expectedNode);
0054     inline void checkRowCount(KisNodeSP parent, int rowCount);
0055 
0056 private:
0057     KisDummiesFacadeBase *m_dummiesFacade;
0058     KisNodeModel *m_nodeModel;
0059     KisModelIndexConverterBase *m_indexConverter;
0060 };
0061 
0062 #endif /* __KIS_MODEL_INDEX_CONVERTER_TEST_H */