Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Screen Curtain unit test if active #17467

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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={resultEffect}, should be identity matrix. "
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
"Full screen colour effect set external to tests. ",
)
return

def test_setAndConfirmBlackFullscreenColorEffect(self):
result = Magnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK)
self.assertTrue(result)
Expand All @@ -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):
Expand Down