1 /*
2  *  Copyright (c) 2016 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 #include "kis_brush_hud_properties_config_test.h"
20 
21 #include <QTest>
22 #include "brushhud/kis_brush_hud_properties_config.h"
23 #include <QDomDocument>
24 
25 #include "kis_debug.h"
26 
27 
test()28 void KisBrushHudPropertiesConfigTest::test()
29 {
30     {
31         KisBrushHudPropertiesConfig cfg;
32 
33         QList<QString> properties1;
34         properties1 << "prop1";
35         properties1 << "prop2";
36         properties1 << "prop3";
37         cfg.setSelectedProperties("brush1", properties1);
38 
39         QList<QString> properties2;
40         properties2 << "prop4";
41         properties2 << "prop5";
42         properties2 << "prop6";
43         cfg.setSelectedProperties("brush2", properties2);
44 
45         // {
46         //     qDebug() << "===========================";
47         //     QString str = cfg.testingGetDocument()->toString(4);
48         //     printf(str.toLatin1());
49         // }
50 
51         properties1.clear();
52         properties1 << "prop7";
53         properties1 << "prop8";
54         cfg.setSelectedProperties("brush1", properties1);
55 
56         // {
57         //     qDebug() << "===========================";
58         //     QString str = cfg.testingGetDocument()->toString(4);
59         //     printf(str.toLatin1());
60         // }
61 
62         properties1.clear();
63         properties1 = cfg.selectedProperties("brush1");
64 
65         QCOMPARE(properties1.size(), 2);
66         QCOMPARE(properties1[0], QString("prop7"));
67         QCOMPARE(properties1[1], QString("prop8"));
68     }
69 
70     {
71         KisBrushHudPropertiesConfig cfg;
72         QList<QString> properties1;
73         properties1 = cfg.selectedProperties("brush1");
74 
75         // qDebug() << "===========================";
76         // qDebug() << ppVar(properties1);
77 
78         QCOMPARE(properties1.size(), 2);
79         QCOMPARE(properties1[0], QString("prop7"));
80         QCOMPARE(properties1[1], QString("prop8"));
81     }
82 }
83 
84 QTEST_MAIN(KisBrushHudPropertiesConfigTest)
85