1 /*
2  *  Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
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_NODE_TESTER_H
20 #define KIS_NODE_TESTER_H
21 
22 #include <QtTest>
23 
24 #include "kis_node.h"
25 #include <sdk/tests/testing_nodes.h>
26 
27 class TestNode : public TestUtil::DefaultNode
28 {
29     Q_OBJECT
30 
31 public:
clone()32     KisNodeSP clone() {
33         return new TestNode(*this);
34     }
35 
36     using KisNode::setDirty;
37 
setDirty()38     void setDirty() override {
39         KisNode::setDirty(QRect(-1000, -1000, 2000, 200));
40     }
clone()41     KisNodeSP clone() const override {
42         return new TestNode(*this);
43     }
44 };
45 
46 
47 class TestNodeA : public TestUtil::DefaultNode
48 {
49     Q_OBJECT
50 public:
clone()51     KisNodeSP clone() const override {
52         return new TestNodeA(*this);
53     }
54 };
55 
56 class TestNodeB : public TestUtil::DefaultNode
57 {
58     Q_OBJECT
59 public:
clone()60     KisNodeSP clone() const override {
61         return new TestNodeB(*this);
62     }
63 };
64 
65 class TestNodeC : public TestUtil::DefaultNode
66 {
67     Q_OBJECT
68 public:
clone()69     KisNodeSP clone() const override {
70         return new TestNodeC(*this);
71     }
72 };
73 
74 
75 
76 class KisNodeTest : public QObject
77 {
78     Q_OBJECT
79 
80 private Q_SLOTS:
81 
82     void testCreation();
83     void testOrdering();
84     void testSetDirty();
85     void testChildNodes();
86 
87     void propertiesStressTest();
88     void graphStressTest();
89 
90 private:
91     class VisibilityKiller;
92     class GraphKiller;
93 
94     template <class KillerClass>
95         void propertiesStressTestImpl();
96 };
97 
98 #endif
99 
100