From 3859b304e846b4ee8e77350945b6c63bbb487e13 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Jul 2015 15:15:12 +0200 Subject: tests/auto/gui: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: I624deb320c378c18a29b3707f48583d53bfd5186 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/gui/image/qicon/tst_qicon.cpp | 10 +- tests/auto/gui/image/qimage/tst_qimage.cpp | 10 +- .../gui/image/qimagereader/tst_qimagereader.cpp | 8 +- tests/auto/gui/image/qmovie/tst_qmovie.cpp | 4 +- tests/auto/gui/image/qpixmap/tst_qpixmap.cpp | 22 +- .../gui/image/qpixmapcache/tst_qpixmapcache.cpp | 10 +- .../kernel/qguiapplication/tst_qguiapplication.cpp | 2 +- .../gui/kernel/qguivariant/no_application/main.cpp | 2 +- .../kernel/qguivariant/test/tst_qguivariant.cpp | 12 +- .../gui/kernel/qopenglwindow/tst_qopenglwindow.cpp | 4 +- .../gui/kernel/qpixelformat/tst_qpixelformat.cpp | 2 +- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 34 +-- .../auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp | 48 +-- .../gui/math3d/qquaternion/tst_qquaternion.cpp | 20 +- tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp | 74 ++--- tests/auto/gui/painting/qbrush/tst_qbrush.cpp | 4 +- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 12 +- .../gui/painting/qpagelayout/tst_qpagelayout.cpp | 2 +- tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 26 +- .../gui/painting/qpainterpath/tst_qpainterpath.cpp | 34 +-- tests/auto/gui/painting/qregion/tst_qregion.cpp | 2 +- .../gui/painting/qtransform/tst_qtransform.cpp | 20 +- tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 38 +-- tests/auto/gui/text/qfont/tst_qfont.cpp | 70 ++--- .../qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp | 2 +- tests/auto/gui/text/qtextblock/tst_qtextblock.cpp | 4 +- .../auto/gui/text/qtextcursor/tst_qtextcursor.cpp | 184 +++++------ .../gui/text/qtextdocument/tst_qtextdocument.cpp | 37 +-- .../tst_qtextdocumentfragment.cpp | 206 ++++++------- .../auto/gui/text/qtextformat/tst_qtextformat.cpp | 4 +- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 28 +- tests/auto/gui/text/qtextlist/tst_qtextlist.cpp | 46 +-- .../text/qtextpiecetable/tst_qtextpiecetable.cpp | 336 ++++++++++----------- tests/auto/gui/text/qtexttable/tst_qtexttable.cpp | 186 ++++++------ .../util/qdoublevalidator/tst_qdoublevalidator.cpp | 32 +- .../gui/util/qintvalidator/tst_qintvalidator.cpp | 16 +- tests/auto/other/macgui/tst_macgui.cpp | 2 +- 37 files changed, 779 insertions(+), 774 deletions(-) diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 32e5d7a841..9ed3873682 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -348,10 +348,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() @@ -368,7 +368,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() @@ -556,7 +556,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]); @@ -593,7 +593,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 f7c71f05bd..c1b32a273c 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -477,7 +477,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); @@ -1564,12 +1564,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 @@ -1580,10 +1580,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() diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 4b3e2606fd..07b75adae4 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -733,7 +733,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 +810,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 +925,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)); } } diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp index acefd0944e..b8c99ca324 100644 --- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp +++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp @@ -189,7 +189,7 @@ void tst_QMovie::jumpToFrame() movie.start(); movie.stop(); QVERIFY(!movie.jumpToFrame(-1)); - QVERIFY(movie.currentFrameNumber() == 0); + 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 b31fb0138f..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. @@ -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); diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 19365bffdd..2ddfdad7e4 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -912,7 +912,7 @@ void tst_QGuiApplication::genericPluginsAndWindowSystemEvents() QGuiApplication app(argc, argv); QVERIFY(QGuiApplication::primaryScreen()); - QVERIFY(QGuiApplication::primaryScreen()->orientation() == testOrientationToSend); + QCOMPARE(QGuiApplication::primaryScreen()->orientation(), testOrientationToSend); QCOMPARE(testReceiver.customEvents, 0); QCoreApplication::sendPostedEvents(&testReceiver); diff --git a/tests/auto/gui/kernel/qguivariant/no_application/main.cpp b/tests/auto/gui/kernel/qguivariant/no_application/main.cpp index c37e633d75..1294751224 100644 --- a/tests/auto/gui/kernel/qguivariant/no_application/main.cpp +++ b/tests/auto/gui/kernel/qguivariant/no_application/main.cpp @@ -56,7 +56,7 @@ void tst_QGuiVariantNoApplication::variantWithoutApplication() { QVariant v = QString("red"); - QVERIFY(qvariant_cast(v) == QColor(Qt::red)); + QCOMPARE(qvariant_cast(v), QColor(Qt::red)); } diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 58c595ad07..0e822ced5b 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -140,13 +140,13 @@ void tst_QGuiVariant::constructor_invalid() QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:")); QVariant variant(static_cast(typeId)); QVERIFY(!variant.isValid()); - QVERIFY(variant.userType() == QMetaType::UnknownType); + QCOMPARE(variant.userType(), int(QMetaType::UnknownType)); } { QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:")); QVariant variant(typeId, /* copy */ 0); QVERIFY(!variant.isValid()); - QVERIFY(variant.userType() == QMetaType::UnknownType); + QCOMPARE(variant.userType(), int(QMetaType::UnknownType)); } } @@ -611,9 +611,9 @@ void tst_QGuiVariant::writeToReadFromDataStream() // the uninitialized float can be NaN (observed on Windows Mobile 5 ARMv4i) float readFloat = qvariant_cast(readVariant); float writtenFloat = qvariant_cast(writeVariant); - QVERIFY(qIsNaN(readFloat) == qIsNaN(writtenFloat)); + QCOMPARE(qIsNaN(readFloat), qIsNaN(writtenFloat)); if (!qIsNaN(readFloat)) - QVERIFY(readFloat == writtenFloat); + QCOMPARE(readFloat, writtenFloat); } break; } @@ -632,7 +632,7 @@ void tst_QGuiVariant::writeToReadFromOldDataStream() dataFileStream.setVersion(QDataStream::Qt_4_9); QVariant readVariant; dataFileStream >> readVariant; - QVERIFY(readVariant.userType() == QMetaType::QPolygonF); + QCOMPARE(readVariant.userType(), int(QMetaType::QPolygonF)); QCOMPARE(testVariant, readVariant); file.close(); } @@ -656,7 +656,7 @@ void tst_QGuiVariant::writeToReadFromOldDataStream() QDataStream readVarData(variantData); readVarData >> dummy; readVarData >> polyData50; - QVERIFY(polyData49 == polyData50); + QCOMPARE(polyData49, polyData50); } } diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp index dcead8bfbf..1fc4967b12 100644 --- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp +++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp @@ -248,7 +248,7 @@ public: GLuint fbo = 0xFFFF; QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *) &fbo); - QVERIFY(fbo == 0); + QCOMPARE(fbo, GLuint(0)); } void paintGL() Q_DECL_OVERRIDE { @@ -272,7 +272,7 @@ public: GLuint fbo = 0xFFFF; QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *) &fbo); - QVERIFY(fbo == 0); + QCOMPARE(fbo, GLuint(0)); } }; diff --git a/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp b/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp index 0d5991ef41..a5f86c6c09 100644 --- a/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp +++ b/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp @@ -53,7 +53,7 @@ void tst_QPixelFormat::testOperators() { QPixelFormat first = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied); QPixelFormat second = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied); - QVERIFY(first == second); + QCOMPARE(first, second); QPixelFormat third = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtEnd, QPixelFormat::NotPremultiplied); QVERIFY(first != third); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 4e596a24d4..ccb8c759c6 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -437,14 +437,14 @@ void tst_QWindow::platformSurface() QCOMPARE(window.geometry(), geometry); window.create(); - QTRY_VERIFY(window.received(QEvent::PlatformSurface) == 1); - QTRY_VERIFY(window.surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated); + QTRY_COMPARE(window.received(QEvent::PlatformSurface), 1); + QTRY_COMPARE(window.surfaceEventType(), QPlatformSurfaceEvent::SurfaceCreated); QTRY_VERIFY(window.handle() != Q_NULLPTR); window.destroy(); - QTRY_VERIFY(window.received(QEvent::PlatformSurface) == 2); - QTRY_VERIFY(window.surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); - QTRY_VERIFY(window.handle() == Q_NULLPTR); + QTRY_COMPARE(window.received(QEvent::PlatformSurface), 2); + QTRY_COMPARE(window.surfaceEventType(), QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); + QTRY_VERIFY(!window.handle()); // Check for synchronous delivery of platform surface events and that the platform // surface always existed upon event delivery @@ -506,7 +506,7 @@ void tst_QWindow::isActive() context.swapBuffers(&window); #endif QTRY_COMPARE(window.received(QEvent::Resize), 1); - QTRY_VERIFY(QGuiApplication::focusWindow() == &window); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QVERIFY(window.isActive()); Window child; @@ -518,7 +518,7 @@ void tst_QWindow::isActive() child.requestActivate(); - QTRY_VERIFY(QGuiApplication::focusWindow() == &child); + QTRY_COMPARE(QGuiApplication::focusWindow(), &child); QVERIFY(child.isActive()); // parent shouldn't receive new resize events from child being shown @@ -541,7 +541,7 @@ void tst_QWindow::isActive() QTRY_VERIFY(dialog.isExposed()); QCoreApplication::processEvents(); QTRY_COMPARE(dialog.received(QEvent::Resize), 1); - QTRY_VERIFY(QGuiApplication::focusWindow() == &dialog); + QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog); QVERIFY(dialog.isActive()); // transient child has focus @@ -552,7 +552,7 @@ void tst_QWindow::isActive() window.requestActivate(); - QTRY_VERIFY(QGuiApplication::focusWindow() == &window); + QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QCoreApplication::processEvents(); QTRY_COMPARE(dialog.received(QEvent::FocusOut), 1); QTRY_COMPARE(window.received(QEvent::FocusIn), 2); @@ -1331,14 +1331,14 @@ void tst_QWindow::inputReentrancy() class TabletTestWindow : public QWindow { public: - TabletTestWindow() : eventType(0) { } + TabletTestWindow() : eventType(QEvent::None) { } void tabletEvent(QTabletEvent *ev) { eventType = ev->type(); eventGlobal = ev->globalPosF(); eventLocal = ev->posF(); eventDevice = ev->device(); } - int eventType; + QEvent::Type eventType; QPointF eventGlobal, eventLocal; int eventDevice; bool eventFilter(QObject *obj, QEvent *ev) { @@ -1371,16 +1371,16 @@ void tst_QWindow::tabletEvents() QTRY_COMPARE(window.eventLocal.toPoint(), local); QWindowSystemInterface::handleTabletEvent(&window, false, deviceLocal, deviceGlobal, 1, 2, 0.5, 1, 2, 0.1, 0, 0, 0); QCoreApplication::processEvents(); - QTRY_VERIFY(window.eventType == QEvent::TabletRelease); + QTRY_COMPARE(window.eventType, QEvent::TabletRelease); QWindowSystemInterface::handleTabletEnterProximityEvent(1, 2, 3); QCoreApplication::processEvents(); - QTRY_VERIFY(window.eventType == QEvent::TabletEnterProximity); + QTRY_COMPARE(window.eventType, QEvent::TabletEnterProximity); QTRY_COMPARE(window.eventDevice, 1); QWindowSystemInterface::handleTabletLeaveProximityEvent(1, 2, 3); QCoreApplication::processEvents(); - QTRY_VERIFY(window.eventType == QEvent::TabletLeaveProximity); + QTRY_COMPARE(window.eventType, QEvent::TabletLeaveProximity); QTRY_COMPARE(window.eventDevice, 1); #endif @@ -1728,13 +1728,13 @@ void tst_QWindow::requestUpdate() QCoreApplication::processEvents(); QTRY_VERIFY(window.isExposed()); - QVERIFY(window.received(QEvent::UpdateRequest) == 0); + QCOMPARE(window.received(QEvent::UpdateRequest), 0); window.requestUpdate(); - QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 1); + QTRY_COMPARE(window.received(QEvent::UpdateRequest), 1); window.requestUpdate(); - QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 2); + QTRY_COMPARE(window.received(QEvent::UpdateRequest), 2); } #include diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index e7659a25bd..463322ff2a 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -673,7 +673,7 @@ void tst_QMatrixNxN::compare2x2() QMatrix2x2 m2(uniqueValues2); QMatrix2x2 m3(transposedValues2); - QVERIFY(m1 == m2); + QCOMPARE(m1, m2); QVERIFY(!(m1 != m2)); QVERIFY(m1 != m3); QVERIFY(!(m1 == m3)); @@ -686,7 +686,7 @@ void tst_QMatrixNxN::compare3x3() QMatrix3x3 m2(uniqueValues3); QMatrix3x3 m3(transposedValues3); - QVERIFY(m1 == m2); + QCOMPARE(m1, m2); QVERIFY(!(m1 != m2)); QVERIFY(m1 != m3); QVERIFY(!(m1 == m3)); @@ -699,7 +699,7 @@ void tst_QMatrixNxN::compare4x4() QMatrix4x4 m2(uniqueValues4); QMatrix4x4 m3(transposedValues4); - QVERIFY(m1 == m2); + QCOMPARE(m1, m2); QVERIFY(!(m1 != m2)); QVERIFY(m1 != m3); QVERIFY(!(m1 == m3)); @@ -712,7 +712,7 @@ void tst_QMatrixNxN::compare4x3() QMatrix4x3 m2(uniqueValues4x3); QMatrix4x3 m3(transposedValues3x4); - QVERIFY(m1 == m2); + QCOMPARE(m1, m2); QVERIFY(!(m1 != m2)); QVERIFY(m1 != m3); QVERIFY(!(m1 == m3)); @@ -1858,7 +1858,7 @@ void tst_QMatrixNxN::inverted4x4() if (invertible) QVERIFY(m1.determinant() != 0.0f); else - QVERIFY(m1.determinant() == 0.0f); + QCOMPARE(m1.determinant(), 0.0f); Matrix4 m1alt; memcpy(m1alt.v, (const float *)m1Values, sizeof(m1alt.v)); @@ -1992,7 +1992,7 @@ void tst_QMatrixNxN::scale4x4() if (z == 1.0f) { QMatrix4x4 m2b; m2b.scale(x, y); - QVERIFY(m2b == m2); + QCOMPARE(m2b, m2); } QVector3D v1(2.0f, 3.0f, -4.0f); @@ -2051,7 +2051,7 @@ void tst_QMatrixNxN::scale4x4() if (z == 1.0f) { QMatrix4x4 m4b(m3); m4b.scale(x, y); - QVERIFY(m4b == m4); + QCOMPARE(m4b, m4); } // Test coverage when the special matrix type is unknown. @@ -2138,7 +2138,7 @@ void tst_QMatrixNxN::translate4x4() if (z == 0.0f) { QMatrix4x4 m2b; m2b.translate(x, y); - QVERIFY(m2b == m2); + QCOMPARE(m2b, m2); } QVector3D v1(2.0f, 3.0f, -4.0f); @@ -2179,7 +2179,7 @@ void tst_QMatrixNxN::translate4x4() if (z == 0.0f) { QMatrix4x4 m4b(m3); m4b.translate(x, y); - QVERIFY(m4b == m4); + QCOMPARE(m4b, m4); } } @@ -3073,7 +3073,7 @@ void tst_QMatrixNxN::convertQMatrix() QPointF p2 = m2 * QPointF(100.0, 150.0); QCOMPARE((double)p2.x(), 100.0 - 3.5); QCOMPARE((double)p2.y(), 150.0 + 2.0); - QVERIFY(m1 == m2.toAffine()); + QCOMPARE(m1, m2.toAffine()); QMatrix m3; m3.scale(1.5, -2.0); @@ -3085,7 +3085,7 @@ void tst_QMatrixNxN::convertQMatrix() QPointF p4 = m4 * QPointF(100.0, 150.0); QCOMPARE((double)p4.x(), 1.5 * 100.0); QCOMPARE((double)p4.y(), -2.0 * 150.0); - QVERIFY(m3 == m4.toAffine()); + QCOMPARE(m3, m4.toAffine()); QMatrix m5; m5.rotate(45.0); @@ -3120,7 +3120,7 @@ void tst_QMatrixNxN::convertQTransform() QPointF p2 = m2 * QPointF(100.0, 150.0); QCOMPARE((double)p2.x(), 100.0 - 3.5); QCOMPARE((double)p2.y(), 150.0 + 2.0); - QVERIFY(m1 == m2.toTransform()); + QCOMPARE(m1, m2.toTransform()); QTransform m3; m3.scale(1.5, -2.0); @@ -3132,7 +3132,7 @@ void tst_QMatrixNxN::convertQTransform() QPointF p4 = m4 * QPointF(100.0, 150.0); QCOMPARE((double)p4.x(), 1.5 * 100.0); QCOMPARE((double)p4.y(), -2.0 * 150.0); - QVERIFY(m3 == m4.toTransform()); + QCOMPARE(m3, m4.toTransform()); QTransform m5; m5.rotate(45.0); @@ -3206,16 +3206,16 @@ void tst_QMatrixNxN::mapRect() QRect recti(qRound(x), qRound(y), qRound(width), qRound(height)); QMatrix4x4 m1; - QVERIFY(m1.mapRect(rect) == rect); - QVERIFY(m1.mapRect(recti) == recti); + QCOMPARE(m1.mapRect(rect), rect); + QCOMPARE(m1.mapRect(recti), recti); QMatrix4x4 m2; m2.translate(-100.5f, 64.0f); QRectF translated = rect.translated(-100.5f, 64.0f); QRect translatedi = QRect(qRound(recti.x() - 100.5f), recti.y() + 64, recti.width(), recti.height()); - QVERIFY(m2.mapRect(rect) == translated); - QVERIFY(m2.mapRect(recti) == translatedi); + QCOMPARE(m2.mapRect(rect), translated); + QCOMPARE(m2.mapRect(recti), translatedi); QMatrix4x4 m3; m3.scale(-100.5f, 64.0f); @@ -3232,7 +3232,7 @@ void tst_QMatrixNxN::mapRect() scaley -= scaleht; } QRectF scaled(scalex, scaley, scalewid, scaleht); - QVERIFY(m3.mapRect(rect) == scaled); + QCOMPARE(m3.mapRect(rect), scaled); scalex = recti.x() * -100.5f; scaley = recti.y() * 64.0f; scalewid = recti.width() * -100.5f; @@ -3247,7 +3247,7 @@ void tst_QMatrixNxN::mapRect() } QRect scaledi(qRound(scalex), qRound(scaley), qRound(scalewid), qRound(scaleht)); - QVERIFY(m3.mapRect(recti) == scaledi); + QCOMPARE(m3.mapRect(recti), scaledi); QMatrix4x4 m4; m4.translate(-100.5f, 64.0f); @@ -3261,7 +3261,7 @@ void tst_QMatrixNxN::mapRect() if (transy1 > transy2) qSwap(transy1, transy2); QRectF trans(transx1, transy1, transx2 - transx1, transy2 - transy1); - QVERIFY(m4.mapRect(rect) == trans); + QCOMPARE(m4.mapRect(rect), trans); transx1 = recti.x() * -2.5f - 100.5f; transy1 = recti.y() * 4.0f + 64.0f; transx2 = (recti.x() + recti.width()) * -2.5f - 100.5f; @@ -3273,7 +3273,7 @@ void tst_QMatrixNxN::mapRect() QRect transi(qRound(transx1), qRound(transy1), qRound(transx2) - qRound(transx1), qRound(transy2) - qRound(transy1)); - QVERIFY(m4.mapRect(recti) == transi); + QCOMPARE(m4.mapRect(recti), transi); m4.rotate(45.0f, 0.0f, 0.0f, 1.0f); @@ -3290,7 +3290,7 @@ void tst_QMatrixNxN::mapRect() QRect mri = m4.mapRect(recti); QRect tri = t4.mapRect(recti); - QVERIFY(mri == tri); + QCOMPARE(mri, tri); } void tst_QMatrixNxN::mapVector_data() @@ -3389,14 +3389,14 @@ void tst_QMatrixNxN::properties() void tst_QMatrixNxN::metaTypes() { - QVERIFY(QMetaType::type("QMatrix4x4") == QMetaType::QMatrix4x4); + QCOMPARE(QMetaType::type("QMatrix4x4"), int(QMetaType::QMatrix4x4)); QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QMatrix4x4)), QByteArray("QMatrix4x4")); QVERIFY(QMetaType::isRegistered(QMetaType::QMatrix4x4)); - QVERIFY(qMetaTypeId() == QMetaType::QMatrix4x4); + QCOMPARE(qMetaTypeId(), int(QMetaType::QMatrix4x4)); } QTEST_APPLESS_MAIN(tst_QMatrixNxN) diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index ec7af97f07..1fbad5b829 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -446,7 +446,7 @@ void tst_QQuaternion::compare() QQuaternion v5(8, 1, 2, 3); QQuaternion v6(3, 1, 2, 4); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); QVERIFY(v1 != v3); QVERIFY(v1 != v4); QVERIFY(v1 != v5); @@ -522,7 +522,7 @@ void tst_QQuaternion::add() QQuaternion v4(v1); v4 += v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() + v2.x()); QCOMPARE(v4.y(), v1.y() + v2.y()); @@ -560,7 +560,7 @@ void tst_QQuaternion::subtract() QQuaternion v4(v3); v4 -= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() - v1.x()); QCOMPARE(v4.y(), v3.y() - v1.y()); @@ -569,7 +569,7 @@ void tst_QQuaternion::subtract() QQuaternion v5(v3); v5 -= v2; - QVERIFY(v5 == v1); + QCOMPARE(v5, v1); QCOMPARE(v5.x(), v3.x() - v2.x()); QCOMPARE(v5.y(), v3.y() - v2.y()); @@ -704,7 +704,7 @@ void tst_QQuaternion::multiplyFactor() QQuaternion v3(v1); v3 *= factor; - QVERIFY(v3 == v2); + QCOMPARE(v3, v2); QCOMPARE(v3.x(), v1.x() * factor); QCOMPARE(v3.y(), v1.y() * factor); @@ -740,7 +740,7 @@ void tst_QQuaternion::divide() QQuaternion v3(v2); v3 /= factor; - QVERIFY(v3 == v1); + QCOMPARE(v3, v1); QCOMPARE(v3.x(), v2.x() / factor); QCOMPARE(v3.y(), v2.y() / factor); @@ -764,7 +764,7 @@ void tst_QQuaternion::negate() QQuaternion v1(w1, x1, y1, z1); QQuaternion v2(-w1, -x1, -y1, -z1); - QVERIFY(-v1 == v2); + QCOMPARE(-v1, v2); } // Test quaternion conjugate calculations. @@ -783,7 +783,7 @@ void tst_QQuaternion::conjugate() QQuaternion v1(w1, x1, y1, z1); QQuaternion v2(w1, -x1, -y1, -z1); - QVERIFY(v1.conjugate() == v2); + QCOMPARE(v1.conjugate(), v2); } // Test quaternion creation from an axis and an angle. @@ -1325,14 +1325,14 @@ void tst_QQuaternion::properties() void tst_QQuaternion::metaTypes() { - QVERIFY(QMetaType::type("QQuaternion") == QMetaType::QQuaternion); + QCOMPARE(QMetaType::type("QQuaternion"), int(QMetaType::QQuaternion)); QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QQuaternion)), QByteArray("QQuaternion")); QVERIFY(QMetaType::isRegistered(QMetaType::QQuaternion)); - QVERIFY(qMetaTypeId() == QMetaType::QQuaternion); + QCOMPARE(qMetaTypeId(), int(QMetaType::QQuaternion)); } QTEST_APPLESS_MAIN(tst_QQuaternion) diff --git a/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp b/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp index d2e0bbe375..eeff2c3bae 100644 --- a/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp +++ b/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp @@ -885,7 +885,7 @@ void tst_QVectorND::compare2() QVector2D v3(3, 2); QVector2D v4(1, 3); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); QVERIFY(v1 != v3); QVERIFY(v1 != v4); } @@ -899,7 +899,7 @@ void tst_QVectorND::compare3() QVector3D v4(1, 3, 4); QVector3D v5(1, 2, 3); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); QVERIFY(v1 != v3); QVERIFY(v1 != v4); QVERIFY(v1 != v5); @@ -915,7 +915,7 @@ void tst_QVectorND::compare4() QVector4D v5(1, 2, 3, 8); QVector4D v6(1, 2, 4, 3); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); QVERIFY(v1 != v3); QVERIFY(v1 != v4); QVERIFY(v1 != v5); @@ -969,7 +969,7 @@ void tst_QVectorND::add2() QVector2D v4(v1); v4 += v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() + v2.x()); QCOMPARE(v4.y(), v1.y() + v2.y()); @@ -1033,7 +1033,7 @@ void tst_QVectorND::add3() QVector3D v4(v1); v4 += v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() + v2.x()); QCOMPARE(v4.y(), v1.y() + v2.y()); @@ -1109,7 +1109,7 @@ void tst_QVectorND::add4() QVector4D v4(v1); v4 += v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() + v2.x()); QCOMPARE(v4.y(), v1.y() + v2.y()); @@ -1141,14 +1141,14 @@ void tst_QVectorND::subtract2() QVector2D v4(v3); v4 -= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() - v1.x()); QCOMPARE(v4.y(), v3.y() - v1.y()); QVector2D v5(v3); v5 -= v2; - QVERIFY(v5 == v1); + QCOMPARE(v5, v1); QCOMPARE(v5.x(), v3.x() - v2.x()); QCOMPARE(v5.y(), v3.y() - v2.y()); @@ -1181,7 +1181,7 @@ void tst_QVectorND::subtract3() QVector3D v4(v3); v4 -= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() - v1.x()); QCOMPARE(v4.y(), v3.y() - v1.y()); @@ -1189,7 +1189,7 @@ void tst_QVectorND::subtract3() QVector3D v5(v3); v5 -= v2; - QVERIFY(v5 == v1); + QCOMPARE(v5, v1); QCOMPARE(v5.x(), v3.x() - v2.x()); QCOMPARE(v5.y(), v3.y() - v2.y()); @@ -1226,7 +1226,7 @@ void tst_QVectorND::subtract4() QVector4D v4(v3); v4 -= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() - v1.x()); QCOMPARE(v4.y(), v3.y() - v1.y()); @@ -1235,7 +1235,7 @@ void tst_QVectorND::subtract4() QVector4D v5(v3); v5 -= v2; - QVERIFY(v5 == v1); + QCOMPARE(v5, v1); QCOMPARE(v5.x(), v3.x() - v2.x()); QCOMPARE(v5.y(), v3.y() - v2.y()); @@ -1290,7 +1290,7 @@ void tst_QVectorND::multiply2() QVector2D v4(v1); v4 *= v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() * v2.x()); QCOMPARE(v4.y(), v1.y() * v2.y()); @@ -1354,7 +1354,7 @@ void tst_QVectorND::multiply3() QVector3D v4(v1); v4 *= v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() * v2.x()); QCOMPARE(v4.y(), v1.y() * v2.y()); @@ -1430,7 +1430,7 @@ void tst_QVectorND::multiply4() QVector4D v4(v1); v4 *= v2; - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); QCOMPARE(v4.x(), v1.x() * v2.x()); QCOMPARE(v4.y(), v1.y() * v2.y()); @@ -1488,7 +1488,7 @@ void tst_QVectorND::multiplyFactor2() QVector2D v3(v1); v3 *= factor; - QVERIFY(v3 == v2); + QCOMPARE(v3, v2); QCOMPARE(v3.x(), v1.x() * factor); QCOMPARE(v3.y(), v1.y() * factor); @@ -1553,7 +1553,7 @@ void tst_QVectorND::multiplyFactor3() QVector3D v3(v1); v3 *= factor; - QVERIFY(v3 == v2); + QCOMPARE(v3, v2); QCOMPARE(v3.x(), v1.x() * factor); QCOMPARE(v3.y(), v1.y() * factor); @@ -1628,7 +1628,7 @@ void tst_QVectorND::multiplyFactor4() QVector4D v3(v1); v3 *= factor; - QVERIFY(v3 == v2); + QCOMPARE(v3, v2); QCOMPARE(v3.x(), v1.x() * factor); QCOMPARE(v3.y(), v1.y() * factor); @@ -1660,7 +1660,7 @@ void tst_QVectorND::divide2() QVector2D v4(v3); v4 /= v2; - QVERIFY(v4 == v1); + QCOMPARE(v4, v1); QCOMPARE(v4.x(), v3.x() / v2.x()); QCOMPARE(v4.y(), v3.y() / v2.y()); @@ -1670,7 +1670,7 @@ void tst_QVectorND::divide2() QVector2D v4(v3); v4 /= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() / v1.x()); QCOMPARE(v4.y(), v3.y() / v1.y()); @@ -1704,7 +1704,7 @@ void tst_QVectorND::divide3() QVector3D v4(v3); v4 /= v2; - QVERIFY(v4 == v1); + QCOMPARE(v4, v1); QCOMPARE(v4.x(), v3.x() / v2.x()); QCOMPARE(v4.y(), v3.y() / v2.y()); @@ -1715,7 +1715,7 @@ void tst_QVectorND::divide3() QVector3D v4(v3); v4 /= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() / v1.x()); QCOMPARE(v4.y(), v3.y() / v1.y()); @@ -1753,7 +1753,7 @@ void tst_QVectorND::divide4() QVector4D v4(v3); v4 /= v2; - QVERIFY(v4 == v1); + QCOMPARE(v4, v1); QCOMPARE(v4.x(), v3.x() / v2.x()); QCOMPARE(v4.y(), v3.y() / v2.y()); @@ -1765,7 +1765,7 @@ void tst_QVectorND::divide4() QVector4D v4(v3); v4 /= v1; - QVERIFY(v4 == v2); + QCOMPARE(v4, v2); QCOMPARE(v4.x(), v3.x() / v1.x()); QCOMPARE(v4.y(), v3.y() / v1.y()); @@ -1798,7 +1798,7 @@ void tst_QVectorND::divideFactor2() QVector2D v3(v2); v3 /= factor; - QVERIFY(v3 == v1); + QCOMPARE(v3, v1); QCOMPARE(v3.x(), v2.x() / factor); QCOMPARE(v3.y(), v2.y() / factor); @@ -1830,7 +1830,7 @@ void tst_QVectorND::divideFactor3() QVector3D v3(v2); v3 /= factor; - QVERIFY(v3 == v1); + QCOMPARE(v3, v1); QCOMPARE(v3.x(), v2.x() / factor); QCOMPARE(v3.y(), v2.y() / factor); @@ -1865,7 +1865,7 @@ void tst_QVectorND::divideFactor4() QVector4D v3(v2); v3 /= factor; - QVERIFY(v3 == v1); + QCOMPARE(v3, v1); QCOMPARE(v3.x(), v2.x() / factor); QCOMPARE(v3.y(), v2.y() / factor); @@ -1887,7 +1887,7 @@ void tst_QVectorND::negate2() QVector2D v1(x1, y1); QVector2D v2(-x1, -y1); - QVERIFY(-v1 == v2); + QCOMPARE(-v1, v2); } // Test vector negation for 3D vectors. @@ -1905,7 +1905,7 @@ void tst_QVectorND::negate3() QVector3D v1(x1, y1, z1); QVector3D v2(-x1, -y1, -z1); - QVERIFY(-v1 == v2); + QCOMPARE(-v1, v2); } // Test vector negation for 4D vectors. @@ -1924,7 +1924,7 @@ void tst_QVectorND::negate4() QVector4D v1(x1, y1, z1, w1); QVector4D v2(-x1, -y1, -z1, -w1); - QVERIFY(-v1 == v2); + QCOMPARE(-v1, v2); } // Test the computation of vector cross-products. @@ -1976,7 +1976,7 @@ void tst_QVectorND::crossProduct() QVector3D v3(x3, y3, z3); QVector3D v4 = QVector3D::crossProduct(v1, v2); - QVERIFY(v4 == v3); + QCOMPARE(v4, v3); // Compute the cross-product long-hand and check again. float xres = y1 * z2 - z1 * y2; @@ -2667,9 +2667,9 @@ void tst_QVectorND::properties() void tst_QVectorND::metaTypes() { - QVERIFY(QMetaType::type("QVector2D") == QMetaType::QVector2D); - QVERIFY(QMetaType::type("QVector3D") == QMetaType::QVector3D); - QVERIFY(QMetaType::type("QVector4D") == QMetaType::QVector4D); + QCOMPARE(QMetaType::type("QVector2D"), int(QMetaType::QVector2D)); + QCOMPARE(QMetaType::type("QVector3D"), int(QMetaType::QVector3D)); + QCOMPARE(QMetaType::type("QVector4D"), int(QMetaType::QVector4D)); QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QVector2D)), QByteArray("QVector2D")); @@ -2682,9 +2682,9 @@ void tst_QVectorND::metaTypes() QVERIFY(QMetaType::isRegistered(QMetaType::QVector3D)); QVERIFY(QMetaType::isRegistered(QMetaType::QVector4D)); - QVERIFY(qMetaTypeId() == QMetaType::QVector2D); - QVERIFY(qMetaTypeId() == QMetaType::QVector3D); - QVERIFY(qMetaTypeId() == QMetaType::QVector4D); + QCOMPARE(qMetaTypeId(), int(QMetaType::QVector2D)); + QCOMPARE(qMetaTypeId(), int(QMetaType::QVector3D)); + QCOMPARE(qMetaTypeId(), int(QMetaType::QVector4D)); } QTEST_APPLESS_MAIN(tst_QVectorND) diff --git a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp index 4f58178f2c..30982f1e24 100644 --- a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp +++ b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp @@ -461,8 +461,8 @@ void tst_QBrush::textureBrushComparison() imageBrush1.setTextureImage(image1); imageBrush2.setTextureImage(image2); - QVERIFY(imageBrush1 == imageBrush2); - QVERIFY(pixmapBrush == imageBrush1); + QCOMPARE(imageBrush1, imageBrush2); + QCOMPARE(pixmapBrush, imageBrush1); } QTEST_MAIN(tst_QBrush) diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index cf0d82f3f7..b9d17bae62 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -253,7 +253,7 @@ void tst_QColor::isValid() { QFETCH(QColor, color); QFETCH(bool, isValid); - QVERIFY(color.isValid() == isValid); + QCOMPARE(color.isValid(), isValid); } Q_DECLARE_METATYPE(QColor::NameFormat); @@ -1325,19 +1325,19 @@ void tst_QColor::convertTo() QColor color(Qt::black); QColor rgb = color.convertTo(QColor::Rgb); - QVERIFY(rgb.spec() == QColor::Rgb); + QCOMPARE(rgb.spec(), QColor::Rgb); QColor hsv = color.convertTo(QColor::Hsv); - QVERIFY(hsv.spec() == QColor::Hsv); + QCOMPARE(hsv.spec(), QColor::Hsv); QColor cmyk = color.convertTo(QColor::Cmyk); - QVERIFY(cmyk.spec() == QColor::Cmyk); + QCOMPARE(cmyk.spec(), QColor::Cmyk); QColor hsl = color.convertTo(QColor::Hsl); - QVERIFY(hsl.spec() == QColor::Hsl); + QCOMPARE(hsl.spec(), QColor::Hsl); QColor invalid = color.convertTo(QColor::Invalid); - QVERIFY(invalid.spec() == QColor::Invalid); + QCOMPARE(invalid.spec(), QColor::Invalid); } void tst_QColor::light() diff --git a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp index 964487f566..0f2f51d9b6 100644 --- a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp +++ b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp @@ -76,7 +76,7 @@ void tst_QPageLayout::basics() QCOMPARE(simple.paintRectPixels(72), QRect(0, 0, 595, 842)); const QPageLayout a4portrait = simple; - QVERIFY(a4portrait == simple); + QCOMPARE(a4portrait, simple); // Change orientation simple.setOrientation(QPageLayout::Landscape); diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 55b869d424..3e98e630c2 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -799,7 +799,7 @@ void tst_QPainter::drawPixmapFragments() QImage origImage = origPixmap.toImage().convertToFormat(QImage::Format_ARGB32); QImage resImage = resPixmap.toImage().convertToFormat(QImage::Format_ARGB32); - QVERIFY(resImage.size() == resPixmap.size()); + QCOMPARE(resImage.size(), resPixmap.size()); QVERIFY(resImage.pixel(5, 5) == origImage.pixel(15, 15)); QVERIFY(resImage.pixel(5, 15) == origImage.pixel(15, 5)); QVERIFY(resImage.pixel(15, 5) == origImage.pixel(5, 15)); @@ -807,16 +807,16 @@ void tst_QPainter::drawPixmapFragments() QPainter::PixmapFragment fragment = QPainter::PixmapFragment::create(QPointF(20, 20), QRectF(30, 30, 2, 2)); - QVERIFY(fragment.x == 20); - QVERIFY(fragment.y == 20); - QVERIFY(fragment.sourceLeft == 30); - QVERIFY(fragment.sourceTop == 30); - QVERIFY(fragment.width == 2); - QVERIFY(fragment.height == 2); - QVERIFY(fragment.scaleX == 1); - QVERIFY(fragment.scaleY == 1); - QVERIFY(fragment.rotation == 0); - QVERIFY(fragment.opacity == 1); + QCOMPARE(fragment.x, qreal(20)); + QCOMPARE(fragment.y, qreal(20)); + QCOMPARE(fragment.sourceLeft, qreal(30)); + QCOMPARE(fragment.sourceTop, qreal(30)); + QCOMPARE(fragment.width, qreal(2)); + QCOMPARE(fragment.height, qreal(2)); + QCOMPARE(fragment.scaleX, qreal(1)); + QCOMPARE(fragment.scaleY, qreal(1)); + QCOMPARE(fragment.rotation, qreal(0)); + QCOMPARE(fragment.opacity, qreal(1)); } void tst_QPainter::drawPixmapNegativeScale() @@ -1481,7 +1481,7 @@ void tst_QPainter::drawPath3() p.drawPath(path); p.end(); - QVERIFY(imgA == imgB); + QCOMPARE(imgA, imgB); imgA.invertPixels(); imgB.fill(0xffffff); @@ -1495,7 +1495,7 @@ void tst_QPainter::drawPath3() p.drawPath(path); p.end(); - QVERIFY(imgA == imgB); + QCOMPARE(imgA, imgB); path.setFillRule(Qt::WindingFill); imgB.fill(0xffffff); diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 0a073f5c84..ae30719ee7 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -602,16 +602,16 @@ void tst_QPainterPath::testOperatorEquals() { QPainterPath empty1; QPainterPath empty2; - QVERIFY(empty1 == empty2); + QCOMPARE(empty1, empty2); QPainterPath rect1; rect1.addRect(100, 100, 100, 100); - QVERIFY(rect1 == rect1); + QCOMPARE(rect1, rect1); QVERIFY(rect1 != empty1); QPainterPath rect2; rect2.addRect(100, 100, 100, 100); - QVERIFY(rect1 == rect2); + QCOMPARE(rect1, rect2); rect2.setFillRule(Qt::WindingFill); QVERIFY(rect1 != rect2); @@ -622,7 +622,7 @@ void tst_QPainterPath::testOperatorEquals() QPainterPath ellipse2; ellipse2.addEllipse(50, 50, 100, 100); - QVERIFY(ellipse1 == ellipse2); + QCOMPARE(ellipse1, ellipse2); } void tst_QPainterPath::testOperatorEquals_fuzzy() @@ -638,12 +638,12 @@ void tst_QPainterPath::testOperatorEquals_fuzzy() QPainterPath pb; pb.addRect(b); - QVERIFY(pa == pb); + QCOMPARE(pa, pb); QTransform transform; transform.translate(-100, -100); - QVERIFY(transform.map(pa) == transform.map(pb)); + QCOMPARE(transform.map(pa), transform.map(pb)); } // higher tolerance for error when path's bounding rect is big @@ -656,12 +656,12 @@ void tst_QPainterPath::testOperatorEquals_fuzzy() QPainterPath pb; pb.addRect(b); - QVERIFY(pa == pb); + QCOMPARE(pa, pb); QTransform transform; transform.translate(-1, -1); - QVERIFY(transform.map(pa) == transform.map(pb)); + QCOMPARE(transform.map(pa), transform.map(pb)); } // operator== should return true for a path that has @@ -676,7 +676,7 @@ void tst_QPainterPath::testOperatorEquals_fuzzy() QPainterPath b = transform.inverted().map(transform.map(a)); - QVERIFY(a == b); + QCOMPARE(a, b); } { @@ -720,7 +720,7 @@ void tst_QPainterPath::testOperatorDatastream() stream >> other; } - QVERIFY(other == path); + QCOMPARE(other, path); } void tst_QPainterPath::closing() @@ -1066,19 +1066,19 @@ void tst_QPainterPath::setElementPositionAt() { QPainterPath path(QPointF(42., 42.)); QCOMPARE(path.elementCount(), 1); - QVERIFY(path.elementAt(0).type == QPainterPath::MoveToElement); + QCOMPARE(path.elementAt(0).type, QPainterPath::MoveToElement); QCOMPARE(path.elementAt(0).x, qreal(42.)); QCOMPARE(path.elementAt(0).y, qreal(42.)); QPainterPath copy = path; copy.setElementPositionAt(0, qreal(0), qreal(0)); QCOMPARE(copy.elementCount(), 1); - QVERIFY(copy.elementAt(0).type == QPainterPath::MoveToElement); + QCOMPARE(copy.elementAt(0).type, QPainterPath::MoveToElement); QCOMPARE(copy.elementAt(0).x, qreal(0)); QCOMPARE(copy.elementAt(0).y, qreal(0)); QCOMPARE(path.elementCount(), 1); - QVERIFY(path.elementAt(0).type == QPainterPath::MoveToElement); + QCOMPARE(path.elementAt(0).type, QPainterPath::MoveToElement); QCOMPARE(path.elementAt(0).x, qreal(42.)); QCOMPARE(path.elementAt(0).y, qreal(42.)); } @@ -1253,10 +1253,10 @@ void tst_QPainterPath::connectPathMoveTo() path1.connectPath(path2); - QVERIFY(path1.elementAt(0).type == QPainterPath::MoveToElement); - QVERIFY(path2.elementAt(0).type == QPainterPath::MoveToElement); - QVERIFY(path3.elementAt(0).type == QPainterPath::MoveToElement); - QVERIFY(path4.elementAt(0).type == QPainterPath::MoveToElement); + QCOMPARE(path1.elementAt(0).type, QPainterPath::MoveToElement); + QCOMPARE(path2.elementAt(0).type, QPainterPath::MoveToElement); + QCOMPARE(path3.elementAt(0).type, QPainterPath::MoveToElement); + QCOMPARE(path4.elementAt(0).type, QPainterPath::MoveToElement); } void tst_QPainterPath::translate() diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index c0e3c6d187..33f81cc10e 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -173,7 +173,7 @@ void tst_QRegion::setRects() QRect rect; region.setRects(&rect, 0); QVERIFY(region.isEmpty()); - QVERIFY(region == QRegion()); + QCOMPARE(region, QRegion()); QVERIFY(!region.boundingRect().isValid()); QVERIFY(region.rects().isEmpty()); } diff --git a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp index 1327cff1bd..60b89aa6ab 100644 --- a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp +++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp @@ -428,14 +428,14 @@ void tst_QTransform::matrix() mat1.m21(), mat1.m22(), 0, mat1.dx(), mat1.dy(), 1); - QVERIFY(tran1 == dummy); - QVERIFY(tran1.inverted() == dummy.inverted()); - QVERIFY(tran1.inverted() == QTransform(mat1.inverted())); - QVERIFY(tran2.inverted() == QTransform(mat2.inverted())); + QCOMPARE(tran1, dummy); + QCOMPARE(tran1.inverted(), dummy.inverted()); + QCOMPARE(tran1.inverted(), QTransform(mat1.inverted())); + QCOMPARE(tran2.inverted(), QTransform(mat2.inverted())); QMatrix mat3 = mat1 * mat2; QTransform tran3 = tran1 * tran2; - QVERIFY(QTransform(mat3) == tran3); + QCOMPARE(QTransform(mat3), tran3); /* QMatrix::operator==() doesn't use qFuzzyCompare(), which * on win32-g++ results in a failure. So we work around it by @@ -447,15 +447,15 @@ void tst_QTransform::matrix() QRect rect(43, 70, 200, 200); QPoint pt(43, 66); - QVERIFY(tranInv.map(pt) == matInv.map(pt)); - QVERIFY(tranInv.map(pt) == matInv.map(pt)); + QCOMPARE(tranInv.map(pt), matInv.map(pt)); + QCOMPARE(tranInv.map(pt), matInv.map(pt)); QPainterPath path; path.moveTo(55, 60); path.lineTo(110, 110); path.quadTo(220, 50, 10, 20); path.closeSubpath(); - QVERIFY(tranInv.map(path) == matInv.map(path)); + QCOMPARE(tranInv.map(path), matInv.map(path)); } void tst_QTransform::testOffset() @@ -741,8 +741,8 @@ void tst_QTransform::inverted() const QTransform inverted = matrix.inverted(); - QVERIFY(matrix.isIdentity() == inverted.isIdentity()); - QVERIFY(matrix.type() == inverted.type()); + QCOMPARE(matrix.isIdentity(), inverted.isIdentity()); + QCOMPARE(matrix.type(), inverted.type()); QVERIFY((matrix * inverted).isIdentity()); QVERIFY((inverted * matrix).isIdentity()); diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 5d78bc1d01..b1beb0ffd0 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -203,8 +203,8 @@ void tst_QCssParser::scanner() QCss::Scanner::scan(QCss::Scanner::preprocess(QString::fromUtf8(inputFile.readAll())), &symbols); QVERIFY(symbols.count() > 1); - QVERIFY(symbols.last().token == QCss::S); - QVERIFY(symbols.last().lexem() == QLatin1String("\n")); + QCOMPARE(symbols.last().token, QCss::S); + QCOMPARE(symbols.last().lexem(), QLatin1String("\n")); symbols.remove(symbols.count() - 1, 1); QFile outputFile(output); @@ -861,7 +861,7 @@ void tst_QCssParser::colorValue() QCss::Declaration decl; QVERIFY(parser.parseNextDeclaration(&decl)); const QColor col = decl.colorValue(); - QVERIFY(expectedColor.isValid() == col.isValid()); + QCOMPARE(expectedColor.isValid(), col.isValid()); QCOMPARE(col, expectedColor); } @@ -1304,7 +1304,7 @@ void tst_QCssParser::rulesForNode() decls += rules.at(i).declarations; } - QVERIFY(decls.count() == declCount); + QCOMPARE(decls.count(), declCount); if (declCount > 0) QCOMPARE(decls.at(0).d->values.at(0).variant.toString(), value0); @@ -1364,7 +1364,7 @@ void tst_QCssParser::shorthandBackgroundProperty() v.extractBackground(&brush, &image, &repeat, &alignment, &origin, &attachment, &ignoredOrigin); QFETCH(QBrush, expectedBrush); - QVERIFY(expectedBrush.color() == brush.color()); + QCOMPARE(expectedBrush.color(), brush.color()); QTEST(image, "expectedImage"); QTEST(int(repeat), "expectedRepeatValue"); @@ -1372,7 +1372,7 @@ void tst_QCssParser::shorthandBackgroundProperty() //QTBUG-9674 : a second evaluation should give the same results QVERIFY(v.extractBackground(&brush, &image, &repeat, &alignment, &origin, &attachment, &ignoredOrigin)); - QVERIFY(expectedBrush.color() == brush.color()); + QCOMPARE(expectedBrush.color(), brush.color()); QTEST(image, "expectedImage"); QTEST(int(repeat), "expectedRepeatValue"); QTEST(int(alignment), "expectedAlignment"); @@ -1438,7 +1438,7 @@ void tst_QCssParser::pseudoElement() decls += rules.at(i).declarations; } - QVERIFY(decls.count() == declCount); + QCOMPARE(decls.count(), declCount); } void tst_QCssParser::gradient_data() @@ -1517,21 +1517,21 @@ void tst_QCssParser::gradient() QBrush sbg, abg; QVERIFY(ve.extractPalette(&fg, &sfg, &sbg, &abg)); if (type == "linear") { - QVERIFY(sbg.style() == Qt::LinearGradientPattern); + QCOMPARE(sbg.style(), Qt::LinearGradientPattern); const QLinearGradient *lg = static_cast(sbg.gradient()); QCOMPARE(lg->start(), start); QCOMPARE(lg->finalStop(), finalStop); } else if (type == "conical") { - QVERIFY(sbg.style() == Qt::ConicalGradientPattern); + QCOMPARE(sbg.style(), Qt::ConicalGradientPattern); const QConicalGradient *cg = static_cast(sbg.gradient()); QCOMPARE(cg->center(), start); } const QGradient *g = sbg.gradient(); QCOMPARE(g->spread(), QGradient::Spread(spread)); - QVERIFY(g->stops().at(0).first == stop0); - QVERIFY(g->stops().at(0).second == color0); - QVERIFY(g->stops().at(1).first == stop1); - QVERIFY(g->stops().at(1).second == color1); + QCOMPARE(g->stops().at(0).first, stop0); + QCOMPARE(g->stops().at(0).second, color0); + QCOMPARE(g->stops().at(1).first, stop1); + QCOMPARE(g->stops().at(1).second, color1); } void tst_QCssParser::extractFontFamily_data() @@ -1637,15 +1637,15 @@ void tst_QCssParser::extractBorder() QSize radii[4]; extractor.extractBorder(widths, colors, styles, radii); - QVERIFY(widths[QCss::TopEdge] == expectedTopWidth); - QVERIFY(styles[QCss::TopEdge] == expectedTopStyle); - QVERIFY(colors[QCss::TopEdge] == expectedTopColor); + QCOMPARE(widths[QCss::TopEdge], expectedTopWidth); + QCOMPARE(int(styles[QCss::TopEdge]), expectedTopStyle); + QCOMPARE(colors[QCss::TopEdge].color(), expectedTopColor); //QTBUG-9674 : a second evaluation should give the same results QVERIFY(extractor.extractBorder(widths, colors, styles, radii)); - QVERIFY(widths[QCss::TopEdge] == expectedTopWidth); - QVERIFY(styles[QCss::TopEdge] == expectedTopStyle); - QVERIFY(colors[QCss::TopEdge] == expectedTopColor); + QCOMPARE(widths[QCss::TopEdge], expectedTopWidth); + QCOMPARE(int(styles[QCss::TopEdge]), expectedTopStyle); + QCOMPARE(colors[QCss::TopEdge].color(), expectedTopColor); } void tst_QCssParser::noTextDecoration() diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 64b06e9856..462e5115b4 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -217,15 +217,15 @@ void tst_QFont::exactMatch() || fontinfo.family().isEmpty()); } if (font.pointSize() != -1) { - QVERIFY(font.pointSize() == fontinfo.pointSize()); + QCOMPARE(font.pointSize(), fontinfo.pointSize()); } else { - QVERIFY(font.pixelSize() == fontinfo.pixelSize()); + QCOMPARE(font.pixelSize(), fontinfo.pixelSize()); } - QVERIFY(font.italic() == fontinfo.italic()); + QCOMPARE(font.italic(), fontinfo.italic()); if (font.weight() != fontinfo.weight()) { qDebug("font is %s", font.toString().toLatin1().constData()); } - QVERIFY(font.weight() == fontinfo.weight()); + QCOMPARE(font.weight(), fontinfo.weight()); } else { font.setFixedPitch(!fontinfo.fixedPitch()); QFontInfo fontinfo1(font); @@ -274,12 +274,12 @@ void tst_QFont::exactMatch() || fontinfo.family().contains(font.family()) || fontinfo.family().isEmpty()); if (font.pointSize() != -1) { - QVERIFY(font.pointSize() == fontinfo.pointSize()); + QCOMPARE(font.pointSize(), fontinfo.pointSize()); } else { - QVERIFY(font.pixelSize() == fontinfo.pixelSize()); + QCOMPARE(font.pixelSize(), fontinfo.pixelSize()); } - QVERIFY(font.italic() == fontinfo.italic()); - QVERIFY(font.weight() == fontinfo.weight()); + QCOMPARE(font.italic(), fontinfo.italic()); + QCOMPARE(font.weight(), fontinfo.weight()); } else { font.setFixedPitch(!fontinfo.fixedPitch()); QFontInfo fontinfo1(font, (QFont::Script) script); @@ -371,42 +371,42 @@ void tst_QFont::compare() QVERIFY(font != font2); QCOMPARE(font < font2,!(font2 < font)); font2.setItalic(false); - QVERIFY(font == font2); + QCOMPARE(font, font2); QVERIFY(!(font < font2)); font2.setWeight(QFont::Bold); QVERIFY(font != font2); QCOMPARE(font < font2,!(font2 < font)); font2.setWeight(QFont::Normal); - QVERIFY(font == font2); + QCOMPARE(font, font2); QVERIFY(!(font < font2)); font.setUnderline(true); QVERIFY(font != font2); QCOMPARE(font < font2,!(font2 < font)); font.setUnderline(false); - QVERIFY(font == font2); + QCOMPARE(font, font2); QVERIFY(!(font < font2)); font.setStrikeOut(true); QVERIFY(font != font2); QCOMPARE(font < font2,!(font2 < font)); font.setStrikeOut(false); - QVERIFY(font == font2); + QCOMPARE(font, font2); QVERIFY(!(font < font2)); font.setOverline(true); QVERIFY(font != font2); QCOMPARE(font < font2,!(font2 < font)); font.setOverline(false); - QVERIFY(font == font2); + QCOMPARE(font, font2); QVERIFY(!(font < font2)); font.setCapitalization(QFont::SmallCaps); QVERIFY(font != font2); QCOMPARE(font < font2,!(font2 < font)); font.setCapitalization(QFont::MixedCase); - QVERIFY(font == font2); + QCOMPARE(font, font2); QVERIFY(!(font < font2)); } } @@ -426,27 +426,27 @@ void tst_QFont::resolve() font1.setWeight(QFont::Bold); QFont font2 = font1.resolve(font); - QVERIFY(font2.weight() == font1.weight()); + QCOMPARE(font2.weight(), font1.weight()); - QVERIFY(font2.pointSize() == font.pointSize()); - QVERIFY(font2.italic() == font.italic()); - QVERIFY(font2.underline() == font.underline()); - QVERIFY(font2.overline() == font.overline()); - QVERIFY(font2.strikeOut() == font.strikeOut()); - QVERIFY(font2.stretch() == font.stretch()); + QCOMPARE(font2.pointSize(), font.pointSize()); + QCOMPARE(font2.italic(), font.italic()); + QCOMPARE(font2.underline(), font.underline()); + QCOMPARE(font2.overline(), font.overline()); + QCOMPARE(font2.strikeOut(), font.strikeOut()); + QCOMPARE(font2.stretch(), font.stretch()); QFont font3; font3.setStretch(QFont::UltraCondensed); QFont font4 = font3.resolve(font1).resolve(font); - QVERIFY(font4.stretch() == font3.stretch()); + QCOMPARE(font4.stretch(), font3.stretch()); - QVERIFY(font4.weight() == font.weight()); - QVERIFY(font4.pointSize() == font.pointSize()); - QVERIFY(font4.italic() == font.italic()); - QVERIFY(font4.underline() == font.underline()); - QVERIFY(font4.overline() == font.overline()); - QVERIFY(font4.strikeOut() == font.strikeOut()); + QCOMPARE(font4.weight(), font.weight()); + QCOMPARE(font4.pointSize(), font.pointSize()); + QCOMPARE(font4.italic(), font.italic()); + QCOMPARE(font4.underline(), font.underline()); + QCOMPARE(font4.overline(), font.overline()); + QCOMPARE(font4.strikeOut(), font.strikeOut()); QFont f1,f2,f3; @@ -479,8 +479,8 @@ void tst_QFont::resetFont() child->setFont(QFont()); // reset font - QVERIFY(child->font().resolve() == 0); - QVERIFY(child->font().pointSize() == parent.font().pointSize()); + QCOMPARE(child->font().resolve(), uint(0)); + QCOMPARE(child->font().pointSize(), parent.font().pointSize()); QVERIFY(parent.font().resolve() != 0); } #endif @@ -728,24 +728,24 @@ void tst_QFont::sharing() QCOMPARE(QFontPrivate::get(f)->engineData->ref.load(), 1 + refs_by_cache); QFont f2(f); - QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f)); + QCOMPARE(QFontPrivate::get(f2), QFontPrivate::get(f)); QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2); QVERIFY(QFontPrivate::get(f2)->engineData); - QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f2)->engineData, QFontPrivate::get(f)->engineData); QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1 + refs_by_cache); f2.setKerning(!f.kerning()); QVERIFY(QFontPrivate::get(f2) != QFontPrivate::get(f)); QCOMPARE(QFontPrivate::get(f2)->ref.load(), 1); QVERIFY(QFontPrivate::get(f2)->engineData); - QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f2)->engineData, QFontPrivate::get(f)->engineData); QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 2 + refs_by_cache); f2 = f; - QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f)); + QCOMPARE(QFontPrivate::get(f2), QFontPrivate::get(f)); QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2); QVERIFY(QFontPrivate::get(f2)->engineData); - QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f2)->engineData, QFontPrivate::get(f)->engineData); QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1 + refs_by_cache); if (f.pointSize() > 0) diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index c0b0738e2a..06448d11fe 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -170,7 +170,7 @@ void tst_QSyntaxHighlighter::basic() QVERIFY(hl->highlighted); QVERIFY(lout->documentChangedCalled); - QVERIFY(doc->begin().layout()->formats() == formats); + QCOMPARE(doc->begin().layout()->formats(), formats); } class CommentTestHighlighter : public QSyntaxHighlighter diff --git a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp index 967fe3114e..49300871d9 100644 --- a/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp @@ -102,7 +102,7 @@ void tst_QTextBlock::fragmentOverBlockBoundaries() // Block separators are always a fragment of their self. Thus: // |Hello|\b|World|\b| #if !defined(Q_OS_WIN) - QVERIFY(doc->docHandle()->fragmentMap().numNodes() == 4); + QCOMPARE(doc->docHandle()->fragmentMap().numNodes(), 4); #endif QCOMPARE(cursor.block().text(), QString("Hello")); cursor.movePosition(QTextCursor::NextBlock); @@ -126,7 +126,7 @@ void tst_QTextBlock::excludeParagraphSeparatorFragment() ++it; QVERIFY(it.atEnd()); - QVERIFY(it == block.end()); + QCOMPARE(it, block.end()); } void tst_QTextBlock::backwardsBlockIterator() diff --git a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp index d60d1e2ba1..9396cd678b 100644 --- a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp @@ -178,15 +178,15 @@ void tst_QTextCursor::navigation1() QVERIFY(doc->toPlainText() == "Hello World"); cursor.movePosition(QTextCursor::End); - QVERIFY(cursor.position() == 11); + QCOMPARE(cursor.position(), 11); cursor.deletePreviousChar(); - QVERIFY(cursor.position() == 10); + QCOMPARE(cursor.position(), 10); cursor.deletePreviousChar(); cursor.deletePreviousChar(); cursor.deletePreviousChar(); cursor.deletePreviousChar(); cursor.deletePreviousChar(); - QVERIFY(doc->toPlainText() == "Hello"); + QCOMPARE(doc->toPlainText(), QLatin1String("Hello")); QTextCursor otherCursor(doc); otherCursor.movePosition(QTextCursor::Start); @@ -195,12 +195,12 @@ void tst_QTextCursor::navigation1() cursor.movePosition(QTextCursor::Right); QVERIFY(cursor != otherCursor); otherCursor.insertText("Hey"); - QVERIFY(cursor.position() == 5); + QCOMPARE(cursor.position(), 5); doc->undo(); - QVERIFY(cursor.position() == 2); + QCOMPARE(cursor.position(), 2); doc->redo(); - QVERIFY(cursor.position() == 5); + QCOMPARE(cursor.position(), 5); doc->undo(); @@ -209,29 +209,29 @@ void tst_QTextCursor::navigation1() cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 6); - QVERIFY(cursor.position() == 6); + QCOMPARE(cursor.position(), 6); otherCursor = cursor; otherCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 2); otherCursor.deletePreviousChar(); otherCursor.deletePreviousChar(); otherCursor.deletePreviousChar(); - QVERIFY(cursor.position() == 5); + QCOMPARE(cursor.position(), 5); cursor.movePosition(QTextCursor::End); cursor.insertBlock(); { int oldPos = cursor.position(); cursor.movePosition(QTextCursor::End); - QVERIFY(cursor.position() == oldPos); + QCOMPARE(cursor.position(), oldPos); } QVERIFY(cursor.atBlockStart()); - QVERIFY(cursor.position() == 9); + QCOMPARE(cursor.position(), 9); QTextCharFormat fmt; fmt.setForeground(Qt::blue); cursor.insertText("Test", fmt); - QVERIFY(fmt == cursor.charFormat()); - QVERIFY(cursor.position() == 13); + QCOMPARE(fmt, cursor.charFormat()); + QCOMPARE(cursor.position(), 13); } void tst_QTextCursor::navigation2_data() @@ -573,8 +573,8 @@ void tst_QTextCursor::insertBlock() QTextBlockFormat fmt; fmt.setTopMargin(100); cursor.insertBlock(fmt); - QVERIFY(cursor.position() == 1); - QVERIFY(cursor.blockFormat() == fmt); + QCOMPARE(cursor.position(), 1); + QCOMPARE(cursor.blockFormat(), fmt); } void tst_QTextCursor::insertWithBlockSeparator1() @@ -584,28 +584,28 @@ void tst_QTextCursor::insertWithBlockSeparator1() cursor.insertText(text); cursor.movePosition(QTextCursor::PreviousBlock); - QVERIFY(cursor.position() == 0); + QCOMPARE(cursor.position(), 0); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.position() == 6); + QCOMPARE(cursor.position(), 6); } void tst_QTextCursor::insertWithBlockSeparator2() { cursor.insertText(QString(QChar::ParagraphSeparator)); - QVERIFY(cursor.position() == 1); + QCOMPARE(cursor.position(), 1); } void tst_QTextCursor::insertWithBlockSeparator3() { cursor.insertText(QString(QChar::ParagraphSeparator) + "Hi" + QString(QChar::ParagraphSeparator)); - QVERIFY(cursor.position() == 4); + QCOMPARE(cursor.position(), 4); } void tst_QTextCursor::insertWithBlockSeparator4() { cursor.insertText(QString(QChar::ParagraphSeparator) + QString(QChar::ParagraphSeparator)); - QVERIFY(cursor.position() == 2); + QCOMPARE(cursor.position(), 2); } void tst_QTextCursor::clearObjectType1() @@ -656,7 +656,7 @@ void tst_QTextCursor::comparisonOperators1() midCursor.movePosition(QTextCursor::NextWord); QVERIFY(midCursor <= cursor); - QVERIFY(midCursor == cursor); + QCOMPARE(midCursor, cursor); QVERIFY(midCursor >= cursor); QVERIFY(midCursor > startCursor); @@ -690,7 +690,7 @@ void tst_QTextCursor::comparisonOperators2() QTextCursor cursor2(&doc2); QVERIFY(cursor1 != cursor2); - QVERIFY(cursor1 == QTextCursor(&doc1)); + QCOMPARE(cursor1, QTextCursor(&doc1)); } void tst_QTextCursor::selection1() @@ -718,97 +718,97 @@ void tst_QTextCursor::dontCopyTableAttributes() void tst_QTextCursor::checkFrame1() { - QVERIFY(cursor.position() == 0); + QCOMPARE(cursor.position(), 0); QPointer frame = cursor.insertFrame(QTextFrameFormat()); QVERIFY(frame != 0); QTextFrame *root = frame->parentFrame(); QVERIFY(root != 0); - QVERIFY(frame->firstPosition() == 1); - QVERIFY(frame->lastPosition() == 1); + QCOMPARE(frame->firstPosition(), 1); + QCOMPARE(frame->lastPosition(), 1); QVERIFY(frame->parentFrame() != 0); - QVERIFY(root->childFrames().size() == 1); + QCOMPARE(root->childFrames().size(), 1); - QVERIFY(cursor.position() == 1); - QVERIFY(cursor.selectionStart() == 1); - QVERIFY(cursor.selectionEnd() == 1); + QCOMPARE(cursor.position(), 1); + QCOMPARE(cursor.selectionStart(), 1); + QCOMPARE(cursor.selectionEnd(), 1); doc->undo(); QVERIFY(!frame); - QVERIFY(root->childFrames().size() == 0); + QCOMPARE(root->childFrames().size(), 0); - QVERIFY(cursor.position() == 0); - QVERIFY(cursor.selectionStart() == 0); - QVERIFY(cursor.selectionEnd() == 0); + QCOMPARE(cursor.position(), 0); + QCOMPARE(cursor.selectionStart(), 0); + QCOMPARE(cursor.selectionEnd(), 0); doc->redo(); frame = doc->frameAt(1); QVERIFY(frame); - QVERIFY(frame->firstPosition() == 1); - QVERIFY(frame->lastPosition() == 1); + QCOMPARE(frame->firstPosition(), 1); + QCOMPARE(frame->lastPosition(), 1); QVERIFY(frame->parentFrame() != 0); - QVERIFY(root->childFrames().size() == 1); + QCOMPARE(root->childFrames().size(), 1); - QVERIFY(cursor.position() == 1); - QVERIFY(cursor.selectionStart() == 1); - QVERIFY(cursor.selectionEnd() == 1); + QCOMPARE(cursor.position(), 1); + QCOMPARE(cursor.selectionStart(), 1); + QCOMPARE(cursor.selectionEnd(), 1); // cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor); -// QVERIFY(cursor.position() == 2); -// QVERIFY(cursor.selectionStart() == 0); -// QVERIFY(cursor.selectionEnd() == 2); +// QCOMPARE(cursor.position(), 2); +// QCOMPARE(cursor.selectionStart(), 0); +// QCOMPARE(cursor.selectionEnd(), 2); } void tst_QTextCursor::checkFrame2() { - QVERIFY(cursor.position() == 0); + QCOMPARE(cursor.position(), 0); cursor.insertText("A"); - QVERIFY(cursor.position() == 1); + QCOMPARE(cursor.position(), 1); cursor.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor); QPointer frame = cursor.insertFrame(QTextFrameFormat()); QTextFrame *root = frame->parentFrame(); - QVERIFY(frame->firstPosition() == 1); - QVERIFY(frame->lastPosition() == 2); + QCOMPARE(frame->firstPosition(), 1); + QCOMPARE(frame->lastPosition(), 2); QVERIFY(frame->parentFrame() != 0); - QVERIFY(root->childFrames().size() == 1); + QCOMPARE(root->childFrames().size(), 1); - QVERIFY(cursor.position() == 1); - QVERIFY(cursor.selectionStart() == 1); - QVERIFY(cursor.selectionEnd() == 2); + QCOMPARE(cursor.position(), 1); + QCOMPARE(cursor.selectionStart(), 1); + QCOMPARE(cursor.selectionEnd(), 2); doc->undo(); QVERIFY(!frame); - QVERIFY(root->childFrames().size() == 0); + QCOMPARE(root->childFrames().size(), 0); - QVERIFY(cursor.position() == 0); - QVERIFY(cursor.selectionStart() == 0); - QVERIFY(cursor.selectionEnd() == 1); + QCOMPARE(cursor.position(), 0); + QCOMPARE(cursor.selectionStart(), 0); + QCOMPARE(cursor.selectionEnd(), 1); doc->redo(); frame = doc->frameAt(1); QVERIFY(frame); - QVERIFY(frame->firstPosition() == 1); - QVERIFY(frame->lastPosition() == 2); + QCOMPARE(frame->firstPosition(), 1); + QCOMPARE(frame->lastPosition(), 2); QVERIFY(frame->parentFrame() != 0); - QVERIFY(root->childFrames().size() == 1); + QCOMPARE(root->childFrames().size(), 1); - QVERIFY(cursor.position() == 1); - QVERIFY(cursor.selectionStart() == 1); - QVERIFY(cursor.selectionEnd() == 2); + QCOMPARE(cursor.position(), 1); + QCOMPARE(cursor.selectionStart(), 1); + QCOMPARE(cursor.selectionEnd(), 2); cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor); - QVERIFY(cursor.position() == 0); - QVERIFY(cursor.selectionStart() == 0); - QVERIFY(cursor.selectionEnd() == 3); + QCOMPARE(cursor.position(), 0); + QCOMPARE(cursor.selectionStart(), 0); + QCOMPARE(cursor.selectionEnd(), 3); } void tst_QTextCursor::insertBlockToUseCharFormat() @@ -833,9 +833,9 @@ void tst_QTextCursor::insertBlockToUseCharFormat() void tst_QTextCursor::tableMovement() { - QVERIFY(cursor.position() == 0); + QCOMPARE(cursor.position(), 0); cursor.insertText("AA"); - QVERIFY(cursor.position() == 2); + QCOMPARE(cursor.position(), 2); cursor.movePosition(QTextCursor::Left); cursor.insertTable(3, 3); @@ -1030,7 +1030,7 @@ void tst_QTextCursor::insertBlockShouldRemoveSelection() cursor.insertBlock(); QVERIFY(!cursor.hasSelection()); - QVERIFY(doc->toPlainText().indexOf("Hello") == -1); + QCOMPARE(doc->toPlainText().indexOf("Hello"), -1); } void tst_QTextCursor::insertBlockShouldRemoveSelection2() @@ -1046,7 +1046,7 @@ void tst_QTextCursor::insertBlockShouldRemoveSelection2() cursor.insertBlock(fmt); QVERIFY(!cursor.hasSelection()); - QVERIFY(doc->toPlainText().indexOf("Hello") == -1); + QCOMPARE(doc->toPlainText().indexOf("Hello"), -1); } void tst_QTextCursor::mergeCellShouldUpdateSelection() @@ -1159,7 +1159,7 @@ void tst_QTextCursor::setBlockFormatInTable() cursor.setBlockFormat(fmt); cursor.movePosition(QTextCursor::Start); - QVERIFY(cursor.blockFormat().background().color() == Qt::blue); + QCOMPARE(cursor.blockFormat().background().color(), QColor(Qt::blue)); } void tst_QTextCursor::blockCharFormat2() @@ -1174,7 +1174,7 @@ void tst_QTextCursor::blockCharFormat2() cursor.movePosition(QTextCursor::Start); cursor.insertText("Red"); cursor.movePosition(QTextCursor::PreviousCharacter); - QVERIFY(cursor.charFormat().foreground().color() == Qt::red); + QCOMPARE(cursor.charFormat().foreground().color(), QColor(Qt::red)); } void tst_QTextCursor::blockCharFormat3() @@ -1189,21 +1189,23 @@ void tst_QTextCursor::blockCharFormat3() cursor.insertText("Test"); cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextCharacter); - QVERIFY(cursor.charFormat().foreground().color() == Qt::green); + const QColor red(Qt::red); + const QColor green(Qt::green); + QCOMPARE(cursor.charFormat().foreground().color(), green); cursor.movePosition(QTextCursor::Start); - QVERIFY(cursor.charFormat().foreground().color() == Qt::green); + QCOMPARE(cursor.charFormat().foreground().color(), green); fmt.setForeground(Qt::red); cursor.setBlockCharFormat(fmt); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::red); + QCOMPARE(cursor.blockCharFormat().foreground().color(), red); cursor.movePosition(QTextCursor::End); cursor.movePosition(QTextCursor::Start); - QVERIFY(cursor.charFormat().foreground().color() == Qt::green); + QCOMPARE(cursor.charFormat().foreground().color(), green); cursor.insertText("Test"); - QVERIFY(cursor.charFormat().foreground().color() == Qt::green); + QCOMPARE(cursor.charFormat().foreground().color(), green); cursor.select(QTextCursor::Document); cursor.removeSelectedText(); @@ -1212,7 +1214,7 @@ void tst_QTextCursor::blockCharFormat3() QVERIFY(cursor.atStart()); cursor.insertText("Test"); - QVERIFY(cursor.charFormat().foreground().color() == Qt::red); + QCOMPARE(cursor.charFormat().foreground().color(), red); } void tst_QTextCursor::blockCharFormat() @@ -1222,12 +1224,12 @@ void tst_QTextCursor::blockCharFormat() cursor.insertBlock(QTextBlockFormat(), fmt); cursor.insertText("Hm"); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::blue); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::blue)); fmt.setForeground(Qt::red); cursor.setBlockCharFormat(fmt); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::red); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::red)); } void tst_QTextCursor::blockCharFormatOnSelection() @@ -1249,11 +1251,11 @@ void tst_QTextCursor::blockCharFormatOnSelection() cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::blue); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::blue)); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::red); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::red)); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::white); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::white)); cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextBlock); @@ -1264,17 +1266,17 @@ void tst_QTextCursor::blockCharFormatOnSelection() cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::cyan); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::cyan)); cursor.movePosition(QTextCursor::Right); cursor.movePosition(QTextCursor::Right); - QVERIFY(cursor.charFormat().foreground().color() == Qt::green); + QCOMPARE(cursor.charFormat().foreground().color(), QColor(Qt::green)); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::cyan); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::cyan)); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::white); + QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::white)); } void tst_QTextCursor::anchorInitialized1() @@ -1404,7 +1406,7 @@ void tst_QTextCursor::selectBlock() cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter); + QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignHCenter); QCOMPARE(cursor.block().text(), QString("blah")); } @@ -1449,7 +1451,7 @@ void tst_QTextCursor::insertFragmentShouldUseCurrentCharFormat() cursor.insertFragment(fragment); cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextCharacter); - QVERIFY(cursor.charFormat() == fmt); + QCOMPARE(cursor.charFormat(), fmt); } int tst_QTextCursor::blockCount() @@ -1910,15 +1912,15 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo() int cursorPositionAfter = cursor.position(); cursor.endEditBlock(); - QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD"); + QCOMPARE(doc->toPlainText(), QLatin1String("*AAAA*BBBB*CCCC*DDDD")); QCOMPARE(12, cursorPositionBefore); QCOMPARE(1, cursorPositionAfter); doc->undo(&cursor); - QVERIFY(doc->toPlainText() == "AAAABBBBCCCCDDDD"); + QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBBCCCCDDDD")); QCOMPARE(cursor.position(), cursorPositionBefore); doc->redo(&cursor); - QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD"); + QCOMPARE(doc->toPlainText(), QLatin1String("*AAAA*BBBB*CCCC*DDDD")); QCOMPARE(cursor.position(), cursorPositionAfter); } @@ -1932,11 +1934,11 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2() cursor.insertText("AAAABBBBCCCCDDDD"); cursor.endEditBlock(); doc->undo(&cursor); - QVERIFY(doc->toPlainText() == "AAAABBBB"); + QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBB")); QCOMPARE(cursor.position(), cursorPositionBefore); cursor.insertText("CCCC"); - QVERIFY(doc->toPlainText() == "AAAABBBBCCCC"); + QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBBCCCC")); cursorPositionBefore = cursor.position(); cursor.setPosition(0, QTextCursor::KeepAnchor); @@ -1951,7 +1953,7 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2() doc->undo(&cursor); - QVERIFY(doc->toPlainText() == "AAAABBBBCCCC"); + QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBBCCCC")); QCOMPARE(cursor.position(), cursorPositionBefore); } diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 5e6b606d83..7378ca85ee 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -744,7 +744,7 @@ void tst_QTextDocument::mightBeRichText() { QFETCH(QString, input); QFETCH(bool, result); - QVERIFY(result == Qt::mightBeRichText(input)); + QCOMPARE(result, Qt::mightBeRichText(input)); } Q_DECLARE_METATYPE(QTextDocumentFragment) @@ -2222,7 +2222,7 @@ void tst_QTextDocument::clonePreservesUserStates() b2 = b2.next(); QCOMPARE(b1.userState(), b2.userState()); } - QVERIFY(b2 == clone->end()); + QCOMPARE(b2, clone->end()); delete clone; } @@ -2269,7 +2269,7 @@ void tst_QTextDocument::resolvedFontInEmptyFormat() doc->setDefaultFont(font); QTextCharFormat fmt = doc->begin().charFormat(); QVERIFY(fmt.properties().isEmpty()); - QVERIFY(fmt.font() == font); + QCOMPARE(fmt.font(), font); } void tst_QTextDocument::defaultRootFrameMargin() @@ -2369,6 +2369,7 @@ void tst_QTextDocument::deleteTextObjectsOnClear() void tst_QTextDocument::defaultStyleSheet() { + const QColor green("green"); const QString sheet("p { background-color: green; }"); QVERIFY(doc->defaultStyleSheet().isEmpty()); doc->setDefaultStyleSheet(sheet); @@ -2376,30 +2377,30 @@ void tst_QTextDocument::defaultStyleSheet() cursor.insertHtml("

test"); QTextBlockFormat fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), green); doc->clear(); cursor.insertHtml("

test"); fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), green); QTextDocument *clone = doc->clone(); QCOMPARE(clone->defaultStyleSheet(), sheet); cursor = QTextCursor(clone); cursor.insertHtml("

test"); fmt = clone->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), green); delete clone; cursor = QTextCursor(doc); cursor.insertHtml("

test"); fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), green); doc->clear(); cursor.insertHtml("

test"); fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("red")); + QCOMPARE(fmt.background().color(), QColor(Qt::red)); doc->clear(); doc->setDefaultStyleSheet("invalid style sheet...."); @@ -2567,7 +2568,7 @@ void tst_QTextDocument::setTextPreservesUndoRedoEnabled() void tst_QTextDocument::firstLast() { QCOMPARE(doc->blockCount(), 1); - QVERIFY(doc->firstBlock() == doc->lastBlock()); + QCOMPARE(doc->firstBlock(), doc->lastBlock()); doc->setPlainText("Hello\nTest\nWorld"); @@ -3013,8 +3014,8 @@ void tst_QTextDocument::QTBUG27354_spaceAndSoftSpace() QTextBlock block = td.begin(); while (block.isValid()) { QTextBlockFormat fmt = block.blockFormat(); - QVERIFY(fmt.lineHeightType() == QTextBlockFormat::SingleHeight); - QVERIFY(fmt.lineHeight() == 0); + QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::SingleHeight)); + QCOMPARE(fmt.lineHeight(), qreal(0)); block = block.next(); } } @@ -3164,8 +3165,8 @@ void tst_QTextDocument::cssInheritance() QTextBlock block = td.begin(); while (block.isValid()) { QTextBlockFormat fmt = block.blockFormat(); - QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight); - QVERIFY(fmt.lineHeight() == 200); + QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::ProportionalHeight)); + QCOMPARE(fmt.lineHeight(), qreal(200)); block = block.next(); } } @@ -3175,12 +3176,12 @@ void tst_QTextDocument::cssInheritance() "

Foo

Bar

Baz

"); QTextBlock block = td.begin(); QTextBlockFormat fmt = block.blockFormat(); - QVERIFY(fmt.lineHeightType() == QTextBlockFormat::FixedHeight); - QVERIFY(fmt.lineHeight() == 40); + QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::FixedHeight)); + QCOMPARE(fmt.lineHeight(), qreal(40)); block = block.next(); fmt = block.blockFormat(); - QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight); - QVERIFY(fmt.lineHeight() == 300); + QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::ProportionalHeight)); + QCOMPARE(fmt.lineHeight(), qreal(300)); } { QTextDocument td; @@ -3188,7 +3189,7 @@ void tst_QTextDocument::cssInheritance() "

Foo

Bar

Baz

"); QTextBlock block = td.begin(); while (block.isValid()) { - QVERIFY(block.blockFormat().background() == QBrush()); + QCOMPARE(block.blockFormat().background(), QBrush()); QVERIFY(block.charFormat().font().bold()); block = block.next(); } diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index ccf4b6d82c..1cd9d9bcbe 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -727,7 +727,7 @@ void tst_QTextDocumentFragment::html_listIndents5() QCOMPARE(list->format().indent(), 1); cursor.movePosition(QTextCursor::NextBlock); - QVERIFY(cursor.currentList() == list); + QCOMPARE(cursor.currentList(), list); QCOMPARE(cursor.blockFormat().indent(), 0); } @@ -778,7 +778,7 @@ void tst_QTextDocumentFragment::blockCharFormatCopied() cleanup(); init(); cursor.insertFragment(frag); - QVERIFY(cursor.blockCharFormat() == fmt); + QCOMPARE(cursor.blockCharFormat(), fmt); } void tst_QTextDocumentFragment::initialBlock() @@ -794,19 +794,19 @@ void tst_QTextDocumentFragment::clone() mod.setAlignment(Qt::AlignCenter); cursor.mergeBlockFormat(mod); cursor.insertText("Blah"); - QVERIFY(cursor.blockFormat().alignment() == Qt::AlignCenter); + QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignCenter); QTextDocumentFragment frag(doc); cleanup(); init(); cursor.insertFragment(frag); cursor.movePosition(QTextCursor::Start); - QVERIFY(cursor.blockFormat().alignment() == Qt::AlignCenter); + QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignCenter); } void tst_QTextDocumentFragment::dontRemoveInitialBlockIfItHoldsObjectIndexedCharFormat() { const char html[] = "
cell onecell two
cell threecell four
"; - QVERIFY(doc->begin().charFormat().objectIndex() == -1); + QCOMPARE(doc->begin().charFormat().objectIndex(), -1); setHtml(QString::fromLatin1(html)); int cnt = 0; @@ -841,13 +841,13 @@ void tst_QTextDocumentFragment::unorderedListEnumeration() setHtml(QString::fromLatin1(html)); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDisc); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDisc); const char html2[] = "
      • Blah
    "; setHtml(QString::fromLatin1(html2)); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListCircle); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListCircle); } @@ -982,7 +982,7 @@ void tst_QTextDocumentFragment::cellBlockCount() int blockCount = 0; for (QTextFrame::iterator it = cell.begin(); !it.atEnd(); ++it) { - QVERIFY(it.currentFrame() == 0); + QVERIFY(!it.currentFrame()); QVERIFY(it.currentBlock().isValid()); ++blockCount; } @@ -1003,7 +1003,7 @@ void tst_QTextDocumentFragment::cellBlockCount2() int blockCount = 0; for (QTextFrame::iterator it = cell.begin(); !it.atEnd(); ++it) { - QVERIFY(it.currentFrame() == 0); + QVERIFY(!it.currentFrame()); QVERIFY(it.currentBlock().isValid()); ++blockCount; } @@ -1037,7 +1037,7 @@ void tst_QTextDocumentFragment::emptyTable3() QCOMPARE(table->columns(), 2); QTextTableCell cell = table->cellAt(0, 0); QVERIFY(cell.isValid()); - QVERIFY(cell.firstPosition() == cell.lastPosition()); + QCOMPARE(cell.firstPosition(), cell.lastPosition()); cell = table->cellAt(0, 1); QTextCursor cursor = cell.firstCursorPosition(); cursor.setPosition(cell.lastPosition(), QTextCursor::KeepAnchor); @@ -1065,7 +1065,7 @@ void tst_QTextDocumentFragment::inheritAlignment() const char html[] = "

    Hey"; setHtml(QString::fromLatin1(html)); // html alignment is absolute - QVERIFY(doc->begin().blockFormat().alignment() == Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute)); + QCOMPARE(doc->begin().blockFormat().alignment(), Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute)); } void tst_QTextDocumentFragment::dontEmitEmptyNodeWhenEmptyTagIsFollowedByCloseTag() @@ -1073,8 +1073,8 @@ void tst_QTextDocumentFragment::dontEmitEmptyNodeWhenEmptyTagIsFollowedByCloseTa // make sure the Hey does not end up as tag text for the img tag const char html[] = "

    Blah

    Hey"; setHtml(QString::fromLatin1(html)); - QVERIFY(doc->begin().blockFormat().alignment() == Qt::Alignment(Qt::AlignLeft|Qt::AlignAbsolute)); - QVERIFY(doc->begin().next().blockFormat().alignment() == Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute)); + QCOMPARE(doc->begin().blockFormat().alignment(), Qt::Alignment(Qt::AlignLeft|Qt::AlignAbsolute)); + QCOMPARE(doc->begin().next().blockFormat().alignment(), Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute)); } void tst_QTextDocumentFragment::toPlainText() @@ -1480,19 +1480,19 @@ void tst_QTextDocumentFragment::html_subAndSuperScript() const char alignmentInherited[] = "Subby"; setHtml(subHtml); - QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSubScript); + QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSubScript); setHtml(subHtmlCss); - QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSubScript); + QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSubScript); setHtml(superHtml); - QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSuperScript); + QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSuperScript); setHtml(superHtmlCss); - QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSuperScript); + QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSuperScript); setHtml(alignmentInherited); - QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSubScript); + QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSubScript); } void tst_QTextDocumentFragment::html_cssColors() @@ -1695,7 +1695,7 @@ void tst_QTextDocumentFragment::html_bodyBackground() const char html[] = "Foo"; doc->setHtml(html); - QVERIFY(doc->rootFrame()->frameFormat().background().style() == Qt::TexturePattern); + QCOMPARE(doc->rootFrame()->frameFormat().background().style(), Qt::TexturePattern); } void tst_QTextDocumentFragment::html_tableCellBackground() @@ -1709,7 +1709,7 @@ void tst_QTextDocumentFragment::html_tableCellBackground() QVERIFY(table); QTextTableCell cell = table->cellAt(0, 0); - QVERIFY(cell.format().background().style() == Qt::TexturePattern); + QCOMPARE(cell.format().background().style(), Qt::TexturePattern); } void tst_QTextDocumentFragment::css_bodyBackground() @@ -1717,7 +1717,7 @@ void tst_QTextDocumentFragment::css_bodyBackground() const char html[] = "Foo"; doc->setHtml(html); - QVERIFY(doc->rootFrame()->frameFormat().background().style() == Qt::TexturePattern); + QCOMPARE(doc->rootFrame()->frameFormat().background().style(), Qt::TexturePattern); } void tst_QTextDocumentFragment::css_tableCellBackground() @@ -1731,7 +1731,7 @@ void tst_QTextDocumentFragment::css_tableCellBackground() QVERIFY(table); QTextTableCell cell = table->cellAt(0, 0); - QVERIFY(cell.format().background().style() == Qt::TexturePattern); + QCOMPARE(cell.format().background().style(), Qt::TexturePattern); } void tst_QTextDocumentFragment::css_cellPaddings() @@ -1767,7 +1767,7 @@ void tst_QTextDocumentFragment::html_blockLevelDiv() setHtml(html); QCOMPARE(doc->begin().blockFormat().alignment(), Qt::AlignRight|Qt::AlignAbsolute); - QVERIFY(doc->begin().next() == doc->end()); + QCOMPARE(doc->begin().next(), doc->end()); } void tst_QTextDocumentFragment::html_spanNesting() @@ -1805,7 +1805,7 @@ void tst_QTextDocumentFragment::html_nestedLists() cursor.movePosition(QTextCursor::NextBlock); QTextList *thirdList = cursor.currentList(); QVERIFY(thirdList); - QVERIFY(thirdList == firstList); + QCOMPARE(thirdList, firstList); } void tst_QTextDocumentFragment::noSpecialCharactersInPlainText() @@ -2022,7 +2022,7 @@ void tst_QTextDocumentFragment::html_frameImport() cursor.insertFragment(frag); QList childFrames = doc->rootFrame()->childFrames(); - QVERIFY(childFrames.count() == 1); + QCOMPARE(childFrames.count(), 1); QTextFrame *frame = childFrames.first(); QCOMPARE(frame->frameFormat().margin(), ffmt.margin()); QCOMPARE(frame->frameFormat().border(), ffmt.border()); @@ -2050,7 +2050,7 @@ void tst_QTextDocumentFragment::html_frameImport2() cursor.insertFragment(frag); QList childFrames = doc->rootFrame()->childFrames(); - QVERIFY(childFrames.count() == 1); + QCOMPARE(childFrames.count(), 1); QTextFrame *frame = childFrames.first(); QCOMPARE(frame->frameFormat().topMargin(), ffmt.topMargin()); QCOMPARE(frame->frameFormat().bottomMargin(), ffmt.bottomMargin()); @@ -2065,7 +2065,7 @@ void tst_QTextDocumentFragment::html_dontAddMarginsAcrossTableCells() cursor.insertFragment(QTextDocumentFragment::fromHtml(QString::fromLatin1(html))); QList childFrames = doc->rootFrame()->childFrames(); - QVERIFY(childFrames.count() == 1); + QCOMPARE(childFrames.count(), 1); QTextFrame *frame = childFrames.first(); cursor = frame->firstCursorPosition(); QCOMPARE(cursor.blockFormat().leftMargin(), qreal(50.0)); @@ -2078,7 +2078,7 @@ void tst_QTextDocumentFragment::html_dontMergeCenterBlocks() QCOMPARE(doc->blockCount(), 2); QTextBlock blk = doc->begin(); - QVERIFY(blk.blockFormat().alignment() == Qt::AlignCenter); + QCOMPARE(blk.blockFormat().alignment(), Qt::AlignCenter); blk = blk.next(); QVERIFY(blk.blockFormat().alignment() != Qt::AlignCenter); } @@ -2112,7 +2112,7 @@ void tst_QTextDocumentFragment::html_tableCellBgColor2() QTextFrame::Iterator it = cell.begin(); QVERIFY(!it.atEnd()); - QVERIFY(it.currentFrame() == 0); + QVERIFY(!it.currentFrame()); QVERIFY(it.currentBlock().isValid()); ++it; @@ -2122,9 +2122,9 @@ void tst_QTextDocumentFragment::html_tableCellBgColor2() ++it; QVERIFY(!it.atEnd()); - QVERIFY(it.currentFrame() == 0); + QVERIFY(!it.currentFrame()); QVERIFY(it.currentBlock().isValid()); - QVERIFY(it.currentBlock().blockFormat().background() == QBrush(Qt::NoBrush)); + QCOMPARE(it.currentBlock().blockFormat().background(), QBrush(Qt::NoBrush)); ++it; QVERIFY(it.atEnd()); @@ -2245,8 +2245,8 @@ void tst_QTextDocumentFragment::html_blockVsInline() { { setHtml("

    Foo
    Bar"); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo

    Bar"); @@ -2255,23 +2255,23 @@ void tst_QTextDocumentFragment::html_blockVsInline() } { setHtml("

    Foo
    "); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo"); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo

    Bar"); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo
    Bar"); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo

    Bar"); @@ -2280,18 +2280,18 @@ void tst_QTextDocumentFragment::html_blockVsInline() } { setHtml("

    Foo
    "); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo"); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } { setHtml("

    Foo

    Bar"); - QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold); - QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold); + QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold)); + QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold)); } } @@ -2338,7 +2338,7 @@ void tst_QTextDocumentFragment::html_nestedTables() QTextTable *firstNestedTable = cursor.currentTable(); QVERIFY(firstNestedTable); - QVERIFY(firstNestedTable->parentFrame() == table); + QCOMPARE(firstNestedTable->parentFrame(), table); QCOMPARE(firstNestedTable->rows(), 1); QCOMPARE(firstNestedTable->columns(), 1); QCOMPARE(firstNestedTable->cellAt(0, 0).firstCursorPosition().block().text(), QString("Hello")); @@ -2348,13 +2348,13 @@ void tst_QTextDocumentFragment::html_nestedTables() ; QVERIFY(!cursor.isNull()); - QVERIFY(cursor.currentTable() == table); + QCOMPARE(cursor.currentTable(), table); cursor.movePosition(QTextCursor::NextBlock); QTextTable *secondNestedTable = cursor.currentTable(); QVERIFY(secondNestedTable); - QVERIFY(secondNestedTable->parentFrame() == table); + QCOMPARE(secondNestedTable->parentFrame(), table); QCOMPARE(secondNestedTable->rows(), 1); QCOMPARE(secondNestedTable->columns(), 1); QCOMPARE(secondNestedTable->cellAt(0, 0).firstCursorPosition().block().text(), QString("World")); @@ -2454,7 +2454,7 @@ void tst_QTextDocumentFragment::html_anchorColor() setHtml("Blue"); cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::NextCharacter); - QVERIFY(cursor.charFormat().foreground().color() == QGuiApplication::palette().link().color()); + QCOMPARE(cursor.charFormat().foreground().color(), QGuiApplication::palette().link().color()); setHtml("Green"); cursor.movePosition(QTextCursor::Start); @@ -2525,17 +2525,17 @@ void tst_QTextDocumentFragment::html_columnWidths() const QVector columnWidths = fmt.columnWidthConstraints(); QCOMPARE(columnWidths.count(), 2); - QVERIFY(columnWidths.at(0).type() == QTextLength::VariableLength); - QVERIFY(columnWidths.at(1).type() == QTextLength::PercentageLength); - QVERIFY(columnWidths.at(1).rawValue() == 1); + QCOMPARE(columnWidths.at(0).type(), QTextLength::VariableLength); + QCOMPARE(columnWidths.at(1).type(), QTextLength::PercentageLength); + QCOMPARE(columnWidths.at(1).rawValue(), qreal(1)); } void tst_QTextDocumentFragment::css_fontWeight() { setHtml("

    blah

    "); - QVERIFY(doc->begin().charFormat().fontWeight() == QFont::Bold); + QCOMPARE(doc->begin().charFormat().fontWeight(), int(QFont::Bold)); setHtml("

    blah

    "); - QVERIFY(doc->begin().charFormat().fontWeight() == QFont::Bold); + QCOMPARE(doc->begin().charFormat().fontWeight(), int(QFont::Bold)); } @@ -2548,7 +2548,7 @@ void tst_QTextDocumentFragment::css_float() QVERIFY(o); QTextFormat f = o->format(); QVERIFY(f.isFrameFormat()); - QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::FloatRight); + QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::FloatRight); setHtml(""); fmt = doc->begin().begin().fragment().charFormat(); @@ -2557,7 +2557,7 @@ void tst_QTextDocumentFragment::css_float() QVERIFY(o); f = o->format(); QVERIFY(f.isFrameFormat()); - QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::FloatRight); + QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::FloatRight); setHtml(""); fmt = doc->begin().begin().fragment().charFormat(); @@ -2566,7 +2566,7 @@ void tst_QTextDocumentFragment::css_float() QVERIFY(o); f = o->format(); QVERIFY(f.isFrameFormat()); - QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::FloatLeft); + QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::FloatLeft); } void tst_QTextDocumentFragment::css_textIndent() @@ -2585,7 +2585,7 @@ void tst_QTextDocumentFragment::css_inline() "

    test

    " ); QTextBlockFormat fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), QColor("green")); } void tst_QTextDocumentFragment::css_external() @@ -2596,11 +2596,12 @@ void tst_QTextDocumentFragment::css_external() "

    test

    " ); QTextBlockFormat fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), QColor("green")); } void tst_QTextDocumentFragment::css_import() { + const QColor green("green"); doc->addResource(QTextDocument::StyleSheetResource, QUrl("test.css"), QString("@import \"other.css\";")); doc->addResource(QTextDocument::StyleSheetResource, QUrl("other.css"), QString("@import url(\"other2.css\");")); doc->addResource(QTextDocument::StyleSheetResource, QUrl("other2.css"), QString("p { background-color: green; }")); @@ -2609,14 +2610,14 @@ void tst_QTextDocumentFragment::css_import() "

    test

    " ); QTextBlockFormat fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), green); doc->setHtml("" "" "

    test

    " ); fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), green); } void tst_QTextDocumentFragment::css_selectors_data() @@ -2662,9 +2663,9 @@ void tst_QTextDocumentFragment::css_selectors() QTextBlockFormat fmt = doc->begin().blockFormat(); if (match) - QVERIFY(fmt.background().color() == QColor("red")); + QCOMPARE(fmt.background().color(), QColor("red")); else - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), QColor("green")); } void tst_QTextDocumentFragment::css_nodeNameCaseInsensitivity() @@ -2674,7 +2675,7 @@ void tst_QTextDocumentFragment::css_nodeNameCaseInsensitivity() "" "

    test

    "); QTextBlockFormat fmt = doc->begin().blockFormat(); - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), QColor("green")); } void tst_QTextDocumentFragment::css_textUnderlineStyle_data() @@ -2710,14 +2711,14 @@ void tst_QTextDocumentFragment::css_textUnderlineStyleAndDecoration() QTextFragment fragment = doc->begin().begin().fragment(); QVERIFY(fragment.isValid()); - QVERIFY(fragment.charFormat().underlineStyle() == QTextCharFormat::SingleUnderline); + QCOMPARE(fragment.charFormat().underlineStyle(), QTextCharFormat::SingleUnderline); QVERIFY(fragment.charFormat().fontOverline()); doc->setHtml("Test"); fragment = doc->begin().begin().fragment(); QVERIFY(fragment.isValid()); - QVERIFY(fragment.charFormat().underlineStyle() == QTextCharFormat::SingleUnderline); + QCOMPARE(fragment.charFormat().underlineStyle(), QTextCharFormat::SingleUnderline); QVERIFY(fragment.charFormat().fontOverline()); } @@ -2726,48 +2727,48 @@ void tst_QTextDocumentFragment::css_listStyleType() doc->setHtml("
    1. Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDisc); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDisc); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListSquare); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListSquare); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListCircle); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListCircle); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDecimal); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDecimal); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerAlpha); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListLowerAlpha); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperAlpha); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListUpperAlpha); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperRoman); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListUpperRoman); doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerRoman); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListLowerRoman); // ignore the unsupported list-style-position inside the list-style shorthand property doc->setHtml("
    • Blah
    "); cursor.movePosition(QTextCursor::End); QVERIFY(cursor.currentList()); - QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDecimal); + QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDecimal); } void tst_QTextDocumentFragment::css_linkPseudo() @@ -2785,13 +2786,13 @@ void tst_QTextDocumentFragment::css_linkPseudo() void tst_QTextDocumentFragment::css_pageBreaks() { doc->setHtml("

    Foo

    "); - QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == QTextFormat::PageBreak_Auto); + QCOMPARE(doc->begin().blockFormat().pageBreakPolicy(), QTextFormat::PageBreak_Auto); doc->setHtml("

    Foo

    "); - QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == QTextFormat::PageBreak_AlwaysBefore); + QCOMPARE(doc->begin().blockFormat().pageBreakPolicy(), QTextFormat::PageBreak_AlwaysBefore); doc->setHtml("

    Foo

    "); - QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == QTextFormat::PageBreak_AlwaysAfter); + QCOMPARE(doc->begin().blockFormat().pageBreakPolicy(), QTextFormat::PageBreak_AlwaysAfter); doc->setHtml("

    Foo

    "); QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == (QTextFormat::PageBreak_AlwaysAfter | QTextFormat::PageBreak_AlwaysBefore)); @@ -2832,13 +2833,14 @@ void tst_QTextDocumentFragment::universalSelectors() QTextBlockFormat fmt = doc->begin().blockFormat(); if (match) - QVERIFY(fmt.background().color() == QColor("green")); + QCOMPARE(fmt.background().color(), QColor("green")); else QVERIFY(!fmt.hasProperty(QTextFormat::BackgroundBrush)); } void tst_QTextDocumentFragment::screenMedia() { + const QColor green("green"); setHtml("