17 |
17 |
18 #include "ut_qtcpixdocument.h" |
18 #include "ut_qtcpixdocument.h" |
19 |
19 |
20 #include <QtCore> |
20 #include <QtCore> |
21 #include <QCoreApplication> |
21 #include <QCoreApplication> |
22 #include <qcpixdocument.h> |
22 #include <cpixdocument.h> |
23 #include <qcpixdocumentfield.h> |
23 #include <cpixdocumentfield.h> |
24 #include <QtTest/QtTest> |
24 #include <QtTest/QtTest> |
25 #include "../../QtTestUtil/QtTestUtil.h" |
25 #include "../../QtTestUtil/QtTestUtil.h" |
26 |
26 |
27 void QCPixDocumentTester::testNewInstance() |
27 void CpixDocumentTester::testNewInstance() |
28 { |
28 { |
29 QCPixDocument* doc = QCPixDocument::newInstance(); |
29 CpixDocument* doc = CpixDocument::newInstance(); |
30 QVERIFY( doc != NULL ); |
30 QVERIFY( doc != NULL ); |
31 delete doc; |
31 delete doc; |
32 } |
32 } |
33 |
33 |
34 void QCPixDocumentTester::testGetSetName_data() |
34 void CpixDocumentTester::testGetSetName_data() |
35 { |
35 { |
36 QTest::addColumn<QString>( "baseAppClass" ); |
36 QTest::addColumn<QString>( "baseAppClass" ); |
37 QTest::newRow("root") << "root"; |
37 QTest::newRow("root") << "root"; |
38 QTest::newRow("root contact") << "root contact"; |
38 QTest::newRow("root contact") << "root contact"; |
39 } |
39 } |
40 |
40 |
41 void QCPixDocumentTester::testGetSetName() |
41 void CpixDocumentTester::testGetSetName() |
42 { |
42 { |
43 QFETCH( QString, baseAppClass ); |
43 QFETCH( QString, baseAppClass ); |
44 iDoc->setBaseAppClass( baseAppClass ); |
44 iDoc->setBaseAppClass( baseAppClass ); |
45 QVERIFY( iDoc->baseAppClass() == baseAppClass ); |
45 QVERIFY( iDoc->baseAppClass() == baseAppClass ); |
46 } |
46 } |
47 |
47 |
48 void QCPixDocumentTester::testGetSetDocId_data() |
48 void CpixDocumentTester::testGetSetDocId_data() |
49 { |
49 { |
50 QTest::addColumn<QString>( "docId" ); |
50 QTest::addColumn<QString>( "docId" ); |
51 QTest::newRow("C:\\some\\doc\\id") << "C:\\some\\doc\\id"; |
51 QTest::newRow("C:\\some\\doc\\id") << "C:\\some\\doc\\id"; |
52 } |
52 } |
53 |
53 |
54 void QCPixDocumentTester::testGetSetDocId() |
54 void CpixDocumentTester::testGetSetDocId() |
55 { |
55 { |
56 QFETCH( QString, docId ); |
56 QFETCH( QString, docId ); |
57 iDoc->setDocId( docId ); |
57 iDoc->setDocId( docId ); |
58 QVERIFY( iDoc->docId() == docId ); |
58 QVERIFY( iDoc->docId() == docId ); |
59 } |
59 } |
60 |
60 |
61 void QCPixDocumentTester::testGetSetExcerpt_data() |
61 void CpixDocumentTester::testGetSetExcerpt_data() |
62 { |
62 { |
63 QTest::addColumn< QString >( "excerpt" ); |
63 QTest::addColumn< QString >( "excerpt" ); |
64 QTest::newRow("this is a sample excerpt") << "this is a sample excerpt"; |
64 QTest::newRow("this is a sample excerpt") << "this is a sample excerpt"; |
65 } |
65 } |
66 |
66 |
67 void QCPixDocumentTester::testGetSetExcerpt() |
67 void CpixDocumentTester::testGetSetExcerpt() |
68 { |
68 { |
69 QFETCH( QString, excerpt ); |
69 QFETCH( QString, excerpt ); |
70 iDoc->setExcerpt( excerpt ); |
70 iDoc->setExcerpt( excerpt ); |
71 QVERIFY( iDoc->excerpt() == excerpt ); |
71 QVERIFY( iDoc->excerpt() == excerpt ); |
72 } |
72 } |
73 |
73 |
74 void QCPixDocumentTester::testGetFieldCount() |
74 void CpixDocumentTester::testGetFieldCount() |
75 { |
75 { |
76 iDoc->addField("testName", "testValue", 10); |
76 iDoc->addField("testName", "testValue", 10); |
77 iDoc->addField("testName2", "testValue2", 12); |
77 iDoc->addField("testName2", "testValue2", 12); |
78 QVERIFY( iDoc->fieldCount() == 2 ); |
78 QVERIFY( iDoc->fieldCount() == 2 ); |
79 } |
79 } |
80 |
80 |
81 void QCPixDocumentTester::testAddGetField() |
81 void CpixDocumentTester::testAddGetField() |
82 { |
82 { |
83 iDoc->addField("testName", "testValue", 10); |
83 iDoc->addField("testName", "testValue", 10); |
84 iDoc->addField("testName2", "testValue2", 12); |
84 iDoc->addField("testName2", "testValue2", 12); |
85 const QCPixDocumentField& field1 = iDoc->field( 0 ); |
85 const CpixDocumentField& field1 = iDoc->field( 0 ); |
86 QVERIFY( field1.name() == "testName" && field1.value() == "testValue" && field1.config() == 10 ); |
86 QVERIFY( field1.name() == "testName" && field1.value() == "testValue" && field1.config() == 10 ); |
87 const QCPixDocumentField& field2 = iDoc->field( 1 ); |
87 const CpixDocumentField& field2 = iDoc->field( 1 ); |
88 QVERIFY( field2.name() == "testName2" && field2.value() == "testValue2" && field2.config() == 12 ); |
88 QVERIFY( field2.name() == "testName2" && field2.value() == "testValue2" && field2.config() == 12 ); |
89 } |
89 } |
90 |
90 |
91 void QCPixDocumentTester::init() |
91 void CpixDocumentTester::init() |
92 { |
92 { |
93 iDoc = QCPixDocument::newInstance(); |
93 iDoc = CpixDocument::newInstance(); |
94 } |
94 } |
95 |
95 |
96 void QCPixDocumentTester::cleanup() |
96 void CpixDocumentTester::cleanup() |
97 { |
97 { |
98 delete iDoc; |
98 delete iDoc; |
99 } |
99 } |
100 |
100 |
101 QTTESTUTIL_REGISTER_TEST( QCPixDocumentTester ); |
101 QTTESTUTIL_REGISTER_TEST( CpixDocumentTester ); |