def test_build_all_combined_ids(self, _init_pygame): theme = UIAppearanceTheme(BlockingThreadedResourceLoader()) with pytest.raises(ValueError, match="Object & class ID hierarchy is not " "equal in length to Element ID hierarchy"): theme.build_all_combined_ids(element_ids=['button'], class_ids=[None], object_ids=['whut', 'the', 'heck'])
def test_build_all_combined_ids(self, _init_pygame): theme = UIAppearanceTheme() with pytest.raises( ValueError, match= "Object ID hierarchy is not equal in length to Element ID hierarchy" ): theme.build_all_combined_ids(object_ids=['whut', 'the', 'heck'], element_ids=['button'])
def test_use_class_id_generated(self, _init_pygame, _display_surface_return_none: None): theme = UIAppearanceTheme(BlockingThreadedResourceLoader(), locale='en') theme.load_theme( PackageResource('tests.data.themes', 'appearance_theme_class_id_test.json')) combined_ids = theme.build_all_combined_ids( element_ids=['button'], class_ids=['@test_class'], object_ids=['#test_object_2']) assert combined_ids == ['#test_object_2', '@test_class', 'button'] border_width = theme.get_misc_data(misc_data_id='border_width', combined_element_ids=combined_ids) shadow_width = theme.get_misc_data(misc_data_id='shadow_width', combined_element_ids=combined_ids) assert shadow_width == '0' assert border_width == '3' combined_ids = theme.build_all_combined_ids( element_ids=['button'], class_ids=['@test_class'], object_ids=['#test_object_1']) assert combined_ids == ['#test_object_1', '@test_class', 'button'] border_width = theme.get_misc_data(misc_data_id='border_width', combined_element_ids=combined_ids) shadow_width = theme.get_misc_data(misc_data_id='shadow_width', combined_element_ids=combined_ids) assert border_width == '1' assert shadow_width == '3' combined_ids = theme.build_all_combined_ids( element_ids=['button'], class_ids=[None], object_ids=['#test_object_2']) assert combined_ids == ['#test_object_2', 'button'] border_width = theme.get_misc_data(misc_data_id='border_width', combined_element_ids=combined_ids) shadow_width = theme.get_misc_data(misc_data_id='shadow_width', combined_element_ids=combined_ids) assert border_width == '2' assert shadow_width == '0'