aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-13 12:55:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-14 10:29:54 +0000
commit05685d645ca58c268bdf25c4c1b5cad4200406ed (patch)
treebe5eaa44cf875606fbe5ca12b12fbc2483573bea /sources/pyside2/tests
parent6bce0b92fa3fa29740d422d9f94ef1341ccf838f (diff)
PySide2: Base the QMatrix<R>x<C> on QGenericMatrix
After fixing non-type templates, QGenericMatrix can be specified as their base class. The inherited functions can then be used instead adding templates. Change-Id: I5ec435cf04d8443626a86a78643e2ad5d29f4a5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/QtGui/qmatrix_test.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/sources/pyside2/tests/QtGui/qmatrix_test.py b/sources/pyside2/tests/QtGui/qmatrix_test.py
index cac8a7ab7..a917199c1 100644
--- a/sources/pyside2/tests/QtGui/qmatrix_test.py
+++ b/sources/pyside2/tests/QtGui/qmatrix_test.py
@@ -29,7 +29,7 @@
import unittest
from PySide2.QtCore import QPoint
-from PySide2.QtGui import QMatrix, QMatrix4x4
+from PySide2.QtGui import QMatrix, QMatrix2x2, QMatrix4x4
def qpointTimesQMatrix(point, matrix):
@@ -49,6 +49,19 @@ class QMatrixTest(unittest.TestCase):
point = QPoint(3, 3)
self.assertRaises(TypeError, matrix.__mul__, point)
+ def testMatrix2x2(self):
+ matrix = QMatrix2x2([1.0, 2.0, 3.0, 4.0])
+
+ expectedTransposed = QMatrix2x2([1.0, 3.0, 2.0, 4.0])
+ self.assertEqual(matrix.transposed(), expectedTransposed)
+
+ expectedMultiplied = QMatrix2x2([2.0, 4.0, 6.0, 8.0])
+ matrix *= 2.0
+ self.assertEqual(matrix, expectedMultiplied)
+
+ matrix.setToIdentity()
+ self.assertTrue(matrix.isIdentity())
+
def testMatrix4x4(self):
self.assertRaises(TypeError, QMatrix4x4, [0.0, 1.0, 2.0, 3.0])
self.assertRaises(TypeError, QMatrix4x4, [0.0, 1.0, 2.0, 'I',