diff --git a/tests/unit/test_visionEnhancementProviders/test_magnificationAPI.py b/tests/unit/test_visionEnhancementProviders/test_magnificationAPI.py index 819baaebb04..fe46b23d621 100644 --- a/tests/unit/test_visionEnhancementProviders/test_magnificationAPI.py +++ b/tests/unit/test_visionEnhancementProviders/test_magnificationAPI.py @@ -7,7 +7,7 @@ import unittest -from visionEnhancementProviders.screenCurtain import Magnification, TRANSFORM_BLACK +from visionEnhancementProviders.screenCurtain import Magnification, TRANSFORM_BLACK, MAGCOLOREFFECT class _Test_MagnificationAPI(unittest.TestCase): @@ -19,6 +19,29 @@ def tearDown(self): class Test_ScreenCurtain(_Test_MagnificationAPI): + def _isIdentityMatrix(self, magTransformMatrix: MAGCOLOREFFECT) -> bool: + for i in range(5): + for j in range(5): + if i == j: + if magTransformMatrix.transform[i][j] != 1: + return False + else: + if magTransformMatrix.transform[i][j] != 0: + return False + return True + + def setUp(self): + super().setUp() + resultEffect = Magnification.MagGetFullscreenColorEffect() + if not self._isIdentityMatrix(resultEffect): + # If the resultEffect is not the identity matrix, skip the test. + # This is because a full screen colour effect is already set external to testing. + self.skipTest( + f"{resultEffect=}, should be identity matrix. " + "Full screen colour effect set external to tests. ", + ) + return + def test_setAndConfirmBlackFullscreenColorEffect(self): result = Magnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK) self.assertTrue(result) @@ -32,18 +55,6 @@ def test_setAndConfirmBlackFullscreenColorEffect(self): msg=f"i={i}, j={j}, resultEffect={resultEffect}", ) - def test_getDefaultIdentityFullscreenColorEffect(self): - resultEffect = Magnification.MagGetFullscreenColorEffect() - for i in range(5): - for j in range(5): - with self.subTest(i=i, j=j): - # The transform matrix should be the identity matrix - self.assertEqual( - int(i == j), - resultEffect.transform[i][j], - msg=f"i={i}, j={j}, resultEffect={resultEffect}", - ) - class Test_Mouse(_Test_MagnificationAPI): def test_MagShowSystemCursor(self):