Test: expected failure of Rotation::setValue() in unit tests

This commit is contained in:
wmayer
2023-03-01 17:43:20 +01:00
committed by wwmayer
parent d196f8c496
commit ea190ce3c2

View File

@@ -364,6 +364,25 @@ class AlgebraTestCase(unittest.TestCase):
p.Rotation.Angle = math.pi / 2
self.assertEqual(abs(p.inverse().Rotation.Angle), p.Rotation.Angle)
def testMatrixToRotationFailure(self):
mat = FreeCAD.Matrix()
mat.A21 = 1.0
with self.assertRaises(ValueError):
FreeCAD.Placement(mat)
with self.assertRaises(ValueError):
FreeCAD.Rotation(mat)
with self.assertRaises(ValueError):
FreeCAD.Rotation(*mat.A)
with self.assertRaises(ValueError):
FreeCAD.Rotation(1, 1, 0, 0, 1, 0, 0, 0, 1)
with self.assertRaises(ValueError):
rot = FreeCAD.Rotation()
rot.Matrix = FreeCAD.Matrix(1, 1, 0, 0, 1, 0, 0, 0, 1)
with self.assertRaises(ValueError):
plm = FreeCAD.Placement()
rot.Matrix = FreeCAD.Matrix(1, 1, 0, 0, 1, 0, 0, 0, 1)
def testYawPitchRoll(self):
def getYPR1(yaw, pitch, roll):
r = FreeCAD.Rotation()