camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp
changeset 46 c826656d6714
parent 41 67457b2ffb33
child 52 7e18d488ac5f
equal deleted inserted replaced
42:feebad15db8c 46:c826656d6714
    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)));
    51     QString filename;
    52     QString filename;
       
    53 
       
    54     QVERIFY(thumbnailReadySpy.isValid()); 
    52 
    55 
    53     // case 1: testing with wrong dummy file, we should get an error code with thumbnailready
    56     // case 1: testing with wrong dummy file, we should get an error code with thumbnailready
    54     // since filename is invalid
    57     // since filename is invalid
    55     mThumbnailManager->createThumbnail(filename, QImage());
    58     mThumbnailManager->createThumbnail(filename, QImage());
       
    59 
       
    60     // we should not get any call back when we have invalid file name.
       
    61     QCOMPARE(thumbnailReadySpy.count(), 0);
    56 
    62 
    57 
    63 
    58     // case 1: testing with proper file name, we shouldnt get an error code with thumbnailready
    64     // case 1: testing with proper file name, we shouldnt get an error code with thumbnailready
    59     // since filename is valid
    65     // since filename is valid
    60     filename = QString("c:\\test.jpg");    
    66     filename = QString("c:\\test.jpg");    
    61     mThumbnailManager->createThumbnail(filename, QImage());
    67     mThumbnailManager->createThumbnail(filename, QImage());
       
    68 
       
    69     QTest::qWait(1500);
       
    70  
       
    71     QCOMPARE( thumbnailReadySpy.count(), 1 );
       
    72     if (thumbnailReadySpy.count() > 0) {
       
    73         QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst();
       
    74         // we are only interested in error code in this case 1
       
    75         QCOMPARE(initModeArguments.at(1).toInt(), KErrNone);
       
    76     }
    62 
    77 
    63     CX_DEBUG_EXIT_FUNCTION();
    78     CX_DEBUG_EXIT_FUNCTION();
    64 }
    79 }
    65 
    80 
    66 
    81