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/tst_qicoimageformat.cpp5
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp31
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp28
-rw-r--r--tests/auto/gui/image/qimagereader/images/longcomment.pgm12
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp42
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp18
-rw-r--r--tests/auto/gui/image/qmovie/tst_qmovie.cpp6
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp24
-rw-r--r--tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp10
9 files changed, 117 insertions, 59 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp
index d2fae0e5e3..bff762fd04 100644
--- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp
+++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp
@@ -324,6 +324,11 @@ void tst_QIcoImageFormat::pngCompression()
QImage image;
reader.jumpToImage(index);
+
+ QSize size = reader.size();
+ QCOMPARE(size.width(), width);
+ QCOMPARE(size.height(), height);
+
reader.read(&image);
QCOMPARE(image.width(), width);
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index 20a08e10a2..7333dd739f 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -53,6 +53,7 @@ private slots:
void actualSize2_data(); // test with 2 pixmaps with different aspect ratio
void actualSize2();
void isNull();
+ void isMask();
void swap();
void bestMatch();
void cacheKey();
@@ -75,14 +76,8 @@ private:
const QString m_pngImageFileName;
const QString m_pngRectFileName;
const QString m_sourceFileName;
-
- const static QIcon staticIcon;
};
-// Creating an icon statically should not cause a crash.
-// But we do not officially support this. See QTBUG-8666
-const QIcon tst_QIcon::staticIcon = QIcon::fromTheme("edit-find");
-
bool tst_QIcon::haveImageFormat(QByteArray const& desiredFormat)
{
return QImageReader::supportedImageFormats().contains(desiredFormat);
@@ -224,6 +219,20 @@ void tst_QIcon::isNull() {
QVERIFY(iconSupportedFormat.actualSize(QSize(32, 32)).isValid());
}
+void tst_QIcon::isMask()
+{
+ QIcon icon;
+ icon.setIsMask(true);
+ icon.addPixmap(QPixmap());
+ QVERIFY(icon.isMask());
+
+ QIcon icon2;
+ icon2.setIsMask(true);
+ QVERIFY(icon2.isMask());
+ icon2.setIsMask(false);
+ QVERIFY(!icon2.isMask());
+}
+
void tst_QIcon::swap()
{
QPixmap p1(1, 1), p2(2, 2);
@@ -354,10 +363,10 @@ void tst_QIcon::cacheKey()
qint64 icon1_key = icon1.cacheKey();
QIcon icon2 = icon1;
- QVERIFY(icon2.cacheKey() == icon1.cacheKey());
+ QCOMPARE(icon2.cacheKey(), icon1.cacheKey());
icon2.detach();
QVERIFY(icon2.cacheKey() != icon1.cacheKey());
- QVERIFY(icon1.cacheKey() == icon1_key);
+ QCOMPARE(icon1.cacheKey(), icon1_key);
}
void tst_QIcon::detach()
@@ -374,7 +383,7 @@ void tst_QIcon::detach()
img1 = icon1.pixmap(32, 32).toImage();
img2 = icon2.pixmap(32, 32).toImage();
- QVERIFY(img1 == img2);
+ QCOMPARE(img1, img2);
}
void tst_QIcon::addFile()
@@ -562,7 +571,7 @@ void tst_QIcon::fromTheme()
QString firstSearchPath = QLatin1String(":/icons");
QString secondSearchPath = QLatin1String(":/second_icons");
QIcon::setThemeSearchPaths(QStringList() << firstSearchPath << secondSearchPath);
- QVERIFY(QIcon::themeSearchPaths().size() == 2);
+ QCOMPARE(QIcon::themeSearchPaths().size(), 2);
QCOMPARE(firstSearchPath, QIcon::themeSearchPaths()[0]);
QCOMPARE(secondSearchPath, QIcon::themeSearchPaths()[1]);
@@ -599,7 +608,7 @@ void tst_QIcon::fromTheme()
// Test non existing icon with fallback
noIcon = QIcon::fromTheme("broken-icon", abIcon);
- QVERIFY(noIcon.cacheKey() == abIcon.cacheKey());
+ QCOMPARE(noIcon.cacheKey(), abIcon.cacheKey());
// Test svg-only icon
noIcon = QIcon::fromTheme("svg-icon", abIcon);
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 939226e2b0..23ddfbdd58 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -196,6 +196,8 @@ private slots:
void metadataPassthrough();
+ void pixelColor();
+
private:
const QString m_prefix;
};
@@ -478,7 +480,7 @@ void tst_QImage::setAlphaChannel()
image.setAlphaChannel(alphaChannel);
image = image.convertToFormat(QImage::Format_ARGB32);
- QVERIFY(image.format() == QImage::Format_ARGB32);
+ QCOMPARE(image.format(), QImage::Format_ARGB32);
// alpha of 0 becomes black at a=0 due to premultiplication
QRgb pixel = alpha == 0 ? 0 : qRgba(red, green, blue, alpha);
@@ -1565,12 +1567,12 @@ void tst_QImage::createHeuristicMask()
// line 2
QVERIFY(newMask.pixel(0,1) != newMask.pixel(1,1));
- QVERIFY(newMask.pixel(1,1) == newMask.pixel(2,1));
+ QCOMPARE(newMask.pixel(1,1), newMask.pixel(2,1));
QVERIFY(newMask.pixel(2,1) != newMask.pixel(3,1));
// line 3
QVERIFY(newMask.pixel(0,2) != newMask.pixel(1,2));
- QVERIFY(newMask.pixel(1,2) == newMask.pixel(2,2));
+ QCOMPARE(newMask.pixel(1,2), newMask.pixel(2,2));
QVERIFY(newMask.pixel(2,2) != newMask.pixel(3,2));
}
#endif
@@ -1581,10 +1583,10 @@ void tst_QImage::cacheKey()
qint64 image1_key = image1.cacheKey();
QImage image2 = image1;
- QVERIFY(image2.cacheKey() == image1.cacheKey());
+ QCOMPARE(image2.cacheKey(), image1.cacheKey());
image2.detach();
QVERIFY(image2.cacheKey() != image1.cacheKey());
- QVERIFY(image1.cacheKey() == image1_key);
+ QCOMPARE(image1.cacheKey(), image1_key);
}
void tst_QImage::smoothScale()
@@ -3020,5 +3022,21 @@ void tst_QImage::metadataPassthrough()
QCOMPARE(swapped.devicePixelRatio(), a.devicePixelRatio());
}
+void tst_QImage::pixelColor()
+{
+ QImage argb32(1, 1, QImage::Format_ARGB32);
+ QImage argb32pm(1, 1, QImage::Format_ARGB32_Premultiplied);
+
+ QColor c(Qt::red);
+ c.setAlpha(128);
+ argb32.setPixelColor(QPoint(0, 0), c);
+ argb32pm.setPixelColor(QPoint(0, 0), c);
+ QCOMPARE(argb32.pixelColor(QPoint(0, 0)), c);
+ QCOMPARE(argb32pm.pixelColor(QPoint(0, 0)), c);
+
+ QImage t = argb32.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0));
+}
+
QTEST_GUILESS_MAIN(tst_QImage)
#include "tst_qimage.moc"
diff --git a/tests/auto/gui/image/qimagereader/images/longcomment.pgm b/tests/auto/gui/image/qimagereader/images/longcomment.pgm
new file mode 100644
index 0000000000..a5624b6c73
--- /dev/null
+++ b/tests/auto/gui/image/qimagereader/images/longcomment.pgm
@@ -0,0 +1,12 @@
+P2
+# A short comment
+# A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment A very long comment
+24 7
+15
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0
+0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0
+0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0
+0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0
+0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 4b3e2606fd..86dd8c4daf 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -36,7 +36,6 @@
#include <QBuffer>
#include <QDebug>
-#include <QFile>
#include <QImage>
#include <QImageReader>
#include <QImageWriter>
@@ -46,6 +45,7 @@
#include <QTcpServer>
#include <QTimer>
#include <QTemporaryDir>
+#include <QTemporaryFile>
#include <algorithm>
@@ -53,6 +53,22 @@ typedef QMap<QString, QString> QStringMap;
typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QImage::Format)
+static QByteArray msgFileOpenWriteFailed(const QFile &file)
+{
+ const QString result = QLatin1String("Cannot open \"")
+ + QDir::toNativeSeparators(file.fileName())
+ + QLatin1String("\" for writing: ") + file.errorString();
+ return result.toLocal8Bit();
+}
+
+static QByteArray msgFileOpenReadFailed(const QFile &file)
+{
+ const QString result = QLatin1String("Cannot open \"")
+ + QDir::toNativeSeparators(file.fileName())
+ + QLatin1String("\" for reading: ") + file.errorString();
+ return result.toLocal8Bit();
+}
+
class tst_QImageReader : public QObject
{
Q_OBJECT
@@ -194,7 +210,7 @@ void tst_QImageReader::initTestCase()
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
- QVERIFY(m_temporaryDir.isValid());
+ QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
}
void tst_QImageReader::cleanupTestCase()
@@ -224,6 +240,7 @@ void tst_QImageReader::readImage_data()
QTest::newRow("PPM: runners") << QString("runners.ppm") << true << QByteArray("ppm");
QTest::newRow("PPM: test") << QString("test.ppm") << true << QByteArray("ppm");
QTest::newRow("XBM: gnus") << QString("gnus.xbm") << true << QByteArray("xbm");
+ QTest::newRow("PGM: longcomment") << QString("longcomment.pgm") << true << QByteArray("pgm");
QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg");
QTest::newRow("JPEG: qtbug13653") << QString("qtbug13653-no_eoi.jpg") << true << QByteArray("jpeg");
@@ -733,7 +750,7 @@ void tst_QImageReader::gifHandlerBugs()
QVERIFY(io.loopCount() != 1);
int count=0;
for (; io.canRead(); io.read(), ++count) ;
- QVERIFY(count == 34);
+ QCOMPARE(count, 34);
}
// Task 95166
@@ -810,7 +827,7 @@ void tst_QImageReader::gifImageCount()
QVERIFY(io.canRead());
QImage greenFrame = io.read();
- QVERIFY(io.imageCount() == 4);
+ QCOMPARE(io.imageCount(), 4);
QVERIFY(io.canRead());
QImage blueFrame = io.read();
@@ -925,8 +942,8 @@ void tst_QImageReader::gifImageCount()
}
{
QImageReader io(":images/trolltech.gif");
- QVERIFY(io.imageCount() == 34);
- QVERIFY(io.size() == QSize(128,64));
+ QCOMPARE(io.imageCount(), 34);
+ QCOMPARE(io.size(), QSize(128,64));
}
}
@@ -1050,7 +1067,7 @@ void tst_QImageReader::readFromDevice()
const QString imageFileName = prefix + fileName;
QImage expectedImage(imageFileName, format);
QFile file(imageFileName);
- QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::ReadOnly), msgFileOpenReadFailed(file).constData());
QByteArray imageData = file.readAll();
QVERIFY(!imageData.isEmpty());
{
@@ -1128,12 +1145,11 @@ void tst_QImageReader::readFromFileAfterJunk()
SKIP_IF_UNSUPPORTED(format);
- QFile::remove("junk");
- QFile junkFile("junk");
- QVERIFY(junkFile.open(QFile::WriteOnly));
+ QTemporaryFile junkFile(m_temporaryDir.path() + QLatin1String("/junkXXXXXX"));
+ QVERIFY2(junkFile.open(), msgFileOpenWriteFailed(junkFile).constData());
QFile imageFile(prefix + fileName);
- QVERIFY(imageFile.open(QFile::ReadOnly));
+ QVERIFY2(imageFile.open(QFile::ReadOnly), msgFileOpenReadFailed(imageFile).constData());
QByteArray imageData = imageFile.readAll();
QVERIFY(!imageData.isNull());
@@ -1154,7 +1170,7 @@ void tst_QImageReader::readFromFileAfterJunk()
}
}
junkFile.close();
- junkFile.open(QFile::ReadOnly);
+ QVERIFY2(junkFile.open(), msgFileOpenReadFailed(junkFile).constData());
for (int i = 0; i < iterations; ++i) {
QByteArray ole = junkFile.read(9);
@@ -1204,7 +1220,7 @@ void tst_QImageReader::devicePosition()
QVERIFY(!expected.isNull());
QFile imageFile(prefix + fileName);
- QVERIFY(imageFile.open(QFile::ReadOnly));
+ QVERIFY2(imageFile.open(QFile::ReadOnly), msgFileOpenReadFailed(imageFile).constData());
QByteArray imageData = imageFile.readAll();
QVERIFY(!imageData.isNull());
int imageDataSize = imageData.size();
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index 4f04e50294..1dd4d69ea8 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -89,6 +89,7 @@ private slots:
void saveToTemporaryFile();
private:
+ QTemporaryDir m_temporaryDir;
QString prefix;
QString writePrefix;
};
@@ -112,14 +113,11 @@ static void initializePadding(QImage *image)
void tst_QImageWriter::initTestCase()
{
+ QVERIFY(m_temporaryDir.isValid());
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
- writePrefix = QDir::homePath();
-#else
- writePrefix = prefix;
-#endif
+ writePrefix = m_temporaryDir.path();
}
// Testing get/set functions
@@ -416,7 +414,7 @@ void tst_QImageWriter::testCanWrite()
{
// check if canWrite won't leave an empty file
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
QString fileName(dir.path() + QLatin1String("/001.garble"));
QVERIFY(!QFileInfo(fileName).exists());
QImageWriter writer(fileName);
@@ -524,7 +522,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 1) Via QImageWriter's API, with a standard temp file name
QTemporaryFile file;
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QImageWriter writer(&file, "PNG");
if (writer.canWrite())
QVERIFY(writer.write(image));
@@ -538,7 +536,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 2) Via QImage's API, with a standard temp file name
QTemporaryFile file;
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(image.save(&file, "PNG"));
file.reset();
QImage tmp;
@@ -548,7 +546,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 3) Via QImageWriter's API, with a named temp file
QTemporaryFile file("tempXXXXXX");
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QImageWriter writer(&file, "PNG");
QVERIFY(writer.write(image));
#if defined(Q_OS_WINCE)
@@ -559,7 +557,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 4) Via QImage's API, with a named temp file
QTemporaryFile file("tempXXXXXX");
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(image.save(&file, "PNG"));
file.reset();
QImage tmp;
diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
index c61c88d1a6..b8c99ca324 100644
--- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp
+++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
@@ -188,8 +188,8 @@ void tst_QMovie::jumpToFrame()
QMovie movie(QFINDTESTDATA(fileName));
movie.start();
movie.stop();
- QVERIFY(movie.jumpToFrame(-1) == false);
- QVERIFY(movie.currentFrameNumber() == 0);
+ QVERIFY(!movie.jumpToFrame(-1));
+ QCOMPARE(movie.currentFrameNumber(), 0);
}
void tst_QMovie::changeMovieFile()
@@ -198,7 +198,7 @@ void tst_QMovie::changeMovieFile()
movie.start();
movie.stop();
movie.setFileName(QFINDTESTDATA("animations/trolltech.gif"));
- QVERIFY(movie.currentFrameNumber() == -1);
+ QCOMPARE(movie.currentFrameNumber(), -1);
}
#ifndef QT_NO_WIDGETS
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 58cc5824bd..67d7e57fd4 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -447,7 +447,7 @@ void tst_QPixmap::scroll()
QString fileName = QString(":/images/%1.png").arg(QTest::currentDataTag());
QPixmap output(fileName);
- QVERIFY(input.isNull() == output.isNull());
+ QCOMPARE(input.isNull(), output.isNull());
QVERIFY(lenientCompare(pixmap, output));
QCOMPARE(exp, exposed);
}
@@ -713,11 +713,11 @@ void tst_QPixmap::cacheKey()
QVERIFY(pixmap1.cacheKey() != pixmap2.cacheKey());
pixmap2 = pixmap1;
- QVERIFY(pixmap2.cacheKey() == pixmap1.cacheKey());
+ QCOMPARE(pixmap2.cacheKey(), pixmap1.cacheKey());
pixmap2.detach();
QVERIFY(pixmap2.cacheKey() != pixmap1.cacheKey());
- QVERIFY(pixmap1.cacheKey() == pixmap1_key);
+ QCOMPARE(pixmap1.cacheKey(), pixmap1_key);
}
// Test drawing a bitmap on a pixmap.
@@ -743,7 +743,7 @@ void tst_QPixmap::isNull()
{
{
QPixmap pixmap(1,1);
- QVERIFY(pixmap.isNull() == false);
+ QVERIFY(!pixmap.isNull());
}
{
QPixmap pixmap(0,0);
@@ -783,11 +783,11 @@ void tst_QPixmap::convertFromImageNoDetach()
QPixmap pix = QPixmap::fromImage(orig);
QImage copy = pix.toImage();
- QVERIFY(copy.format() == screenFormat);
+ QCOMPARE(copy.format(), screenFormat);
const QImage constOrig = orig;
const QImage constCopy = copy;
- QVERIFY(constOrig.bits() == constCopy.bits());
+ QCOMPARE(constOrig.bits(), constCopy.bits());
}
void tst_QPixmap::convertFromImageDetach()
@@ -821,7 +821,7 @@ void tst_QPixmap::convertFromImageCacheKey()
QPixmap pix = QPixmap::fromImage(orig);
QImage copy = pix.toImage();
- QVERIFY(copy.format() == screenFormat);
+ QCOMPARE(copy.format(), screenFormat);
QCOMPARE(orig.cacheKey(), pix.cacheKey());
QCOMPARE(copy.cacheKey(), pix.cacheKey());
@@ -1135,9 +1135,9 @@ void tst_QPixmap::copy()
void tst_QPixmap::depthOfNullObjects()
{
QBitmap b1;
- QVERIFY(b1.depth() == 0);
+ QCOMPARE(b1.depth(), 0);
QPixmap p4;
- QVERIFY(p4.depth() == 0);
+ QCOMPARE(p4.depth(), 0);
}
void tst_QPixmap::transformed()
@@ -1437,7 +1437,7 @@ void tst_QPixmap::task_246446()
{
QPixmap pm2(pm);
}
- QVERIFY(pm.width() == 10);
+ QCOMPARE(pm.width(), 10);
QVERIFY(pm.mask().isNull());
}
@@ -1490,14 +1490,14 @@ void tst_QPixmap::loadAsBitmapOrPixmap()
// The do the same check for bitmaps..
QBitmap bitmap("temp_image.png");
QVERIFY(!bitmap.isNull());
- QVERIFY(bitmap.depth() == 1);
+ QCOMPARE(bitmap.depth(), 1);
QVERIFY(bitmap.isQBitmap());
bitmap = QBitmap();
ok = bitmap.load("temp_image.png");
QVERIFY(ok);
QVERIFY(!bitmap.isNull());
- QVERIFY(bitmap.depth() == 1);
+ QCOMPARE(bitmap.depth(), 1);
QVERIFY(bitmap.isQBitmap());
}
diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
index f22aa63112..a3cf66da18 100644
--- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp
@@ -111,7 +111,7 @@ void tst_QPixmapCache::setCacheLimit()
delete p1;
QPixmapCache::setCacheLimit(0);
- QVERIFY(QPixmapCache::find("P1") == 0);
+ QVERIFY(!QPixmapCache::find("P1"));
p1 = new QPixmap(2, 3);
QPixmapCache::setCacheLimit(1000);
@@ -346,12 +346,12 @@ void tst_QPixmapCache::remove()
QVERIFY(p1.toImage() == p1.toImage()); // sanity check
QPixmapCache::remove("red");
- QVERIFY(QPixmapCache::find("red") == 0);
+ QVERIFY(!QPixmapCache::find("red"));
QPixmapCache::remove("red");
- QVERIFY(QPixmapCache::find("red") == 0);
+ QVERIFY(!QPixmapCache::find("red"));
QPixmapCache::remove("green");
- QVERIFY(QPixmapCache::find("green") == 0);
+ QVERIFY(!QPixmapCache::find("green"));
//The int part of the API
QPixmapCache::clear();
@@ -424,7 +424,7 @@ void tst_QPixmapCache::clear()
QPixmapCache::clear();
for (int k = 0; k < numberOfKeys; ++k)
- QVERIFY(QPixmapCache::find(QString::number(k)) == 0);
+ QVERIFY(!QPixmapCache::find(QString::number(k)));
//The int part of the API
QPixmap p2(10, 10);