summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/image
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/image')
-rw-r--r--tests/auto/gui/image/qicoimageformat/qicoimageformat.pro1
-rw-r--r--tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp50
-rw-r--r--tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cachebin0 -> 280 bytes
-rw-r--r--tests/auto/gui/image/qicon/qicon.pro1
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp64
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.qrc1
-rw-r--r--tests/auto/gui/image/qimage/qimage.pro1
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp92
-rw-r--r--tests/auto/gui/image/qimageiohandler/qimageiohandler.pro1
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp8
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp21
-rw-r--r--tests/auto/gui/image/qmovie/qmovie.pro1
-rw-r--r--tests/auto/gui/image/qpicture/qpicture.pro1
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp29
-rw-r--r--tests/auto/gui/image/qpixmapcache/qpixmapcache.pro1
-rw-r--r--tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp12
16 files changed, 167 insertions, 117 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..c940498935 100644
--- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp
+++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp
@@ -38,17 +38,8 @@ class tst_QIcoImageFormat : public QObject
{
Q_OBJECT
-public:
- tst_QIcoImageFormat();
- virtual ~tst_QIcoImageFormat();
-
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
private slots:
+ void initTestCase();
void format();
void canRead_data();
void canRead();
@@ -69,26 +60,6 @@ private:
QString m_IconPath;
};
-
-tst_QIcoImageFormat::tst_QIcoImageFormat()
-{
-}
-
-tst_QIcoImageFormat::~tst_QIcoImageFormat()
-{
-
-}
-
-void tst_QIcoImageFormat::init()
-{
-
-}
-
-void tst_QIcoImageFormat::cleanup()
-{
-
-}
-
void tst_QIcoImageFormat::initTestCase()
{
m_IconPath = QFINDTESTDATA("icons");
@@ -96,11 +67,6 @@ void tst_QIcoImageFormat::initTestCase()
QFAIL("Cannot find icons directory containing testdata!");
}
-void tst_QIcoImageFormat::cleanupTestCase()
-{
-
-}
-
void tst_QIcoImageFormat::format()
{
{
@@ -141,7 +107,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 +141,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 +178,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 +206,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 +229,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 +257,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 +286,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
new file mode 100644
index 0000000000..a323875989
--- /dev/null
+++ b/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache
Binary files differ
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 7333dd739f..329c3ae66d 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -64,6 +64,7 @@ private slots:
void streamAvailableSizes_data();
void streamAvailableSizes();
void fromTheme();
+ void fromThemeCache();
#ifndef QT_NO_WIDGETS
void task184901_badCache();
@@ -648,6 +649,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 23ddfbdd58..1c3e3ade39 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -112,6 +112,7 @@ private slots:
void smoothScale2_data();
void smoothScale2();
void smoothScale3();
+ void smoothScale4();
void smoothScaleBig();
void smoothScaleAlpha();
@@ -972,13 +973,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];
}
}
}
@@ -1075,34 +1080,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;
}
}
@@ -1626,9 +1631,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];
}
}
}
@@ -1671,6 +1678,30 @@ void tst_QImage::smoothScale2()
QCOMPARE(qBlue(pixel), qBlue(expected));
}
+ // scale x up
+ scaled = img.scaled(QSize(size, size * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ for (int y = 0; y < scaled.height(); ++y) {
+ for (int x = 0; x < scaled.width(); ++x) {
+ pixel = scaled.pixel(x, y);
+ QCOMPARE(qAlpha(pixel), qAlpha(expected));
+ QCOMPARE(qRed(pixel), qRed(expected));
+ QCOMPARE(qGreen(pixel), qGreen(expected));
+ QCOMPARE(qBlue(pixel), qBlue(expected));
+ }
+ }
+
+ // scale y up
+ scaled = img.scaled(QSize(size * 2, size), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ for (int y = 0; y < scaled.height(); ++y) {
+ for (int x = 0; x < scaled.width(); ++x) {
+ pixel = scaled.pixel(x, y);
+ QCOMPARE(qAlpha(pixel), qAlpha(expected));
+ QCOMPARE(qRed(pixel), qRed(expected));
+ QCOMPARE(qGreen(pixel), qGreen(expected));
+ QCOMPARE(qBlue(pixel), qBlue(expected));
+ }
+ }
+
// scale x up, y up
scaled = img.scaled(QSize(size * 2, size * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
for (int y = 0; y < scaled.height(); ++y) {
@@ -1736,6 +1767,26 @@ void tst_QImage::smoothScale3()
}
}
+// Tests smooth upscale is smooth
+void tst_QImage::smoothScale4()
+{
+ QImage img(4, 4, QImage::Format_RGB32);
+ for (int y = 0; y < 4; ++y) {
+ for (int x = 0; x < 4; ++x) {
+ img.setPixel(x, y, qRgb(x * 255 / 3, y * 255 / 3, 0));
+ }
+ }
+ QImage scaled = img.scaled(37, 23, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ for (int y = 0; y < scaled.height(); ++y) {
+ for (int x = 0; x < scaled.width(); ++x) {
+ if (x > 0)
+ QVERIFY(qRed(scaled.pixel(x, y)) >= qRed(scaled.pixel(x - 1, y)));
+ if (y > 0)
+ QVERIFY(qGreen(scaled.pixel(x, y)) >= qGreen(scaled.pixel(x, y - 1)));
+ }
+ }
+}
+
void tst_QImage::smoothScaleBig()
{
#if defined(Q_OS_WINCE)
@@ -2600,10 +2651,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 86dd8c4daf..68b92e1851 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -174,7 +174,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
@@ -802,7 +802,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();
}
@@ -1653,14 +1653,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 1dd4d69ea8..c6a4d9107f 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -61,13 +61,10 @@ class tst_QImageWriter : public QObject
Q_OBJECT
public:
- tst_QImageWriter();
virtual ~tst_QImageWriter();
public slots:
- void init();
void initTestCase();
- void cleanup();
private slots:
void getSetCheck();
@@ -97,7 +94,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)
@@ -163,10 +160,6 @@ void tst_QImageWriter::getSetCheck()
QCOMPARE(1.1f, obj1.gamma());
}
-tst_QImageWriter::tst_QImageWriter()
-{
-}
-
tst_QImageWriter::~tst_QImageWriter()
{
QDir dir(prefix);
@@ -177,14 +170,6 @@ tst_QImageWriter::~tst_QImageWriter()
}
-void tst_QImageWriter::init()
-{
-}
-
-void tst_QImageWriter::cleanup()
-{
-}
-
void tst_QImageWriter::writeImage_data()
{
QTest::addColumn<QString>("fileName");
@@ -269,8 +254,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..9a8761d076 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -64,12 +64,8 @@ class tst_QPixmap : public QObject
public:
tst_QPixmap();
- virtual ~tst_QPixmap();
-
public slots:
- void init();
- void cleanup();
void initTestCase();
void cleanupTestCase();
@@ -212,18 +208,6 @@ tst_QPixmap::tst_QPixmap()
{
}
-tst_QPixmap::~tst_QPixmap()
-{
-}
-
-void tst_QPixmap::init()
-{
-}
-
-void tst_QPixmap::cleanup()
-{
-}
-
void tst_QPixmap::initTestCase()
{
QVERIFY(!m_prefix.isEmpty());
@@ -445,7 +429,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 +443,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 +985,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 +1023,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());
}
}