Skip to content

Commit

Permalink
unified font NotoSansCJK-Cy_SC_KR
Browse files Browse the repository at this point in the history
fixed codebase to fit this change

fixed tests to fit this change
  • Loading branch information
qlrd committed Aug 22, 2024
1 parent ac48e61 commit 6909a05
Show file tree
Hide file tree
Showing 44 changed files with 241 additions and 1,290 deletions.
Binary file removed assets/NanumGothic-Regular.ttf
Binary file not shown.
Binary file added assets/NotoSansCJK_Cy_SC_KR_Krux.ttf
Binary file not shown.
Binary file removed assets/NotoSansSC-Regular.ttf
Binary file not shown.
Binary file removed assets/terminus.ttf
Binary file not shown.
55 changes: 15 additions & 40 deletions e2e/test_002_check_permissions_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ def setUpClass(cls):
cwd_path = os.path.dirname(__file__)
rel_assets_path = os.path.join(cwd_path, "..", "assets")
assets_path = os.path.abspath(rel_assets_path)
terminus_path = os.path.join(assets_path, "terminus.ttf")
nanum_path = os.path.join(assets_path, "NanumGothic-Regular.ttf")
LabelBase.register(name="terminus", fn_regular=terminus_path)
LabelBase.register(name="nanum", fn_regular=nanum_path)
LabelBase.register(DEFAULT_FONT, terminus_path)
noto_sans_path = os.path.join(assets_path, "NotoSansCJK_Cy_SC_KR_Krux.ttf")
LabelBase.register(DEFAULT_FONT, noto_sans_path)

@classmethod
def teardown_class(cls):
Expand Down Expand Up @@ -103,7 +100,7 @@ def test_update_fail_check_user(
screen.update(name="CheckPermissionsScreen", key="check_user")

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_redirect_error.assert_called_once_with(msg="Not implemented for 'mockos'")
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_has_calls([call(), call(pretty=True)])
Expand Down Expand Up @@ -144,19 +141,17 @@ def test_update_check_user_in_ubuntu(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]Setup mockeduser for Ubuntu[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_called_once()
Expand Down Expand Up @@ -196,21 +191,19 @@ def test_update_check_user_in_fedora(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]",
"Setup mockeduser for Fedora",
"[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_called_once()
Expand Down Expand Up @@ -250,21 +243,19 @@ def test_update_check_user_in_linuxmint(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]",
"Setup mockeduser for Mint",
"[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_called_once()
Expand Down Expand Up @@ -306,21 +297,19 @@ def test_update_check_user_in_debian_like(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]",
"Setup mockeduser for Mockos",
"[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_has_calls([call(), call()])
Expand Down Expand Up @@ -360,18 +349,17 @@ def test_check_user_in_arch(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp][color=#efcc00]Setup mockeduser for ArchLinux[/color]",
f"[size={fontsize}sp]",
"[color=#efcc00]Setup mockeduser for ArchLinux[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_has_calls([call(), call()])
Expand Down Expand Up @@ -411,19 +399,17 @@ def test_update_check_user_in_manjaro(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]Setup mockeduser for Manjaro[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_has_calls([call(), call()])
Expand Down Expand Up @@ -465,19 +451,17 @@ def test_update_check_user_in_slackware(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]Setup mockeduser for Slackware[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_has_calls([call(), call()])
Expand Down Expand Up @@ -517,21 +501,19 @@ def test_update_check_user_in_gentoo(
screen.update(name="CheckPermissionsScreen", key="check_user")
message = "".join(
[
"[font=terminus]",
f"[size={fontsize}sp]",
"[color=#efcc00]",
"Setup mockeduser for Gentoo",
"[/color]",
"[/size]",
"[/font]",
]
)

# default assertions
self.assertEqual(button.text, message)

# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()
mock_environ_get.assert_called_once_with("USER")
mock_name.assert_called_once()
mock_id.assert_has_calls([call(), call()])
Expand Down Expand Up @@ -578,9 +560,7 @@ def test_check_group_not_in_group(
self.assertEqual(screen.in_dialout, False)

# patch assertions
mock_get_locale.assert_has_calls(
[call(), call(), call(), call()], any_order=True
)
mock_get_locale.assert_any_call()
mock_distro_name.assert_called_once_with(pretty=True)
mock_grp.getgrall.assert_called_once()

Expand All @@ -607,14 +587,12 @@ def test_update_make_on_permission_created(self, mock_get_locale):
screen.update(name="CheckPermissionsScreen", key="make_on_permission_created")
text = "\n".join(
[
"[font=terminus]",
f"[size={fontsize_m}sp][color=#efcc00]mocked command[/color][/size]",
"",
f"[size={fontsize_m}sp]You may need to logout (or even reboot)",
"and back in for the new group to take effect.",
"",
"Do not worry, this message won't appear again.[/size]",
"[/font]",
]
)

Expand All @@ -628,10 +606,7 @@ def test_update_make_on_permission_created(self, mock_get_locale):
self.assertEqual(screen.bin_args, None)
self.assertEqual(screen.group, None)
self.assertEqual(screen.user, None)

# Do test again
# patch assertions
mock_get_locale.assert_has_calls([call(), call()], any_order=True)
mock_get_locale.assert_any_call()

@patch.object(EventLoopBase, "ensure_window", lambda x: None)
@patch("sys.platform", "mockos")
Expand Down
Loading

0 comments on commit 6909a05

Please sign in to comment.