diff options
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r-- | tests/auto/gui/painting/CMakeLists.txt | 20 | ||||
-rw-r--r-- | tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 37 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpagesize/CMakeLists.txt | 14 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpaintengine/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpainterpath/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpen/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/auto/gui/painting/qtransform/tst_qtransform.cpp | 63 |
8 files changed, 119 insertions, 63 deletions
diff --git a/tests/auto/gui/painting/CMakeLists.txt b/tests/auto/gui/painting/CMakeLists.txt new file mode 100644 index 0000000000..e13679e282 --- /dev/null +++ b/tests/auto/gui/painting/CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from painting.pro. + +add_subdirectory("qpainterpath") +add_subdirectory("qpainterpathstroker") +# add_subdirectory("qcolor") +# add_subdirectory("qbrush") +# add_subdirectory("qregion") +# add_subdirectory("qpagelayout") +add_subdirectory("qpagesize") +# add_subdirectory("qpainter") +if (QT_FEATURE_private_tests) + # not converted yet + #add_subdirectory("qpathclipper") +endif() +# add_subdirectory("qpdfwriter") +add_subdirectory("qpen") +add_subdirectory("qpaintengine") +# add_subdirectory("qtransform") +# add_subdirectory("qwmatrix") +# add_subdirectory("qpolygon") diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 07c820dc86..f8502c1e2f 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -1032,6 +1032,15 @@ void tst_QColor::setRgbF() QCOMPARE(qfloat16(b2), qfloat16(b)); } } + QVERIFY(color.isValid()); + QColor invalidRgb = color; + QColor invalidRgbF = color; + QTest::ignoreMessage(QtWarningMsg, "QColor::setRgb: RGB parameters out of range"); + invalidRgb.setRgb(-1, -1, -1); + QTest::ignoreMessage(QtWarningMsg, "QColor::setRgb: RGB parameters out of range"); + invalidRgbF.setRgb(-1, -1, -1, -1); + QVERIFY(!invalidRgb.isValid()); + QVERIFY(!invalidRgbF.isValid()); } void tst_QColor::setRgba() @@ -1146,6 +1155,16 @@ void tst_QColor::setHsv() QCOMPARE(v2, v); } } + QVERIFY(color.isValid()); + QVERIFY(color.isValid()); + QColor invalidHsv = color; + QColor invalidHsvF = color; + QTest::ignoreMessage(QtWarningMsg, "QColor::setHsv: HSV parameters out of range"); + invalidHsv.setHsv(-1, -1, -1); + QTest::ignoreMessage(QtWarningMsg, "QColor::setHsvF: HSV parameters out of range"); + invalidHsvF.setHsvF(-1, -1, -1); + QVERIFY(!invalidHsv.isValid()); + QVERIFY(!invalidHsvF.isValid()); } void tst_QColor::setCmyk() @@ -1271,6 +1290,15 @@ void tst_QColor::setCmyk() QCOMPARE(k2, k); } } + QVERIFY(color.isValid()); + QColor invalidCmyk = color; + QColor invalidCmykF = color; + QTest::ignoreMessage(QtWarningMsg, "QColor::setCmyk: CMYK parameters out of range"); + invalidCmyk.setCmyk(-1, -1, -1, -1, -1); + QTest::ignoreMessage(QtWarningMsg, "QColor::setCmykF: CMYK parameters out of range"); + invalidCmykF.setCmykF(-1, -1, -1, -1, -1); + QVERIFY(!invalidCmyk.isValid()); + QVERIFY(!invalidCmykF.isValid()); } void tst_QColor::setHsl() @@ -1372,6 +1400,15 @@ void tst_QColor::setHsl() QCOMPARE(l2, l); } } + QVERIFY(color.isValid()); + QColor invalidHsl = color; + QColor invalidHslF = color; + QTest::ignoreMessage(QtWarningMsg, "QColor::setHsl: HSL parameters out of range"); + invalidHsl.setHsl(-1, -1, -1, -1); + QTest::ignoreMessage(QtWarningMsg, "QColor::setHslF: HSL parameters out of range"); + invalidHslF.setHslF(-1, -1, -1, -1); + QVERIFY(!invalidHsl.isValid()); + QVERIFY(!invalidHslF.isValid()); } void tst_QColor::toRgb_data() diff --git a/tests/auto/gui/painting/qpagesize/CMakeLists.txt b/tests/auto/gui/painting/qpagesize/CMakeLists.txt new file mode 100644 index 0000000000..260abfbc0f --- /dev/null +++ b/tests/auto/gui/painting/qpagesize/CMakeLists.txt @@ -0,0 +1,14 @@ +# Generated from qpagesize.pro. + +##################################################################### +## tst_qpagesize Test: +##################################################################### + +add_qt_test(tst_qpagesize + SOURCES + tst_qpagesize.cpp + DEFINES + QT_USE_USING_NAMESPACE + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/gui/painting/qpaintengine/CMakeLists.txt b/tests/auto/gui/painting/qpaintengine/CMakeLists.txt new file mode 100644 index 0000000000..8125a98d3e --- /dev/null +++ b/tests/auto/gui/painting/qpaintengine/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qpaintengine.pro. + +##################################################################### +## tst_qpaintengine Test: +##################################################################### + +add_qt_test(tst_qpaintengine + SOURCES + tst_qpaintengine.cpp + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/gui/painting/qpainterpath/CMakeLists.txt b/tests/auto/gui/painting/qpainterpath/CMakeLists.txt new file mode 100644 index 0000000000..c2c88cc258 --- /dev/null +++ b/tests/auto/gui/painting/qpainterpath/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qpainterpath.pro. + +##################################################################### +## tst_qpainterpath Test: +##################################################################### + +add_qt_test(tst_qpainterpath + SOURCES + tst_qpainterpath.cpp + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt b/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt new file mode 100644 index 0000000000..a1c5f6547f --- /dev/null +++ b/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qpainterpathstroker.pro. + +##################################################################### +## tst_qpainterpathstroker Test: +##################################################################### + +add_qt_test(tst_qpainterpathstroker + SOURCES + tst_qpainterpathstroker.cpp + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/gui/painting/qpen/CMakeLists.txt b/tests/auto/gui/painting/qpen/CMakeLists.txt new file mode 100644 index 0000000000..d096f7a6ce --- /dev/null +++ b/tests/auto/gui/painting/qpen/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qpen.pro. + +##################################################################### +## tst_qpen Test: +##################################################################### + +add_qt_test(tst_qpen + SOURCES + tst_qpen.cpp + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp index 78638a7518..97c6ad60b8 100644 --- a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp +++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp @@ -46,8 +46,6 @@ private slots: void qhash(); void translate(); void scale(); - void matrix(); - void testOffset(); void types(); void types2_data(); void types2(); @@ -372,67 +370,6 @@ void tst_QTransform::scale() QVERIFY( QTransform::fromScale( 1, 1 ) == QTransform()); } -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -void tst_QTransform::matrix() -{ - QMatrix mat1; - mat1.scale(0.3, 0.7); - mat1.translate(53.3, 94.4); - mat1.rotate(45); - - QMatrix mat2; - mat2.rotate(33); - mat2.scale(0.6, 0.6); - mat2.translate(13.333, 7.777); - - QTransform tran1(mat1); - QTransform tran2(mat2); - QTransform dummy; - dummy.setMatrix(mat1.m11(), mat1.m12(), 0, - mat1.m21(), mat1.m22(), 0, - mat1.dx(), mat1.dy(), 1); - - 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; - QCOMPARE(QTransform(mat3), tran3); - - /* QMatrix::operator==() doesn't use qFuzzyCompare(), which - * on win32-g++ results in a failure. So we work around it by - * calling QTranform::operator==(), which performs a fuzzy compare. */ - QCOMPARE(QTransform(mat3), QTransform(tran3.toAffine())); - - QTransform tranInv = tran1.inverted(); - QMatrix matInv = mat1.inverted(); - - QRect rect(43, 70, 200, 200); - QPoint pt(43, 66); - QCOMPARE(tranInv.mapRect(rect), matInv.mapRect(rect)); - 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(); - QCOMPARE(tranInv.map(path), matInv.map(path)); -} - -void tst_QTransform::testOffset() -{ - QTransform trans; - const QMatrix &aff = trans.toAffine(); - QCOMPARE((void*)(&aff), (void*)(&trans)); -} -QT_WARNING_POP -#endif - void tst_QTransform::types() { QTransform m1; |