diff options
author | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-02-03 08:46:53 (GMT) |
---|---|---|
committer | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-02-03 08:57:57 (GMT) |
commit | 0c73b18d0750bee9da4b88de595aa6093b5be820 (patch) | |
tree | c45abb1f633954481f61f005a241ceb94e7e51f5 /tests/auto/qpixmap | |
parent | 64581bfcb285a2c51e5bb0facd9dc82fb53c6875 (diff) | |
download | Qt-0c73b18d0750bee9da4b88de595aa6093b5be820.zip Qt-0c73b18d0750bee9da4b88de595aa6093b5be820.tar.gz Qt-0c73b18d0750bee9da4b88de595aa6093b5be820.tar.bz2 |
Implementation for QVGPixmapData to/fromSymbianCFbsBitmap
functions.
Diffstat (limited to 'tests/auto/qpixmap')
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 8bcd5e8..d7c6ad3 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -145,9 +145,11 @@ private slots: void fromWinHICON(); #endif -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) void fromSymbianCFbsBitmap_data(); void fromSymbianCFbsBitmap(); + void toSymbianCFbsBitmap_data(); + void toSymbianCFbsBitmap(); #endif void onlyNullPixmapsOutsideGuiThread(); @@ -1110,7 +1112,7 @@ void tst_QPixmap::fromWinHICON() #endif // Q_WS_WIN -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) Q_DECLARE_METATYPE(TDisplayMode) void tst_QPixmap::fromSymbianCFbsBitmap_data() @@ -1206,6 +1208,45 @@ void tst_QPixmap::fromSymbianCFbsBitmap() CleanupStack::PopAndDestroy(3); } + +void tst_QPixmap::toSymbianCFbsBitmap_data() +{ + QTest::addColumn<int>("red"); + QTest::addColumn<int>("green"); + QTest::addColumn<int>("blue"); + + QTest::newRow("red") << 255 << 0 << 0; + QTest::newRow("green") << 0 << 255 << 0; + QTest::newRow("blue") << 0 << 0 << 255; +} + +void tst_QPixmap::toSymbianCFbsBitmap() +{ + QFETCH(int, red); + QFETCH(int, green); + QFETCH(int, blue); + + QPixmap pm(100, 100); + pm.fill(QColor(red, green, blue)); + + CFbsBitmap *bitmap = pm.toSymbianCFbsBitmap(); + + QVERIFY(bitmap != 0); + + // Verify size + QCOMPARE(100, (int) bitmap->SizeInPixels().iWidth); + QCOMPARE(100, (int) bitmap->SizeInPixels().iHeight); + + // Verify pixel color + TRgb pixel; + bitmap->GetPixel(pixel, TPoint(0,0)); + QCOMPARE((int)pixel.Red(), red); + QCOMPARE((int)pixel.Green(), green); + QCOMPARE((int)pixel.Blue(), blue); + + // Clean up + delete bitmap; +} #endif void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() |