testsuite: Fix stylecontext test

Update the test to the stricter interpretation of the CSS specification
and the removal of custom additions.
This commit is contained in:
Benjamin Otte 2019-04-11 22:41:04 +02:00
parent ec6ce0707a
commit 023b695422

View File

@ -22,8 +22,8 @@ test_parse_selectors (void)
"#id {}", "#id {}",
"tab:first-child {}", "tab:first-child {}",
"tab:last-child {}", "tab:last-child {}",
"tab:nth-child(first) {}", "tab:first-child {}",
"tab:nth-child(last) {}", "tab:last-child {}",
"tab:nth-child(even) {}", "tab:nth-child(even) {}",
"tab:nth-child(odd) {}", "tab:nth-child(odd) {}",
".some-class {}", ".some-class {}",
@ -47,8 +47,8 @@ test_parse_selectors (void)
"E1.e1_2 #T3_4 {}", "E1.e1_2 #T3_4 {}",
"E:first-child {}", "E:first-child {}",
"E:last-child {}", "E:last-child {}",
"E:nth-child(first) {}", "E:first-child {}",
"E:nth-child(last) {}", "E:last-child {}",
"E:nth-child(even) {}", "E:nth-child(even) {}",
"E:nth-child(odd) {}", "E:nth-child(odd) {}",
"E:focus tab {}", "E:focus tab {}",
@ -148,76 +148,76 @@ test_match (void)
GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER); GTK_STYLE_PROVIDER_PRIORITY_USER);
data = "* { color: #fff }"; data = "* { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"button { color: #fff }"; "button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"button { color: #fff }\n" "button { color: #fff; }\n"
"window > button { color: #000 }"; "window > button { color: #000; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
".button { color: #fff }"; ".button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"button { color: #000 }\n" "button { color: #000; }\n"
".button { color: #fff }"; ".button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"button { color: #000 }\n" "button { color: #000; }\n"
"window button { color: #fff }"; "window button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
".button { color: #000 }\n" ".button { color: #000; }\n"
"window .button { color: #fff }"; "window .button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"* .button { color: #000 }\n" "* .button { color: #000; }\n"
"#mywindow .button { color: #fff }"; "#mywindow .button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"window .button { color: #000 }\n" "window .button { color: #000; }\n"
"window#mywindow .button { color: #fff }"; "window#mywindow .button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"window .button { color: #000 }\n" "window .button { color: #000; }\n"
"window button.button { color: #fff }"; "window button.button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n" data = "* { color: #f00; }\n"
"window:backdrop .button { color: #000 }\n" "window:backdrop .button { color: #000; }\n"
"window .button { color: #111 }\n" "window .button { color: #111; }\n"
"window:active .button { color: #fff }"; "window:active .button { color: #fff; }";
gtk_css_provider_load_from_data (provider, data, -1); gtk_css_provider_load_from_data (provider, data, -1);
gtk_style_context_get_color (context, &color); gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected)); g_assert (gdk_rgba_equal (&color, &expected));
@ -532,6 +532,5 @@ main (int argc, char *argv[])
ADD_PRIORITIES_TEST ("three-context-higher", test_style_priorities_three_context_higher); ADD_PRIORITIES_TEST ("three-context-higher", test_style_priorities_three_context_higher);
#undef ADD_PRIORITIES_TEST #undef ADD_PRIORITIES_TEST
return g_test_run (); return g_test_run ();
} }