summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2022-07-27 18:04:30 +0800
committerJiDe Zhang <zhangjide@uniontech.com>2022-08-18 10:40:42 +0800
commita6b55b3c46cf47d560e10a4b69db24a475261546 (patch)
treea7303a6d13a3266d2cc619e33436b6426225c257 /tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
parent371214dea7f92b3170d0239b3d9944275adf951a (diff)
Allow specify distance to plane for QTransform
The default camera to plane distance is 1024, when rotating a big image along the x or y axis, some areas of the screen may move above the camera, causing the rotation to fail. A new rotation interface has been added to allow users to specify the distance from the camera to the plane themselves when rotating the QImage. Also, this support has been added to QMatrix4x4::projectedRotate. [ChangeLog][QtGui][QTransform] Added overloads to rotate() and rotateRadians() that allow specifying of the distance to the rotation plane. Fixes: QTBUG-105088 Change-Id: I81f629916ddd9b6ab84e0282191e4284a88a85f5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp')
-rw-r--r--tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index 29c5248fe3..8a155a789e 100644
--- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -100,6 +100,7 @@ private slots:
void rotate4x4_data();
void rotate4x4();
+ void projectedRotate();
void normalMatrix_data();
void normalMatrix();
@@ -2383,6 +2384,22 @@ void tst_QMatrixNxN::rotate4x4()
}
}
+void tst_QMatrixNxN::projectedRotate()
+{
+ QMatrix4x4 m1, m2;
+ const QPointF origin(1000, 1000);
+
+ m1.translate(origin.x(), origin.y());
+ m1.projectedRotate(60, 0, 1, 0, 0);
+ m1.translate(-origin.x(), -origin.y());
+
+ m2.translate(origin.x(), origin.y());
+ m2.rotate(60, 0, 1, 0);
+ m2.translate(-origin.x(), -origin.y());
+
+ QCOMPARE(m1.toTransform(), m2.toTransform());
+}
+
static bool isSame(const QMatrix3x3& m1, const Matrix3& m2)
{
for (int row = 0; row < 3; ++row) {