From 05685d645ca58c268bdf25c4c1b5cad4200406ed Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 13 Sep 2018 12:55:09 +0200 Subject: PySide2: Base the QMatrixx 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 Reviewed-by: Christian Tismer --- sources/pyside2/tests/QtGui/qmatrix_test.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sources/pyside2/tests') 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', -- cgit v1.2.3