13 * |
13 * |
14 * Description: tests for VideoOperatorService |
14 * Description: tests for VideoOperatorService |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // INCLUDE FILES |
18 #include <hbapplication.h> |
19 #include <hbapplication.h> |
19 #include <hbmainwindow.h> |
20 #include <hbmainwindow.h> |
20 #include <hbinstance.h> |
21 #include <hbinstance.h> |
21 #include <qdebug.h> |
22 #include <qdebug.h> |
22 |
23 |
23 #include "testvideooperatorservice.h" |
24 #include "testvideooperatorservice.h" |
24 #include "videocollectionviewutilsdata.h" |
25 #include "videooperatorservice_pdata.h" |
25 |
26 |
26 #define private public |
27 #define private public |
27 #include "videooperatorservice.h" |
28 #include "videooperatorservice.h" |
28 #include "videooperatorservicedata.h" |
|
29 #undef private |
29 #undef private |
30 |
30 |
31 int main(int argc, char *argv[]) |
31 int main(int argc, char *argv[]) |
32 { |
32 { |
33 HbApplication app(argc, argv); |
33 HbApplication app(argc, argv); |
86 } |
86 } |
87 |
87 |
88 // TEST CASES START ---------------------------------------------------------- |
88 // TEST CASES START ---------------------------------------------------------- |
89 |
89 |
90 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
91 // testLoad |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void TestVideoOperatorService::testLoad() |
|
95 { |
|
96 // Good case |
|
97 VideoCollectionViewUtilsData::mCenRepStringValues.append("test title"); |
|
98 VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); |
|
99 VideoCollectionViewUtilsData::mCenRepStringValues.append("test uri"); |
|
100 VideoCollectionViewUtilsData::mCenRepIntValues.append(5050); |
|
101 QVERIFY(mTestObject->load(0, 0, 0, 0) == true); |
|
102 QVERIFY(mTestObject->mTitle == "test title"); |
|
103 QVERIFY(mTestObject->mIconResource == "test icon"); |
|
104 QVERIFY(mTestObject->mServiceUri == "test uri"); |
|
105 QCOMPARE(mTestObject->mApplicationUid, 5050); |
|
106 |
|
107 // Only icon is defined for service. |
|
108 VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); |
|
109 VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); |
|
110 QVERIFY(mTestObject->load(0, 0, 0, 0) == false); |
|
111 QVERIFY(mTestObject->mTitle == ""); |
|
112 QVERIFY(mTestObject->mIconResource == "test icon"); |
|
113 QVERIFY(mTestObject->mServiceUri == ""); |
|
114 QCOMPARE(mTestObject->mApplicationUid, -1); |
|
115 |
|
116 // Only icon and uri are defined for service. |
|
117 VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); |
|
118 VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); |
|
119 VideoCollectionViewUtilsData::mCenRepStringValues.append("test uri"); |
|
120 QVERIFY(mTestObject->load(0, 0, 0, 0) == true); |
|
121 QVERIFY(mTestObject->mTitle == ""); |
|
122 QVERIFY(mTestObject->mIconResource == "test icon"); |
|
123 QVERIFY(mTestObject->mServiceUri == "test uri"); |
|
124 QCOMPARE(mTestObject->mApplicationUid, -1); |
|
125 |
|
126 // Only icon and app uid are defined for service. |
|
127 VideoCollectionViewUtilsData::mCenRepStringValues.append(CENREP_NO_STRING); |
|
128 VideoCollectionViewUtilsData::mCenRepStringValues.append("test icon"); |
|
129 VideoCollectionViewUtilsData::mCenRepIntValues.append(5050); |
|
130 QVERIFY(mTestObject->load(0, 0, 0, 0) == true); |
|
131 QVERIFY(mTestObject->mTitle == ""); |
|
132 QVERIFY(mTestObject->mIconResource == "test icon"); |
|
133 QVERIFY(mTestObject->mServiceUri == ""); |
|
134 QCOMPARE(mTestObject->mApplicationUid, 5050); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // testTitle |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 void TestVideoOperatorService::testTitle() |
|
142 { |
|
143 mTestObject->mTitle = "test title"; |
|
144 QVERIFY(mTestObject->title() == "test title"); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // testIconResource |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void TestVideoOperatorService::testIconResource() |
|
152 { |
|
153 mTestObject->mIconResource = "test icon"; |
|
154 QVERIFY(mTestObject->iconResource() == "test icon"); |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // test |
91 // test |
159 // --------------------------------------------------------------------------- |
92 // --------------------------------------------------------------------------- |
160 // |
93 // |
161 void TestVideoOperatorService::testLaunchService() |
94 void TestVideoOperatorService::test() |
162 { |
95 { |
163 mTestObject->mApplicationUid = 0; |
96 init(); |
|
97 |
|
98 VideoOperatorServicePrivateData::mLoadReturnValue = true; |
|
99 QVERIFY(mTestObject->load(0, 0, 0, 0) == true); |
|
100 VideoOperatorServicePrivateData::mLoadReturnValue = false; |
|
101 QVERIFY(mTestObject->load(0, 0, 0, 0) == false); |
|
102 |
|
103 VideoOperatorServicePrivateData::mTitleReturnValue = "test1"; |
|
104 QVERIFY(mTestObject->title() == QString("test1")); |
|
105 VideoOperatorServicePrivateData::mTitleReturnValue = "test2"; |
|
106 QVERIFY(mTestObject->title() == QString("test2")); |
|
107 |
|
108 VideoOperatorServicePrivateData::mIconResourceReturnValue = "test3"; |
|
109 QVERIFY(mTestObject->iconResource() == QString("test3")); |
|
110 VideoOperatorServicePrivateData::mIconResourceReturnValue = "test4"; |
|
111 QVERIFY(mTestObject->iconResource() == QString("test4")); |
|
112 |
|
113 VideoOperatorServicePrivateData::mLaunchServiceCallCount = 0; |
164 mTestObject->launchService(); |
114 mTestObject->launchService(); |
|
115 QCOMPARE(VideoOperatorServicePrivateData::mLaunchServiceCallCount, 1); |
|
116 |
|
117 cleanup(); |
165 } |
118 } |
166 |
119 |
167 // end of file |
120 // end of file |