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
This commit is contained in:
Jason McDonald 2011-05-17 18:09:34 +10:00
parent 6e50394c4e
commit 0cd93933d8
5 changed files with 9 additions and 8399 deletions

View File

@ -8,7 +8,7 @@ SUBDIRS=\
qalgorithms \
qcombobox \
qcssparser \
#qdatastream \ # FIXME: uses qtsvg (QTBUG-19244)
qdatastream \
qdir \
qfocusevent \
qimage \

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 522 KiB

View File

@ -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

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!-- SVG content generated using Symbology Configuration Management System (SCMS) -->
<!-- Systematic Software Engineering Ltd. - www.systematic.co.uk - do not remove -->
<svg id="SUZP-----------" width="400px" height="400px" viewBox="0 0 400 400">
<g >
<svg viewBox="0 0 400 400" id="_0.SUZ------------" width="400px" height="400px"><path d="M115 285 C115 400 285 400 285 285 C400 285 400 115 285 115 C285 0 115 0 115 115 C0 115 0 285 115 285 z" style="fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:10"></path>
<text x="130px" y="180px" style="font-size:100;font-family:Arial;fill:rgb(0,0,0)">U</text>
</svg>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 757 B

View File

@ -45,13 +45,11 @@
#ifdef QT3_SUPPORT
#include <Qt3Support/Qt3Support>
#endif
#include <QtSvg/QtSvg>
#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