def test_get_colour_from_gradient_objects(self, _init_pygame):
     theme = UIAppearanceTheme()
     with pytest.warns(UserWarning, match="Invalid gradient"):
         theme.load_theme(os.path.join("tests", "data", "themes", "appearance_theme_test.json"))
     colour = theme.get_colour(object_ids=['#test_parent', '#test_child'], element_ids=['good_window','text_box'],
                               colour_id='dark_bg')
     assert colour == pygame.Color('#25f92e')
 def test_get_colour_from_gradient(self, _init_pygame):
     theme = UIAppearanceTheme(BlockingThreadedResourceLoader())
     theme.load_theme(
         os.path.join("tests", "data", "themes",
                      "ui_text_box_non_default.json"))
     colour = theme.get_colour(colour_id='dark_bg',
                               combined_element_ids=['text_box'])
     assert colour == pygame.Color('#25f92e')
 def test_load_non_default_theme_from_package(self, _init_pygame):
     theme = UIAppearanceTheme(BlockingThreadedResourceLoader())
     theme.load_theme(
         PackageResource('tests.data.themes',
                         'ui_text_box_non_default.json'))
     colour = theme.get_colour(colour_id='dark_bg',
                               combined_element_ids=['text_box'])
     assert colour == pygame.Color('#25f92e')
 def test_get_colour_from_gradient_objects(self, _init_pygame):
     theme = UIAppearanceTheme(BlockingThreadedResourceLoader())
     with pytest.warns(UserWarning, match="Invalid gradient"):
         theme.load_theme(
             os.path.join("tests", "data", "themes",
                          "appearance_theme_test.json"))
     colour = theme.get_colour(colour_id='dark_bg',
                               combined_element_ids=['#test_parent'])
     assert colour == pygame.Color('#25f92e')
示例#5
0
 def test_get_colour_from_gradient(self, _init_pygame):
     theme = UIAppearanceTheme()
     theme.load_theme(
         os.path.join("tests", "data", "themes",
                      "ui_text_box_non_default.json"))
     colour = theme.get_colour(object_ids=[''],
                               element_ids=['text_box'],
                               colour_id='dark_bg')
     assert colour == pygame.Color('#25f92e')