1 /*
2  *  Copyright (c) 2006 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 #include "kis_filter_configuration_test.h"
20 #include <QApplication>
21 #include <QTest>
22 #include <kis_debug.h>
23 #include <KoID.h>
24 #include <kis_paint_device.h>
25 
26 
27 #include "../filter/kis_filter_configuration.h"
28 #include "../filter/kis_filter_registry.h"
29 #include "../filter/kis_filter.h"
30 
testCreation()31 void KisFilterConfigurationTest::testCreation()
32 {
33     KisFilterConfigurationSP  kfc = new KisFilterConfiguration("test", 1);
34     QVERIFY2(kfc != 0,  "Could not create test filter configuration");
35     QCOMPARE(kfc->version(), 1);
36     QCOMPARE(kfc->name(), QString("test"));
37 
38 }
39 
testRoundTrip()40 void KisFilterConfigurationTest::testRoundTrip()
41 {
42     KisFilterConfigurationSP  kfc = new KisFilterConfiguration("test", 1);
43     QCOMPARE(kfc->version(), 1);
44     QCOMPARE(kfc->name(), QString("test"));
45     QString s = kfc->toXML();
46 
47     kfc = new KisFilterConfiguration("test2", 2);
48     kfc->fromXML(s);
49     QCOMPARE(kfc->version(), 1);
50 }
51 
testSetGetProperty()52 void KisFilterConfigurationTest::testSetGetProperty()
53 {
54     KisFilterConfigurationSP  kfc = new KisFilterConfiguration("test", 1);
55     kfc->setProperty("value1", 10);
56     kfc->setProperty("value2", "foo");
57     QCOMPARE(kfc->getInt("value1"), 10);
58     QCOMPARE(kfc->getString("value2"), QString("foo"));
59     QString s = kfc->toXML();
60 
61     kfc = new KisFilterConfiguration("test2", 2);
62     kfc->fromXML(s);
63     QCOMPARE(kfc->getInt("value1"), 10);
64     QCOMPARE(kfc->getString("value2"), QString("foo"));
65 }
66 
67 
68 QTEST_MAIN(KisFilterConfigurationTest)
69