diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-10-07 19:33:50 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-10-18 14:13:27 +0200 |
commit | bed8663a0bc1024d604ce2fdd32e33d5a17cfe8c (patch) | |
tree | 623b28eee565ada8762f466c005adbe140b6fe7b /tests/auto/gui/painting | |
parent | 4af55438d05221edbda01d4c173c0ab3da88f850 (diff) |
tst_QPainterPath::testNaNandInfinites(): anticipate the warnings
The test used to trigger a lot of QWARN messages; these are clearly
intended, so tell QTest to expect them, so that we get an error here
if those warnings ever don't show up.
Incidentally tidy up a comment and convert a != verify to a
QCOMPARE_NE(), since it's now available to do that job.
Change-Id: I83e225c37abe8446dac06ebe4e75258cb87b71b0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r-- | tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 9938230551..20ee6e07c7 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -1220,38 +1220,65 @@ void tst_QPainterPath::testNaNandInfinites() QPointF p3 = QPointF(qQNaN(), 1); QPointF pInf = QPointF(qInf(), 1); - // all these operations with NaN/Inf should be ignored - // can't test operator>> reliably, as we can't create a path with NaN to << later + // All these operations with NaN/Inf should be ignored. + // Can't test operator>> reliably, as we can't create a path with NaN to << later. +#ifdef QT_NO_DEBUG +# define WARNS(name) +#else +# define WARNS(name) \ + QTest::ignoreMessage(QtWarningMsg, "QPainterPath::" #name ": " \ + "Adding point with invalid coordinates, ignoring call") +#endif + WARNS(moveTo); path1.moveTo(p1); + WARNS(moveTo); path1.moveTo(qSNaN(), qQNaN()); + WARNS(moveTo); path1.moveTo(pInf); + WARNS(lineTo); path1.lineTo(p1); + WARNS(lineTo); path1.lineTo(qSNaN(), qQNaN()); + WARNS(lineTo); path1.lineTo(pInf); + WARNS(cubicTo); path1.cubicTo(p1, p2, p3); + WARNS(cubicTo); path1.cubicTo(p1, QPointF(1, 1), QPointF(2, 2)); + WARNS(cubicTo); path1.cubicTo(pInf, QPointF(10, 10), QPointF(5, 1)); + WARNS(quadTo); path1.quadTo(p1, p2); + WARNS(quadTo); path1.quadTo(QPointF(1, 1), p3); + WARNS(quadTo); path1.quadTo(QPointF(1, 1), pInf); + WARNS(arcTo); path1.arcTo(QRectF(p1, p2), 5, 5); + WARNS(arcTo); path1.arcTo(QRectF(pInf, QPointF(1, 1)), 5, 5); + WARNS(addRect); path1.addRect(QRectF(p1, p2)); + WARNS(addRect); path1.addRect(QRectF(pInf, QPointF(1, 1))); + WARNS(addEllipse); path1.addEllipse(QRectF(p1, p2)); + WARNS(addEllipse); path1.addEllipse(QRectF(pInf, QPointF(1, 1))); +#undef WARNS + QCOMPARE(path1, path2); path1.lineTo(QPointF(1, 1)); - QVERIFY(path1 != path2); + QCOMPARE_NE(path1, path2); } #endif // signaling_nan |