equal
deleted
inserted
replaced
100 { |
100 { |
101 QVERIFY(mTest->mThumbnailManager != 0); |
101 QVERIFY(mTest->mThumbnailManager != 0); |
102 QCOMPARE(mTest->mThumbnailManager->getInitCounter(), 1); |
102 QCOMPARE(mTest->mThumbnailManager->getInitCounter(), 1); |
103 QVERIFY(mTest->mDuration == 0); |
103 QVERIFY(mTest->mDuration == 0); |
104 QVERIFY(mTest->mPosition == 0); |
104 QVERIFY(mTest->mPosition == 0); |
105 QVERIFY(mTest->mDefaultAlbumArt != 0); |
|
106 |
105 |
107 } |
106 } |
108 |
107 |
109 /*! |
108 /*! |
110 test setDuration and duration |
109 test setDuration and duration |
226 test setAlbumArtUri |
225 test setAlbumArtUri |
227 */ |
226 */ |
228 void TestMpPlaybackData::testSetAlbumArtUri() |
227 void TestMpPlaybackData::testSetAlbumArtUri() |
229 { |
228 { |
230 QSignalSpy spy(mTest, SIGNAL(albumArtReady())); |
229 QSignalSpy spy(mTest, SIGNAL(albumArtReady())); |
231 //Empty string |
|
232 mTest->setAlbumArtUri(QString("")); |
|
233 QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); |
|
234 QCOMPARE(spy.count(),1); |
|
235 spy.clear(); |
|
236 |
|
237 //Request failed |
|
238 mTest->mThumbnailManager->mGetThumbFails = true; |
|
239 mTest->setAlbumArtUri(QString("AlbumArt")); |
|
240 QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); |
|
241 QCOMPARE(spy.count(),1); |
|
242 spy.clear(); |
|
243 |
230 |
244 //Succesful requests |
231 //Succesful requests |
245 mTest->mThumbnailManager->mGetThumbFails = false; |
232 mTest->mThumbnailManager->mGetThumbFails = false; |
246 for(int i = 1; i < 10; i++){ |
233 for(int i = 1; i < 10; i++){ |
247 mTest->setAlbumArtUri(QString("AlbumArt")); |
234 mTest->setAlbumArtUri(QString("AlbumArt")); |
267 void* temp; |
254 void* temp; |
268 temp=0; |
255 temp=0; |
269 QSignalSpy spy(mTest, SIGNAL(albumArtReady())); |
256 QSignalSpy spy(mTest, SIGNAL(albumArtReady())); |
270 QPixmap albumArt(100,100); |
257 QPixmap albumArt(100,100); |
271 HbIcon albumArtIcon; |
258 HbIcon albumArtIcon; |
272 |
|
273 //Error |
|
274 mTest->thumbnailReady(albumArt,temp,KUndefined,KUndefined); |
|
275 QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); |
|
276 QCOMPARE(mTest->mReqId, KUndefined); |
|
277 QCOMPARE(spy.count(),1); |
|
278 spy.clear(); |
|
279 |
|
280 //Wrong id |
|
281 mTest->mReqId = 1; |
|
282 mTest->thumbnailReady(albumArt,temp,KUndefined,0); |
|
283 QCOMPARE(mTest->mAlbumArt, mTest->mDefaultAlbumArt); |
|
284 QCOMPARE(mTest->mReqId, KUndefined); |
|
285 QCOMPARE(spy.count(),1); |
|
286 spy.clear(); |
|
287 |
259 |
288 //Update album art |
260 //Update album art |
289 mTest->mReqId = 1; |
261 mTest->mReqId = 1; |
290 mTest->thumbnailReady(albumArt,temp,1,0); |
262 mTest->thumbnailReady(albumArt,temp,1,0); |
291 QCOMPARE(mTest->mReqId, KUndefined); |
263 QCOMPARE(mTest->mReqId, KUndefined); |