diff options
Diffstat (limited to 'tests/auto/gui/image')
-rw-r--r-- | tests/auto/gui/image/qicoimageformat/qicoimageformat.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp | 14 | ||||
-rw-r--r-- | tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache | bin | 0 -> 280 bytes | |||
-rw-r--r-- | tests/auto/gui/image/qicon/qicon.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qicon/tst_qicon.cpp | 64 | ||||
-rw-r--r-- | tests/auto/gui/image/qicon/tst_qicon.qrc | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qimage/qimage.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 47 | ||||
-rw-r--r-- | tests/auto/gui/image/qimageiohandler/qimageiohandler.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 8 | ||||
-rw-r--r-- | tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp | 6 | ||||
-rw-r--r-- | tests/auto/gui/image/qmovie/qmovie.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qpicture/qpicture.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 13 | ||||
-rw-r--r-- | tests/auto/gui/image/qpixmapcache/qpixmapcache.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp | 12 |
16 files changed, 121 insertions, 51 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index 7ed69ce1d1..485472c70c 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qicoimageformat SOURCES+= tst_qicoimageformat.cpp QT += testlib diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index bff762fd04..ffe3dcfb75 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -141,7 +141,7 @@ void tst_QIcoImageFormat::canRead() QFETCH(QString, fileName); QFETCH(int, isValid); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.canRead(), (isValid == 0 ? false : true)); } @@ -175,7 +175,7 @@ void tst_QIcoImageFormat::SequentialFile() QFETCH(QString, fileName); QFETCH(int, isValid); - QSequentialFile *file = new QSequentialFile(m_IconPath + "/" + fileName); + QSequentialFile *file = new QSequentialFile(m_IconPath + QLatin1Char('/') + fileName); QVERIFY(file); QVERIFY(file->open(QFile::ReadOnly)); QImageReader reader(file); @@ -212,7 +212,7 @@ void tst_QIcoImageFormat::imageCount() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.imageCount(), count); } @@ -240,7 +240,7 @@ void tst_QIcoImageFormat::jumpToNextImage() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); bool bJumped = reader.jumpToImage(0); while (bJumped) { count--; @@ -263,7 +263,7 @@ void tst_QIcoImageFormat::loopCount() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.loopCount(), count); } @@ -291,7 +291,7 @@ void tst_QIcoImageFormat::nextImageDelay() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); if (count == -1) { QCOMPARE(reader.nextImageDelay(), 0); } else { @@ -320,7 +320,7 @@ void tst_QIcoImageFormat::pngCompression() QFETCH(int, width); QFETCH(int, height); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QImage image; reader.jumpToImage(index); diff --git a/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache b/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache Binary files differnew file mode 100644 index 0000000000..a323875989 --- /dev/null +++ b/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache diff --git a/tests/auto/gui/image/qicon/qicon.pro b/tests/auto/gui/image/qicon/qicon.pro index 6ff20ec8fa..f5570c2497 100644 --- a/tests/auto/gui/image/qicon/qicon.pro +++ b/tests/auto/gui/image/qicon/qicon.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qicon QT += testlib diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 9ed3873682..afa72f6922 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -63,6 +63,7 @@ private slots: void streamAvailableSizes_data(); void streamAvailableSizes(); void fromTheme(); + void fromThemeCache(); #ifndef QT_NO_WIDGETS void task184901_badCache(); @@ -633,6 +634,69 @@ void tst_QIcon::fromTheme() QVERIFY(abIcon.isNull()); } +void tst_QIcon::fromThemeCache() +{ + QTemporaryDir dir; + QVERIFY(QDir().mkpath(dir.path() + QLatin1String("/testcache/16x16/actions"))); + QVERIFY(QFile(QStringLiteral(":/styles/commonstyle/images/standardbutton-open-16.png")) + .copy( dir.path() + QLatin1String("/testcache/16x16/actions/button-open.png"))); + + { + QFile index(dir.path() + QLatin1String("/testcache/index.theme")); + QVERIFY(index.open(QFile::WriteOnly)); + index.write("[Icon Theme]\nDirectories=16x16/actions\n[16x16/actions]\nSize=16\nContext=Actions\nType=Fixed\n"); + } + QIcon::setThemeSearchPaths(QStringList() << dir.path()); + QIcon::setThemeName("testcache"); + + // We just created a theme with that icon, it must exist + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + + QString cacheName = dir.path() + QLatin1String("/testcache/icon-theme.cache"); + + // An invalid cache should not prevent lookup + { + QFile cacheFile(cacheName); + QVERIFY(cacheFile.open(QFile::WriteOnly)); + QDataStream(&cacheFile) << quint16(1) << quint16(0) << "invalid corrupted stuff in there\n"; + } + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + + // An empty cache should prevent the lookup + { + QFile cacheFile(cacheName); + QVERIFY(cacheFile.open(QFile::WriteOnly)); + QDataStream ds(&cacheFile); + ds << quint16(1) << quint16(0); // 0: version + ds << quint32(12) << quint32(20); // 4: hash offset / dir list offset + ds << quint32(1) << quint32(0xffffffff); // 12: one empty bucket + ds << quint32(1) << quint32(28); // 20: list with one element + ds.writeRawData("16x16/actions", sizeof("16x16/actions")); // 28 + } + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(QIcon::fromTheme("button-open").isNull()); // The icon was not in the cache, it should not be found + + // Adding an icon should be changing the modification date of one sub directory which should make the cache ignored + QTest::qWait(1000); // wait enough to have a different modification time in seconds + QVERIFY(QFile(QStringLiteral(":/styles/commonstyle/images/standardbutton-save-16.png")) + .copy(dir.path() + QLatin1String("/testcache/16x16/actions/button-save.png"))); + QVERIFY(QFileInfo(cacheName).lastModified() < QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified()); + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + + // Try to run the actual gtk-update-icon-cache and make sure that icons are still found + QProcess process; + process.start(QStringLiteral("gtk-update-icon-cache"), + QStringList() << QStringLiteral("-f") << QStringLiteral("-t") << (dir.path() + QLatin1String("/testcache"))); + if (!process.waitForFinished()) + QSKIP("gtk-update-icon-cache not run"); + QVERIFY(QFileInfo(cacheName).lastModified() >= QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified()); + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + QVERIFY(!QIcon::fromTheme("button-open-fallback").isNull()); + QVERIFY(QIcon::fromTheme("notexist-fallback").isNull()); +} void tst_QIcon::task223279_inconsistentAddFile() { diff --git a/tests/auto/gui/image/qicon/tst_qicon.qrc b/tests/auto/gui/image/qicon/tst_qicon.qrc index 1505ca925b..3c8fbba7c2 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.qrc +++ b/tests/auto/gui/image/qicon/tst_qicon.qrc @@ -15,6 +15,7 @@ <file>./icons/themeparent/32x32/actions/address-book-new.png</file> <file>./icons/themeparent/32x32/actions/appointment-new.png</file> <file>./icons/themeparent/index.theme</file> +<file>./icons/themeparent/icon-theme.cache</file> <file>./icons/themeparent/scalable/actions/address-book-new.svg</file> <file>./icons/themeparent/scalable/actions/appointment-new.svg</file> <file>./styles/commonstyle/images/standardbutton-open-16.png</file> diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 42280d3bd4..d32e84c0d7 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qimage SOURCES += tst_qimage.cpp diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 08f48abd20..e15e66b0a7 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -970,13 +970,17 @@ void tst_QImage::createAlphaMask_data() int alphas[] = { 0, 127, 255 }; for (unsigned a1 = 0; a1 < sizeof(alphas) / sizeof(int); ++a1) { + const QByteArray a1B = QByteArray::number(alphas[a1]); for (unsigned a2 = 0; a2 < sizeof(alphas) / sizeof(int); ++a2) { if (a1 == a2) continue; + const QByteArray a2B = QByteArray::number(alphas[a2]); for (int x=10; x<18; x+=3) { + const QByteArray xB = QByteArray::number(x); for (int y=100; y<108; y+=3) { - QTest::newRow(qPrintable(QString::fromLatin1("x=%1, y=%2, a1=%3, a2=%4").arg(x).arg(y).arg(alphas[a1]).arg(alphas[a2]))) - << x << y << alphas[a1] << alphas[a2]; + const QByteArray testName = "x=" + xB + ", y=" + QByteArray::number(y) + + ", a1=" + a1B + ", a2=" + a2B; + QTest::newRow(testName.constData()) << x << y << alphas[a1] << alphas[a2]; } } } @@ -1073,34 +1077,34 @@ void tst_QImage::rotate_data() degrees << 0 << 90 << 180 << 270; foreach (int d, degrees) { - QString title = QString("%1 %2").arg(d); - QTest::newRow(qPrintable(title.arg("Format_RGB32"))) + const QByteArray dB = QByteArray::number(d); + QTest::newRow((dB + " Format_RGB32").constData()) << QImage::Format_RGB32 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB32"))) + QTest::newRow((dB + " Format_ARGB32").constData()) << QImage::Format_ARGB32 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB32_Premultiplied"))) + QTest::newRow((dB + " Format_ARGB32_Premultiplied").constData()) << QImage::Format_ARGB32_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_RGB16"))) + QTest::newRow((dB + " Format_RGB16").constData()) << QImage::Format_RGB16 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB8565_Premultiplied"))) + QTest::newRow((dB + " Format_ARGB8565_Premultiplied").constData()) << QImage::Format_ARGB8565_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_RGB666"))) + QTest::newRow((dB + " Format_RGB666").constData()) << QImage::Format_RGB666 << d; - QTest::newRow(qPrintable(title.arg("Format_RGB555"))) + QTest::newRow((dB + " Format_RGB555").constData()) << QImage::Format_RGB555 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB8555_Premultiplied"))) + QTest::newRow((dB + " Format_ARGB8555_Premultiplied").constData()) << QImage::Format_ARGB8555_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_RGB888"))) + QTest::newRow((dB + " Format_RGB888").constData()) << QImage::Format_RGB888 << d; - QTest::newRow(qPrintable(title.arg("Format_Indexed8"))) + QTest::newRow((dB + " Format_Indexed8").constData()) << QImage::Format_Indexed8 << d; - QTest::newRow(qPrintable(title.arg("Format_RGBX8888"))) + QTest::newRow((dB + " Format_RGBX8888").constData()) << QImage::Format_RGBX8888 << d; - QTest::newRow(qPrintable(title.arg("Format_RGBA8888_Premultiplied"))) + QTest::newRow((dB + " Format_RGBA8888_Premultiplied").constData()) << QImage::Format_RGBA8888_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_Alpha8"))) + QTest::newRow((dB + " Format_Alpha8").constData()) << QImage::Format_Alpha8 << d; - QTest::newRow(qPrintable(title.arg("Format_Grayscale8"))) + QTest::newRow((dB + " Format_Grayscale8").constData()) << QImage::Format_Grayscale8 << d; } } @@ -1624,9 +1628,11 @@ void tst_QImage::smoothScale2_data() int sizes[] = { 2, 3, 4, 6, 7, 8, 10, 16, 20, 32, 40, 64, 100, 101, 128, 0 }; QImage::Format formats[] = { QImage::Format_RGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_Invalid }; for (int j = 0; formats[j] != QImage::Format_Invalid; ++j) { - QString formatstr = formats[j] == QImage::Format_RGB32 ? QStringLiteral("rgb32") : QStringLiteral("argb32pm"); + QByteArray formatstr = formats[j] == QImage::Format_RGB32 ? QByteArrayLiteral("rgb32") : QByteArrayLiteral("argb32pm"); for (int i = 0; sizes[i] != 0; ++i) { - QTest::newRow(QString("%1 %2x%2").arg(formatstr).arg(sizes[i]).toUtf8()) << (int)formats[j] << sizes[i]; + const QByteArray sizeB = QByteArray::number(sizes[i]); + QTest::newRow((formatstr + ' ' + sizeB + 'x' + sizeB).constData()) + << (int)formats[j] << sizes[i]; } } } @@ -2598,10 +2604,11 @@ void tst_QImage::genericRgbConversion_data() QTest::addColumn<QImage::Format>("dest_format"); for (int i = QImage::Format_RGB32; i < QImage::Format_Alpha8; ++i) { + const QString formatI = formatToString(QImage::Format(i)); for (int j = QImage::Format_RGB32; j < QImage::Format_Alpha8; ++j) { if (i == j) continue; - QString test = QString::fromLatin1("%1 -> %2").arg(formatToString(QImage::Format(i))).arg(formatToString(QImage::Format(j))); + const QString test = formatI + QLatin1String(" -> ") + formatToString(QImage::Format(j)); QTest::newRow(qPrintable(test)) << QImage::Format(i) << QImage::Format(j); } } diff --git a/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro b/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro index bbcf8d23c9..428ff62959 100644 --- a/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro +++ b/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qimageiohandler QT += testlib diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 16fe959b11..2eb9b4fc2d 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -158,7 +158,7 @@ private: // 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"); \ + QSKIP('"' + QByteArray(format) + "\" images are not supported"); \ } while (0) // Testing get/set functions @@ -785,7 +785,7 @@ void tst_QImageReader::animatedGif() QVERIFY(!image.isNull()); int i = 0; while(!image.isNull()){ - QString frameName = QString(":images/qt%1.gif").arg(++i); + QString frameName = QLatin1String(":images/qt") + QString::number(++i) + QLatin1String(".gif"); QCOMPARE(image, QImage(frameName)); image = io.read(); } @@ -1637,14 +1637,14 @@ void tst_QImageReader::pixelCompareWithBaseline() // least one file succeeded we know that the plugin was built. // The other failures are then real failures. QImage icoImg; - const QString inputFileName(QString::fromLatin1("images/%1").arg(fileName)); + const QString inputFileName(QLatin1String("images/") + fileName); QFileInfo fi(inputFileName); ++enteredCount; // might fail if the plugin does not exist, which is ok. if (icoImg.load(inputFileName)) { icoImg = icoImg.convertToFormat(QImage::Format_ARGB32_Premultiplied); - const QString baselineFileName(QString::fromLatin1("baseline/%1.png").arg(fi.baseName())); + const QString baselineFileName(QLatin1String("baseline/") + fi.baseName() + QLatin1String(".png")); #if 0 icoImg.save(baselineFileName); #else diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 06c775dded..6c22c47f0e 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -96,7 +96,7 @@ private: // 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"); \ + QSKIP('"' + QByteArray(format) + "\" images are not supported"); \ } while (0) static void initializePadding(QImage *image) @@ -271,8 +271,8 @@ void tst_QImageWriter::writeImage2_data() QImage image = image0.convertToFormat(imgFormat); initializePadding(&image); foreach (const QString format, formats) { - const QString fileName = QString("solidcolor_%1.%2").arg(imgFormat) - .arg(format); + const QString fileName = QLatin1String("solidcolor_") + + QString::number(imgFormat) + QLatin1Char('.') + format; QTest::newRow(fileName.toLatin1()) << fileName << format.toLatin1() << image; diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index 4e7030b1f7..a04ad73b80 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmovie QT += testlib qtHaveModule(widgets): QT += widgets diff --git a/tests/auto/gui/image/qpicture/qpicture.pro b/tests/auto/gui/image/qpicture/qpicture.pro index a24b8ec481..0fc851ce11 100644 --- a/tests/auto/gui/image/qpicture/qpicture.pro +++ b/tests/auto/gui/image/qpicture/qpicture.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpicture QT += testlib qtHaveModule(widgets): QT += widgets diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 67d7e57fd4..b4252031e6 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -445,7 +445,8 @@ void tst_QPixmap::scroll() else QVERIFY(pixmap.cacheKey() != oldKey); - QString fileName = QString(":/images/%1.png").arg(QTest::currentDataTag()); + const QString fileName = QLatin1String(":/images/") + QLatin1String(QTest::currentDataTag()) + + QLatin1String(".png"); QPixmap output(fileName); QCOMPARE(input.isNull(), output.isNull()); QVERIFY(lenientCompare(pixmap, output)); @@ -458,7 +459,7 @@ void tst_QPixmap::fill_data() QTest::addColumn<bool>("syscolor"); QTest::addColumn<bool>("bitmap"); for (int color = Qt::black; color < Qt::darkYellow; ++color) - QTest::newRow(QString("syscolor_%1").arg(color).toLatin1()) + QTest::newRow(("syscolor_" + QByteArray::number(color)).constData()) << uint(color) << true << false; #if defined (Q_OS_WINCE) @@ -1000,7 +1001,9 @@ void tst_QPixmap::toWinHICON() HBITMAP bitmap = qt_pixmapToWinHBITMAP(empty, Alpha); SelectObject(bitmap_dc, bitmap); - QImage imageFromFile(image + QString(QLatin1String("_%1x%2.png")).arg(width).arg(height)); + const QString fileName = image + QLatin1Char('_') + QString::number(width) + QLatin1Char('x') + + QString::number(height) + QLatin1String(".png"); + QImage imageFromFile(fileName); imageFromFile = imageFromFile.convertToFormat(QImage::Format_ARGB32_Premultiplied); HICON icon = qt_pixmapToWinHICON(QPixmap::fromImage(imageFromFile)); @@ -1036,7 +1039,9 @@ void tst_QPixmap::fromWinHICON() QImage imageFromHICON = qt_pixmapFromWinHICON(icon).toImage(); DestroyIcon(icon); - QImage imageFromFile(image + QString(QLatin1String("_%1x%2.png")).arg(width).arg(height)); + const QString fileName = image + QLatin1Char('_') + QString::number(width) + QLatin1Char('x') + + QString::number(height) + QLatin1String(".png"); + QImage imageFromFile(fileName); imageFromFile = imageFromFile.convertToFormat(QImage::Format_ARGB32_Premultiplied); // fuzzy comparison must be used, as the pixel values change slightly during conversion diff --git a/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro b/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro index a81712ba23..fe3b5a2db3 100644 --- a/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro +++ b/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpixmapcache QT += gui-private testlib SOURCES += tst_qpixmapcache.cpp diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp index a3cf66da18..d1f76e8742 100644 --- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -147,7 +147,7 @@ void tst_QPixmapCache::setCacheLimit() QVERIFY(QPixmapCache::find(key, p1) == 0); QPixmapCache::setCacheLimit(1000); key = QPixmapCache::insert(*p1); - QCOMPARE(getPrivate(key)->isValid, true); + QVERIFY(key.isValid()); QCOMPARE(getPrivate(key)->key, 1); delete p1; @@ -189,7 +189,7 @@ void tst_QPixmapCache::setCacheLimit() key2 = QPixmapCache::insert(*p1); QCOMPARE(getPrivate(key2)->key, 1); //This old key is not valid anymore after the flush - QCOMPARE(getPrivate(key)->isValid, false); + QVERIFY(!key.isValid()); QVERIFY(QPixmapCache::find(key, &p2) == 0); delete p1; } @@ -233,7 +233,7 @@ void tst_QPixmapCache::find() //at that time the first key has been erase because no more place in the cache QVERIFY(QPixmapCache::find(key, &p1) == 0); - QCOMPARE(getPrivate(key)->isValid, false); + QVERIFY(!key.isValid()); } void tst_QPixmapCache::insert() @@ -313,7 +313,7 @@ void tst_QPixmapCache::replace() p2.fill(Qt::yellow); QPixmapCache::Key key = QPixmapCache::insert(p1); - QCOMPARE(getPrivate(key)->isValid, true); + QVERIFY(key.isValid()); QPixmap p3; QVERIFY(QPixmapCache::find(key, &p3) == 1); @@ -321,7 +321,7 @@ void tst_QPixmapCache::replace() QPixmapCache::replace(key, p2); QVERIFY(QPixmapCache::find(key, &p3) == 1); - QCOMPARE(getPrivate(key)->isValid, true); + QVERIFY(key.isValid()); QCOMPARE(getPrivate(key)->key, 1); QCOMPARE(p3.width(), 10); @@ -438,7 +438,7 @@ void tst_QPixmapCache::clear() for (int k = 0; k < numberOfKeys; ++k) { QVERIFY(QPixmapCache::find(keys.at(k), &p1) == 0); - QCOMPARE(getPrivate(keys[k])->isValid, false); + QVERIFY(!keys[k].isValid()); } } |