1 /* 2 * Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __KIS_MODEL_INDEX_CONVERTER_TEST_H 20 #define __KIS_MODEL_INDEX_CONVERTER_TEST_H 21 22 #include <QtTest> 23 24 #include "empty_nodes_test.h" 25 26 class KisDummiesFacadeBase; 27 class KisNodeModel; 28 class KisModelIndexConverterBase; 29 30 31 class KisModelIndexConverterTest : public QObject, public TestUtil::EmptyNodesTest 32 { 33 Q_OBJECT 34 private Q_SLOTS: 35 void init(); 36 void cleanup(); 37 38 void testIndexFromDummy(); 39 void testIndexFromAddedAllowedDummy(); 40 void testIndexFromAddedDeniedDummy(); 41 void testDummyFromRow(); 42 void testRowCount(); 43 44 void testIndexFromDummyShowGlobalSelection(); 45 void testIndexFromAddedAllowedDummyShowGlobalSelection(); 46 void testIndexFromAddedDeniedDummyShowGlobalSelection(); 47 void testDummyFromRowShowGlobalSelection(); 48 void testRowCountShowGlobalSelection(); 49 50 void testIndexFromDummyShowAll(); 51 void testIndexFromAddedAllowedDummyShowAll(); 52 void testIndexFromAddedDeniedDummyShowAll(); 53 void testDummyFromRowShowAll(); 54 void testRowCountShowAll(); 55 56 private: 57 inline void checkIndexFromDummy(KisNodeSP node, int row); 58 inline void checkInvalidIndexFromDummy(KisNodeSP node); 59 inline void checkIndexFromAddedAllowedDummy(KisNodeSP parent, int index, int parentRow, int childRow, bool parentValid); 60 inline void checkIndexFromAddedDeniedDummy(KisNodeSP parent, int index, int parentRow, int childRow, bool parentValid); 61 inline void checkIndexFromAddedDummy(KisNodeSP parent, int index, const QString &type, int parentRow, int childRow, bool parentValid); 62 inline void checkInvalidIndexFromAddedAllowedDummy(KisNodeSP parent, int index); 63 inline void checkInvalidIndexFromAddedDeniedDummy(KisNodeSP parent, int index); 64 inline void checkInvalidIndexFromAddedDummy(KisNodeSP parent, int index, const QString &type); 65 inline void checkDummyFromRow(KisNodeSP parent, int row, KisNodeSP expectedNode); 66 inline void checkRowCount(KisNodeSP parent, int rowCount); 67 68 private: 69 KisDummiesFacadeBase *m_dummiesFacade; 70 KisNodeModel *m_nodeModel; 71 KisModelIndexConverterBase *m_indexConverter; 72 }; 73 74 #endif /* __KIS_MODEL_INDEX_CONVERTER_TEST_H */ 75