[gtk/css-style-split: 18/18] Add some checking for the group splitup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/css-style-split: 18/18] Add some checking for the group splitup
- Date: Sun, 26 Jan 2020 19:50:09 +0000 (UTC)
commit 4aae706a86c730504a07b1ab9c699d4961471d86
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jan 26 11:50:01 2020 -0500
Add some checking for the group splitup
Verify that we don't miss properties or have them
more than once.
gtk/gtkcssstaticstyle.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
---
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index 0f9dd6a475..03e48122c0 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -342,6 +342,48 @@ DEFINE_VALUES (GtkCssTransitionValues, transition)
DEFINE_VALUES (GtkCssSizeValues, size)
DEFINE_VALUES (GtkCssOtherValues, other)
+#define VERIFY_MASK(NAME) \
+ { \
+ GtkBitmask *copy; \
+ copy = _gtk_bitmask_intersect (_gtk_bitmask_copy (gtk_css_ ## NAME ## _values_mask), all); \
+ g_assert (_gtk_bitmask_equals (copy, gtk_css_ ## NAME ## _values_mask)); \
+ _gtk_bitmask_free (copy); \
+ } \
+ all = _gtk_bitmask_subtract (all, gtk_css_ ## NAME ## _values_mask);
+
+/* Verify that every style property is present in one group, and none
+ * is present in more than one group.
+ */
+static void
+verify_style_groups (void)
+{
+ GtkBitmask *all;
+ guint id;
+
+ all = _gtk_bitmask_new ();
+
+ for (id = 0; id < GTK_CSS_PROPERTY_N_PROPERTIES; id++)
+ all = _gtk_bitmask_set (all, id, TRUE);
+
+ VERIFY_MASK (core);
+ VERIFY_MASK (background);
+ VERIFY_MASK (border);
+ VERIFY_MASK (icon);
+ VERIFY_MASK (outline);
+ VERIFY_MASK (font);
+ VERIFY_MASK (font_variant);
+ VERIFY_MASK (animation);
+ VERIFY_MASK (transition);
+ VERIFY_MASK (size);
+ VERIFY_MASK (other);
+
+ g_assert (_gtk_bitmask_is_empty (all));
+
+ _gtk_bitmask_free (all);
+}
+
+#undef VERIFY_MASK
+
G_DEFINE_TYPE (GtkCssStaticStyle, gtk_css_static_style, GTK_TYPE_CSS_STYLE)
static GtkCssValue *
@@ -620,6 +662,7 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
gtk_css_other_values_init ();
init_style_counts ();
+ verify_style_groups ();
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]