From 0cd93933d8e5cc69151958fc285936854ff86e47 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 17 May 2011 18:09:34 +1000 Subject: Make QDataStream test compile and re-enable it This test can't use svg files as QtSvg is a separate module, on which qtbase does not depend. This commit changes the test to use a pixmap that was already present in the test. Change-Id: Iab4ce70aa376a7d2985b69816bd251ce4f5d46cf Task-number: QTBUG-19244 Reviewed-by: Rohan McGovern --- tests/auto/other.pro | 2 +- tests/auto/qdatastream/gearflowers.svg | 8342 ---------------------------- tests/auto/qdatastream/qdatastream.pro | 15 +- tests/auto/qdatastream/tests2.svg | 12 - tests/auto/qdatastream/tst_qdatastream.cpp | 37 +- 5 files changed, 9 insertions(+), 8399 deletions(-) delete mode 100644 tests/auto/qdatastream/gearflowers.svg delete mode 100644 tests/auto/qdatastream/tests2.svg diff --git a/tests/auto/other.pro b/tests/auto/other.pro index b3715b3993..b50e1697b3 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -8,7 +8,7 @@ SUBDIRS=\ qalgorithms \ qcombobox \ qcssparser \ - #qdatastream \ # FIXME: uses qtsvg (QTBUG-19244) + qdatastream \ qdir \ qfocusevent \ qimage \ diff --git a/tests/auto/qdatastream/gearflowers.svg b/tests/auto/qdatastream/gearflowers.svg deleted file mode 100644 index 038e202d28..0000000000 --- a/tests/auto/qdatastream/gearflowers.svg +++ /dev/null @@ -1,8342 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Gearflowers - January 8, 2004 - - - Alexandre Rostovtsev - - - Wallpaper design for the KDE SVG contest. Also, hummingbirds are cool. - - - - gear - flower - hummingbird - - - - - Alexandre Rostovtsev - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro index 39bd09ef86..5e503aea78 100644 --- a/tests/auto/qdatastream/qdatastream.pro +++ b/tests/auto/qdatastream/qdatastream.pro @@ -1,23 +1,14 @@ load(qttest_p4) SOURCES += tst_qdatastream.cpp -!symbian: { -cross_compile: DEFINES += SVGFILE=\\\"tests2.svg\\\" -else: DEFINES += SVGFILE=\\\"gearflowers.svg\\\" -} - -# for qpaintdevicemetrics.h -QT += svg - - wince*: { - addFiles.files = datastream.q42 tests2.svg + addFiles.files = datastream.q42 addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" } else:symbian { - # SRCDIR and SVGFILE defined in code in symbian - addFiles.files = datastream.q42 tests2.svg + # SRCDIR defined in code in symbian + addFiles.files = datastream.q42 addFiles.path = . DEPLOYMENT += addFiles TARGET.EPOCHEAPSIZE = 1000000 10000000 diff --git a/tests/auto/qdatastream/tests2.svg b/tests/auto/qdatastream/tests2.svg deleted file mode 100644 index e7942c7e19..0000000000 --- a/tests/auto/qdatastream/tests2.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -U - - - - diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index 70d37e9749..a5f8e013ca 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -45,13 +45,11 @@ #ifdef QT3_SUPPORT #include #endif -#include #if defined(Q_OS_SYMBIAN) # define STRINGIFY(x) #x # define TOSTRING(x) STRINGIFY(x) # define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" -#define SVGFILE "tests2.svg" #endif Q_DECLARE_METATYPE(QBitArray) @@ -279,9 +277,6 @@ private: void readQWMatrix(QDataStream *s); void readQIcon(QDataStream *s); void readQEasingCurve(QDataStream *s); - -private: - QString svgFile; }; static int NColorRoles[] = { @@ -327,7 +322,6 @@ void tst_QDataStream::getSetCheck() tst_QDataStream::tst_QDataStream() { - svgFile = QLatin1String(SRCDIR SVGFILE); } tst_QDataStream::~tst_QDataStream() @@ -1870,9 +1864,6 @@ void tst_QDataStream::writeQIcon(QDataStream *s) QPixmap pm(open_xpm); QIcon d16(pm); *s << d16; - - QIcon svg(svgFile); - *s << svg; } void tst_QDataStream::readQIcon(QDataStream *s) @@ -1883,24 +1874,6 @@ void tst_QDataStream::readQIcon(QDataStream *s) *s >> d16; QVERIFY(!d16.isNull() && !icon.isNull()); QCOMPARE(d16.pixmap(100), pm); - - QIcon svg; - *s >> svg; - QVERIFY(!svg.isNull()); - - QImage image(200, 200, QImage::Format_ARGB32_Premultiplied); - image.fill(0); - QPainter p(&image); - p.drawPixmap(0, 0, svg.pixmap(200, 200)); - p.end(); - - QIcon svg2(svgFile); - QImage image2(200, 200, QImage::Format_ARGB32_Premultiplied); - image2.fill(0); - p.begin(&image2); - p.drawPixmap(0, 0, svg2.pixmap(200, 200)); - p.end(); - QCOMPARE(image, image2); } // ************************************ @@ -3219,13 +3192,13 @@ void tst_QDataStream::streamToAndFromQByteArray() void tst_QDataStream::streamRealDataTypes() { - // Generate QPicture from SVG. - QSvgRenderer renderer(svgFile); - QVERIFY(renderer.isValid()); + // Generate QPicture from pixmap. + QPixmap pm(open_xpm); + QVERIFY(!pm.isNull()); QPicture picture; - picture.setBoundingRect(QRect(QPoint(0, 0), renderer.defaultSize())); + picture.setBoundingRect(QRect(QPoint(0, 0), pm.size())); QPainter painter(&picture); - renderer.render(&painter); + painter.drawPixmap(0, 0, pm); painter.end(); // Generate path -- cgit v1.2.3