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
}
-/* 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
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
}
pix = QPixmap::fromImage(img2);
QPixmap res = QPixmap::fromImage(img2);
- QVERIFY( pixmapsAreEqual(&pix, &res) );
+ QCOMPARE(pix, res);
}
void tst_QPixmap::scroll_data()
trans.fill(Qt::transparent);
QPixmap transCopy = trans.copy();
- QVERIFY(pixmapsAreEqual(&trans, &transCopy));
+ QCOMPARE(trans, transCopy);
}
void tst_QPixmap::depthOfNullObjects()
QPixmap directLoadingPixmap;
directLoadingPixmap.loadFromData(rawData);
- QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
+ QCOMPARE(pixmapWithCopy, directLoadingPixmap);
}
void tst_QPixmap::fromImageReader_data()
QPixmap directLoadingPixmap = QPixmap::fromImageReader(&imageReader);
- QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
+ QCOMPARE(pixmapWithCopy, directLoadingPixmap);
}
void tst_QPixmap::fromImageReaderAnimatedGif_data()
QPixmap refPixmap = QPixmap::fromImage(refImage);
QPixmap directLoadingPixmap = QPixmap::fromImageReader(&pixmapReader);
- QVERIFY(pixmapsAreEqual(&refPixmap, &directLoadingPixmap));
+ QCOMPARE(refPixmap, directLoadingPixmap);
}
}
QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG");
QPixmap actualPix = QPixmap::grabWidget(testWidget);
- QVERIFY(pixmapsAreEqual(&actualPix,&p));
+ QCOMPARE(actualPix, p);
testWidget->hide();
}
QImage oldFile = readImage(filename);
QPixmap oldPixmap = QPixmap::fromImage(oldFile);
if (!oldFile.isNull())
- QVERIFY(pixmapsAreEqual(&pixmap, &oldPixmap));
+ QCOMPARE(pixmap, oldPixmap);
else
writeImage(filename, pixmap.toImage());
}