46 |
46 |
47 void UnitTestCxeThumbnailManagerSymbian::testCreateThumbnail() |
47 void UnitTestCxeThumbnailManagerSymbian::testCreateThumbnail() |
48 { |
48 { |
49 CX_DEBUG_ENTER_FUNCTION(); |
49 CX_DEBUG_ENTER_FUNCTION(); |
50 |
50 |
51 QSignalSpy thumbnailReadySpy(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, int))); |
|
52 QString filename; |
51 QString filename; |
53 |
|
54 QVERIFY(thumbnailReadySpy.isValid()); |
|
55 |
52 |
56 // case 1: testing with wrong dummy file, we should get an error code with thumbnailready |
53 // case 1: testing with wrong dummy file, we should get an error code with thumbnailready |
57 // since filename is invalid |
54 // since filename is invalid |
58 mThumbnailManager->createThumbnail(filename, QPixmap()); |
55 mThumbnailManager->createThumbnail(filename, QImage()); |
59 |
56 |
60 QCOMPARE(thumbnailReadySpy.count(), 1 ); |
|
61 if (thumbnailReadySpy.count() > 0) { |
|
62 QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst(); |
|
63 // we are only interested in error code in this case 1 |
|
64 QCOMPARE(initModeArguments.at(1).toInt(), KErrNotFound); |
|
65 } |
|
66 |
57 |
67 // case 1: testing with proper file name, we shouldnt get an error code with thumbnailready |
58 // case 1: testing with proper file name, we shouldnt get an error code with thumbnailready |
68 // since filename is valid |
59 // since filename is valid |
69 filename = QString("c:\\test.jpg"); |
60 filename = QString("c:\\test.jpg"); |
70 mThumbnailManager->createThumbnail(filename, QPixmap()); |
61 mThumbnailManager->createThumbnail(filename, QImage()); |
71 |
|
72 QCOMPARE( thumbnailReadySpy.count(), 1 ); |
|
73 if (thumbnailReadySpy.count() > 0) { |
|
74 QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst(); |
|
75 // we are only interested in error code in this case 1 |
|
76 QCOMPARE(initModeArguments.at(1).toInt(), KErrNone); |
|
77 } |
|
78 |
62 |
79 CX_DEBUG_EXIT_FUNCTION(); |
63 CX_DEBUG_EXIT_FUNCTION(); |
80 } |
64 } |
81 |
65 |
82 |
66 |