diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-09-27 19:53:01 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-29 06:41:42 +0200 |
commit | 95cebd34ebc5b4d39b11dc91610309a35e488663 (patch) | |
tree | 90ceffef5acea093dd2b8f8f7e8c30593023b85a /tests/auto/gui/image | |
parent | ab061e3e436fab35eac8666f3e950e98f66c4d3e (diff) |
Remove Symbian-specific code from tests.
Symbian is not a supported platform for Qt5, so this code is no longer
required.
Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa
Reviewed-on: http://codereview.qt-project.org/5657
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/gui/image')
-rw-r--r-- | tests/auto/gui/image/qicoimageformat/qicoimageformat.pro | 11 | ||||
-rw-r--r-- | tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp | 6 | ||||
-rw-r--r-- | tests/auto/gui/image/qicon/qicon.pro | 10 | ||||
-rw-r--r-- | tests/auto/gui/image/qicon/tst_qicon.cpp | 4 | ||||
-rw-r--r-- | tests/auto/gui/image/qimage/qimage.pro | 10 | ||||
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 9 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagereader/qimagereader.pro | 16 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 9 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagewriter/qimagewriter.pro | 9 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp | 13 | ||||
-rw-r--r-- | tests/auto/gui/image/qmovie/qmovie.pro | 11 | ||||
-rw-r--r-- | tests/auto/gui/image/qpixmap/qpixmap.pro | 8 | ||||
-rw-r--r-- | tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 305 | ||||
-rw-r--r-- | tests/auto/gui/image/qvolatileimage/qvolatileimage.pro | 5 | ||||
-rw-r--r-- | tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp | 190 |
15 files changed, 13 insertions, 603 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index c150c9af9f..aae89db52f 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -12,17 +12,6 @@ wince*: { } addPlugins.path = imageformats DEPLOYMENT += addFiles addPlugins -} else:symbian { - addFiles.files = icons - addFiles.path = . - DEPLOYMENT += addFiles - qt_not_deployed { - addPlugins.files = qico.dll - addPlugins.path = imageformats - DEPLOYMENT += addPlugins - } - TARGET.UID3 = 0xE0340004 - DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index 3aace12fdb..a6fc7a8212 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -42,12 +42,6 @@ #include <QtGui> #include <QtCore> -#if defined(Q_OS_SYMBIAN) -# define STRINGIFY(x) #x -# define TOSTRING(x) STRINGIFY(x) -# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" -#endif - class tst_QIcoImageFormat : public QObject { Q_OBJECT diff --git a/tests/auto/gui/image/qicon/qicon.pro b/tests/auto/gui/image/qicon/qicon.pro index cc87fae539..336a63d02f 100644 --- a/tests/auto/gui/image/qicon/qicon.pro +++ b/tests/auto/gui/image/qicon/qicon.pro @@ -15,16 +15,6 @@ wince* { DEPLOYMENT_PLUGIN += qsvg DEFINES += SRCDIR=\\\".\\\" -} else:symbian { - QT += xml svg - addFiles.files = *.png tst_qicon.cpp *.svg *.svgz - addFiles.path = . - DEPLOYMENT += addFiles - qt_not_deployed { - plugins.files = qsvgicon.dll - plugins.path = iconengines - DEPLOYMENT += plugins - } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 4c430f9435..35be4ae04f 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -43,10 +43,6 @@ #include <QtTest/QtTest> #include <QImageReader> #include <qicon.h> - -#if defined(Q_OS_SYMBIAN) -#define SRCDIR "." -#endif #include <qiconengine.h> Q_DECLARE_METATYPE(QSize) diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index b517bc1237..87828b9c3e 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -8,16 +8,6 @@ wince*: { addImages.path = images DEPLOYMENT += addImages DEFINES += SRCDIR=\\\".\\\" -} else:symbian { - TARGET.EPOCHEAPSIZE = 0x200000 0x800000 - addImages.files = images/* - addImages.path = images - DEPLOYMENT += addImages - qt_not_deployed { - imagePlugins.files = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll - imagePlugins.path = imageformats - DEPLOYMENT += imagePlugins - } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index dce2957ae4..a144fdb3fc 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -54,9 +54,6 @@ //TESTED_CLASS= //TESTED_FILES= -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif Q_DECLARE_METATYPE(QImage::Format) Q_DECLARE_METATYPE(Qt::GlobalColor) @@ -268,11 +265,7 @@ void tst_QImage::formatHandlersInput_data() { QTest::addColumn<QString>("testFormat"); QTest::addColumn<QString>("testFile"); - #ifdef Q_OS_SYMBIAN - const QString prefix = QLatin1String(SRCDIR) + "images/"; - #else const QString prefix = QLatin1String(SRCDIR) + "/images/"; - #endif // add a new line here when a file is added QTest::newRow("ICO") << "ICO" << prefix + "image.ico"; @@ -1499,8 +1492,6 @@ void tst_QImage::smoothScaleBig() { #if defined(Q_OS_WINCE) int bigValue = 2000; -#elif defined(Q_OS_SYMBIAN) - int bigValue = 2000; #else int bigValue = 200000; #endif diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 43d587ea48..e706f24814 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -3,7 +3,7 @@ SOURCES += tst_qimagereader.cpp MOC_DIR=tmp QT += widgets widgets-private core-private gui-private network RESOURCES += qimagereader.qrc -!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" +DEFINES += SRCDIR=\\\"$$PWD\\\" win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 @@ -20,17 +20,3 @@ wince*: { DEPLOYMENT += images imagePlugins DEFINES += SRCDIR=\\\".\\\" } - -symbian: { - images.files = images - images.path = . - - DEPLOYMENT += images - - qt_not_deployed { - imagePlugins.files = qjpeg.dll qgif.dll qmng.dll - imagePlugins.path = imageformats - - DEPLOYMENT += imagePlugins - } -} diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index ffedc69a7f..d36a7bba39 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -57,10 +57,6 @@ #include "../../../platformquirks.h" -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "." -#endif - typedef QMap<QString, QString> QStringMap; typedef QList<int> QIntList; Q_DECLARE_METATYPE(QImage) @@ -1089,11 +1085,6 @@ void tst_QImageReader::readFromDevice() QCOMPARE(image1, expectedImage); } -#if defined (Q_OS_SYMBIAN) && defined (__WINS__) - //the emulator hangs in socket write (this is a test bug, it assumes the TCP stack can accept a whole image to its buffers) - if(imageData.size() > 16384) - QSKIP("image larger than socket buffer (test needs to be rewritten)", SkipSingle); -#endif Server server(imageData); QEventLoop loop; connect(&server, SIGNAL(ready()), &loop, SLOT(quit())); diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index 0fc40d0f0a..ebd5efd49a 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -11,15 +11,6 @@ wince*: { addFiles.path = images DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" -} else:symbian { - addFiles.files = images\\*.* - addFiles.path = images - DEPLOYMENT += addFiles - qt_not_deployed { - imagePlugins.files = qjpeg.dll qtiff.dll - imagePlugins.path = imageformats - DEPLOYMENT += imagePlugins - } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index b119763723..e21e671938 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -52,9 +52,6 @@ #include <QPainter> #include <QSet> -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif typedef QMap<QString, QString> QStringMap; typedef QList<int> QIntList; Q_DECLARE_METATYPE(QImage) @@ -106,11 +103,9 @@ private slots: void saveToTemporaryFile(); }; -#ifdef Q_OS_SYMBIAN -static const QLatin1String prefix(SRCDIR "images/"); -#else + static const QLatin1String prefix(SRCDIR "/images/"); -#endif + static void initializePadding(QImage *image) { int effectiveBytesPerLine = (image->width() * image->depth() + 7) / 8; @@ -278,7 +273,7 @@ void tst_QImageWriter::writeImage2_data() #if defined QTEST_HAVE_TIFF void tst_QImageWriter::largeTiff() { -#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_OS_WINCE) QImage img(4096, 2048, QImage::Format_ARGB32); QPainter p(&img); @@ -305,7 +300,7 @@ void tst_QImageWriter::largeTiff() QCOMPARE(img, img2); #else - QWARN("not tested on Symbian/WinCE"); + QWARN("not tested on WinCE"); #endif } #endif diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index 3e085ceeaf..54cd7a2548 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -15,14 +15,3 @@ wince*: { RESOURCES += resources.qrc -symbian: { - addFiles.files = animations\\* - addFiles.path = animations - DEPLOYMENT += addFiles - - qt_not_deployed { - imagePlugins.files = qjpeg.dll qgif.dll qmng.dll - imagePlugins.path = imageformats - DEPLOYMENT += imagePlugins - } -} diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index fe156d547c..d6d260da00 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -3,8 +3,7 @@ load(qttest_p4) QT += core-private gui-private widgets widgets-private SOURCES += tst_qpixmap.cpp -wince*|symbian: { - +wince* { task31722_0.files = convertFromImage/task31722_0/*.png task31722_0.path = convertFromImage/task31722_0 @@ -18,13 +17,8 @@ wince*|symbian: { loadFromData.path = loadFromData DEPLOYMENT += task31722_0 task31722_1 icons loadFromData -} - -wince*: { DEFINES += SRCDIR=\\\".\\\" DEPLOYMENT_PLUGIN += qico -} else:symbian { - LIBS += -lfbscli.dll -lbitgdi.dll -lgdi.dll } else { DEFINES += SRCDIR=\\\"$$PWD\\\" win32:LIBS += -lgdi32 -luser32 diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 38858e5503..996bd6c017 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -64,26 +64,13 @@ #include <qscreen_qws.h> #endif -#ifdef Q_OS_SYMBIAN -#include <e32std.h> -#include <fbs.h> -#include <gdi.h> -#include <bitdev.h> -#if !defined(QT_NO_OPENVG) -#include <QtOpenVG/qvg.h> -#include <QtOpenVG/private/qpixmapdata_vg_p.h> -#endif -#endif - #ifdef Q_WS_X11 #include <QX11Info> #endif //TESTED_CLASS= //TESTED_FILES= -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif + Q_DECLARE_METATYPE(QImage::Format) class tst_QPixmap : public QObject @@ -148,13 +135,6 @@ private slots: void fromWinHICON(); #endif -#if defined(Q_OS_SYMBIAN) - void fromSymbianCFbsBitmap_data(); - void fromSymbianCFbsBitmap(); - void toSymbianCFbsBitmap_data(); - void toSymbianCFbsBitmap(); -#endif - void onlyNullPixmapsOutsideGuiThread(); void refUnref(); @@ -185,9 +165,6 @@ private slots: void loadAsBitmapOrPixmap(); -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) - void vgImageReadBack(); -#endif void scaled_QTBUG19157(); }; @@ -337,11 +314,8 @@ void tst_QPixmap::convertFromImage_data() { QTest::addColumn<QImage>("img1"); QTest::addColumn<QImage>("img2"); -#ifdef Q_OS_SYMBIAN - const QString prefix = QLatin1String(SRCDIR) + "convertFromImage"; -#else const QString prefix = QLatin1String(SRCDIR) + "/convertFromImage"; -#endif + { QImage img1; QImage img2; @@ -1107,157 +1081,6 @@ void tst_QPixmap::fromWinHICON() #endif // Q_WS_WIN -#if defined(Q_OS_SYMBIAN) -Q_DECLARE_METATYPE(TDisplayMode) - -void tst_QPixmap::fromSymbianCFbsBitmap_data() -{ - QTest::addColumn<TDisplayMode>("format"); - QTest::addColumn<int>("width"); - QTest::addColumn<int>("height"); - QTest::addColumn<QColor>("color"); - - const int smallWidth = 20; - const int smallHeight = 20; - const int largeWidth = 240; - const int largeHeight = 320; - const int notAlignedWidth = 250; - const int notAlignedHeight = 250; - - // Indexed Color Formats - Disabled since images seem to be blank -> no palette? -// QTest::newRow("EGray2 small") << EGray2 << smallWidth << smallHeight << QColor(Qt::black); -// QTest::newRow("EGray2 big") << EGray2 << largeWidth << largeHeight << QColor(Qt::black); -// QTest::newRow("EGray256 small") << EGray256 << smallWidth << smallHeight << QColor(Qt::blue); -// QTest::newRow("EGray256 big") << EGray256 << largeWidth << largeHeight << QColor(Qt::blue); -// QTest::newRow("EColor256 small") << EColor256 << smallWidth << smallHeight << QColor(Qt::red); -// QTest::newRow("EColor256 big") << EColor256 << largeWidth << largeHeight << QColor(Qt::red); - - // Direct Color Formats - QTest::newRow("EColor4K small") << EColor4K << smallWidth << smallHeight << QColor(Qt::red); - QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red); - QTest::newRow("EColor4K not aligned") << EColor4K << notAlignedWidth << notAlignedHeight << QColor(Qt::red); - QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green); - QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green); - QTest::newRow("EColor64K not aligned") << EColor64K << notAlignedWidth << notAlignedHeight << QColor(Qt::green); - QTest::newRow("EColor16M small") << EColor16M << smallWidth << smallHeight << QColor(Qt::yellow); - QTest::newRow("EColor16M big") << EColor16M << largeWidth << largeHeight << QColor(Qt::yellow); - QTest::newRow("EColor16M not aligned") << EColor16M << notAlignedWidth << notAlignedHeight << QColor(Qt::yellow); - QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red); - QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red); - QTest::newRow("EColor16MU not aligned") << EColor16MU << notAlignedWidth << notAlignedHeight << QColor(Qt::red); - QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0); - QTest::newRow("EColor16MA big opaque") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0); - QTest::newRow("EColor16MA not aligned opaque") << EColor16MA << notAlignedWidth << notAlignedHeight << QColor(255, 255, 0); - - // Semi-transparent Colors - Disabled for now, since the QCOMPARE fails, but visually confirmed to work -// QTest::newRow("EColor16MA small semi") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 127); -// QTest::newRow("EColor16MA big semi") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 127); -// QTest::newRow("EColor16MA small trans") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 0); -// QTest::newRow("EColor16MA big trans") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 0); - -#if !defined(__SERIES60_31__) - QTest::newRow("EColor16MAP small") << EColor16MAP << smallWidth << smallHeight << QColor(Qt::red); - QTest::newRow("EColor16MAP big") << EColor16MAP << largeWidth << largeHeight << QColor(Qt::red); -#endif -} - -void tst_QPixmap::fromSymbianCFbsBitmap() -{ - QFETCH(TDisplayMode, format); - QFETCH(int, width); - QFETCH(int, height); - QFETCH(QColor, color); - int expectedDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(format); - - CFbsBitmap *nativeBitmap = 0; - CFbsBitmapDevice *bitmapDevice = 0; - CBitmapContext *bitmapContext = 0; - - nativeBitmap = new (ELeave) CFbsBitmap(); - TInt err = nativeBitmap->Create(TSize(width, height), format); - CleanupStack::PushL(nativeBitmap); - QVERIFY(err == KErrNone); - bitmapDevice = CFbsBitmapDevice::NewL(nativeBitmap); - CleanupStack::PushL(bitmapDevice); - - err = bitmapDevice->CreateBitmapContext(bitmapContext); - CleanupStack::PushL(bitmapContext); - QVERIFY(err == KErrNone); - TRgb symbianColor = TRgb(color.red(), color.green(), color.blue(), color.alpha()); - bitmapContext->SetBrushColor(symbianColor); - bitmapContext->Clear(); - - __UHEAP_MARK; - { // Test the null case - CFbsBitmap *bitmap = 0; - QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(bitmap); - QVERIFY(pixmap.isNull()); - } - __UHEAP_MARKEND; - - __UHEAP_MARK; - { // Test the normal case - QPixmap pixmap = QPixmap::fromSymbianCFbsBitmap(nativeBitmap); -// QCOMPARE(pixmap.depth(), expectedDepth); // Depth is not preserved now - QCOMPARE(pixmap.width(), width); - QCOMPARE(pixmap.height(), height); - QImage image = pixmap.toImage(); - - QColor actualColor(image.pixel(1, 1)); - QCOMPARE(actualColor, color); - - QImage shouldBe(pixmap.width(), pixmap.height(), image.format()); - if (image.format() == QImage::Format_RGB16) - shouldBe.fill(qrgb565(color.rgba()).rawValue()); - else - shouldBe.fill(color.rgba()); - QCOMPARE(image, shouldBe); - } - __UHEAP_MARKEND; - - 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() { #ifdef Q_WS_QPA @@ -1286,16 +1109,8 @@ void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() } }; Thread thread; -#if defined(Q_OS_SYMBIAN) - thread.setStackSize(0x10000); -#endif thread.start(); -#if defined(Q_OS_SYMBIAN) - QVERIFY(thread.wait(10000)); -#else thread.wait(); -#endif - #endif // !defined(Q_WS_WIN) && !defined(Q_WS_MAC) } @@ -1489,11 +1304,9 @@ void tst_QPixmap::loadFromDataNullValues() void tst_QPixmap::loadFromDataImage_data() { QTest::addColumn<QString>("imagePath"); -#ifdef Q_OS_SYMBIAN - const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; -#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; -#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; // When no extension is provided we try all extensions that has been registered by image providers QTest::newRow("designer_argb32") << prefix + "/designer_argb32.png"; @@ -1525,11 +1338,9 @@ void tst_QPixmap::loadFromDataImage() void tst_QPixmap::fromImageReader_data() { QTest::addColumn<QString>("imagePath"); -#ifdef Q_OS_SYMBIAN - const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; -#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; -#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png"; @@ -1565,11 +1376,8 @@ void tst_QPixmap::fromImageReaderAnimatedGif_data() void tst_QPixmap::fromImageReaderAnimatedGif() { QFETCH(QString, imagePath); -#ifdef Q_OS_SYMBIAN - const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; -#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; -#endif const QString path = prefix + imagePath; QImageReader referenceReader(path); @@ -1677,105 +1485,6 @@ void tst_QPixmap::toImageDeepCopy() QVERIFY(first != second); } -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) -Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap); -class FriendlyVGPlatformPixmap : public QVGPlatformPixmap -{ -public: - FriendlyVGPlatformPixmap(PixelType type) : QVGPlatformPixmap(type) { } - bool sourceIsNull() { return source.isNull(); } - friend QPixmap pixmapFromVGImage(VGImage image); -}; -QPixmap pixmapFromVGImage(VGImage image) -{ - if (image != VG_INVALID_HANDLE) { - int w = vgGetParameteri(image, VG_IMAGE_WIDTH); - int h = vgGetParameteri(image, VG_IMAGE_HEIGHT); - FriendlyVGPlatformPixmap *pd = new FriendlyVGPlatformPixmap(QPlatformPixmap::PixmapType); - pd->resize(w, h); - pd->vgImage = image; - pd->recreate = false; - pd->prevSize = QSize(pd->w, pd->h); - return QPixmap(pd); - } - return QPixmap(); -} -class Content : public QWidget -{ -public: - void paintEvent(QPaintEvent *) { - QPainter painter(this); - QColor testPixel(qRgb(200, 150, 100)); - if (pm.isNull()) { // first phase: create a VGImage - painter.beginNativePainting(); - vgimage = vgCreateImage(VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); - QImage img(20, 10, QImage::Format_ARGB32_Premultiplied); - img.fill(qRgb(0, 0, 0)); - QPainter p(&img); - p.fillRect(0, 0, img.width(), img.height(), testPixel); - p.end(); - vgImageSubData(vgimage, img.bits(), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height()); - // Now the area 0,0 20x10 (in OpenVG coords) is filled with some color. - painter.endNativePainting(); - } else { // second phase: check if readback works - painter.drawPixmap(0, 0, pm); - // Drawing should not cause readback, this is important for performance; - noreadback_ok = static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull(); - // However toImage() requires readback. - QImage img = pm.toImage(); - readback_ok = img.width() == pm.width(); - readback_ok &= img.height() == pm.height(); - readback_ok &= !static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull(); - uint pix = img.pixel(1, 1); - content_ok = qRed(pix) == testPixel.red(); - content_ok &= qGreen(pix) == testPixel.green(); - content_ok &= qBlue(pix) == testPixel.blue(); - pix = img.pixel(img.width() - 1, img.height() - 1); - content_ok &= qRed(pix) == 0; - content_ok &= qGreen(pix) == 0; - content_ok &= qBlue(pix) == 0; - } - } - int w; - int h; - VGImage vgimage; - QPixmap pm; - bool noreadback_ok; - bool readback_ok; - bool content_ok; -}; -void tst_QPixmap::vgImageReadBack() -{ - QPixmap tmp(10, 20); - if (tmp.handle()->classId() == QPlatformPixmap::OpenVGClass) { - Content c; - c.w = 50; - c.h = 60; - c.vgimage = VG_INVALID_HANDLE; - c.noreadback_ok = c.readback_ok = c.content_ok = false; - c.showFullScreen(); - QTest::qWaitForWindowShown(&c); - QVERIFY(c.vgimage != VG_INVALID_HANDLE); - QPixmap pm = pixmapFromVGImage(c.vgimage); - QVERIFY(!pm.isNull()); - QCOMPARE(pm.width(), c.w); - QCOMPARE(pm.height(), c.h); - QVERIFY(qPixmapToVGImage(pm) == c.vgimage); - QVERIFY(static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull()); - c.pm = pm; - // Make sure the second phase in paintEvent is executed too. - c.hide(); - c.showFullScreen(); - QTest::qWaitForWindowShown(&c); - QVERIFY(c.noreadback_ok); - QVERIFY(c.readback_ok); - QVERIFY(c.content_ok); - } else { - QSKIP("Not using openvg graphicssystem", SkipSingle); - } -} -#endif // Symbian & OpenVG - void tst_QPixmap::scaled_QTBUG19157() { QPixmap foo(5000, 1); diff --git a/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro b/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro index 45d80b85f2..d97eb1ee13 100644 --- a/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro +++ b/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro @@ -3,8 +3,3 @@ load(qttest_p4) QT += gui-private widgets SOURCES += tst_qvolatileimage.cpp - -symbian { - TARGET.EPOCHEAPSIZE = 0x200000 0x800000 - LIBS += -lfbscli -} diff --git a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp index bacca66dcd..87389ff355 100644 --- a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp +++ b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp @@ -44,9 +44,6 @@ #include <QtGui/qpainter.h> #include <QtGui/qpaintengine.h> #include <QtGui/private/qvolatileimage_p.h> -#ifdef Q_OS_SYMBIAN -#include <fbs.h> -#endif class tst_QVolatileImage : public QObject { @@ -60,10 +57,8 @@ private slots: void ensureFormat(); void dataAccess(); void sharing(); - void paint(); void fill(); void copy(); - void bitmap(); }; void tst_QVolatileImage::create() @@ -93,21 +88,6 @@ void tst_QVolatileImage::create() QCOMPARE(img.hasAlphaChannel(), img.imageRef().hasAlphaChannel()); QCOMPARE(img.hasAlphaChannel(), img.toImage().hasAlphaChannel()); QCOMPARE(img.depth(), 32); - -#ifdef Q_OS_SYMBIAN - CFbsBitmap *bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone); - QVolatileImage bmpimg(bmp); - QVERIFY(!bmpimg.isNull()); - QCOMPARE(bmpimg.width(), 100); - QCOMPARE(bmpimg.height(), 50); - // Verify that we only did handle duplication, not pixel data copying. - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - delete bmp; - // Check if content is still valid. - QImage copyimg = bmpimg.toImage(); - QCOMPARE(copyimg.format(), QImage::Format_ARGB32_Premultiplied); -#endif } void tst_QVolatileImage::ensureFormat() @@ -127,30 +107,6 @@ void tst_QVolatileImage::ensureFormat() QVERIFY(img.imageRef() != source); QVERIFY(img.toImage() != source); QVERIFY(img.format() == QImage::Format_RGB32); - -#ifdef Q_OS_SYMBIAN - CFbsBitmap *bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone); - QVolatileImage bmpimg(bmp); - QVERIFY(bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - - // A different format should cause data copying. - QVERIFY(bmpimg.ensureFormat(QImage::Format_RGB32)); - QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress()); - const uchar *prevBits = bmpimg.constBits(); - - QVERIFY(bmpimg.ensureFormat(QImage::Format_RGB16)); - QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress()); - QVERIFY(bmpimg.constBits() != prevBits); - prevBits = bmpimg.constBits(); - - QVERIFY(bmpimg.ensureFormat(QImage::Format_MonoLSB)); - QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress()); - QVERIFY(bmpimg.constBits() != prevBits); - - delete bmp; -#endif } void tst_QVolatileImage::dataAccess() @@ -190,21 +146,6 @@ void tst_QVolatileImage::sharing() // toImage() should return a copy of the internal QImage. // imageRef() is a reference to the internal QImage. QVERIFY(img1.imageRef().constBits() != img1.toImage().constBits()); - -#ifdef Q_OS_SYMBIAN - CFbsBitmap *bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone); - QVolatileImage bmpimg(bmp); - QVolatileImage bmpimg2; - bmpimg2 = bmpimg; - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - QCOMPARE(bmpimg2.constBits(), (const uchar *) bmp->DataAddress()); - // Now force a detach, which should copy the pixel data under-the-hood. - bmpimg.imageRef(); - QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress()); - QCOMPARE(bmpimg2.constBits(), (const uchar *) bmp->DataAddress()); - delete bmp; -#endif } bool fuzzyCompareImages(const QImage &image1, const QImage &image2, int tolerance) @@ -227,52 +168,6 @@ bool fuzzyCompareImages(const QImage &image1, const QImage &image2, int toleranc return true; } -void tst_QVolatileImage::paint() -{ -#ifdef Q_OS_SYMBIAN - QVolatileImage img(100, 100, QImage::Format_ARGB32); - img.beginDataAccess(); - img.imageRef().fill(QColor(Qt::green).rgba()); - QPainter p(&img.imageRef()); - p.drawRect(10, 10, 50, 50); - p.end(); - img.endDataAccess(); - QImage imgA = img.toImage(); - - // The following assumes that on openvg the pixmapdata is backed by QVolatileImage) - // (and that openvg is in use) - // It should pass with any engine nonetheless. - // See if painting into the underlying QImage succeeds. - QPixmap pm(100, 100); - if (pm.paintEngine()->type() == QPaintEngine::Raster) { - pm.fill(Qt::green); - QPainter pmp(&pm); - pmp.drawRect(10, 10, 50, 50); - pmp.end(); - QImage imgB = pm.toImage(); - QVERIFY(fuzzyCompareImages(imgA, imgB, 0)); - // Exercise the accelerated QVolatileImagePaintEngine::drawPixmap() a bit. - QPixmap targetPm(pm.size()); - targetPm.fill(Qt::black); - pmp.begin(&targetPm); - pmp.drawPixmap(QPointF(0, 0), pm); - pmp.end(); - imgB = targetPm.toImage(); - QVERIFY(fuzzyCompareImages(imgA, imgB, 0)); - // Now the overload taking rects. - targetPm.fill(Qt::black); - pmp.begin(&targetPm); - QRectF rect(QPointF(0, 0), pm.size()); - pmp.drawPixmap(rect, pm, rect); - pmp.end(); - imgB = targetPm.toImage(); - QVERIFY(fuzzyCompareImages(imgA, imgB, 0)); - } else { - QSKIP("Pixmaps not painted via raster, skipping paint test", SkipSingle); - } -#endif -} - void tst_QVolatileImage::fill() { QVolatileImage img(100, 100, QImage::Format_ARGB32_Premultiplied); @@ -280,17 +175,6 @@ void tst_QVolatileImage::fill() img.fill(col.rgba()); QVERIFY(img.imageRef().pixel(1, 1) == col.rgba()); QVERIFY(img.toImage().pixel(1, 1) == col.rgba()); - -#ifdef Q_OS_SYMBIAN - CFbsBitmap *bmp = static_cast<CFbsBitmap *>(img.duplicateNativeImage()); - QVERIFY(bmp); - TRgb pix; - bmp->GetPixel(pix, TPoint(1, 1)); - QCOMPARE(pix.Red(), col.red()); - QCOMPARE(pix.Green(), col.green()); - QCOMPARE(pix.Blue(), col.blue()); - delete bmp; -#endif } void tst_QVolatileImage::copy() @@ -318,80 +202,6 @@ void tst_QVolatileImage::copy() QVERIFY(fuzzyCompareImages(imgA, imgB, 0)); } -void tst_QVolatileImage::bitmap() -{ -#ifdef Q_OS_SYMBIAN - CFbsBitmap *bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(100, 50), EColor64K) == KErrNone); - QVolatileImage bmpimg(bmp); - CFbsBitmap *dupbmp = static_cast<CFbsBitmap *>(bmpimg.duplicateNativeImage()); - QVERIFY(dupbmp); - QVERIFY(dupbmp != bmp); - QCOMPARE(dupbmp->DataAddress(), bmp->DataAddress()); - delete dupbmp; - delete bmp; - bmpimg.beginDataAccess(); - qMemSet(bmpimg.bits(), 0, bmpimg.byteCount()); - qMemSet(bmpimg.bits(), 1, bmpimg.bytesPerLine() * bmpimg.height()); - bmpimg.endDataAccess(); - - // Test bgr->rgb conversion in case of EColor16M. - bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(101, 89), EColor16M) == KErrNone); - bmp->BeginDataAccess(); - TUint32 *addr = bmp->DataAddress(); - uint rgb = QColor(10, 20, 30).rgb(); - qMemCopy(bmp->DataAddress(), &rgb, 3); - bmp->EndDataAccess(); - TRgb symrgb; - bmp->GetPixel(symrgb, TPoint(0, 0)); - QVERIFY(symrgb.Red() == 10 && symrgb.Green() == 20 && symrgb.Blue() == 30); - bmpimg = QVolatileImage(bmp); - QVERIFY(bmpimg.toImage().pixel(0, 0) == rgb); - // check if there really was a conversion - bmp->BeginDataAccess(); - bmpimg.beginDataAccess(); - qMemCopy(&rgb, bmpimg.constBits(), 3); - uint rgb2 = rgb; - qMemCopy(&rgb2, bmp->DataAddress(), 3); - QVERIFY(rgb != rgb2); - bmpimg.endDataAccess(true); - bmp->EndDataAccess(true); - delete bmp; - - bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(101, 89), EGray2) == KErrNone); - bmpimg = QVolatileImage(bmp); // inverts pixels, but should do it in place - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - QCOMPARE(bmpimg.format(), QImage::Format_MonoLSB); - bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied); - QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress()); - QCOMPARE(bmpimg.format(), QImage::Format_ARGB32_Premultiplied); - delete bmp; - - // The following two formats must be optimal always. - bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(101, 89), EColor16MAP) == KErrNone); - bmpimg = QVolatileImage(bmp); - QCOMPARE(bmpimg.format(), QImage::Format_ARGB32_Premultiplied); - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied); - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - delete bmp; - bmp = new CFbsBitmap; - QVERIFY(bmp->Create(TSize(101, 89), EColor16MU) == KErrNone); - bmpimg = QVolatileImage(bmp); - QCOMPARE(bmpimg.format(), QImage::Format_RGB32); - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - bmpimg.ensureFormat(QImage::Format_RGB32); - QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress()); - delete bmp; - -#else - QSKIP("CFbsBitmap is only available on Symbian, skipping bitmap test", SkipSingle); -#endif -} - int main(int argc, char *argv[]) { QApplication::setGraphicsSystem("openvg"); |