50 |
48 |
51 void UnitTestCxeThumbnailManagerSymbian::testCreateThumbnail() |
49 void UnitTestCxeThumbnailManagerSymbian::testCreateThumbnail() |
52 { |
50 { |
53 CX_DEBUG_ENTER_FUNCTION(); |
51 CX_DEBUG_ENTER_FUNCTION(); |
54 |
52 |
55 QSignalSpy thumbnailReadySpy(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int))); |
53 // case 1: Testing with wrong dummy file. Check only that call is made successfully. |
56 QString filename; |
54 mThumbnailManager->createThumbnail(QString(""), QImage()); |
57 |
55 |
58 QVERIFY(thumbnailReadySpy.isValid()); |
56 // case 2: Testing with proper file name. |
59 |
57 mThumbnailManager->createThumbnail(QString("C:\\test.jpg"), QImage()); |
60 // case 1: testing with wrong dummy file, we should get an error code with thumbnailready |
|
61 // since filename is invalid |
|
62 // DISABLE FOR NOW |
|
63 // TODO: Create a fake implementation for the thumbnailmanager |
|
64 // what is used by cxethumbnailmanagersymbian. |
|
65 //mThumbnailManager->createThumbnail(filename, QImage()); |
|
66 |
|
67 // we should not get any call back when we have invalid file name. |
|
68 //QCOMPARE(thumbnailReadySpy.count(), 0); |
|
69 |
|
70 |
|
71 // case 1: testing with proper file name, we shouldnt get an error code with thumbnailready |
|
72 // since filename is valid |
|
73 filename = QString("c:\\test.jpg"); |
|
74 mThumbnailManager->createThumbnail(filename, QImage()); |
|
75 |
|
76 QVERIFY(CxeTestUtils::waitForSignal(thumbnailReadySpy, SIGNAL_TIMEOUT)); |
|
77 |
|
78 |
|
79 //QCOMPARE( thumbnailReadySpy.count(), 1 ); |
|
80 if (thumbnailReadySpy.count() > 0) { |
|
81 QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst(); |
|
82 // we are only interested in error code in this case 1 |
|
83 QCOMPARE(initModeArguments.at(1).toInt(), KErrNone); |
|
84 } |
|
85 |
58 |
86 CX_DEBUG_EXIT_FUNCTION(); |
59 CX_DEBUG_EXIT_FUNCTION(); |
87 } |
60 } |
88 |
61 |
89 |
62 |
90 void UnitTestCxeThumbnailManagerSymbian::testCancelThumbnail() |
63 void UnitTestCxeThumbnailManagerSymbian::testCancelThumbnail() |
91 { |
64 { |
92 CX_DEBUG_ENTER_FUNCTION(); |
65 CX_DEBUG_ENTER_FUNCTION(); |
93 |
66 |
|
67 // case 1: Cancel with empty string. |
|
68 mThumbnailManager->cancelThumbnail(QString()); |
|
69 |
|
70 // case 2: Cancel non-existent file / request. |
94 mThumbnailManager->cancelThumbnail(QString("filename")); |
71 mThumbnailManager->cancelThumbnail(QString("filename")); |
|
72 |
|
73 // case 3: Cancel actual request. |
|
74 QString file("C:\\test2.jpg"); |
|
75 mThumbnailManager->createThumbnail(file, QImage()); |
|
76 mThumbnailManager->cancelThumbnail(file); |
95 |
77 |
96 CX_DEBUG_EXIT_FUNCTION(); |
78 CX_DEBUG_EXIT_FUNCTION(); |
97 } |
79 } |
98 |
80 |
99 // main() function non-GUI testing |
81 // main() function non-GUI testing |