summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.0.03
-rw-r--r--src/testlib/qtest_gui.h15
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp14
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp10
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp4
5 files changed, 20 insertions, 26 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index fe159c4ad9..159ef73341 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -57,6 +57,9 @@ information about a particular change.
internal testlib function that was exposed in the public API due to its use
in a public macro. Any calls to this function should be replaced by a call
to qsnprintf(), which comes from the <QtCore/QByteArray> header.
+ * The QTest::pixmapsAreEqual() function has been removed from the API.
+ Comparison of QPixmap objects should be done using QCOMPARE, which provides
+ more informative output in the event of a failure.
* The QSKIP macro no longer has the "mode" parameter, which caused problems
for calculating test metrics, as the SkipAll mode hid information about
what test data was skipped. Calling QSKIP in a test function now behaves
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index 89f63e25c6..99b7700e3b 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -94,21 +94,6 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
}
-/* compatibility */
-
-inline static bool pixmapsAreEqual(const QPixmap *actual, const QPixmap *expected)
-{
- if (!actual && !expected)
- return true;
- if (!actual || !expected)
- return false;
- if (actual->isNull() && expected->isNull())
- return true;
- if (actual->isNull() || expected->isNull() || actual->size() != expected->size())
- return false;
- return actual->toImage() == expected->toImage();
-}
-
#ifdef Q_WS_X11
extern void qt_x11_wait_for_window_manager(QWidget *w);
#endif
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index 3d3f5b4a97..9e7e93255d 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -1100,11 +1100,17 @@ void tst_QDataStream::readQCursor(QDataStream *s)
QVERIFY(d5.shape() == test.shape()); //## lacks operator==
QVERIFY(d5.hotSpot() == test.hotSpot());
QVERIFY((d5.bitmap() != 0 && test.bitmap() != 0) || (d5.bitmap() == 0 && test.bitmap() == 0));
- if (d5.bitmap() != 0)
- QVERIFY(pixmapsAreEqual(d5.bitmap(), test.bitmap()));
+ if (d5.bitmap() != 0) {
+ QPixmap actual = *(d5.bitmap());
+ QPixmap expected = *(test.bitmap());
+ QCOMPARE(actual, expected);
+ }
QVERIFY((d5.mask() != 0 && test.mask() != 0) || (d5.mask() == 0 && test.mask() == 0));
- if (d5.mask() != 0)
- QVERIFY(pixmapsAreEqual(d5.mask(), test.mask()));
+ if (d5.mask() != 0) {
+ QPixmap actual = *(d5.mask());
+ QPixmap expected = *(test.mask());
+ QCOMPARE(actual, expected);
+ }
#endif
}
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index c15d1e6976..8d575c90c0 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -329,7 +329,7 @@ void tst_QPixmap::convertFromImage()
pix = QPixmap::fromImage(img2);
QPixmap res = QPixmap::fromImage(img2);
- QVERIFY( pixmapsAreEqual(&pix, &res) );
+ QCOMPARE(pix, res);
}
void tst_QPixmap::scroll_data()
@@ -1149,7 +1149,7 @@ void tst_QPixmap::copy()
trans.fill(Qt::transparent);
QPixmap transCopy = trans.copy();
- QVERIFY(pixmapsAreEqual(&trans, &transCopy));
+ QCOMPARE(trans, transCopy);
}
void tst_QPixmap::depthOfNullObjects()
@@ -1317,7 +1317,7 @@ void tst_QPixmap::loadFromDataImage()
QPixmap directLoadingPixmap;
directLoadingPixmap.loadFromData(rawData);
- QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
+ QCOMPARE(pixmapWithCopy, directLoadingPixmap);
}
void tst_QPixmap::fromImageReader_data()
@@ -1348,7 +1348,7 @@ void tst_QPixmap::fromImageReader()
QPixmap directLoadingPixmap = QPixmap::fromImageReader(&imageReader);
- QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
+ QCOMPARE(pixmapWithCopy, directLoadingPixmap);
}
void tst_QPixmap::fromImageReaderAnimatedGif_data()
@@ -1376,7 +1376,7 @@ void tst_QPixmap::fromImageReaderAnimatedGif()
QPixmap refPixmap = QPixmap::fromImage(refImage);
QPixmap directLoadingPixmap = QPixmap::fromImageReader(&pixmapReader);
- QVERIFY(pixmapsAreEqual(&refPixmap, &directLoadingPixmap));
+ QCOMPARE(refPixmap, directLoadingPixmap);
}
}
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index 5dede997ae..d5849f1c2c 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -273,7 +273,7 @@ void tst_QStyle::drawItemPixmap()
QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG");
QPixmap actualPix = QPixmap::grabWidget(testWidget);
- QVERIFY(pixmapsAreEqual(&actualPix,&p));
+ QCOMPARE(actualPix, p);
testWidget->hide();
}
@@ -458,7 +458,7 @@ void comparePixmap(const QString &filename, const QPixmap &pixmap)
QImage oldFile = readImage(filename);
QPixmap oldPixmap = QPixmap::fromImage(oldFile);
if (!oldFile.isNull())
- QVERIFY(pixmapsAreEqual(&pixmap, &oldPixmap));
+ QCOMPARE(pixmap, oldPixmap);
else
writeImage(filename, pixmap.toImage());
}