Add some static assertions

Add assertions that ensure the relationships between
css property IDs that we rely on are preserved.
This commit is contained in:
Matthias Clasen 2020-01-20 22:53:25 -05:00
parent a350c2452a
commit a38ba91e35
2 changed files with 9 additions and 0 deletions

View File

@ -206,6 +206,12 @@ gtk_css_static_style_new_compute (GtkStyleProvider *provider,
return GTK_CSS_STYLE (result);
}
G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_TOP_STYLE == GTK_CSS_PROPERTY_BORDER_TOP_WIDTH - 1);
G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE == GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH - 1);
G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE == GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH - 1);
G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE == GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH - 1);
G_STATIC_ASSERT (GTK_CSS_PROPERTY_OUTLINE_STYLE == GTK_CSS_PROPERTY_OUTLINE_WIDTH - 1);
void
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProvider *provider,

View File

@ -921,6 +921,9 @@ icon_theme_value_parse (GtkCssStyleProperty *property,
/*** REGISTRATION ***/
G_STATIC_ASSERT (GTK_CSS_PROPERTY_COLOR == 0);
G_STATIC_ASSERT (GTK_CSS_PROPERTY_DPI < GTK_CSS_PROPERTY_FONT_SIZE);
void
_gtk_css_style_property_init_properties (void)
{