summaryrefslogtreecommitdiffstats
path: root/tests/auto/qimagereader
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qimagereader')
-rw-r--r--tests/auto/qimagereader/images/image_100dpi.tifbin0 -> 2242 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.pro2
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc1
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp421
4 files changed, 217 insertions, 207 deletions
diff --git a/tests/auto/qimagereader/images/image_100dpi.tif b/tests/auto/qimagereader/images/image_100dpi.tif
new file mode 100644
index 0000000..fcf3cd8
--- /dev/null
+++ b/tests/auto/qimagereader/images/image_100dpi.tif
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro
index b178823..2c9510e 100644
--- a/tests/auto/qimagereader/qimagereader.pro
+++ b/tests/auto/qimagereader/qimagereader.pro
@@ -3,6 +3,7 @@ SOURCES += tst_qimagereader.cpp
MOC_DIR=tmp
QT += network
RESOURCES += qimagereader.qrc
+DEFINES += SRCDIR=\\\"$$PWD\\\"
!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
@@ -22,5 +23,6 @@ wince*: {
imagePlugins.path = imageformats
DEPLOYMENT += images imagePlugins
+ DEFINES += SRCDIR=\\\".\\\"
}
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 13ce582..3c674ad 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -30,6 +30,7 @@
<file>images/image.pgm</file>
<file>images/image.png</file>
<file>images/image.ppm</file>
+ <file>images/image.tif</file>
<file>images/kollada.png</file>
<file>images/marble.xpm</file>
<file>images/namedcolors.xpm</file>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 8f7094c..f5313eb 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -158,6 +158,8 @@ private slots:
void pixelCompareWithBaseline();
};
+static const QLatin1String prefix(SRCDIR "/images/");
+
// Testing get/set functions
void tst_QImageReader::getSetCheck()
{
@@ -232,7 +234,7 @@ void tst_QImageReader::readImage()
QFETCH(QByteArray, format);
for (int i = 0; i < 2; ++i) {
- QImageReader io("images/" + fileName, i ? QByteArray() : format);
+ QImageReader io(prefix + fileName, i ? QByteArray() : format);
if (success) {
if (!io.supportsAnimation())
QVERIFY(io.imageCount() > 0);
@@ -248,16 +250,16 @@ void tst_QImageReader::readImage()
QVERIFY2(!image.isNull(), io.errorString().toLatin1().constData());
// No format
- QImageReader io2("images/" + fileName);
+ QImageReader io2(prefix + fileName);
QVERIFY2(!io2.read().isNull(), io.errorString().toLatin1().constData());
// No extension, no format
- QImageReader io3("images/" + fileName.left(fileName.lastIndexOf(QLatin1Char('.'))));
+ QImageReader io3(prefix + fileName.left(fileName.lastIndexOf(QLatin1Char('.'))));
QVERIFY2(!io3.read().isNull(), io.errorString().toLatin1().constData());
// Read into \a image2
QImage image2;
- QImageReader image2Reader("images/" + fileName, i ? QByteArray() : format);
+ QImageReader image2Reader(prefix + fileName, i ? QByteArray() : format);
QCOMPARE(image2Reader.format(), format);
QVERIFY(image2Reader.read(&image2));
if (image2Reader.canRead()) {
@@ -281,8 +283,8 @@ void tst_QImageReader::readImage()
void tst_QImageReader::jpegRgbCmyk()
{
- QImage image1(QLatin1String("images/YCbCr_cmyk.jpg"));
- QImage image2(QLatin1String("images/YCbCr_cmyk.png"));
+ QImage image1(prefix + QLatin1String("YCbCr_cmyk.jpg"));
+ QImage image2(prefix + QLatin1String("YCbCr_cmyk.png"));
QCOMPARE(image1, image2);
}
@@ -293,24 +295,24 @@ void tst_QImageReader::setScaledSize_data()
QTest::addColumn<QSize>("newSize");
QTest::addColumn<QByteArray>("format");
- QTest::newRow("BMP: colorful") << "images/colorful" << QSize(200, 200) << QByteArray("bmp");
- QTest::newRow("BMP: font") << "images/font" << QSize(200, 200) << QByteArray("bmp");
- QTest::newRow("XPM: marble") << "images/marble" << QSize(200, 200) << QByteArray("xpm");
- QTest::newRow("PNG: kollada") << "images/kollada" << QSize(200, 200) << QByteArray("png");
- QTest::newRow("PPM: teapot") << "images/teapot" << QSize(200, 200) << QByteArray("ppm");
- QTest::newRow("PPM: runners") << "images/runners.ppm" << QSize(400, 400) << QByteArray("ppm");
- QTest::newRow("PPM: test") << "images/test.ppm" << QSize(10, 10) << QByteArray("ppm");
- QTest::newRow("XBM: gnus") << "images/gnus" << QSize(200, 200) << QByteArray("xbm");
+ QTest::newRow("BMP: colorful") << "colorful" << QSize(200, 200) << QByteArray("bmp");
+ QTest::newRow("BMP: font") << "font" << QSize(200, 200) << QByteArray("bmp");
+ QTest::newRow("XPM: marble") << "marble" << QSize(200, 200) << QByteArray("xpm");
+ QTest::newRow("PNG: kollada") << "kollada" << QSize(200, 200) << QByteArray("png");
+ QTest::newRow("PPM: teapot") << "teapot" << QSize(200, 200) << QByteArray("ppm");
+ QTest::newRow("PPM: runners") << "runners.ppm" << QSize(400, 400) << QByteArray("ppm");
+ QTest::newRow("PPM: test") << "test.ppm" << QSize(10, 10) << QByteArray("ppm");
+ QTest::newRow("XBM: gnus") << "gnus" << QSize(200, 200) << QByteArray("xbm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("JPEG: beavis") << "images/beavis" << QSize(200, 200) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis") << "beavis" << QSize(200, 200) << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
- QTest::newRow("GIF: earth") << "images/earth" << QSize(200, 200) << QByteArray("gif");
- QTest::newRow("GIF: trolltech") << "images/trolltech" << QSize(200, 200) << QByteArray("gif");
+ QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif");
+ QTest::newRow("GIF: trolltech") << "trolltech" << QSize(200, 200) << QByteArray("gif");
#endif // QTEST_HAVE_GIF
#ifdef QTEST_HAVE_MNG
- QTest::newRow("MNG: ball") << "images/ball" << QSize(200, 200) << QByteArray("mng");
- QTest::newRow("MNG: fire") << "images/fire" << QSize(200, 200) << QByteArray("mng");
+ QTest::newRow("MNG: ball") << "ball" << QSize(200, 200) << QByteArray("mng");
+ QTest::newRow("MNG: fire") << "fire" << QSize(200, 200) << QByteArray("mng");
#endif // QTEST_HAVE_MNG
}
@@ -323,7 +325,7 @@ void tst_QImageReader::setScaledSize()
if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format))
QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle);
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
reader.setScaledSize(newSize);
QImage image = reader.read();
QVERIFY(!image.isNull());
@@ -336,25 +338,25 @@ void tst_QImageReader::setClipRect_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<QRect>("newRect");
QTest::addColumn<QByteArray>("format");
- QTest::newRow("BMP: colorful") << "images/colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp");
- QTest::newRow("BMP: font") << "images/font" << QRect(0, 0, 50, 50) << QByteArray("bmp");
- QTest::newRow("BMP: 4bpp uncompressed") << "images/tst7.bmp" << QRect(0, 0, 31, 31) << QByteArray("bmp");
- QTest::newRow("XPM: marble") << "images/marble" << QRect(0, 0, 50, 50) << QByteArray("xpm");
- QTest::newRow("PNG: kollada") << "images/kollada" << QRect(0, 0, 50, 50) << QByteArray("png");
- QTest::newRow("PPM: teapot") << "images/teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm");
- QTest::newRow("PPM: runners") << "images/runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
- QTest::newRow("PPM: test") << "images/test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
- QTest::newRow("XBM: gnus") << "images/gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm");
+ QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: 4bpp uncompressed") << "tst7.bmp" << QRect(0, 0, 31, 31) << QByteArray("bmp");
+ QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm");
+ QTest::newRow("PNG: kollada") << "kollada" << QRect(0, 0, 50, 50) << QByteArray("png");
+ QTest::newRow("PPM: teapot") << "teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm");
+ QTest::newRow("PPM: runners") << "runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
+ QTest::newRow("PPM: test") << "test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
+ QTest::newRow("XBM: gnus") << "gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("JPEG: beavis") << "images/beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis") << "beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
- QTest::newRow("GIF: earth") << "images/earth" << QRect(0, 0, 50, 50) << QByteArray("gif");
- QTest::newRow("GIF: trolltech") << "images/trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif");
+ QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif");
+ QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif");
#endif // QTEST_HAVE_GIF
#ifdef QTEST_HAVE_MNG
- QTest::newRow("MNG: ball") << "images/ball" << QRect(0, 0, 50, 50) << QByteArray("mng");
- QTest::newRow("MNG: fire") << "images/fire" << QRect(0, 0, 50, 50) << QByteArray("mng");
+ QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng");
+ QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng");
#endif // QTEST_HAVE_MNG
}
@@ -367,13 +369,13 @@ void tst_QImageReader::setClipRect()
if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format))
QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle);
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
reader.setClipRect(newRect);
QImage image = reader.read();
QVERIFY(!image.isNull());
QCOMPARE(image.rect(), newRect);
- QImageReader originalReader(fileName);
+ QImageReader originalReader(prefix + fileName);
QImage originalImage = originalReader.read();
QCOMPARE(originalImage.copy(newRect), image);
}
@@ -384,24 +386,24 @@ void tst_QImageReader::setScaledClipRect_data()
QTest::addColumn<QRect>("newRect");
QTest::addColumn<QByteArray>("format");
- QTest::newRow("BMP: colorful") << "images/colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp");
- QTest::newRow("BMP: font") << "images/font" << QRect(0, 0, 50, 50) << QByteArray("bmp");
- QTest::newRow("XPM: marble") << "images/marble" << QRect(0, 0, 50, 50) << QByteArray("xpm");
- QTest::newRow("PNG: kollada") << "images/kollada" << QRect(0, 0, 50, 50) << QByteArray("png");
- QTest::newRow("PPM: teapot") << "images/teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm");
- QTest::newRow("PPM: runners") << "images/runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
- QTest::newRow("PPM: test") << "images/test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
- QTest::newRow("XBM: gnus") << "images/gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm");
+ QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm");
+ QTest::newRow("PNG: kollada") << "kollada" << QRect(0, 0, 50, 50) << QByteArray("png");
+ QTest::newRow("PPM: teapot") << "teapot" << QRect(0, 0, 50, 50) << QByteArray("ppm");
+ QTest::newRow("PPM: runners") << "runners.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
+ QTest::newRow("PPM: test") << "test.ppm" << QRect(0, 0, 50, 50) << QByteArray("ppm");
+ QTest::newRow("XBM: gnus") << "gnus" << QRect(0, 0, 50, 50) << QByteArray("xbm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("JPEG: beavis") << "images/beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg");
+ QTest::newRow("JPEG: beavis") << "beavis" << QRect(0, 0, 50, 50) << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
- QTest::newRow("GIF: earth") << "images/earth" << QRect(0, 0, 50, 50) << QByteArray("gif");
- QTest::newRow("GIF: trolltech") << "images/trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif");
+ QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif");
+ QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif");
#endif // QTEST_HAVE_GIF
#ifdef QTEST_HAVE_MNG
- QTest::newRow("MNG: ball") << "images/ball" << QRect(0, 0, 50, 50) << QByteArray("mng");
- QTest::newRow("MNG: fire") << "images/fire" << QRect(0, 0, 50, 50) << QByteArray("mng");
+ QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng");
+ QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng");
#endif // QTEST_HAVE_MNG
}
@@ -414,14 +416,14 @@ void tst_QImageReader::setScaledClipRect()
if (!format.isEmpty() && !QImageReader::supportedImageFormats().contains(format))
QSKIP("Qt does not support reading the \"" + format + "\" format", SkipSingle);
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
reader.setScaledSize(QSize(300, 300));
reader.setScaledClipRect(newRect);
QImage image = reader.read();
QVERIFY(!image.isNull());
QCOMPARE(image.rect(), newRect);
- QImageReader originalReader(fileName);
+ QImageReader originalReader(prefix + fileName);
originalReader.setScaledSize(QSize(300, 300));
QImage originalImage = originalReader.read();
QCOMPARE(originalImage.copy(newRect), image);
@@ -433,29 +435,29 @@ void tst_QImageReader::imageFormat_data()
QTest::addColumn<QByteArray>("format");
QTest::addColumn<QImage::Format>("imageFormat");
- QTest::newRow("pbm") << QString("images/image.pbm") << QByteArray("pbm") << QImage::Format_Mono;
- QTest::newRow("pgm") << QString("images/image.pgm") << QByteArray("pgm") << QImage::Format_Indexed8;
- QTest::newRow("ppm-1") << QString("images/image.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
- QTest::newRow("ppm-2") << QString("images/teapot.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
- QTest::newRow("ppm-3") << QString("images/runners.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
- QTest::newRow("ppm-4") << QString("images/test.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
+ QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm") << QImage::Format_Mono;
+ QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm") << QImage::Format_Indexed8;
+ QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
+ QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
+ QTest::newRow("ppm-3") << QString("runners.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
+ QTest::newRow("ppm-4") << QString("test.ppm") << QByteArray("ppm") << QImage::Format_RGB32;
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("jpeg-1") << QString("images/beavis.jpg") << QByteArray("jpeg") << QImage::Format_Indexed8;
- QTest::newRow("jpeg-2") << QString("images/YCbCr_cmyk.jpg") << QByteArray("jpeg") << QImage::Format_RGB32;
- QTest::newRow("jpeg-3") << QString("images/YCbCr_rgb.jpg") << QByteArray("jpeg") << QImage::Format_RGB32;
+ QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg") << QImage::Format_Indexed8;
+ QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg") << QImage::Format_RGB32;
+ QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg") << QImage::Format_RGB32;
#endif
#if defined QTEST_HAVE_GIF
- QTest::newRow("gif-1") << QString("images/earth.gif") << QByteArray("gif") << QImage::Format_Invalid;
- QTest::newRow("gif-2") << QString("images/trolltech.gif") << QByteArray("gif") << QImage::Format_Invalid;
+ QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif") << QImage::Format_Invalid;
+ QTest::newRow("gif-2") << QString("trolltech.gif") << QByteArray("gif") << QImage::Format_Invalid;
#endif
- QTest::newRow("xbm") << QString("images/gnus.xbm") << QByteArray("xbm") << QImage::Format_MonoLSB;
- QTest::newRow("xpm") << QString("images/marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8;
- QTest::newRow("bmp-1") << QString("images/colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8;
- QTest::newRow("bmp-2") << QString("images/font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8;
- QTest::newRow("png") << QString("images/kollada.png") << QByteArray("png") << QImage::Format_ARGB32;
- QTest::newRow("png-2") << QString("images/YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32;
- QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng") << QImage::Format_Invalid;
- QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng") << QImage::Format_Invalid;
+ QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm") << QImage::Format_MonoLSB;
+ QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8;
+ QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8;
+ QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8;
+ QTest::newRow("png") << QString("kollada.png") << QByteArray("png") << QImage::Format_ARGB32;
+ QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32;
+ QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng") << QImage::Format_Invalid;
+ QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng") << QImage::Format_Invalid;
}
void tst_QImageReader::imageFormat()
@@ -463,7 +465,8 @@ void tst_QImageReader::imageFormat()
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
QFETCH(QImage::Format, imageFormat);
- if (QImageReader::imageFormat(fileName).isEmpty()) {
+
+ if (QImageReader::imageFormat(prefix + fileName).isEmpty()) {
if (QByteArray("jpeg") == format)
#ifndef QTEST_HAVE_JPEG
return;
@@ -478,31 +481,31 @@ void tst_QImageReader::imageFormat()
#endif // !QTEST_HAVE_MNG
QSKIP(("Qt does not support the " + format + " format.").constData(), SkipSingle);
} else {
- QCOMPARE(QImageReader::imageFormat(fileName), format);
+ QCOMPARE(QImageReader::imageFormat(prefix + fileName), format);
}
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
QCOMPARE(reader.imageFormat(), imageFormat);
}
void tst_QImageReader::blackXPM()
{
- QImage image(QLatin1String("images/black.xpm"));
- QImage image2(QLatin1String("images/black.png"));
+ QImage image(prefix + QLatin1String("black.xpm"));
+ QImage image2(prefix + QLatin1String("black.png"));
QCOMPARE(image.pixel(25, 25), qRgb(190, 190, 190));
QCOMPARE(image.pixel(25, 25), image2.pixel(25, 25));
}
void tst_QImageReader::transparentXPM()
{
- QImage image(QLatin1String("images/nontransparent.xpm"));
- QImage image2(QLatin1String("images/transparent.xpm"));
+ QImage image(prefix + QLatin1String("nontransparent.xpm"));
+ QImage image2(prefix + QLatin1String("transparent.xpm"));
QCOMPARE(image.format(), QImage::Format_RGB32);
QCOMPARE(image2.format(), QImage::Format_ARGB32);
}
void tst_QImageReader::multiWordNamedColorXPM()
{
- QImage image(QLatin1String("images/namedcolors.xpm"));
+ QImage image(prefix + QLatin1String("namedcolors.xpm"));
QCOMPARE(image.pixel(0, 0), qRgb(102, 139, 139)); // pale turquoise 4
QCOMPARE(image.pixel(0, 1), qRgb(250, 250, 210)); // light golden rod yellow
QCOMPARE(image.pixel(0, 2), qRgb(255, 250, 205)); // lemon chiffon
@@ -593,7 +596,7 @@ void tst_QImageReader::supportsAnimation()
{
QFETCH(QString, fileName);
QFETCH(bool, success);
- QImageReader io("images/" + fileName);
+ QImageReader io(prefix + fileName);
QCOMPARE(io.supportsAnimation(), success);
}
@@ -606,7 +609,7 @@ void tst_QImageReader::sizeBeforeRead()
{
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
QVERIFY(reader.canRead());
if (format == "mng") {
QCOMPARE(reader.size(), QSize());
@@ -644,7 +647,7 @@ void tst_QImageReader::imageFormatBeforeRead()
void tst_QImageReader::gifHandlerBugs()
{
{
- QImageReader io("images/trolltech.gif");
+ QImageReader io(prefix + "trolltech.gif");
QVERIFY(io.loopCount() != 1);
int count=0;
for (; io.canRead(); io.read(), ++count) ;
@@ -653,8 +656,8 @@ void tst_QImageReader::gifHandlerBugs()
// Task 95166
{
- QImageReader io1("images/bat1.gif");
- QImageReader io2("images/bat2.gif");
+ QImageReader io1(prefix + "bat1.gif");
+ QImageReader io2(prefix + "bat2.gif");
QVERIFY(io1.canRead());
QVERIFY(io2.canRead());
QImage im1 = io1.read();
@@ -666,8 +669,8 @@ void tst_QImageReader::gifHandlerBugs()
// Task 9994
{
- QImageReader io1("images/noclearcode.gif");
- QImageReader io2("images/noclearcode.bmp");
+ QImageReader io1(prefix + "noclearcode.gif");
+ QImageReader io2(prefix + "noclearcode.bmp");
QVERIFY(io1.canRead()); QVERIFY(io2.canRead());
QImage im1 = io1.read(); QImage im2 = io2.read();
QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull());
@@ -731,29 +734,29 @@ void tst_QImageReader::readFromDevice_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format");
- QTest::newRow("pbm") << QString("images/image.pbm") << QByteArray("pbm");
- QTest::newRow("pgm") << QString("images/image.pgm") << QByteArray("pgm");
- QTest::newRow("ppm-1") << QString("images/image.ppm") << QByteArray("ppm");
- QTest::newRow("ppm-2") << QString("images/teapot.ppm") << QByteArray("ppm");
- QTest::newRow("ppm-3") << QString("images/teapot.ppm") << QByteArray("ppm");
- QTest::newRow("ppm-4") << QString("images/runners.ppm") << QByteArray("ppm");
+ QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm");
+ QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm");
+ QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm");
+ QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm");
+ QTest::newRow("ppm-3") << QString("teapot.ppm") << QByteArray("ppm");
+ QTest::newRow("ppm-4") << QString("runners.ppm") << QByteArray("ppm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("jpeg-1") << QString("images/beavis.jpg") << QByteArray("jpeg");
- QTest::newRow("jpeg-2") << QString("images/YCbCr_cmyk.jpg") << QByteArray("jpeg");
- QTest::newRow("jpeg-3") << QString("images/YCbCr_rgb.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg");
#endif // QTEST_HAVE_JPEG
#ifdef QTEST_HAVE_GIF
- QTest::newRow("gif-1") << QString("images/earth.gif") << QByteArray("gif");
- QTest::newRow("gif-2") << QString("images/trolltech.gif") << QByteArray("gif");
+ QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif");
+ QTest::newRow("gif-2") << QString("trolltech.gif") << QByteArray("gif");
#endif // QTEST_HAVE_GIF
- QTest::newRow("xbm") << QString("images/gnus.xbm") << QByteArray("xbm");
- QTest::newRow("xpm") << QString("images/marble.xpm") << QByteArray("xpm");
- QTest::newRow("bmp-1") << QString("images/colorful.bmp") << QByteArray("bmp");
- QTest::newRow("bmp-2") << QString("images/font.bmp") << QByteArray("bmp");
- QTest::newRow("png") << QString("images/kollada.png") << QByteArray("png");
+ QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm");
+ QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm");
+ QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp");
+ QTest::newRow("png") << QString("kollada.png") << QByteArray("png");
#ifdef QTEST_HAVE_MNG
- QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng");
- QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng");
+ QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng");
+ QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng");
#endif // QTEST_HAVE_MNG
}
@@ -762,9 +765,9 @@ void tst_QImageReader::readFromDevice()
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
- QImage expectedImage(fileName, format);
+ QImage expectedImage(prefix + fileName, format);
- QFile file(fileName);
+ QFile file(prefix + fileName);
QVERIFY(file.open(QFile::ReadOnly));
QByteArray imageData = file.readAll();
QVERIFY(!imageData.isEmpty());
@@ -813,26 +816,26 @@ void tst_QImageReader::readFromFileAfterJunk_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format");
- QTest::newRow("pbm") << QString("images/image.pbm") << QByteArray("pbm");
- QTest::newRow("pgm") << QString("images/image.pgm") << QByteArray("pgm");
- QTest::newRow("ppm-1") << QString("images/image.ppm") << QByteArray("ppm");
- QTest::newRow("ppm-2") << QString("images/teapot.ppm") << QByteArray("ppm");
- QTest::newRow("ppm-3") << QString("images/teapot.ppm") << QByteArray("ppm");
- QTest::newRow("ppm-4") << QString("images/runners.ppm") << QByteArray("ppm");
+ QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm");
+ QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm");
+ QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm");
+ QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm");
+ QTest::newRow("ppm-3") << QString("teapot.ppm") << QByteArray("ppm");
+ QTest::newRow("ppm-4") << QString("runners.ppm") << QByteArray("ppm");
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("jpeg-1") << QString("images/beavis.jpg") << QByteArray("jpeg");
- QTest::newRow("jpeg-2") << QString("images/YCbCr_cmyk.jpg") << QByteArray("jpeg");
- QTest::newRow("jpeg-3") << QString("images/YCbCr_rgb.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg");
+ QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg");
#endif
#if defined QTEST_HAVE_GIF
// QTest::newRow("gif-1") << QString("images/earth.gif") << QByteArray("gif");
// QTest::newRow("gif-2") << QString("images/trolltech.gif") << QByteArray("gif");
#endif
- QTest::newRow("xbm") << QString("images/gnus.xbm") << QByteArray("xbm");
- QTest::newRow("xpm") << QString("images/marble.xpm") << QByteArray("xpm");
- QTest::newRow("bmp-1") << QString("images/colorful.bmp") << QByteArray("bmp");
- QTest::newRow("bmp-2") << QString("images/font.bmp") << QByteArray("bmp");
- QTest::newRow("png") << QString("images/kollada.png") << QByteArray("png");
+ QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm");
+ QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm");
+ QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp");
+ QTest::newRow("png") << QString("kollada.png") << QByteArray("png");
// QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng");
// QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng");
}
@@ -851,7 +854,7 @@ void tst_QImageReader::readFromFileAfterJunk()
QFile junkFile("junk");
QVERIFY(junkFile.open(QFile::WriteOnly));
- QFile imageFile(fileName);
+ QFile imageFile(prefix + fileName);
QVERIFY(imageFile.open(QFile::ReadOnly));
QByteArray imageData = imageFile.readAll();
QVERIFY(!imageData.isNull());
@@ -869,7 +872,7 @@ void tst_QImageReader::readFromFileAfterJunk()
for (int i = 0; i < iterations; ++i) {
QImageWriter writer(&junkFile, format);
junkFile.write("deadbeef", 9);
- QVERIFY(writer.write(QImage(fileName)));
+ QVERIFY(writer.write(QImage(prefix + fileName)));
}
}
junkFile.close();
@@ -903,8 +906,8 @@ void tst_QImageReader::description_data()
willem["Software"] = "Created on a NeXTstation color using \"pnmtopng\".";
willem["Disclaimer"] = "Freeware.";
- QTest::newRow("PNG") << QString("images/pngwithtext.png") << willem;
- QTest::newRow("PNG Compressed") << QString("images/pngwithcompressedtext.png") << willem;
+ QTest::newRow("PNG") << QString("pngwithtext.png") << willem;
+ QTest::newRow("PNG Compressed") << QString("pngwithcompressedtext.png") << willem;
}
void tst_QImageReader::description()
@@ -913,9 +916,9 @@ void tst_QImageReader::description()
QFETCH(QStringMap, description);
// Sanity check
- QVERIFY(!QImage(fileName).isNull());
+ QVERIFY(!QImage(prefix + fileName).isNull());
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
foreach (QString key, description.keys())
QCOMPARE(reader.text(key), description.value(key));
@@ -940,143 +943,143 @@ void tst_QImageReader::readFromResources_data()
QTest::addColumn<QSize>("size");
QTest::addColumn<QString>("message");
- QTest::newRow("images/corrupt.bmp") << QString("images/corrupt.bmp")
+ QTest::newRow("corrupt.bmp") << QString("corrupt.bmp")
<< QByteArray("bmp") << QSize(0, 0)
<< QString("");
- QTest::newRow("images/negativeheight.bmp") << QString("images/negativeheight.bmp")
+ QTest::newRow("negativeheight.bmp") << QString("negativeheight.bmp")
<< QByteArray("bmp") << QSize(127, 64)
<< QString("");
- QTest::newRow("images/font.bmp") << QString("images/font.bmp")
+ QTest::newRow("font.bmp") << QString("font.bmp")
<< QByteArray("bmp") << QSize(240, 8)
<< QString("");
- QTest::newRow("images/noclearcode.bmp") << QString("images/noclearcode.bmp")
+ QTest::newRow("noclearcode.bmp") << QString("noclearcode.bmp")
<< QByteArray("bmp") << QSize(29, 18)
<< QString("");
- QTest::newRow("images/colorful.bmp") << QString("images/colorful.bmp")
+ QTest::newRow("colorful.bmp") << QString("colorful.bmp")
<< QByteArray("bmp") << QSize(320, 200)
<< QString("");
- QTest::newRow("images/16bpp.bmp") << QString("images/16bpp.bmp")
+ QTest::newRow("16bpp.bmp") << QString("16bpp.bmp")
<< QByteArray("bmp") << QSize(320, 240)
<< QString("");
- QTest::newRow("images/crash-signed-char.bmp") << QString("images/crash-signed-char.bmp")
+ QTest::newRow("crash-signed-char.bmp") << QString("crash-signed-char.bmp")
<< QByteArray("bmp") << QSize(360, 280)
<< QString("");
- QTest::newRow("images/4bpp-rle.bmp") << QString("images/4bpp-rle.bmp")
+ QTest::newRow("4bpp-rle.bmp") << QString("4bpp-rle.bmp")
<< QByteArray("bmp") << QSize(640, 480)
<< QString("");
#ifdef QTEST_HAVE_GIF
- QTest::newRow("images/corrupt.gif") << QString("images/corrupt.gif")
+ QTest::newRow("corrupt.gif") << QString("corrupt.gif")
<< QByteArray("gif") << QSize(0, 0)
<< QString("");
- QTest::newRow("images/trolltech.gif") << QString("images/trolltech.gif")
+ QTest::newRow("trolltech.gif") << QString("trolltech.gif")
<< QByteArray("gif") << QSize(128, 64)
<< QString("");
- QTest::newRow("images/noclearcode.gif") << QString("images/noclearcode.gif")
+ QTest::newRow("noclearcode.gif") << QString("noclearcode.gif")
<< QByteArray("gif") << QSize(29, 18)
<< QString("");
- QTest::newRow("images/earth.gif") << QString("images/earth.gif")
+ QTest::newRow("earth.gif") << QString("earth.gif")
<< QByteArray("gif") << QSize(320, 200)
<< QString("");
- QTest::newRow("images/bat1.gif") << QString("images/bat1.gif")
+ QTest::newRow("bat1.gif") << QString("bat1.gif")
<< QByteArray("gif") << QSize(32, 32)
<< QString("");
- QTest::newRow("images/bat2.gif") << QString("images/bat2.gif")
+ QTest::newRow("bat2.gif") << QString("bat2.gif")
<< QByteArray("gif") << QSize(32, 32)
<< QString("");
#endif
#ifdef QTEST_HAVE_JPEG
- QTest::newRow("images/corrupt.jpg") << QString("images/corrupt.jpg")
+ QTest::newRow("corrupt.jpg") << QString("corrupt.jpg")
<< QByteArray("jpg") << QSize(0, 0)
<< QString("JPEG datastream contains no image");
- QTest::newRow("images/beavis.jpg") << QString("images/beavis.jpg")
+ QTest::newRow("beavis.jpg") << QString("beavis.jpg")
<< QByteArray("jpg") << QSize(350, 350)
<< QString("");
- QTest::newRow("images/YCbCr_cmyk.jpg") << QString("images/YCbCr_cmyk.jpg")
+ QTest::newRow("YCbCr_cmyk.jpg") << QString("YCbCr_cmyk.jpg")
<< QByteArray("jpg") << QSize(75, 50)
<< QString("");
- QTest::newRow("images/YCbCr_rgb.jpg") << QString("images/YCbCr_rgb.jpg")
+ QTest::newRow("YCbCr_rgb.jpg") << QString("YCbCr_rgb.jpg")
<< QByteArray("jpg") << QSize(75, 50)
<< QString("");
#endif
#ifdef QTEST_HAVE_MNG
- QTest::newRow("images/corrupt.mng") << QString("images/corrupt.mng")
+ QTest::newRow("corrupt.mng") << QString("corrupt.mng")
<< QByteArray("mng") << QSize(0, 0)
<< QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0");
- QTest::newRow("images/fire.mng") << QString("images/fire.mng")
+ QTest::newRow("fire.mng") << QString("fire.mng")
<< QByteArray("mng") << QSize(30, 60)
<< QString("");
- QTest::newRow("images/ball.mng") << QString("images/ball.mng")
+ QTest::newRow("ball.mng") << QString("ball.mng")
<< QByteArray("mng") << QSize(32, 32)
<< QString("");
#endif
- QTest::newRow("images/image.pbm") << QString("images/image.pbm")
+ QTest::newRow("image.pbm") << QString("image.pbm")
<< QByteArray("pbm") << QSize(16, 6)
<< QString("");
- QTest::newRow("images/image.pgm") << QString("images/image.pgm")
+ QTest::newRow("image.pgm") << QString("image.pgm")
<< QByteArray("pgm") << QSize(24, 7)
<< QString("");
- QTest::newRow("images/corrupt.png") << QString("images/corrupt.png")
+ QTest::newRow("corrupt.png") << QString("corrupt.png")
<< QByteArray("png") << QSize(0, 0)
<< QString("");
- QTest::newRow("images/away.png") << QString("images/away.png")
+ QTest::newRow("away.png") << QString("away.png")
<< QByteArray("png") << QSize(16, 16)
<< QString("");
- QTest::newRow("images/image.png") << QString("images/image.png")
+ QTest::newRow("image.png") << QString("image.png")
<< QByteArray("png") << QSize(22, 22)
<< QString("");
- QTest::newRow("images/pngwithcompressedtext.png") << QString("images/pngwithcompressedtext.png")
+ QTest::newRow("pngwithcompressedtext.png") << QString("pngwithcompressedtext.png")
<< QByteArray("png") << QSize(32, 32)
<< QString("");
- QTest::newRow("images/pngwithtext.png") << QString("images/pngwithtext.png")
+ QTest::newRow("pngwithtext.png") << QString("pngwithtext.png")
<< QByteArray("png") << QSize(32, 32)
<< QString("");
- QTest::newRow("images/kollada.png") << QString("images/kollada.png")
+ QTest::newRow("kollada.png") << QString("kollada.png")
<< QByteArray("png") << QSize(436, 160)
<< QString("");
- QTest::newRow("images/black.png") << QString("images/black.png")
+ QTest::newRow("black.png") << QString("black.png")
<< QByteArray("png") << QSize(48, 48)
<< QString("");
- QTest::newRow("images/YCbCr_cmyk.png") << QString("images/YCbCr_cmyk.png")
+ QTest::newRow("YCbCr_cmyk.png") << QString("YCbCr_cmyk.png")
<< QByteArray("png") << QSize(75, 50)
<< QString("");
- QTest::newRow("images/teapot.ppm") << QString("images/teapot.ppm")
+ QTest::newRow("teapot.ppm") << QString("teapot.ppm")
<< QByteArray("ppm") << QSize(256, 256)
<< QString("");
- QTest::newRow("images/image.ppm") << QString("images/image.ppm")
+ QTest::newRow("image.ppm") << QString("image.ppm")
<< QByteArray("ppm") << QSize(4, 4)
<< QString("");
- QTest::newRow("images/runners.ppm") << QString("images/runners.ppm")
+ QTest::newRow("runners.ppm") << QString("runners.ppm")
<< QByteArray("ppm") << QSize(400, 400)
<< QString("");
- QTest::newRow("images/test.ppm") << QString("images/test.ppm")
+ QTest::newRow("test.ppm") << QString("test.ppm")
<< QByteArray("ppm") << QSize(10, 10)
<< QString("");
-// QTest::newRow("images/corrupt.xbm") << QString("images/corrupt.xbm") << QByteArray("xbm") << QSize(0, 0);
- QTest::newRow("images/gnus.xbm") << QString("images/gnus.xbm")
+// QTest::newRow("corrupt.xbm") << QString("corrupt.xbm") << QByteArray("xbm") << QSize(0, 0);
+ QTest::newRow("gnus.xbm") << QString("gnus.xbm")
<< QByteArray("xbm") << QSize(271, 273)
<< QString("");
- QTest::newRow("images/corrupt-colors.xpm") << QString("images/corrupt-colors.xpm")
+ QTest::newRow("corrupt-colors.xpm") << QString("corrupt-colors.xpm")
<< QByteArray("xpm") << QSize(0, 0)
<< QString("QImage: XPM color specification is missing: bla9an.n#x");
- QTest::newRow("images/corrupt-pixels.xpm") << QString("images/corrupt-pixels.xpm")
+ QTest::newRow("corrupt-pixels.xpm") << QString("corrupt-pixels.xpm")
<< QByteArray("xpm") << QSize(0, 0)
<< QString("QImage: XPM pixels missing on image line 3");
- QTest::newRow("images/marble.xpm") << QString("images/marble.xpm")
+ QTest::newRow("marble.xpm") << QString("marble.xpm")
<< QByteArray("xpm") << QSize(240, 240)
<< QString("");
- QTest::newRow("images/test.xpm") << QString("images/test.xpm")
+ QTest::newRow("test.xpm") << QString("test.xpm")
<< QByteArray("xpm") << QSize(256, 256)
<< QString("");
- QTest::newRow("images/black.xpm") << QString("images/black.xpm")
+ QTest::newRow("black.xpm") << QString("black.xpm")
<< QByteArray("xpm") << QSize(48, 48)
<< QString("");
- QTest::newRow("images/namedcolors.xpm") << QString("images/namedcolors.xpm")
+ QTest::newRow("namedcolors.xpm") << QString("namedcolors.xpm")
<< QByteArray("xpm") << QSize(8, 8)
<< QString("");
- QTest::newRow("images/nontransparent.xpm") << QString("images/nontransparent.xpm")
+ QTest::newRow("nontransparent.xpm") << QString("nontransparent.xpm")
<< QByteArray("xpm") << QSize(8, 8)
<< QString("");
- QTest::newRow("images/transparent.xpm") << QString("images/transparent.xpm")
+ QTest::newRow("transparent.xpm") << QString("transparent.xpm")
<< QByteArray("xpm") << QSize(8, 8)
<< QString("");
}
@@ -1087,9 +1090,8 @@ void tst_QImageReader::readFromResources()
QFETCH(QByteArray, format);
QFETCH(QSize, size);
QFETCH(QString, message);
-
for (int i = 0; i < 2; ++i) {
- QString file = i ? (":/" + fileName) : fileName;
+ QString file = i ? (":/images/" + fileName) : (prefix + fileName);
{
// suppress warnings if we expect them
if (!message.isEmpty()) {
@@ -1153,7 +1155,7 @@ void tst_QImageReader::readFromResources()
QTest::ignoreMessage(QtWarningMsg, message.toLatin1());
QTest::ignoreMessage(QtWarningMsg, message.toLatin1());
}
- QCOMPARE(QImageReader(fileName).read(), QImageReader(":/" + fileName).read());
+ QCOMPARE(QImageReader(prefix + fileName).read(), QImageReader(":/images/" + fileName).read());
}
void tst_QImageReader::readCorruptImage_data()
@@ -1162,25 +1164,25 @@ void tst_QImageReader::readCorruptImage_data()
QTest::addColumn<bool>("shouldFail");
QTest::addColumn<QString>("message");
#if defined QTEST_HAVE_JPEG
- QTest::newRow("corrupt jpeg") << QString("images/corrupt.jpg") << true
+ QTest::newRow("corrupt jpeg") << QString("corrupt.jpg") << true
<< QString("JPEG datastream contains no image");
#endif
#if defined QTEST_HAVE_GIF
- QTest::newRow("corrupt gif") << QString("images/corrupt.gif") << true << QString("");
+ QTest::newRow("corrupt gif") << QString("corrupt.gif") << true << QString("");
#endif
#ifdef QTEST_HAVE_MNG
- QTest::newRow("corrupt mng") << QString("images/corrupt.mng") << true
+ QTest::newRow("corrupt mng") << QString("corrupt.mng") << true
<< QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0");
#endif
- QTest::newRow("corrupt png") << QString("images/corrupt.png") << true << QString("");
- QTest::newRow("corrupt bmp") << QString("images/corrupt.bmp") << true << QString("");
- QTest::newRow("corrupt xpm (colors)") << QString("images/corrupt-colors.xpm") << true
+ QTest::newRow("corrupt png") << QString("corrupt.png") << true << QString("");
+ QTest::newRow("corrupt bmp") << QString("corrupt.bmp") << true << QString("");
+ QTest::newRow("corrupt xpm (colors)") << QString("corrupt-colors.xpm") << true
<< QString("QImage: XPM color specification is missing: bla9an.n#x");
- QTest::newRow("corrupt xpm (pixels)") << QString("images/corrupt-pixels.xpm") << true
+ QTest::newRow("corrupt xpm (pixels)") << QString("corrupt-pixels.xpm") << true
<< QString("QImage: XPM pixels missing on image line 3");
- QTest::newRow("corrupt xbm") << QString("images/corrupt.xbm") << false << QString("");
+ QTest::newRow("corrupt xbm") << QString("corrupt.xbm") << false << QString("");
#if defined QTEST_HAVE_TIFF
- QTest::newRow("corrupt tiff") << QString("images/corrupt-data.tif") << true << QString("");
+ QTest::newRow("corrupt tiff") << QString("corrupt-data.tif") << true << QString("");
#endif
}
@@ -1189,16 +1191,17 @@ void tst_QImageReader::readCorruptImage()
QFETCH(QString, fileName);
QFETCH(bool, shouldFail);
QFETCH(QString, message);
+
if (!message.isEmpty())
QTest::ignoreMessage(QtWarningMsg, message.toLatin1());
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
QVERIFY(reader.canRead());
QCOMPARE(reader.read().isNull(), shouldFail);
}
void tst_QImageReader::readCorruptBmp()
{
- QCOMPARE(QImage("images/tst7.bmp").convertToFormat(QImage::Format_ARGB32_Premultiplied), QImage("images/tst7.png").convertToFormat(QImage::Format_ARGB32_Premultiplied));
+ QCOMPARE(QImage("tst7.bmp").convertToFormat(QImage::Format_ARGB32_Premultiplied), QImage("images/tst7.png").convertToFormat(QImage::Format_ARGB32_Premultiplied));
}
void tst_QImageReader::supportsOption_data()
@@ -1206,7 +1209,7 @@ void tst_QImageReader::supportsOption_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<QIntList>("options");
- QTest::newRow("png") << QString("images/black.png")
+ QTest::newRow("png") << QString("black.png")
<< (QIntList() << QImageIOHandler::Gamma
<< QImageIOHandler::Description
<< QImageIOHandler::Quality
@@ -1234,7 +1237,7 @@ void tst_QImageReader::supportsOption()
<< QImageIOHandler::Animation
<< QImageIOHandler::BackgroundColor;
- QImageReader reader(fileName);
+ QImageReader reader(prefix + fileName);
for (int i = 0; i < options.size(); ++i) {
QVERIFY(reader.supportsOption(QImageIOHandler::ImageOption(options.at(i))));
allOptions.remove(QImageIOHandler::ImageOption(options.at(i)));
@@ -1250,14 +1253,14 @@ void tst_QImageReader::tiffCompression_data()
QTest::addColumn<QString>("uncompressedFile");
QTest::addColumn<QString>("compressedFile");
- QTest::newRow("TIFF: adobedeflate") << "images/rgba_nocompression_littleendian.tif"
- << "images/rgba_adobedeflate_littleendian.tif";
- QTest::newRow("TIFF: lzw") << "images/rgba_nocompression_littleendian.tif"
- << "images/rgba_lzw_littleendian.tif";
- QTest::newRow("TIFF: packbits") << "images/rgba_nocompression_littleendian.tif"
- << "images/rgba_packbits_littleendian.tif";
- QTest::newRow("TIFF: zipdeflate") << "images/rgba_nocompression_littleendian.tif"
- << "images/rgba_zipdeflate_littleendian.tif";
+ QTest::newRow("TIFF: adobedeflate") << "rgba_nocompression_littleendian.tif"
+ << "rgba_adobedeflate_littleendian.tif";
+ QTest::newRow("TIFF: lzw") << "rgba_nocompression_littleendian.tif"
+ << "rgba_lzw_littleendian.tif";
+ QTest::newRow("TIFF: packbits") << "rgba_nocompression_littleendian.tif"
+ << "rgba_packbits_littleendian.tif";
+ QTest::newRow("TIFF: zipdeflate") << "rgba_nocompression_littleendian.tif"
+ << "rgba_zipdeflate_littleendian.tif";
}
void tst_QImageReader::tiffCompression()
@@ -1265,16 +1268,16 @@ void tst_QImageReader::tiffCompression()
QFETCH(QString, uncompressedFile);
QFETCH(QString, compressedFile);
- QImage uncompressedImage(uncompressedFile);
- QImage compressedImage(compressedFile);
+ QImage uncompressedImage(prefix + uncompressedFile);
+ QImage compressedImage(prefix + compressedFile);
QCOMPARE(uncompressedImage, compressedImage);
}
void tst_QImageReader::tiffEndianness()
{
- QImage littleEndian("images/rgba_nocompression_littleendian.tif");
- QImage bigEndian("images/rgba_nocompression_bigendian.tif");
+ QImage littleEndian(prefix + "rgba_nocompression_littleendian.tif");
+ QImage bigEndian(prefix + "rgba_nocompression_bigendian.tif");
QCOMPARE(littleEndian, bigEndian);
}
@@ -1286,8 +1289,10 @@ void tst_QImageReader::dotsPerMeter_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("expectedDotsPerMeterX");
QTest::addColumn<int>("expectedDotsPerMeterY");
-
- QTest::newRow("TIFF: 72 dpi") << "images/rgba_nocompression_littleendian.tif" << qRound(72 * (100 / 2.54)) << qRound(72 * (100 / 2.54));
+#if defined QTEST_HAVE_TIFF
+ QTest::newRow("TIFF: 72 dpi") << ("rgba_nocompression_littleendian.tif") << qRound(72 * (100 / 2.54)) << qRound(72 * (100 / 2.54));
+ QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54));
+#endif
}
void tst_QImageReader::dotsPerMeter()
@@ -1296,7 +1301,7 @@ void tst_QImageReader::dotsPerMeter()
QFETCH(int, expectedDotsPerMeterX);
QFETCH(int, expectedDotsPerMeterY);
- QImage image(fileName);
+ QImage image(prefix + fileName);
QCOMPARE(image.dotsPerMeterX(), expectedDotsPerMeterX);
QCOMPARE(image.dotsPerMeterY(), expectedDotsPerMeterY);
@@ -1307,8 +1312,10 @@ void tst_QImageReader::physicalDpi_data()
QTest::addColumn<QString>("fileName");
QTest::addColumn<int>("expectedPhysicalDpiX");
QTest::addColumn<int>("expectedPhysicalDpiY");
-
- QTest::newRow("TIFF: 72 dpi") << "images/rgba_nocompression_littleendian.tif" << 72 << 72;
+#if defined QTEST_HAVE_TIFF
+ QTest::newRow("TIFF: 72 dpi") << "rgba_nocompression_littleendian.tif" << 72 << 72;
+ QTest::newRow("TIFF: 100 dpi") << "image_100dpi.tif" << 100 << 100;
+#endif
}
void tst_QImageReader::physicalDpi()
@@ -1317,7 +1324,7 @@ void tst_QImageReader::physicalDpi()
QFETCH(int, expectedPhysicalDpiX);
QFETCH(int, expectedPhysicalDpiY);
- QImage image(fileName);
+ QImage image(prefix + fileName);
QCOMPARE(image.physicalDpiX(), expectedPhysicalDpiX);
QCOMPARE(image.physicalDpiY(), expectedPhysicalDpiY);
@@ -1328,7 +1335,7 @@ void tst_QImageReader::autoDetectImageFormat()
// Assume PNG is supported :-)
{
// Disables file name extension probing
- QImageReader reader("images/kollada");
+ QImageReader reader(prefix + "kollada");
reader.setAutoDetectImageFormat(false);
QVERIFY(!reader.canRead());
QVERIFY(reader.read().isNull());
@@ -1338,7 +1345,7 @@ void tst_QImageReader::autoDetectImageFormat()
}
{
// Disables detection based on suffix
- QImageReader reader("images/kollada.png");
+ QImageReader reader(prefix + "kollada.png");
reader.setAutoDetectImageFormat(false);
QVERIFY(!reader.canRead());
QVERIFY(reader.read().isNull());
@@ -1348,7 +1355,7 @@ void tst_QImageReader::autoDetectImageFormat()
}
{
// Disables detection based on content
- QImageReader reader("images/kollada-noext");
+ QImageReader reader(prefix + "kollada-noext");
reader.setAutoDetectImageFormat(false);
QVERIFY(!reader.canRead());
QVERIFY(reader.read().isNull());