diff options
Diffstat (limited to 'tests/auto/gui/image')
62 files changed, 131 insertions, 484 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index 0ad195f629..fc25d7567a 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -4,16 +4,12 @@ SOURCES+= tst_qicoimageformat.cpp QT += testlib wince*: { - DEFINES += SRCDIR=\\\".\\\" - addFiles.files = icons - addFiles.path = . CONFIG(debug, debug|release):{ addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll } else { addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll } addPlugins.path = imageformats - DEPLOYMENT += addFiles addPlugins -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" + DEPLOYMENT += addPlugins } +TESTDATA += icons/* diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index 40cd9b848a..25c6c81b2a 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -80,8 +80,6 @@ private: tst_QIcoImageFormat::tst_QIcoImageFormat() { - m_IconPath = QLatin1String(SRCDIR) + "/icons"; - qDebug() << m_IconPath; } tst_QIcoImageFormat::~tst_QIcoImageFormat() @@ -101,7 +99,9 @@ void tst_QIcoImageFormat::cleanup() void tst_QIcoImageFormat::initTestCase() { - + m_IconPath = QFINDTESTDATA("icons"); + if (m_IconPath.isEmpty()) + QFAIL("Cannot find icons directory containing testdata!"); } void tst_QIcoImageFormat::cleanupTestCase() diff --git a/tests/auto/gui/image/qicon/qicon.pro b/tests/auto/gui/image/qicon/qicon.pro index 34fc5b7716..c44c080ced 100644 --- a/tests/auto/gui/image/qicon/qicon.pro +++ b/tests/auto/gui/image/qicon/qicon.pro @@ -7,15 +7,6 @@ RESOURCES = tst_qicon.qrc wince* { QT += xml svg - addFiles.files += $$_PRO_FILE_PWD_/*.png - addFiles.files += $$_PRO_FILE_PWD_/*.svg - addFiles.files += $$_PRO_FILE_PWD_/*.svgz - addFiles.files += $$_PRO_FILE_PWD_/tst_qicon.cpp - addFiles.path = . - DEPLOYMENT += addFiles - DEPLOYMENT_PLUGIN += qsvg - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" } +TESTDATA += icons/* *.png *.svg *.svgz diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 55b0c81529..7d455f1010 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -54,9 +54,6 @@ public: tst_QIcon(); private slots: - void init(); - void cleanup(); - void actualSize_data(); // test with 1 pixmap void actualSize(); void actualSize2_data(); // test with 2 pixmaps with different aspect ratio @@ -77,13 +74,10 @@ private slots: void task184901_badCache(); void task223279_inconsistentAddFile(); - void task239461_custom_iconengine_crash(); private: bool haveImageFormat(QByteArray const&); - QString oldCurrentDir; - const static QIcon staticIcon; }; @@ -91,22 +85,6 @@ private: // But we do not officially support this. See QTBUG-8666 const QIcon tst_QIcon::staticIcon = QIcon::fromTheme("edit-find"); -void tst_QIcon::init() -{ - QString srcdir(QLatin1String(SRCDIR)); - if (!srcdir.isEmpty()) { - oldCurrentDir = QDir::current().absolutePath(); - QDir::setCurrent(srcdir); - } -} - -void tst_QIcon::cleanup() -{ - if (!oldCurrentDir.isEmpty()) { - QDir::setCurrent(oldCurrentDir); - } -} - bool tst_QIcon::haveImageFormat(QByteArray const& desiredFormat) { return QImageReader::supportedImageFormats().contains(desiredFormat); @@ -136,7 +114,7 @@ void tst_QIcon::actualSize_data() QTest::newRow("resource9") << ":/rect.png" << QSize( 15, 50) << QSize( 15, 30); QTest::newRow("resource10") << ":/rect.png" << QSize( 25, 50) << QSize( 20, 40); - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; QTest::newRow("external0") << prefix + "image.png" << QSize(128, 128) << QSize(128, 128); QTest::newRow("external1") << prefix + "image.png" << QSize( 64, 64) << QSize( 64, 64); QTest::newRow("external2") << prefix + "image.png" << QSize( 32, 64) << QSize( 32, 32); @@ -191,7 +169,7 @@ void tst_QIcon::actualSize2_data() void tst_QIcon::actualSize2() { QIcon icon; - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; icon.addPixmap(QPixmap(prefix + "image.png")); icon.addPixmap(QPixmap(prefix + "rect.png")); @@ -209,7 +187,7 @@ void tst_QIcon::svgActualSize() QSKIP("SVG support is not available"); } - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; QIcon icon(prefix + "rect.svg"); QCOMPARE(icon.actualSize(QSize(16, 16)), QSize(16, 2)); QCOMPARE(icon.pixmap(QSize(16, 16)).size(), QSize(16, 2)); @@ -252,7 +230,7 @@ void tst_QIcon::isNull() { QVERIFY(!iconNoFileSuffix.isNull()); QVERIFY(!iconNoFileSuffix.actualSize(QSize(32, 32)).isValid()); - const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); + const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; // test string constructor with existing file but unsupported format QIcon iconUnsupportedFormat = QIcon(prefix + "tst_qicon.cpp"); QVERIFY(!iconUnsupportedFormat.isNull()); @@ -406,7 +384,7 @@ void tst_QIcon::detach() img.fill(0xffff0000); QIcon icon1(QPixmap::fromImage(img)); QIcon icon2 = icon1; - icon2.addFile("image.png", QSize(64, 64)); + icon2.addFile(QFINDTESTDATA("image.png"), QSize(64, 64)); QImage img1 = icon1.pixmap(64, 64).toImage(); QImage img2 = icon2.pixmap(64, 64).toImage(); @@ -648,7 +626,7 @@ static inline bool operator<(const QSize &lhs, const QSize &rhs) void tst_QIcon::task184901_badCache() { - QPixmap pm("image.png"); + QPixmap pm(QFINDTESTDATA("image.png")); QIcon icon(pm); //the disabled icon must have an effect (grayed) @@ -743,32 +721,5 @@ void tst_QIcon::task223279_inconsistentAddFile() } -// During detach, v2 engines are cloned, while v1 engines are only -// passed on, so v1 engines need to be referenced counted. This test -// verifies that the engine is destroyed once and only once. - -class IconEngine : public QIconEngine -{ -public: - ~IconEngine() { destructorCalled++; } - virtual void paint(QPainter *, const QRect &, QIcon::Mode, QIcon::State) { } - static int destructorCalled; -}; -int IconEngine::destructorCalled = 0; - -void tst_QIcon::task239461_custom_iconengine_crash() -{ - QIconEngine *engine = new IconEngine(); - { - QIcon icon(engine); - QIcon icon2 = icon; - - QPixmap pixmap(32, 32); - icon.addPixmap(pixmap); - } - QCOMPARE(IconEngine::destructorCalled, 1); -} - - QTEST_MAIN(tst_QIcon) #include "tst_qicon.moc" diff --git a/tests/auto/gui/image/qimage/images/image.tif b/tests/auto/gui/image/qimage/images/image.tif Binary files differdeleted file mode 100644 index ee0637cf25..0000000000 --- a/tests/auto/gui/image/qimage/images/image.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index afa279f340..d9252f036f 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -4,11 +4,4 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib -wince*: { - addImages.files = images/* - addImages.path = images - DEPLOYMENT += addImages - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} +TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 479acea3fd..cda887d8e1 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -144,6 +144,8 @@ private slots: void deepCopyWhenPaintingActive(); void scaled_QTBUG19157(); + + void cleanupFunctions(); }; tst_QImage::tst_QImage() @@ -261,7 +263,10 @@ void tst_QImage::formatHandlersInput_data() { QTest::addColumn<QString>("testFormat"); QTest::addColumn<QString>("testFile"); - const QString prefix = QLatin1String(SRCDIR) + "/images/"; + + const QString prefix = QFINDTESTDATA("images/"); + if (prefix.isEmpty()) + QFAIL("can not find images directory!"); // add a new line here when a file is added QTest::newRow("ICO") << "ICO" << prefix + "image.ico"; @@ -274,9 +279,6 @@ void tst_QImage::formatHandlersInput_data() QTest::newRow("PPM") << "PPM" << prefix + "image.ppm"; QTest::newRow("XBM") << "XBM" << prefix + "image.xbm"; QTest::newRow("XPM") << "XPM" << prefix + "image.xpm"; -#if defined QTEST_HAVE_TIFF - QTest::newRow("TIFF") << "TIFF" << prefix + "image.tif"; -#endif } void tst_QImage::formatHandlersInput() @@ -1997,5 +1999,40 @@ void tst_QImage::scaled_QTBUG19157() QVERIFY(!foo.isNull()); } +static void cleanupFunction(void* info) +{ + bool *called = static_cast<bool*>(info); + *called = true; +} + +void tst_QImage::cleanupFunctions() +{ + QImage bufferImage(64, 64, QImage::Format_ARGB32); + bufferImage.fill(0); + + bool called; + + { + called = false; + { + QImage image(bufferImage.bits(), bufferImage.width(), bufferImage.height(), bufferImage.format(), cleanupFunction, &called); + } + QVERIFY(called); + } + + { + called = false; + QImage *copy = 0; + { + QImage image(bufferImage.bits(), bufferImage.width(), bufferImage.height(), bufferImage.format(), cleanupFunction, &called); + copy = new QImage(image); + } + QVERIFY(!called); + delete copy; + QVERIFY(called); + } + +} + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp index acf4e4f4ea..b17ca9c622 100644 --- a/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp +++ b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qimagereader/images/ball.mng b/tests/auto/gui/image/qimagereader/images/ball.mng Binary files differdeleted file mode 100644 index 81544780fd..0000000000 --- a/tests/auto/gui/image/qimagereader/images/ball.mng +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/corrupt-data.tif b/tests/auto/gui/image/qimagereader/images/corrupt-data.tif Binary files differdeleted file mode 100644 index d63c688b27..0000000000 --- a/tests/auto/gui/image/qimagereader/images/corrupt-data.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/corrupt.mng b/tests/auto/gui/image/qimagereader/images/corrupt.mng Binary files differdeleted file mode 100644 index 17fd43a5ca..0000000000 --- a/tests/auto/gui/image/qimagereader/images/corrupt.mng +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/fire.mng b/tests/auto/gui/image/qimagereader/images/fire.mng Binary files differdeleted file mode 100644 index c6695c8369..0000000000 --- a/tests/auto/gui/image/qimagereader/images/fire.mng +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif b/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif Binary files differdeleted file mode 100644 index 960531ea86..0000000000 --- a/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/grayscale.tif b/tests/auto/gui/image/qimagereader/images/grayscale.tif Binary files differdeleted file mode 100644 index 5f4e11429d..0000000000 --- a/tests/auto/gui/image/qimagereader/images/grayscale.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/image_100dpi.tif b/tests/auto/gui/image/qimagereader/images/image_100dpi.tif Binary files differdeleted file mode 100644 index fcf3cd89aa..0000000000 --- a/tests/auto/gui/image/qimagereader/images/image_100dpi.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif Binary files differdeleted file mode 100644 index 78868b0d48..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif Binary files differdeleted file mode 100644 index 107eab74e7..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif Binary files differdeleted file mode 100644 index c314bae4c0..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif Binary files differdeleted file mode 100644 index 4f820f6649..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif Binary files differdeleted file mode 100644 index ddeec38fbc..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif Binary files differdeleted file mode 100644 index 50a3024246..0000000000 --- a/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff Binary files differdeleted file mode 100644 index 3fcb8a9aca..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff Binary files differdeleted file mode 100644 index 6f3e9d5297..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff Binary files differdeleted file mode 100644 index aab9cf2596..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff Binary files differdeleted file mode 100644 index aad96ffc6c..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff Binary files differdeleted file mode 100644 index 05d23dcb86..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff Binary files differdeleted file mode 100644 index 9ffe7fcaa4..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff Binary files differdeleted file mode 100644 index eeeb01937e..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff Binary files differdeleted file mode 100644 index 87cf2fd774..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff Binary files differdeleted file mode 100644 index 3b589b2232..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff Binary files differdeleted file mode 100644 index 9a662239db..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff Binary files differdeleted file mode 100644 index eed242388c..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff Binary files differdeleted file mode 100644 index 055480e0ca..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff Binary files differdeleted file mode 100644 index b4d0974ec8..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff Binary files differdeleted file mode 100644 index 3b1e02af56..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff Binary files differdeleted file mode 100644 index b752c745c3..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff Binary files differdeleted file mode 100644 index e228d05659..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff Binary files differdeleted file mode 100644 index 7507e526a5..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff Binary files differdeleted file mode 100644 index 8ff9db80f5..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff Binary files differdeleted file mode 100644 index 321ea3ebf5..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff Binary files differdeleted file mode 100644 index 2756a82fbb..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff Binary files differdeleted file mode 100644 index ae9af0999d..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff Binary files differdeleted file mode 100644 index a2f432526b..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff Binary files differdeleted file mode 100644 index f35bfc4c9c..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff Binary files differdeleted file mode 100644 index 70e5478065..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff Binary files differdeleted file mode 100644 index b2635fe14f..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff Binary files differdeleted file mode 100644 index 1fb0cd9df6..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff Binary files differdeleted file mode 100644 index 666b1b4c55..0000000000 --- a/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagereader/qimagereader.qrc b/tests/auto/gui/image/qimagereader/qimagereader.qrc index 2c70652389..3ff41d393b 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.qrc +++ b/tests/auto/gui/image/qimagereader/qimagereader.qrc @@ -6,7 +6,6 @@ <file>images/YCbCr_cmyk.png</file> <file>images/YCbCr_rgb.jpg</file> <file>images/away.png</file> - <file>images/ball.mng</file> <file>images/bat1.gif</file> <file>images/bat2.gif</file> <file>images/beavis.jpg</file> @@ -18,19 +17,16 @@ <file>images/corrupt.bmp</file> <file>images/corrupt.gif</file> <file>images/corrupt.jpg</file> - <file>images/corrupt.mng</file> <file>images/corrupt.png</file> <file>images/corrupt.xbm</file> <file>images/crash-signed-char.bmp</file> <file>images/earth.gif</file> - <file>images/fire.mng</file> <file>images/font.bmp</file> <file>images/gnus.xbm</file> <file>images/image.pbm</file> <file>images/image.pgm</file> <file>images/image.png</file> <file>images/image.ppm</file> - <file>images/image_100dpi.tif</file> <file>images/kollada.png</file> <file>images/marble.xpm</file> <file>images/namedcolors.xpm</file> diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 7504ab3466..8a18bee83f 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -121,12 +121,6 @@ private slots: void readFromResources_data(); void readFromResources(); - void dotsPerMeter_data(); - void dotsPerMeter(); - - void physicalDpi_data(); - void physicalDpi(); - void sizeBeforeRead_data(); void sizeBeforeRead(); @@ -148,15 +142,6 @@ private slots: void supportsOption_data(); void supportsOption(); - void tiffCompression_data(); - void tiffCompression(); - void tiffEndianness(); - - void tiffOrientation_data(); - void tiffOrientation(); - - void tiffGrayscale(); - void autoDetectImageFormat(); void fileNameProbing(); @@ -256,9 +241,6 @@ void tst_QImageReader::readImage_data() QTest::newRow("GIF: earth") << QString("earth.gif") << true << QByteArray("gif"); QTest::newRow("GIF: trolltech") << QString("trolltech.gif") << true << QByteArray("gif"); - QTest::newRow("MNG: ball") << QString("ball.mng") << true << QByteArray("mng"); - QTest::newRow("MNG: fire") << QString("fire.mng") << true << QByteArray("mng"); - QTest::newRow("SVG: rect") << QString("rect.svg") << true << QByteArray("svg"); QTest::newRow("SVGZ: rect") << QString("rect.svgz") << true << QByteArray("svgz"); } @@ -374,9 +356,6 @@ void tst_QImageReader::setScaledSize_data() QTest::newRow("GIF: earth") << "earth" << QSize(200, 200) << QByteArray("gif"); QTest::newRow("GIF: trolltech") << "trolltech" << QSize(200, 200) << QByteArray("gif"); - QTest::newRow("MNG: ball") << "ball" << QSize(200, 200) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "fire" << QSize(200, 200) << QByteArray("mng"); - QTest::newRow("SVG: rect") << "rect" << QSize(200, 200) << QByteArray("svg"); QTest::newRow("SVGZ: rect") << "rect" << QSize(200, 200) << QByteArray("svgz"); } @@ -441,9 +420,6 @@ void tst_QImageReader::setClipRect_data() QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); - QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("SVG: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svg"); QTest::newRow("SVGZ: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svgz"); } @@ -489,9 +465,6 @@ void tst_QImageReader::setScaledClipRect_data() QTest::newRow("GIF: earth") << "earth" << QRect(0, 0, 50, 50) << QByteArray("gif"); QTest::newRow("GIF: trolltech") << "trolltech" << QRect(0, 0, 50, 50) << QByteArray("gif"); - QTest::newRow("MNG: ball") << "ball" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("MNG: fire") << "fire" << QRect(0, 0, 50, 50) << QByteArray("mng"); - QTest::newRow("SVG: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svg"); QTest::newRow("SVGZ: rect") << "rect" << QRect(0, 0, 50, 50) << QByteArray("svgz"); } @@ -545,8 +518,6 @@ void tst_QImageReader::imageFormat_data() QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp") << QImage::Format_RGB32; 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; QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg") << QImage::Format_ARGB32_Premultiplied; QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz") << QImage::Format_ARGB32_Premultiplied; } @@ -625,9 +596,6 @@ void tst_QImageReader::setBackgroundColor_data() QTest::newRow("GIF: earth") << QString("earth.gif") << QColor(Qt::cyan); QTest::newRow("GIF: trolltech") << QString("trolltech.gif") << QColor(Qt::magenta); - QTest::newRow("MNG: ball") << QString("ball.mng") << QColor(Qt::yellow); - QTest::newRow("MNG: fire") << QString("fire.mng") << QColor(Qt::gray); - QTest::newRow("SVG: rect") << QString("rect.svg") << QColor(Qt::darkGreen); QTest::newRow("SVGZ: rect") << QString("rect.svgz") << QColor(Qt::darkGreen); } @@ -664,9 +632,6 @@ void tst_QImageReader::supportsAnimation_data() QTest::newRow("GIF: earth") << QString("earth.gif") << true; QTest::newRow("GIF: trolltech") << QString("trolltech.gif") << true; - QTest::newRow("MNG: ball") << QString("ball.mng") << true; - QTest::newRow("MNG: fire") << QString("fire.mng") << true; - QTest::newRow("SVG: rect") << QString("rect.svg") << false; QTest::newRow("SVGZ: rect") << QString("rect.svgz") << false; } @@ -693,10 +658,6 @@ void tst_QImageReader::sizeBeforeRead() QImageReader reader(prefix + fileName); QVERIFY(reader.canRead()); - if (format == "mng") { - QCOMPARE(reader.size(), QSize()); - return; - } QSize size = reader.size(); QVERIFY(reader.canRead()); @@ -1043,9 +1004,6 @@ void tst_QImageReader::readFromDevice_data() QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp"); QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); - QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng"); - QTest::newRow("mng-2") << QString("fire.mng") << QByteArray("mng"); - QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg"); QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz"); #if defined QTEST_HAVE_TGA @@ -1165,7 +1123,7 @@ void tst_QImageReader::readFromFileAfterJunk() if (format == "ppm" || format == "pbm" || format == "pgm" || format == "svg" || format == "svgz") iterations = 1; - if (format == "mng" || !QImageWriter::supportedImageFormats().contains(format)) { + if (!QImageWriter::supportedImageFormats().contains(format)) { for (int i = 0; i < iterations; ++i) { junkFile.write("deadbeef", 9); QCOMPARE(junkFile.write(imageData), qint64(imageData.size())); @@ -1321,15 +1279,6 @@ void tst_QImageReader::readFromResources_data() QTest::newRow("qtbug13653-no_eoi.jpg") << QString("qtbug13653-no_eoi.jpg") << QByteArray("jpg") << QSize(240, 180) << QString(""); - 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("fire.mng") << QString("fire.mng") - << QByteArray("mng") << QSize(30, 60) - << QString(""); - QTest::newRow("ball.mng") << QString("ball.mng") - << QByteArray("mng") << QSize(32, 32) - << QString(""); QTest::newRow("rect.svg") << QString("rect.svg") << QByteArray("svg") << QSize(105, 137) << QString(""); @@ -1497,9 +1446,6 @@ void tst_QImageReader::readCorruptImage_data() << QString("JPEG datastream contains no image") << QByteArray("jpeg"); QTest::newRow("corrupt gif") << QString("corrupt.gif") << true << QString("") << QByteArray("gif"); - QTest::newRow("corrupt mng") << QString("corrupt.mng") << true - << QString("MNG error 901: Application signalled I/O error; chunk IHDR; subcode 0:0") - << QByteArray("mng"); QTest::newRow("corrupt png") << QString("corrupt.png") << true << QString("") << QByteArray("png"); QTest::newRow("corrupt bmp") << QString("corrupt.bmp") << true << QString("") << QByteArray("bmp"); QTest::newRow("corrupt xpm (colors)") << QString("corrupt-colors.xpm") << true @@ -1509,7 +1455,6 @@ void tst_QImageReader::readCorruptImage_data() << QString("QImage: XPM pixels missing on image line 3") << QByteArray("xpm"); QTest::newRow("corrupt xbm") << QString("corrupt.xbm") << false << QString("") << QByteArray("xbm"); - QTest::newRow("corrupt tiff") << QString("corrupt-data.tif") << true << QString("") << QByteArray("tiff"); QTest::newRow("corrupt svg") << QString("corrupt.svg") << true << QString("") << QByteArray("svg"); QTest::newRow("corrupt svgz") << QString("corrupt.svgz") << true << QString("") << QByteArray("svgz"); } @@ -1578,148 +1523,6 @@ void tst_QImageReader::supportsOption() QVERIFY(!reader.supportsOption(option)); } -void tst_QImageReader::tiffCompression_data() -{ - QTest::addColumn<QString>("uncompressedFile"); - QTest::addColumn<QString>("compressedFile"); - - 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() -{ - QFETCH(QString, uncompressedFile); - QFETCH(QString, compressedFile); - - SKIP_IF_UNSUPPORTED("tiff"); - - QImage uncompressedImage(prefix + uncompressedFile); - QImage compressedImage(prefix + compressedFile); - - QCOMPARE(uncompressedImage, compressedImage); -} - -void tst_QImageReader::tiffEndianness() -{ - SKIP_IF_UNSUPPORTED("tiff"); - - QImage littleEndian(prefix + "rgba_nocompression_littleendian.tif"); - QImage bigEndian(prefix + "rgba_nocompression_bigendian.tif"); - - QCOMPARE(littleEndian, bigEndian); -} - -void tst_QImageReader::tiffOrientation_data() -{ - QTest::addColumn<QString>("expected"); - QTest::addColumn<QString>("oriented"); - QTest::newRow("Indexed TIFF, orientation1") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_1.tiff"; - QTest::newRow("Indexed TIFF, orientation2") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_2.tiff"; - QTest::newRow("Indexed TIFF, orientation3") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_3.tiff"; - QTest::newRow("Indexed TIFF, orientation4") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_4.tiff"; - QTest::newRow("Indexed TIFF, orientation5") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_5.tiff"; - QTest::newRow("Indexed TIFF, orientation6") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_6.tiff"; - QTest::newRow("Indexed TIFF, orientation7") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_7.tiff"; - QTest::newRow("Indexed TIFF, orientation8") << "tiff_oriented/original_indexed.tiff" << "tiff_oriented/indexed_orientation_8.tiff"; - - QTest::newRow("Mono TIFF, orientation1") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_1.tiff"; - QTest::newRow("Mono TIFF, orientation2") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_2.tiff"; - QTest::newRow("Mono TIFF, orientation3") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_3.tiff"; - QTest::newRow("Mono TIFF, orientation4") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_4.tiff"; - QTest::newRow("Mono TIFF, orientation5") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_5.tiff"; - QTest::newRow("Mono TIFF, orientation6") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_6.tiff"; - QTest::newRow("Mono TIFF, orientation7") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_7.tiff"; - QTest::newRow("Mono TIFF, orientation8") << "tiff_oriented/original_mono.tiff" << "tiff_oriented/mono_orientation_8.tiff"; - - QTest::newRow("RGB TIFF, orientation1") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_1.tiff"; - QTest::newRow("RGB TIFF, orientation2") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_2.tiff"; - QTest::newRow("RGB TIFF, orientation3") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_3.tiff"; - QTest::newRow("RGB TIFF, orientation4") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_4.tiff"; - QTest::newRow("RGB TIFF, orientation5") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_5.tiff"; - QTest::newRow("RGB TIFF, orientation6") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_6.tiff"; - QTest::newRow("RGB TIFF, orientation7") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_7.tiff"; - QTest::newRow("RGB TIFF, orientation8") << "tiff_oriented/original_rgb.tiff" << "tiff_oriented/rgb_orientation_8.tiff"; -} - -void tst_QImageReader::tiffOrientation() -{ - QFETCH(QString, expected); - QFETCH(QString, oriented); - - SKIP_IF_UNSUPPORTED("tiff"); - - QImage expectedImage(prefix + expected); - QImage orientedImage(prefix + oriented); - QCOMPARE(expectedImage, orientedImage); -} - -void tst_QImageReader::tiffGrayscale() -{ - SKIP_IF_UNSUPPORTED("tiff"); - - QImage actualImage(prefix + "grayscale.tif"); - QImage expectedImage(prefix + "grayscale-ref.tif"); - - QCOMPARE(expectedImage, actualImage.convertToFormat(expectedImage.format())); -} - -void tst_QImageReader::dotsPerMeter_data() -{ - QTest::addColumn<QString>("fileName"); - QTest::addColumn<int>("expectedDotsPerMeterX"); - QTest::addColumn<int>("expectedDotsPerMeterY"); - QTest::addColumn<QByteArray>("format"); - QTest::newRow("TIFF: 72 dpi") << ("rgba_nocompression_littleendian.tif") << qRound(72 * (100 / 2.54)) << qRound(72 * (100 / 2.54)) << QByteArray("tiff"); - QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54)) << QByteArray("tiff"); -} - -void tst_QImageReader::dotsPerMeter() -{ - QFETCH(QString, fileName); - QFETCH(int, expectedDotsPerMeterX); - QFETCH(int, expectedDotsPerMeterY); - QFETCH(QByteArray, format); - - SKIP_IF_UNSUPPORTED(format); - - QImage image(prefix + fileName); - - QCOMPARE(image.dotsPerMeterX(), expectedDotsPerMeterX); - QCOMPARE(image.dotsPerMeterY(), expectedDotsPerMeterY); -} - -void tst_QImageReader::physicalDpi_data() -{ - QTest::addColumn<QString>("fileName"); - QTest::addColumn<int>("expectedPhysicalDpiX"); - QTest::addColumn<int>("expectedPhysicalDpiY"); - QTest::addColumn<QByteArray>("format"); - QTest::newRow("TIFF: 72 dpi") << "rgba_nocompression_littleendian.tif" << 72 << 72 << QByteArray("tiff"); - QTest::newRow("TIFF: 100 dpi") << "image_100dpi.tif" << 100 << 100 << QByteArray("tiff"); -} - -void tst_QImageReader::physicalDpi() -{ - QFETCH(QString, fileName); - QFETCH(int, expectedPhysicalDpiX); - QFETCH(int, expectedPhysicalDpiY); - QFETCH(QByteArray, format); - - SKIP_IF_UNSUPPORTED(format); - - QImage image(prefix + fileName); - - QCOMPARE(image.physicalDpiX(), expectedPhysicalDpiX); - QCOMPARE(image.physicalDpiY(), expectedPhysicalDpiY); -} - void tst_QImageReader::autoDetectImageFormat() { // Assume PNG is supported :-) @@ -1860,10 +1663,6 @@ void tst_QImageReader::testIgnoresFormatAndExtension_data() QTest::newRow("beavis.jpg") << "beavis" << "jpg" << "jpeg"; - QTest::newRow("fire.mng") << "fire" << "mng" << "mng"; - - QTest::newRow("image_100dpi.tif") << "image_100dpi" << "tif" << "tiff"; - QTest::newRow("rect.svg") << "rect" << "svg" << "svg"; QTest::newRow("rect.svgz") << "rect" << "svgz" << "svgz"; } diff --git a/tests/auto/gui/image/qimagewriter/images/teapot.tiff b/tests/auto/gui/image/qimagewriter/images/teapot.tiff Binary files differdeleted file mode 100644 index 20845c6e32..0000000000 --- a/tests/auto/gui/image/qimagewriter/images/teapot.tiff +++ /dev/null diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index 10c950cf0a..b6c80b8d62 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -3,15 +3,7 @@ TARGET = tst_qimagewriter QT += widgets testlib SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp -!contains(QT_CONFIG, no-tiff):DEFINES += QTEST_HAVE_TIFF win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 -wince*: { - addFiles.files = images\\*.* - addFiles.path = images - DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\".\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} +TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 9acf210eeb..8473597dac 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -71,6 +71,7 @@ public: public slots: void init(); + void initTestCase(); void cleanup(); private slots: @@ -81,13 +82,6 @@ private slots: void writeImage2(); void supportedFormats(); - void readWriteNonDestructive_data(); - void readWriteNonDestructive(); - -#if defined QTEST_HAVE_TIFF - void largeTiff(); -#endif - void writeToInvalidDevice(); void supportsOption_data(); @@ -96,13 +90,16 @@ private slots: void saveWithNoFormat_data(); void saveWithNoFormat(); - void resolution_data(); - void resolution(); - void saveToTemporaryFile(); +private: + QString prefix; }; -static const QLatin1String prefix(SRCDIR "/images/"); +// helper to skip an autotest when the given image format is not supported +#define SKIP_IF_UNSUPPORTED(format) do { \ + if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ + QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ +} while (0) static void initializePadding(QImage *image) { @@ -115,6 +112,13 @@ static void initializePadding(QImage *image) } } +void tst_QImageWriter::initTestCase() +{ + prefix = QFINDTESTDATA("images/"); + if (prefix.isEmpty()) + QFAIL("Can't find images directory!"); +} + // Testing get/set functions void tst_QImageWriter::getSetCheck() { @@ -194,9 +198,6 @@ void tst_QImageWriter::writeImage_data() QTest::newRow("PBM: ship63") << QString("ship63.pbm") << true << QByteArray("pbm"); QTest::newRow("XBM: gnus") << QString("gnus.xbm") << false << QByteArray("xbm"); QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg"); -#if defined QTEST_HAVE_TIFF - QTest::newRow("TIFF: teapot") << QString("teapot.tiff") << false << QByteArray("tiff"); -#endif } void tst_QImageWriter::writeImage() @@ -205,6 +206,8 @@ void tst_QImageWriter::writeImage() QFETCH(bool, lossy); QFETCH(QByteArray, format); + SKIP_IF_UNSUPPORTED(format); + QImage image; { QImageReader reader(prefix + fileName); @@ -217,15 +220,22 @@ void tst_QImageWriter::writeImage() } { - // Shouldn't be able to write to read-only file - QFile sourceFile(prefix + "gen-" + fileName); - QFile::Permissions permissions = sourceFile.permissions(); - QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); + bool skip = false; +#if defined(Q_OS_UNIX) + if (::geteuid() == 0) + skip = true; +#endif + if (!skip) { + // Shouldn't be able to write to read-only file + QFile sourceFile(prefix + "gen-" + fileName); + QFile::Permissions permissions = sourceFile.permissions(); + QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); - QImageWriter writer(prefix + "gen-" + fileName, format); - QVERIFY(!writer.write(image)); + QImageWriter writer(prefix + "gen-" + fileName, format); + QVERIFY(!writer.write(image)); - QVERIFY(sourceFile.setPermissions(permissions)); + QVERIFY(sourceFile.setPermissions(permissions)); + } } QImage image2; @@ -268,41 +278,6 @@ void tst_QImageWriter::writeImage2_data() } } -#if defined QTEST_HAVE_TIFF -void tst_QImageWriter::largeTiff() -{ -#if !defined(Q_OS_WINCE) - QImage img(4096, 2048, QImage::Format_ARGB32); - - QPainter p(&img); - img.fill(0x0); - p.fillRect(0, 0, 4096, 2048, QBrush(Qt::CrossPattern)); - p.end(); - - QByteArray array; - QBuffer writeBuffer(&array); - writeBuffer.open(QIODevice::WriteOnly); - - QImageWriter writer(&writeBuffer, "tiff"); - QVERIFY(writer.write(img)); - - writeBuffer.close(); - - QBuffer readBuffer(&array); - readBuffer.open(QIODevice::ReadOnly); - - QImageReader reader(&readBuffer, "tiff"); - - QImage img2 = reader.read(); - QVERIFY(!img2.isNull()); - - QCOMPARE(img, img2); -#else - QWARN("not tested on WinCE"); -#endif -} -#endif - /* Workaround for the equality operator for indexed formats (which fails if the colortables are different). @@ -377,39 +352,6 @@ void tst_QImageWriter::supportedFormats() QCOMPARE(formatSet.size(), formats.size()); } -void tst_QImageWriter::readWriteNonDestructive_data() -{ - QTest::addColumn<QImage::Format>("format"); - QTest::addColumn<QImage::Format>("expectedFormat"); - QTest::addColumn<bool>("grayscale"); - QTest::newRow("tiff mono") << QImage::Format_Mono << QImage::Format_Mono << false; - QTest::newRow("tiff indexed") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << false; - QTest::newRow("tiff rgb32") << QImage::Format_ARGB32 << QImage::Format_ARGB32 << false; - QTest::newRow("tiff grayscale") << QImage::Format_Indexed8 << QImage::Format_Indexed8 << true; -} - -void tst_QImageWriter::readWriteNonDestructive() -{ - QFETCH(QImage::Format, format); - QFETCH(QImage::Format, expectedFormat); - QFETCH(bool, grayscale); - QImage image = QImage(prefix + "colorful.bmp").convertToFormat(format); - - if (grayscale) { - QVector<QRgb> colors; - for (int i = 0; i < 256; ++i) - colors << qRgb(i, i, i); - image.setColorTable(colors); - } - - QVERIFY(image.save(prefix + "gen-readWriteNonDestructive.tiff")); - - QImage image2 = QImage(prefix + "gen-readWriteNonDestructive.tiff"); - QImage::Format readFormat = image2.format(); - QCOMPARE(readFormat, expectedFormat); - QCOMPARE(image, image2); -} - void tst_QImageWriter::writeToInvalidDevice() { QLatin1String fileName("/these/directories/do/not/exist/001.png"); @@ -449,15 +391,12 @@ void tst_QImageWriter::supportsOption_data() << QImageIOHandler::Description << QImageIOHandler::Quality << QImageIOHandler::Size); -#if defined QTEST_HAVE_TIFF - QTest::newRow("tiff") << QString("gen-black.tiff") - << (QIntList() << QImageIOHandler::Size - << QImageIOHandler::CompressionRatio); -#endif } void tst_QImageWriter::supportsOption() { + SKIP_IF_UNSUPPORTED(QTest::currentDataTag()); + QFETCH(QString, fileName); QFETCH(QIntList, options); @@ -500,9 +439,6 @@ void tst_QImageWriter::saveWithNoFormat_data() QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); -#if defined QTEST_HAVE_TIFF - QTest::newRow("tiff") << prefix + QString("gen-out.tiff") << QByteArray("tiff") << QImageWriter::ImageWriterError(0); -#endif } void tst_QImageWriter::saveWithNoFormat() @@ -511,6 +447,8 @@ void tst_QImageWriter::saveWithNoFormat() QFETCH(QByteArray, format); QFETCH(QImageWriter::ImageWriterError, error); + SKIP_IF_UNSUPPORTED(format); + QImage niceImage(64, 64, QImage::Format_ARGB32); qMemSet(niceImage.bits(), 0, niceImage.byteCount()); @@ -532,39 +470,6 @@ void tst_QImageWriter::saveWithNoFormat() QVERIFY2(!outImage.isNull(), qPrintable(reader.errorString())); } -void tst_QImageWriter::resolution_data() -{ - QTest::addColumn<QString>("filename"); - QTest::addColumn<int>("expectedDotsPerMeterX"); - QTest::addColumn<int>("expectedDotsPerMeterY"); -#if defined QTEST_HAVE_TIFF - QTest::newRow("TIFF: 100 dpi") << ("image_100dpi.tif") << qRound(100 * (100 / 2.54)) << qRound(100 * (100 / 2.54)); - QTest::newRow("TIFF: 50 dpi") << ("image_50dpi.tif") << qRound(50 * (100 / 2.54)) << qRound(50 * (100 / 2.54)); - QTest::newRow("TIFF: 300 dot per meter") << ("image_300dpm.tif") << 300 << 300; -#endif -} - -void tst_QImageWriter::resolution() -{ - QFETCH(QString, filename); - QFETCH(int, expectedDotsPerMeterX); - QFETCH(int, expectedDotsPerMeterY); - - QImage image(prefix + QLatin1String("colorful.bmp")); - image.setDotsPerMeterX(expectedDotsPerMeterX); - image.setDotsPerMeterY(expectedDotsPerMeterY); - const QString generatedFilepath = prefix + "gen-" + filename; - { - QImageWriter writer(generatedFilepath); - QVERIFY(writer.write(image)); - } - QImageReader reader(generatedFilepath); - const QImage generatedImage = reader.read(); - - QCOMPARE(expectedDotsPerMeterX, generatedImage.dotsPerMeterX()); - QCOMPARE(expectedDotsPerMeterY, generatedImage.dotsPerMeterY()); -} - void tst_QImageWriter::saveToTemporaryFile() { QImage image(prefix + "kollada.png"); diff --git a/tests/auto/gui/image/qmovie/animations/dutch.mng b/tests/auto/gui/image/qmovie/animations/dutch.mng Binary files differdeleted file mode 100644 index 4917fdee7a..0000000000 --- a/tests/auto/gui/image/qmovie/animations/dutch.mng +++ /dev/null diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index 5da0b80670..b2891a482f 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -6,7 +6,6 @@ MOC_DIR=tmp !contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF !contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG -!contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG RESOURCES += resources.qrc TESTDATA += animations/* diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp index d0c5e91f57..1a66141ea1 100644 --- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp +++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -137,10 +137,6 @@ void tst_QMovie::playMovie_data() { QTest::addColumn<QString>("fileName"); QTest::addColumn<int>("frameCount"); -#if defined(QTEST_HAVE_MNG) && !defined(Q_OS_WINCE) - // Qt/WinCE runs out of memory for this one... - QTest::newRow("home") << QString("animations/dutch.mng") << 10; -#endif #ifdef QTEST_HAVE_GIF QTest::newRow("comicsecard") << QString("animations/comicsecard.gif") << 5; QTest::newRow("trolltech") << QString("animations/trolltech.gif") << 34; @@ -191,7 +187,7 @@ void tst_QMovie::jumpToFrame_data() void tst_QMovie::jumpToFrame() { QFETCH(QString, fileName); - QMovie movie(fileName); + QMovie movie(QFINDTESTDATA(fileName)); movie.start(); movie.stop(); QVERIFY(movie.jumpToFrame(-1) == false); diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp index d4dc254dcb..8c2db9bed7 100644 --- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp +++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro index fc09164c46..15098770c6 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -4,25 +4,9 @@ TARGET = tst_qpixmap QT += core-private gui-private widgets widgets-private testlib SOURCES += tst_qpixmap.cpp -wince* { - task31722_0.files = convertFromImage/task31722_0/*.png - task31722_0.path = convertFromImage/task31722_0 - - task31722_1.files = convertFromImage/task31722_1/*.png - task31722_1.path = convertFromImage/task31722_1 - - icons.files = convertFromToHICON/* - icons.path = convertFromToHICON - - loadFromData.files = loadFromData/* - loadFromData.path = loadFromData - - DEPLOYMENT += task31722_0 task31722_1 icons loadFromData - DEFINES += SRCDIR=\\\".\\\" - DEPLOYMENT_PLUGIN += qico -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" +!wince* { win32:LIBS += -lgdi32 -luser32 } RESOURCES += qpixmap.qrc +TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/* diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 7ae680dbdb..527dcce916 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -79,6 +79,7 @@ public: public slots: void init(); void cleanup(); + void cleanupTestCase(); private slots: void swap(); @@ -215,6 +216,11 @@ void tst_QPixmap::cleanup() { } +void tst_QPixmap::cleanupTestCase() +{ + QFile::remove(QLatin1String("temp_image.png")); +} + void tst_QPixmap::swap() { QPixmap p1( 16, 16 ), p2( 32, 32 ); @@ -300,7 +306,7 @@ void tst_QPixmap::convertFromImage_data() { QTest::addColumn<QImage>("img1"); QTest::addColumn<QImage>("img2"); - const QString prefix = QLatin1String(SRCDIR) + "/convertFromImage"; + const QString prefix = QFINDTESTDATA("convertFromImage"); { QImage img1; @@ -853,12 +859,14 @@ void tst_QPixmap::convertFromImageDetach() #if defined(Q_OS_WIN) +QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0); Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0); Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p); Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h); Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); +QT_END_NAMESPACE void tst_QPixmap::toWinHBITMAP_data() { @@ -994,7 +1002,7 @@ void tst_QPixmap::toWinHICON_data() QTest::addColumn<int>("width"); QTest::addColumn<int>("height"); - const QString prefix = QLatin1String(SRCDIR) + "/convertFromToHICON"; + const QString prefix = QFINDTESTDATA("convertFromToHICON"); QTest::newRow("32bpp_16x16") << prefix + QLatin1String("/icon_32bpp") << 16 << 16; QTest::newRow("32bpp_32x32") << prefix + QLatin1String("/icon_32bpp") << 32 << 32; @@ -1290,7 +1298,7 @@ void tst_QPixmap::loadFromDataImage_data() { QTest::addColumn<QString>("imagePath"); - const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; + const QString prefix = QFINDTESTDATA("loadFromData"); 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 @@ -1324,7 +1332,7 @@ void tst_QPixmap::fromImageReader_data() { QTest::addColumn<QString>("imagePath"); - const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; + const QString prefix = QFINDTESTDATA("loadFromData"); QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; @@ -1362,7 +1370,7 @@ void tst_QPixmap::fromImageReaderAnimatedGif() { QFETCH(QString, imagePath); - const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; + const QString prefix = QFINDTESTDATA("loadFromData"); const QString path = prefix + imagePath; QImageReader referenceReader(path); diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp index c79e42f908..0127e2cc83 100644 --- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp index 91ba2332d1..c9b2e054da 100644 --- a/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp +++ b/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp index 158ccc5770..f203cfec0f 100644 --- a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp +++ b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ |