diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/rendernode.c | 23 | ||||
-rw-r--r-- | tests/showrendernode.c | 23 |
2 files changed, 34 insertions, 12 deletions
diff --git a/tests/rendernode.c b/tests/rendernode.c index 786cc6d050..d0e3230663 100644 --- a/tests/rendernode.c +++ b/tests/rendernode.c @@ -14,15 +14,26 @@ static GOptionEntry options[] = { }; static void -deserialize_error_func (const GtkCssSection *section, - const GError *error, - gpointer user_data) +deserialize_error_func (const GskParseLocation *start, + const GskParseLocation *end, + const GError *error, + gpointer user_data) { - char *section_str = gtk_css_section_to_string (section); + GString *string = g_string_new ("<data>"); - g_warning ("Error at %s: %s", section_str, error->message); + g_string_append_printf (string, ":%zu:%zu", + start->lines + 1, start->line_chars + 1); + if (start->lines != end->lines || start->line_chars != end->line_chars) + { + g_string_append (string, "-"); + if (start->lines != end->lines) + g_string_append_printf (string, "%zu:", end->lines + 1); + g_string_append_printf (string, "%zu", end->line_chars + 1); + } + + g_warning ("Error at %s: %s", string->str, error->message); - g_free (section_str); + g_string_free (string, TRUE); } diff --git a/tests/showrendernode.c b/tests/showrendernode.c index 92bc6d40eb..5fafd3c00e 100644 --- a/tests/showrendernode.c +++ b/tests/showrendernode.c @@ -102,15 +102,26 @@ gtk_node_view_class_init (GtkNodeViewClass *klass) } static void -deserialize_error_func (const GtkCssSection *section, - const GError *error, - gpointer user_data) +deserialize_error_func (const GskParseLocation *start, + const GskParseLocation *end, + const GError *error, + gpointer user_data) { - char *section_str = gtk_css_section_to_string (section); + GString *string = g_string_new ("<data>"); - g_warning ("Error at %s: %s", section_str, error->message); + g_string_append_printf (string, ":%zu:%zu", + start->lines + 1, start->line_chars + 1); + if (start->lines != end->lines || start->line_chars != end->line_chars) + { + g_string_append (string, "-"); + if (start->lines != end->lines) + g_string_append_printf (string, "%zu:", end->lines + 1); + g_string_append_printf (string, "%zu", end->line_chars + 1); + } + + g_warning ("Error at %s: %s", string->str, error->message); - g_free (section_str); + g_string_free (string, TRUE); } static void |