imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp
changeset 22 a67f74060682
parent 17 ffa62e555b02
child 30 b67379558a75
equal deleted inserted replaced
19:b790c5b3d11f 22:a67f74060682
   144 {
   144 {
   145     wrapper = new ThumbnailManager();
   145     wrapper = new ThumbnailManager();
   146     connect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   146     connect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   147             this, SLOT( thumbnailReady( QPixmap , void* , int , int )));
   147             this, SLOT( thumbnailReady( QPixmap , void* , int , int )));
   148     
   148     
   149     wrapper_p = new ThumbnailManagerPrivate();
   149     wrapper_p = wrapper->d; //new ThumbnailManagerPrivate();
   150 }
   150 }
   151     
   151     
   152 void TestThumbnailManager::cleanup()
   152 void TestThumbnailManager::cleanup()
   153 {
   153 {
   154     disconnect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   154     disconnect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   159     if( ipixmap ) {
   159     if( ipixmap ) {
   160         delete ipixmap;
   160         delete ipixmap;
   161         ipixmap = NULL;
   161         ipixmap = NULL;
   162         }
   162         }
   163  
   163  
   164     delete wrapper_p;
   164  //   delete wrapper_p;
   165 }
   165 }
   166 
   166 
   167 // --- test ---
   167 // --- test ---
   168 
   168 
   169 /**
   169 /**
   325     QVERIFY(td.bitmap!=0);
   325     QVERIFY(td.bitmap!=0);
   326     QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
   326     QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
   327     QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
   327     QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
   328 
   328 
   329     disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
   329     disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
   330         this, SLOT( thumbnailReadyImage(QImage, void* , int , int )));
   330         this, SLOT( thumbnailReadyImage(QImage, void* , int , int )));  
   331     
       
   332 }
   331 }
   333 
   332 
   334 void TestThumbnailManager::testThumbnailReadyPixmap()
   333 void TestThumbnailManager::testThumbnailReadyPixmap()
   335 {
   334 {
   336     QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   335     QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   353     QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
   352     QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
   354     QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
   353     QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
   355 
   354 
   356     disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   355     disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   357         this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
   356         this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
   358 
       
   359 }
   357 }
   360 
   358 
   361 void TestThumbnailManager::testThumbnailReadyImageAndPixmap()
   359 void TestThumbnailManager::testThumbnailReadyImageAndPixmap()
   362 {
   360 {
   363     QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   361     QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   385 
   383 
   386     disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
   384     disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
   387         this, SLOT( thumbnailReadyImage( QImage , void* , int , int )));
   385         this, SLOT( thumbnailReadyImage( QImage , void* , int , int )));
   388 
   386 
   389     disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   387     disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
   390         this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
   388         this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));    
   391     
       
   392 }
   389 }
   393 
   390 
   394 void TestThumbnailManager::testPriorities_data()
   391 void TestThumbnailManager::testPriorities_data()
   395 {
   392 {
   396     // note: current bounds for priorites are [-100:20] (from: CActive::TPriority)
   393     // note: current bounds for priorites are [-100:20] (from: CActive::TPriority)
   415 }
   412 }
   416  
   413  
   417 
   414 
   418 // --- private slots - callback  ---
   415 // --- private slots - callback  ---
   419 
   416 
   420 void TestThumbnailManager::thumbnailReady( QPixmap /*pixmap*/, void * /*clientData*/, int /*id*/, int /*errorCode*/ )
   417 void TestThumbnailManager::thumbnailReady( QPixmap pixmap, void *clientData, int id, int errorCode )
   421 {
   418 {
   422     //do nothing, we dont test Thumbnail Manager's functionality, we just use it
   419     //do nothing, we dont test Thumbnail Manager's functionality, we just use it
   423 }
   420     Q_UNUSED( pixmap );
   424 
   421     Q_UNUSED( clientData );
   425 void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * /*clientData*/, int id, int errorCode )
   422     Q_UNUSED( id );
   426 {
   423     Q_UNUSED( errorCode );
       
   424 }
       
   425 
       
   426 void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * clientData, int id, int errorCode )
       
   427 {
       
   428     Q_UNUSED( clientData );
   427     QVERIFY( pixmap.isNull() == pixmapNull );
   429     QVERIFY( pixmap.isNull() == pixmapNull );
   428     QVERIFY( errorCode == aerrorCode );
   430     QVERIFY( errorCode == aerrorCode );
   429     QVERIFY( id == aid );
   431     QVERIFY( id == aid );
   430 }
   432 }
   431 
   433