tests/auto/qpixmap/tst_qpixmap.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
equal deleted inserted replaced
4:3b1da2848fc7 5:d3bac044e0f0
   143     void toWinHICON();
   143     void toWinHICON();
   144     void fromWinHICON_data();
   144     void fromWinHICON_data();
   145     void fromWinHICON();
   145     void fromWinHICON();
   146 #endif
   146 #endif
   147 
   147 
   148 #if defined(Q_WS_S60)
   148 #if defined(Q_OS_SYMBIAN)
   149     void fromSymbianCFbsBitmap_data();
   149     void fromSymbianCFbsBitmap_data();
   150     void fromSymbianCFbsBitmap();
   150     void fromSymbianCFbsBitmap();
       
   151     void toSymbianCFbsBitmap_data();
       
   152     void toSymbianCFbsBitmap();
   151 #endif
   153 #endif
   152 
   154 
   153     void onlyNullPixmapsOutsideGuiThread();
   155     void onlyNullPixmapsOutsideGuiThread();
   154     void refUnref();
   156     void refUnref();
   155 
   157 
  1108 #endif
  1110 #endif
  1109 }
  1111 }
  1110 
  1112 
  1111 #endif // Q_WS_WIN
  1113 #endif // Q_WS_WIN
  1112 
  1114 
  1113 #if defined(Q_WS_S60)
  1115 #if defined(Q_OS_SYMBIAN)
  1114 Q_DECLARE_METATYPE(TDisplayMode)
  1116 Q_DECLARE_METATYPE(TDisplayMode)
  1115 
  1117 
  1116 void tst_QPixmap::fromSymbianCFbsBitmap_data()
  1118 void tst_QPixmap::fromSymbianCFbsBitmap_data()
  1117 {
  1119 {
  1118     QTest::addColumn<TDisplayMode>("format");
  1120     QTest::addColumn<TDisplayMode>("format");
  1204     }
  1206     }
  1205     __UHEAP_MARKEND;
  1207     __UHEAP_MARKEND;
  1206 
  1208 
  1207     CleanupStack::PopAndDestroy(3);
  1209     CleanupStack::PopAndDestroy(3);
  1208 }
  1210 }
       
  1211 
       
  1212 void tst_QPixmap::toSymbianCFbsBitmap_data()
       
  1213 {
       
  1214     QTest::addColumn<int>("red");
       
  1215     QTest::addColumn<int>("green");
       
  1216     QTest::addColumn<int>("blue");
       
  1217 
       
  1218     QTest::newRow("red")   << 255 << 0 << 0;
       
  1219     QTest::newRow("green") << 0 << 255 << 0;
       
  1220     QTest::newRow("blue")  << 0 << 0 << 255;
       
  1221 }
       
  1222 
       
  1223 void tst_QPixmap::toSymbianCFbsBitmap()
       
  1224 {
       
  1225     QFETCH(int, red);
       
  1226     QFETCH(int, green);
       
  1227     QFETCH(int, blue);
       
  1228 
       
  1229     QPixmap pm(100, 100);
       
  1230     pm.fill(QColor(red, green, blue));
       
  1231 
       
  1232     CFbsBitmap *bitmap = pm.toSymbianCFbsBitmap();
       
  1233 
       
  1234     QVERIFY(bitmap != 0);
       
  1235 
       
  1236     // Verify size
       
  1237     QCOMPARE(100, (int) bitmap->SizeInPixels().iWidth);
       
  1238     QCOMPARE(100, (int) bitmap->SizeInPixels().iHeight);
       
  1239 
       
  1240     // Verify pixel color
       
  1241     TRgb pixel;
       
  1242     bitmap->GetPixel(pixel, TPoint(0,0));
       
  1243     QCOMPARE((int)pixel.Red(), red);
       
  1244     QCOMPARE((int)pixel.Green(), green);
       
  1245     QCOMPARE((int)pixel.Blue(), blue);
       
  1246 
       
  1247     // Clean up
       
  1248     delete bitmap;
       
  1249 }
  1209 #endif
  1250 #endif
  1210 
  1251 
  1211 void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
  1252 void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
  1212 {
  1253 {
  1213 #if !defined(Q_WS_WIN)
  1254 #if !defined(Q_WS_WIN)