diff --git a/src/st/test-theme.c b/src/st/test-theme.c index 6e2702c15..d093d0bf4 100644 --- a/src/st/test-theme.c +++ b/src/st/test-theme.c @@ -124,18 +124,18 @@ assert_text_decoration (StThemeNode *node, static void assert_foreground_color (StThemeNode *node, - const char *node_description, - guint32 expected) + const char *node_description, + const char *expected) { ClutterColor color; - guint32 value; + g_autofree char* value; st_theme_node_get_foreground_color (node, &color); - value = clutter_color_to_pixel (&color); + value = clutter_color_to_string (&color); - if (expected != value) + if (g_strcmp0 (expected, value) != 0) { - g_print ("%s: %s.color: expected: #%08x, got: #%08x\n", + g_print ("%s: %s.color: expected: %s, got: %s\n", test, node_description, expected, value); fail = TRUE; } @@ -143,18 +143,18 @@ assert_foreground_color (StThemeNode *node, static void assert_background_color (StThemeNode *node, - const char *node_description, - guint32 expected) + const char *node_description, + const char *expected) { ClutterColor color; - guint32 value; + g_autofree char* value; st_theme_node_get_background_color (node, &color); - value = clutter_color_to_pixel (&color); + value = clutter_color_to_string (&color); - if (expected != value) + if (g_strcmp0 (expected, value) != 0) { - g_print ("%s: %s.background-color: expected: #%08x, got: #%08x\n", + g_print ("%s: %s.background-color: expected: %s, got: %s\n", test, node_description, expected, value); fail = TRUE; } @@ -182,17 +182,17 @@ static void assert_border_color (StThemeNode *node, const char *node_description, StSide side, - guint32 expected) + const char *expected) { ClutterColor color; - guint32 value; + g_autofree char* value; st_theme_node_get_border_color (node, side, &color); - value = clutter_color_to_pixel (&color); + value = clutter_color_to_string (&color); - if (expected != value) + if (g_strcmp0 (expected, value) != 0) { - g_print ("%s: %s.border-%s-color: expected: #%08x, got: #%08x\n", + g_print ("%s: %s.border-%s-color: expected: %s, got: %s\n", test, node_description, side_to_string (side), expected, value); fail = TRUE; } @@ -244,7 +244,7 @@ test_defaults (void) /* font comes from context */ assert_font (root, "stage", "sans-serif 12"); /* black is the default foreground color */ - assert_foreground_color (root, "stage", 0x00000ff); + assert_foreground_color (root, "stage", "#000000ff"); } static void @@ -304,9 +304,9 @@ test_adjacent_selector (void) { test = "adjacent_selector"; /* #group1 > #text1 matches text1 */ - assert_foreground_color (text1, "text1", 0x00ff00ff); + assert_foreground_color (text1, "text1", "#00ff00ff"); /* stage > #text2 doesn't match text2 */ - assert_foreground_color (text2, "text2", 0x000000ff); + assert_foreground_color (text2, "text2", "#000000ff"); } static void @@ -392,10 +392,10 @@ test_border (void) assert_length ("group2", "border-left-width", 2., st_theme_node_get_border_width (group2, ST_SIDE_LEFT)); - assert_border_color (group2, "group2", ST_SIDE_TOP, 0x000000ff); - assert_border_color (group2, "group2", ST_SIDE_RIGHT, 0x000000ff); - assert_border_color (group2, "group2", ST_SIDE_BOTTOM, 0x0000ffff); - assert_border_color (group2, "group2", ST_SIDE_LEFT, 0x000000ff); + assert_border_color (group2, "group2", ST_SIDE_TOP, "#000000ff"); + assert_border_color (group2, "group2", ST_SIDE_RIGHT, "#000000ff"); + assert_border_color (group2, "group2", ST_SIDE_BOTTOM, "#0000ffff"); + assert_border_color (group2, "group2", ST_SIDE_LEFT, "#000000ff"); assert_length ("group2", "border-radius-topleft", 10., st_theme_node_get_border_radius (group2, ST_CORNER_TOPLEFT)); @@ -412,13 +412,13 @@ test_background (void) { test = "background"; /* group1 has a background: shortcut property setting color and image */ - assert_background_color (group1, "group1", 0xff0000ff); + assert_background_color (group1, "group1", "#ff0000ff"); assert_background_image (group1, "group1", "some-background.png"); /* text1 inherits the background image but not the color */ - assert_background_color (text1, "text1", 0x00000000); + assert_background_color (text1, "text1", "#00000000"); assert_background_image (text1, "text1", "some-background.png"); /* text2 inherits both, but then background: none overrides both */ - assert_background_color (text2, "text2", 0x00000000); + assert_background_color (text2, "text2", "#00000000"); assert_background_image (text2, "text2", NULL); /* background-image property */ assert_background_image (group2, "group2", "other-background.png"); @@ -458,7 +458,7 @@ test_pseudo_class (void) test = "pseudo_class"; /* text4 has :visited and :hover pseudo-classes, so should pick up both of these */ - assert_foreground_color (text4, "text4", 0x888888ff); + assert_foreground_color (text4, "text4", "#888888ff"); assert_text_decoration (text4, "text4", ST_TEXT_DECORATION_UNDERLINE); /* :hover pseudo-class matches, but class doesn't match */ assert_text_decoration (group3, "group3", 0); @@ -468,7 +468,7 @@ test_pseudo_class (void) clutter_actor_add_child (stage, CLUTTER_ACTOR (label)); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x000000ff); + assert_foreground_color (labelNode, "label", "#000000ff"); assert_text_decoration (labelNode, "label", 0); assert_length ("label", "border-width", 0., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); @@ -476,7 +476,7 @@ test_pseudo_class (void) st_widget_add_style_pseudo_class (label, "visited"); g_assert (st_widget_has_style_pseudo_class (label, "visited")); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x888888ff); + assert_foreground_color (labelNode, "label", "#888888ff"); assert_text_decoration (labelNode, "label", 0); assert_length ("label", "border-width", 0., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); @@ -484,7 +484,7 @@ test_pseudo_class (void) st_widget_add_style_pseudo_class (label, "hover"); g_assert (st_widget_has_style_pseudo_class (label, "hover")); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x888888ff); + assert_foreground_color (labelNode, "label", "#888888ff"); assert_text_decoration (labelNode, "label", ST_TEXT_DECORATION_UNDERLINE); assert_length ("label", "border-width", 0., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); @@ -493,21 +493,21 @@ test_pseudo_class (void) g_assert (!st_widget_has_style_pseudo_class (label, "visited")); g_assert (st_widget_has_style_pseudo_class (label, "hover")); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x000000ff); + assert_foreground_color (labelNode, "label", "#000000ff"); assert_text_decoration (labelNode, "label", ST_TEXT_DECORATION_UNDERLINE); assert_length ("label", "border-width", 0., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); st_widget_add_style_pseudo_class (label, "boxed"); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x000000ff); + assert_foreground_color (labelNode, "label", "#000000ff"); assert_text_decoration (labelNode, "label", ST_TEXT_DECORATION_UNDERLINE); assert_length ("label", "border-width", 1., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); st_widget_remove_style_pseudo_class (label, "hover"); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x000000ff); + assert_foreground_color (labelNode, "label", "#000000ff"); assert_text_decoration (labelNode, "label", 0); assert_length ("label", "border-width", 1., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); @@ -516,7 +516,7 @@ test_pseudo_class (void) g_assert (!st_widget_has_style_pseudo_class (label, "boxed")); g_assert (st_widget_has_style_pseudo_class (label, "insensitive")); labelNode = st_widget_get_theme_node (label); - assert_foreground_color (labelNode, "label", 0x000000ff); + assert_foreground_color (labelNode, "label", "#000000ff"); assert_text_decoration (labelNode, "label", 0); assert_length ("label", "border-width", 0., st_theme_node_get_border_width (labelNode, ST_SIDE_TOP)); @@ -530,7 +530,7 @@ test_inline_style (void) { test = "inline_style"; /* These properties come from the inline-style specified when creating the node */ - assert_foreground_color (text3, "text3", 0x00000ffff); + assert_foreground_color (text3, "text3", "#0000ffff"); assert_length ("text3", "padding-bottom", 12., st_theme_node_get_padding (text3, ST_SIDE_BOTTOM)); }