diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/kernel/qmetatype/typeFlags.bin | bin | 144 -> 158 bytes | |||
-rw-r--r-- | tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 1 | ||||
-rw-r--r-- | tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp | 17 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp | 9 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp | 22 | ||||
-rw-r--r-- | tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp | 53 | ||||
-rw-r--r-- | tests/auto/gui/painting/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/gui/painting/painting.pro | 1 | ||||
-rw-r--r-- | tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 44 | ||||
-rw-r--r-- | tests/auto/gui/painting/qwmatrix/qwmatrix.pro | 6 | ||||
-rw-r--r-- | tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp | 334 | ||||
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 51 | ||||
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 4 | ||||
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp | 1 |
14 files changed, 16 insertions, 528 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/typeFlags.bin b/tests/auto/corelib/kernel/qmetatype/typeFlags.bin Binary files differindex 7009be98a2..0aa282efc9 100644 --- a/tests/auto/corelib/kernel/qmetatype/typeFlags.bin +++ b/tests/auto/corelib/kernel/qmetatype/typeFlags.bin diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 22464daf67..1b3bc8a627 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -1769,7 +1769,6 @@ void tst_QVariant::typeName_data() QTest::newRow("39") << int(QVariant::RectF) << QByteArray("QRectF"); QTest::newRow("40") << int(QVariant::PointF) << QByteArray("QPointF"); QTest::newRow("41") << int(QVariant::RegExp) << QByteArray("QRegExp"); - QTest::newRow("43") << int(QVariant::Matrix) << QByteArray("QMatrix"); QTest::newRow("44") << int(QVariant::Transform) << QByteArray("QTransform"); QTest::newRow("45") << int(QVariant::Hash) << QByteArray("QVariantHash"); QTest::newRow("46") << int(QVariant::Matrix4x4) << QByteArray("QMatrix4x4"); diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index d777d69d3c..75bfadb200 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -3297,7 +3297,7 @@ void tst_QDataStream::streamRealDataTypes() stream.setVersion(QDataStream::Qt_4_2); stream << qreal(0) << qreal(1.0) << qreal(1.1) << qreal(3.14) << qreal(-3.14) << qreal(-1); stream << QPointF(3, 5) << QRectF(-1, -2, 3, 4) << (QPolygonF() << QPointF(0, 0) << QPointF(1, 2)); - stream << QMatrix().rotate(90).scale(2, 2); + stream << QTransform().rotate(90).scale(2, 2).asAffineMatrix(); stream << path; stream << picture; stream << QTextLength(QTextLength::VariableLength, 1.5); @@ -3311,7 +3311,7 @@ void tst_QDataStream::streamRealDataTypes() QPointF point; QRectF rect; QPolygonF polygon; - QMatrix matrix; + QTransform transform; QPainterPath p; QPicture pict; QTextLength textLength; @@ -3361,8 +3361,9 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(rect, QRectF(-1, -2, 3, 4)); stream >> polygon; QCOMPARE((QVector<QPointF> &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2))); + auto matrix = transform.asAffineMatrix(); stream >> matrix; - QCOMPARE(matrix, QMatrix().rotate(90).scale(2, 2)); + QCOMPARE(transform, QTransform().rotate(90).scale(2, 2)); stream >> p; QCOMPARE(p, path); if (i == 1) { @@ -3384,10 +3385,7 @@ void tst_QDataStream::streamRealDataTypes() QCOMPARE(col, color); stream >> rGrad; QCOMPARE(rGrad.style(), radialBrush.style()); -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QCOMPARE(rGrad.matrix(), radialBrush.matrix()); -QT_WARNING_POP + QCOMPARE(rGrad.transform(), radialBrush.transform()); QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type()); QCOMPARE(rGrad.gradient()->stops(), radialBrush.gradient()->stops()); QCOMPARE(rGrad.gradient()->spread(), radialBrush.gradient()->spread()); @@ -3396,10 +3394,7 @@ QT_WARNING_POP QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius()); stream >> cGrad; QCOMPARE(cGrad.style(), conicalBrush.style()); -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QCOMPARE(cGrad.matrix(), conicalBrush.matrix()); -QT_WARNING_POP + QCOMPARE(cGrad.transform(), conicalBrush.transform()); QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type()); QCOMPARE(cGrad.gradient()->stops(), conicalBrush.gradient()->stops()); QCOMPARE(cGrad.gradient()->spread(), conicalBrush.gradient()->spread()); diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index d60d6643b2..f0c5bf79a7 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -67,7 +67,6 @@ private slots: F(QPen, QPen) \ F(QTextLength, QTextLength) \ F(QTextFormat, QTextFormat) \ - F(QMatrix, QMatrix) \ F(QTransform, QTransform) \ F(QMatrix4x4, QMatrix4x4) \ F(QVector2D, QVector2D) \ @@ -197,14 +196,6 @@ template<> struct TestValueFactory<QMetaType::QTextLength> { template<> struct TestValueFactory<QMetaType::QTextFormat> { static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); } }; -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -template<> struct TestValueFactory<QMetaType::QMatrix> { - static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); } -}; -QT_WARNING_POP -#endif template<> struct TestValueFactory<QMetaType::QTransform> { static QTransform *create() { return new QTransform(10, 20, 30, 40, 50, 60); } }; diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 8b301c145a..12998add71 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -36,7 +36,6 @@ #include <qcursor.h> #include <qimage.h> #include <qicon.h> -#include <qmatrix.h> #include <qmatrix4x4.h> #include <qpen.h> #include <qpolygon.h> @@ -87,8 +86,6 @@ private slots: void toBrush_data(); void toBrush(); - void matrix(); - void transform(); void matrix4x4(); @@ -402,24 +399,6 @@ void tst_QGuiVariant::toString() QCOMPARE( str, result ); } -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -void tst_QGuiVariant::matrix() -{ - QVariant variant; - QMatrix matrix = qvariant_cast<QMatrix>(variant); - QVERIFY(matrix.isIdentity()); - variant.setValue(QMatrix().rotate(90)); - QCOMPARE(QMatrix().rotate(90), qvariant_cast<QMatrix>(variant)); - - void *mmatrix = QMetaType::create(QVariant::Matrix, 0); - QVERIFY(mmatrix); - QMetaType::destroy(QVariant::Matrix, mmatrix); -} -QT_WARNING_POP -#endif - void tst_QGuiVariant::matrix4x4() { QVariant variant; @@ -711,7 +690,6 @@ void tst_QGuiVariant::implicitConstruction() F(Pen) \ F(TextLength) \ F(TextFormat) \ - F(Matrix) \ F(Transform) \ F(Matrix4x4) \ F(Vector2D) \ diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index 3c4f2f2e75..26e22e5883 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -144,7 +144,6 @@ private slots: void columnsAndRows(); - void convertQMatrix(); void convertQTransform(); void fill(); @@ -3061,58 +3060,6 @@ void tst_QMatrixNxN::columnsAndRows() QVERIFY(m1.row(3) == QVector4D(4, 8, 12, 16)); } -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -// Test converting QMatrix objects into QMatrix4x4 and then -// checking that transformations in the original perform the -// equivalent transformations in the new matrix. -void tst_QMatrixNxN::convertQMatrix() -{ - QMatrix m1; - m1.translate(-3.5, 2.0); - QPointF p1 = m1.map(QPointF(100.0, 150.0)); - QCOMPARE(p1.x(), 100.0 - 3.5); - QCOMPARE(p1.y(), 150.0 + 2.0); - - QMatrix4x4 m2(m1); - QPointF p2 = m2 * QPointF(100.0, 150.0); - QCOMPARE((double)p2.x(), 100.0 - 3.5); - QCOMPARE((double)p2.y(), 150.0 + 2.0); - QCOMPARE(m1, m2.toAffine()); - - QMatrix m3; - m3.scale(1.5, -2.0); - QPointF p3 = m3.map(QPointF(100.0, 150.0)); - QCOMPARE(p3.x(), 1.5 * 100.0); - QCOMPARE(p3.y(), -2.0 * 150.0); - - QMatrix4x4 m4(m3); - QPointF p4 = m4 * QPointF(100.0, 150.0); - QCOMPARE((double)p4.x(), 1.5 * 100.0); - QCOMPARE((double)p4.y(), -2.0 * 150.0); - QCOMPARE(m3, m4.toAffine()); - - QMatrix m5; - m5.rotate(45.0); - QPointF p5 = m5.map(QPointF(100.0, 150.0)); - - QMatrix4x4 m6(m5); - QPointF p6 = m6 * QPointF(100.0, 150.0); - QVERIFY(qFuzzyCompare(float(p5.x()), float(p6.x()))); - QVERIFY(qFuzzyCompare(float(p5.y()), float(p6.y()))); - - QMatrix m7 = m6.toAffine(); - QVERIFY(qFuzzyCompare(float(m5.m11()), float(m7.m11()))); - QVERIFY(qFuzzyCompare(float(m5.m12()), float(m7.m12()))); - QVERIFY(qFuzzyCompare(float(m5.m21()), float(m7.m21()))); - QVERIFY(qFuzzyCompare(float(m5.m22()), float(m7.m22()))); - QVERIFY(qFuzzyCompare(float(m5.dx()), float(m7.dx()))); - QVERIFY(qFuzzyCompare(float(m5.dy()), float(m7.dy()))); -} -QT_WARNING_POP -#endif - // Test converting QTransform objects into QMatrix4x4 and then // checking that transformations in the original perform the // equivalent transformations in the new matrix. diff --git a/tests/auto/gui/painting/CMakeLists.txt b/tests/auto/gui/painting/CMakeLists.txt index e13679e282..7cb4c55cee 100644 --- a/tests/auto/gui/painting/CMakeLists.txt +++ b/tests/auto/gui/painting/CMakeLists.txt @@ -16,5 +16,4 @@ endif() add_subdirectory("qpen") add_subdirectory("qpaintengine") # add_subdirectory("qtransform") -# add_subdirectory("qwmatrix") # add_subdirectory("qpolygon") diff --git a/tests/auto/gui/painting/painting.pro b/tests/auto/gui/painting/painting.pro index 26e84c1b15..3fdb0db760 100644 --- a/tests/auto/gui/painting/painting.pro +++ b/tests/auto/gui/painting/painting.pro @@ -14,7 +14,6 @@ SUBDIRS=\ qpen \ qpaintengine \ qtransform \ - qwmatrix \ qpolygon \ !qtConfig(private_tests): SUBDIRS -= \ diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 9eb62ceab2..7418f447e6 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -140,7 +140,7 @@ private slots: void setWindow(); - void combinedMatrix(); + void combinedTransform(); void renderHints(); void disableEnableClipping(); @@ -1692,7 +1692,7 @@ void tst_QPainter::setWindow() QVERIFY(195 < painted.height() && painted.height() < 205); // correct value is around 200 } -void tst_QPainter::combinedMatrix() +void tst_QPainter::combinedTransform() { QPixmap pm(64, 64); @@ -1703,15 +1703,7 @@ void tst_QPainter::combinedMatrix() p.translate(0.5, 0.5); QTransform ct = p.combinedTransform(); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QMatrix cm = p.combinedMatrix(); - QCOMPARE(cm, ct.toAffine()); -QT_WARNING_POP -#endif - - QPointF pt = QPointF(0, 0) * ct.toAffine(); + QPointF pt = QPointF(0, 0) * ct; QCOMPARE(pt.x(), 48.0); QCOMPARE(pt.y(), 16.0); @@ -4067,7 +4059,7 @@ void tst_QPainter::drawPolygon() path.moveTo(2, 34); path.lineTo(34, 2); - QPolygonF poly = stroker.createStroke(path).toFillPolygon(QTransform()); + QPolygonF poly = stroker.createStroke(path).toFillPolygon(); img.fill(0xffffffff); QPainter p(&img); @@ -4135,24 +4127,12 @@ void tst_QPainter::inactivePainter() p.setClipRegion(region); p.setClipping(true); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - p.combinedMatrix(); -QT_WARNING_POP -#endif p.combinedTransform(); p.compositionMode(); p.setCompositionMode(QPainter::CompositionMode_Plus); p.device(); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - p.deviceMatrix(); -QT_WARNING_POP -#endif p.deviceTransform(); p.font(); @@ -4176,12 +4156,6 @@ QT_WARNING_POP p.setRenderHint(QPainter::Antialiasing, true); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - p.resetMatrix(); -QT_WARNING_POP -#endif p.resetTransform(); p.rotate(1); p.scale(2, 2); @@ -4197,13 +4171,9 @@ QT_WARNING_POP p.window(); p.setWindow(QRect(10, 10, 620, 460)); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - p.worldMatrix(); - p.setWorldMatrix(QMatrix().translate(43, 21), true); -QT_WARNING_POP -#endif + p.worldTransform(); + p.setWorldTransform(QTransform().translate(43, 21), true); + p.setWorldMatrixEnabled(true); p.transform(); diff --git a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro deleted file mode 100644 index de6454025c..0000000000 --- a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG += testcase -TARGET = tst_qwmatrix -SOURCES += tst_qwmatrix.cpp -QT += testlib - -unix:!darwin:!haiku:!integrity: LIBS += -lm diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp deleted file mode 100644 index 281639c27a..0000000000 --- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QtTest> -#include <qmatrix.h> -#include <qmath.h> -#include <qpolygon.h> - -#if QT_DEPRECATED_SINCE(5, 15) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - -class tst_QWMatrix : public QObject -{ - Q_OBJECT - -private slots: - void mapRect_data(); - void mapToPolygon_data(); - void mapRect(); - void operator_star_qwmatrix(); - void assignments(); - void mapToPolygon(); - void translate(); - void scale(); - void mapPolygon(); - -private: - void mapping_data(); -}; - -void tst_QWMatrix::mapRect_data() -{ - mapping_data(); -} - -void tst_QWMatrix::mapToPolygon_data() -{ - mapping_data(); -} - -void tst_QWMatrix::mapping_data() -{ - //create the testtable instance and define the elements - QTest::addColumn<QMatrix>("matrix"); - QTest::addColumn<QRect>("src"); - QTest::addColumn<QPolygon>("res"); - - //next we fill it with data - - // identity - QTest::newRow( "identity" ) << QMatrix( 1, 0, 0, 1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 10, 20, 30, 40 ) ); - // scaling - QTest::newRow( "scale 0" ) << QMatrix( 2, 0, 0, 2, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 20, 40, 60, 80 ) ); - QTest::newRow( "scale 1" ) << QMatrix( 10, 0, 0, 10, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 100, 200, 300, 400 ) ); - // mirroring - QTest::newRow( "mirror 0" ) << QMatrix( -1, 0, 0, 1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -40, 20, 30, 40 ) ); - QTest::newRow( "mirror 1" ) << QMatrix( 1, 0, 0, -1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 10, -60, 30, 40 ) ); - QTest::newRow( "mirror 2" ) << QMatrix( -1, 0, 0, -1, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -40, -60, 30, 40 ) ); - QTest::newRow( "mirror 3" ) << QMatrix( -2, 0, 0, -2, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -80, -120, 60, 80 ) ); - QTest::newRow( "mirror 4" ) << QMatrix( -10, 0, 0, -10, 0, 0 ) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -400, -600, 300, 400 ) ); - QTest::newRow( "mirror 5" ) << QMatrix( -1, 0, 0, 1, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -30, 0, 30, 40 ) ); - QTest::newRow( "mirror 6" ) << QMatrix( 1, 0, 0, -1, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( 0, -40, 30, 40 ) ); - QTest::newRow( "mirror 7" ) << QMatrix( -1, 0, 0, -1, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -30, -40, 30, 40 ) ); - QTest::newRow( "mirror 8" ) << QMatrix( -2, 0, 0, -2, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -60, -80, 60, 80 ) ); - QTest::newRow( "mirror 9" ) << QMatrix( -10, 0, 0, -10, 0, 0 ) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -300, -400, 300, 400 ) ); - - const auto rotate = [](qreal degrees) { - const qreal rad = qDegreesToRadians(degrees); - return QMatrix(std::cos(rad), -std::sin(rad), - std::sin(rad), std::cos(rad), 0, 0); - }; - - // rotations - QTest::newRow( "rot 0 a" ) << rotate(0.) - << QRect( 0, 0, 30, 40 ) - << QPolygon ( QRect( 0, 0, 30, 40 ) ); - QTest::newRow( "rot 0 b" ) << rotate(0.00001f) - << QRect( 0, 0, 30, 40 ) - << QPolygon ( QRect( 0, 0, 30, 40 ) ); - QTest::newRow( "rot 0 c" ) << rotate(0.) - << QRect( 10, 20, 30, 40 ) - << QPolygon ( QRect( 10, 20, 30, 40 ) ); - QTest::newRow( "rot 0 d" ) << rotate(0.00001f) - << QRect( 10, 20, 30, 40 ) - << QPolygon ( QRect( 10, 20, 30, 40 ) ); - -#if 0 - const auto rotScale = [](qreal degrees, qreal scale) { - const qreal rad = qDegreesToRadians(degrees); - return QMatrix(scale * std::cos(rad), -scale * std::sin(rad), - scale * std::sin(rad), scale * std::cos(rad), 0, 0); - }; - // rotations with scaling - QTest::newRow( "rotscale 90 a" ) << rotScale(90., 10) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( 0, -299, 400, 300 ) ); - QTest::newRow( "rotscale 90 b" ) << rotScale(90.00001, 10) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( 0, -299, 400, 300 ) ); - QTest::newRow( "rotscale 90 c" ) << rotScale(90., 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 200, -399, 400, 300 ) ); - QTest::newRow( "rotscale 90 d" ) << rotScale(90.00001, 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 200, -399, 400, 300 ) ); - - QTest::newRow( "rotscale 180 a" ) << rotScale(180., 10) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -299, -399, 300, 400 ) ); - QTest::newRow( "rotscale 180 b" ) << rotScale(180.000001, 10) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -299, -399, 300, 400 ) ); - QTest::newRow( "rotscale 180 c" ) << rotScale(180., 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -399, -599, 300, 400 ) ); - QTest::newRow( "rotscale 180 d" ) << rotScale(180.000001, 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -399, -599, 300, 400 ) ); - - QTest::newRow( "rotscale 270 a" ) << rotScale(270., 10) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -399, 00, 400, 300 ) ); - QTest::newRow( "rotscale 270 b" ) << rotScale(270.0000001, 10) - << QRect( 0, 0, 30, 40 ) - << QPolygon( QRect( -399, 00, 400, 300 ) ); - QTest::newRow( "rotscale 270 c" ) << rotScale(270., 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -599, 100, 400, 300 ) ); - QTest::newRow( "rotscale 270 d" ) << rotScale(270.000001, 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -599, 100, 400, 300 ) ); - - // rotations that are not multiples of 90 degrees. mapRect returns the bounding rect here. - QTest::newRow( "rot 45 a" ) << rotate(45) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( 0, -7, 14, 14 ) ); - QTest::newRow( "rot 45 b" ) << rotate(45) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 21, -14, 49, 49 ) ); - QTest::newRow( "rot 45 c" ) << rotScale(45, 10) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( 0, -70, 141, 141 ) ); - QTest::newRow( "rot 45 d" ) << rotScale(45, 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( 212, -141, 495, 495 ) ); - - QTest::newRow( "rot -45 a" ) << rotate(-45) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( -7, 0, 14, 14 ) ); - QTest::newRow( "rot -45 b" ) << rotate(-45) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -35, 21, 49, 49 ) ); - QTest::newRow( "rot -45 c" ) << rotScale(-45, 10) - << QRect( 0, 0, 10, 10 ) - << QPolygon( QRect( -70, 0, 141, 141 ) ); - QTest::newRow( "rot -45 d" ) << rotScale(-45, 10) - << QRect( 10, 20, 30, 40 ) - << QPolygon( QRect( -353, 212, 495, 495 ) ); -#endif -} - -void tst_QWMatrix::mapRect() -{ - QFETCH( QMatrix, matrix ); - QFETCH( QRect, src ); -// qDebug( "got src: %d/%d (%d/%d), matrix=[ %f %f %f %f %f %f ]", -// src.x(), src.y(), src.width(), src.height(), -// matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), matrix.dx(), matrix.dy() ); - QTEST( QPolygon( matrix.mapRect(src) ), "res" ); -} - -void tst_QWMatrix::operator_star_qwmatrix() -{ - QMatrix m1( 2, 3, 4, 5, 6, 7 ); - QMatrix m2( 3, 4, 5, 6, 7, 8 ); - - QMatrix result1x2( 21, 26, 37, 46, 60, 74 ); - QMatrix result2x1( 22, 29, 34, 45, 52, 68); - - QMatrix product12 = m1*m2; - QMatrix product21 = m2*m1; - - QVERIFY( product12==result1x2 ); - QVERIFY( product21==result2x1 ); -} - - -void tst_QWMatrix::assignments() -{ - QMatrix m; - m.scale(2, 3); - m.rotate(45); - m.shear(4, 5); - - QMatrix c1(m); - - QCOMPARE(m.m11(), c1.m11()); - QCOMPARE(m.m12(), c1.m12()); - QCOMPARE(m.m21(), c1.m21()); - QCOMPARE(m.m22(), c1.m22()); - QCOMPARE(m.dx(), c1.dx()); - QCOMPARE(m.dy(), c1.dy()); - - QMatrix c2 = m; - QCOMPARE(m.m11(), c2.m11()); - QCOMPARE(m.m12(), c2.m12()); - QCOMPARE(m.m21(), c2.m21()); - QCOMPARE(m.m22(), c2.m22()); - QCOMPARE(m.dx(), c2.dx()); - QCOMPARE(m.dy(), c2.dy()); -} - - -void tst_QWMatrix::mapToPolygon() -{ - QFETCH( QMatrix, matrix ); - QFETCH( QRect, src ); - QFETCH( QPolygon, res ); - - QCOMPARE( matrix.mapToPolygon( src ), res ); -} - - -void tst_QWMatrix::translate() -{ - QMatrix m( 1, 2, 3, 4, 5, 6 ); - QMatrix res2( m ); - QMatrix res( 1, 2, 3, 4, 75, 106 ); - m.translate( 10, 20 ); - QVERIFY( m == res ); - m.translate( -10, -20 ); - QVERIFY( m == res2 ); -} - -void tst_QWMatrix::scale() -{ - QMatrix m( 1, 2, 3, 4, 5, 6 ); - QMatrix res2( m ); - QMatrix res( 10, 20, 60, 80, 5, 6 ); - m.scale( 10, 20 ); - QVERIFY( m == res ); - m.scale( 1./10., 1./20. ); - QVERIFY( m == res2 ); -} - -void tst_QWMatrix::mapPolygon() -{ - QPolygon poly; - poly << QPoint(0, 0) << QPoint(1, 1) << QPoint(100, 1) << QPoint(1, 100) << QPoint(-1, -1) << QPoint(-1000, 1000); - - { - QMatrix m; - m.rotate(90); - - // rotating 90 degrees four times should result in original poly - QPolygon mapped = m.map(m.map(m.map(m.map(poly)))); - QCOMPARE(mapped, poly); - - QMatrix m2; - m2.scale(10, 10); - QMatrix m3; - m3.scale(0.1, 0.1); - - mapped = m3.map(m2.map(poly)); - QCOMPARE(mapped, poly); - } - - { - QMatrix m(1, 2, 3, 4, 5, 6); - - QPolygon mapped = m.map(poly); - for (int i = 0; i < mapped.size(); ++i) - QCOMPARE(mapped.at(i), m.map(poly.at(i))); - } -} - -QT_WARNING_POP -#endif - -QTEST_APPLESS_MAIN(tst_QWMatrix) -#include "tst_qwmatrix.moc" diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 4206ce1f87..dc6a8fc564 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4496,19 +4496,6 @@ protected: break; case QGraphicsItem::ItemPositionHasChanged: break; -#if QT_DEPRECATED_SINCE(5, 14) - case QGraphicsItem::ItemMatrixChange: { -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QVariant variant; - variant.setValue<QMatrix>(matrix()); - oldValues << variant; -QT_WARNING_POP -#endif - } - break; -#endif case QGraphicsItem::ItemTransformChange: { QVariant variant; variant.setValue<QTransform>(transform()); @@ -4626,32 +4613,7 @@ void tst_QGraphicsItem::itemChange() QCOMPARE(tester.oldValues.constLast(), QVariant(true)); QCOMPARE(tester.isEnabled(), true); } -#if QT_DEPRECATED_SINCE(5, 13) - { -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen() - // ItemMatrixChange / ItemTransformHasChanged - tester.itemChangeReturnValue.setValue<QMatrix>(QMatrix().rotate(90)); - tester.setMatrix(QMatrix().translate(50, 0), true); - ++changeCount; // notification sent too - QCOMPARE(tester.changes.size(), ++changeCount); - QCOMPARE(int(tester.changes.at(tester.changes.size() - 2)), int(QGraphicsItem::ItemMatrixChange)); - QCOMPARE(int(tester.changes.last()), int(QGraphicsItem::ItemTransformHasChanged)); - QCOMPARE(qvariant_cast<QMatrix>(tester.values.at(tester.values.size() - 2)), - QMatrix().translate(50, 0)); - QCOMPARE(tester.values.constLast(), QVariant(QTransform(QMatrix().rotate(90)))); - QVariant variant; - variant.setValue<QMatrix>(QMatrix()); - QCOMPARE(tester.oldValues.constLast(), variant); - QCOMPARE(tester.matrix(), QMatrix().rotate(90)); -QT_WARNING_POP - } -#endif { - tester.resetTransform(); - ++changeCount; - ++changeCount; // notification sent too - // ItemTransformChange / ItemTransformHasChanged tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90)); tester.setTransform(QTransform::fromTranslate(50, 0), true); @@ -8016,21 +7978,10 @@ public: //Doesn't use the extended style option so the exposed rect is the boundingRect if (!(flags() & QGraphicsItem::ItemUsesExtendedStyleOption)) { QCOMPARE(option->exposedRect, boundingRect()); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QCOMPARE(option->matrix, QMatrix()); -QT_WARNING_POP -#endif } else { QVERIFY(option->exposedRect != QRect()); QVERIFY(option->exposedRect != boundingRect()); -#if QT_DEPRECATED_SINCE(5, 13) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QCOMPARE(option->matrix, sceneTransform().toAffine()); -QT_WARNING_POP -#endif + QCOMPARE(option->matrix, sceneTransform()); } } QGraphicsRectItem::paint(painter, option, widget); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 98833776cc..769836ff62 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -2125,8 +2125,8 @@ void tst_QGraphicsView::mapFromScenePath() QPainterPath path2; path2.addPolygon(polygon2); - QPolygonF pathPoly = view.mapFromScene(path).toFillPolygon(QTransform()); - QPolygonF path2Poly = path2.toFillPolygon(QTransform()); + QPolygonF pathPoly = view.mapFromScene(path).toFillPolygon(); + QPolygonF path2Poly = path2.toFillPolygon(); for (int i = 0; i < pathPoly.size(); ++i) { QVERIFY(qAbs(pathPoly[i].x() - path2Poly[i].x()) < 3); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp index 9550655868..bd470dbcfc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp @@ -39,7 +39,6 @@ Q_DECLARE_METATYPE(ExpectedValueDescription) Q_DECLARE_METATYPE(QList<int>) Q_DECLARE_METATYPE(QList<QRectF>) -Q_DECLARE_METATYPE(QMatrix) Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(Qt::ScrollBarPolicy) Q_DECLARE_METATYPE(ScrollBarCount) |