14 * Description: Unit test for mpcollectiondocumentloader |
14 * Description: Unit test for mpcollectiondocumentloader |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <qnamespace.h> |
18 #include <qnamespace.h> |
19 #include <hbapplication.h> |
|
20 #include <hbmainwindow.h> |
|
21 #include <hbInstance.h> |
|
22 |
19 |
23 #include "unittest_mpcollectiondocumentloader.h" |
20 #include "unittest_mpcollectiondocumentloader.h" |
24 #include "mpnowplayingwidget.h" |
21 #include "mpnowplayingwidget.h" |
|
22 #include "hgmediawall.h" |
25 |
23 |
26 // Do this so we can access all member variables. |
24 // Do this so we can access all member variables. |
27 #define private public |
25 #define private public |
28 #include "mpcollectiondocumentloader.h" |
26 #include "mpcollectiondocumentloader.h" |
29 #undef private |
27 #undef private |
31 /*! |
29 /*! |
32 Make our test case a stand-alone executable that runs all the test functions. |
30 Make our test case a stand-alone executable that runs all the test functions. |
33 */ |
31 */ |
34 int main(int argc, char *argv[]) |
32 int main(int argc, char *argv[]) |
35 { |
33 { |
36 HbApplication app(argc, argv); |
34 QApplication app(argc, argv); |
37 HbMainWindow window; |
|
38 TestMpCollectionDocumentLoader tv; |
35 TestMpCollectionDocumentLoader tv; |
39 |
36 |
40 char *pass[3]; |
37 if ( argc > 1 ) { |
41 pass[0] = argv[0]; |
38 return QTest::qExec( &tv, argc, argv); |
42 pass[1] = "-o"; |
39 } |
43 pass[2] = "c:\\data\\unittest_mpcollectiondocumentloader.txt"; |
40 else { |
|
41 char *pass[3]; |
|
42 pass[0] = argv[0]; |
|
43 pass[1] = "-o"; |
|
44 pass[2] = "c:\\data\\unittest_mpcollectiondocumentloader.txt"; |
44 |
45 |
45 int res = QTest::qExec(&tv, 3, pass); |
46 return QTest::qExec(&tv, 3, pass); |
46 |
47 } |
47 return res; |
|
48 } |
48 } |
49 |
49 |
50 TestMpCollectionDocumentLoader::TestMpCollectionDocumentLoader() |
50 TestMpCollectionDocumentLoader::TestMpCollectionDocumentLoader() |
51 : mTest(0) |
51 : mTest(0) |
52 { |
52 { |
91 /*! |
91 /*! |
92 Tests the correct creation of MpNowPlayingWidget. |
92 Tests the correct creation of MpNowPlayingWidget. |
93 */ |
93 */ |
94 void TestMpCollectionDocumentLoader::testCreateMpNowPlayingWidget() |
94 void TestMpCollectionDocumentLoader::testCreateMpNowPlayingWidget() |
95 { |
95 { |
96 cleanup(); |
|
97 init(); |
|
98 QObject *theObject; |
96 QObject *theObject; |
99 theObject = mTest->createObject(QString("MpNowPlayingWidget"),QString("myMpNowPlayingWidget")); |
97 theObject = mTest->createObject(QString("MpNowPlayingWidget"), QString("myMpNowPlayingWidget")); |
100 QCOMPARE(theObject->metaObject()->className(),"MpNowPlayingWidget"); |
98 QCOMPARE(theObject->metaObject()->className(), "MpNowPlayingWidget"); |
101 QCOMPARE(theObject->objectName(),QString("myMpNowPlayingWidget")); |
99 QCOMPARE(theObject->objectName(), QString("myMpNowPlayingWidget")); |
102 QVERIFY(qobject_cast<MpNowPlayingWidget*>(theObject)); |
100 QVERIFY(qobject_cast<MpNowPlayingWidget*>(theObject)); |
103 delete theObject; |
101 delete theObject; |
|
102 } |
104 |
103 |
|
104 /*! |
|
105 Tests the correct creation of HgMediawall. |
|
106 */ |
|
107 void TestMpCollectionDocumentLoader::testCreateHgMediawall() |
|
108 { |
|
109 QObject *theObject; |
|
110 theObject = mTest->createObject(QString("HgMediawall"), QString("HgMediawall")); |
|
111 QCOMPARE(theObject->metaObject()->className(),"HgMediawall"); |
|
112 QCOMPARE(theObject->objectName(),QString("HgMediawall")); |
|
113 QVERIFY(qobject_cast<HgMediawall*>(theObject)); |
|
114 delete theObject; |
105 } |
115 } |
106 |
116 |
107 /*! |
117 /*! |
108 Tests the correct creation of QObject, this should be pased to the |
118 Tests the correct creation of QObject, this should be pased to the |
109 base clas and base clas should return a named object. |
119 base class and base class should return a named object. |
110 */ |
120 */ |
111 void TestMpCollectionDocumentLoader::testCreateQObject() |
121 void TestMpCollectionDocumentLoader::testCreateQObject() |
112 { |
122 { |
113 cleanup(); |
|
114 init(); |
|
115 QObject *theObject; |
123 QObject *theObject; |
116 theObject = mTest->createObject(QString("QObject"),QString("myQObject")); |
124 theObject = mTest->createObject(QString("QObject"), QString("myQObject")); |
117 QCOMPARE(theObject->metaObject()->className(),"QObject"); |
125 QCOMPARE(theObject->metaObject()->className(), "QObject"); |
118 QCOMPARE(theObject->objectName(),QString("myQObject")); |
126 QCOMPARE(theObject->objectName(), QString("myQObject")); |
119 delete theObject; |
127 delete theObject; |
120 } |
128 } |
121 |
129 |
122 // End of file |
|