Skip to content

Commit

Permalink
Add test for GetLocaleKeyboardLayouts
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Jan 17, 2025
1 parent a95908e commit 715780a
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from dasbus.typing import Bool, Str, get_variant

from pyanaconda.modules.common.constants.services import LOCALIZATION
from pyanaconda.modules.common.structures.keyboard_layout import KeyboardLayout
from pyanaconda.modules.common.structures.language import LanguageData, LocaleData
from pyanaconda.modules.common.task import TaskInterface
from pyanaconda.modules.localization.installation import (
Expand Down Expand Up @@ -217,6 +218,62 @@ def test_locale_data(self):
}
assert data == english_us

def test_keyboard_layouts_for_language(self):
get_keyboard_layouts = self.localization_interface.GetLocaleKeyboardLayouts
layouts = get_keyboard_layouts("cs_CZ.UTF-8")

normalized_layouts = KeyboardLayout.from_structure_list(layouts)

expected_layouts = [
KeyboardLayout(
layout_id="cz",
description="Czech",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (bksl)",
description="Czech (extra backslash)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (qwerty)",
description="Czech (QWERTY)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (qwerty_bksl)",
description="Czech (QWERTY, extra backslash)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (winkeys)",
description="Czech (QWERTZ, Windows)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (winkeys-qwerty)",
description="Czech (QWERTY, Windows)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (qwerty-mac)",
description="Czech (QWERTY, Macintosh)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (ucw)",
description="Czech (UCW, only accented letters)",
langs=["Czech"],
),
KeyboardLayout(
layout_id="cz (dvorak-ucw)",
description="Czech (US, Dvorak, UCW support)",
langs=["Czech"],
),
]

assert normalized_layouts == expected_layouts

def test_common_locales(self):
common_locales = self.localization_interface.GetCommonLocales()

Expand Down

0 comments on commit 715780a

Please sign in to comment.