[gtk+] cssimageradial: Only emit one error for wrong position



commit 982da040b234f8c2da349a45111972d04c98f4a8
Author: Benjamin Otte <otte redhat com>
Date:   Fri Feb 5 18:30:28 2016 +0100

    cssimageradial: Only emit one error for wrong position
    
    Test included.

 gtk/gtkcssimageradial.c                            |    5 +----
 testsuite/css/parser/Makefile.am                   |    3 +++
 .../parser/radial-background-position-error.css    |    3 +++
 .../parser/radial-background-position-error.errors |    1 +
 4 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c
index f8024d7..3a3b343 100644
--- a/gtk/gtkcssimageradial.c
+++ b/gtk/gtkcssimageradial.c
@@ -273,10 +273,7 @@ gtk_css_image_radial_parse (GtkCssImage  *image,
       {
         radial->position = _gtk_css_position_value_parse (parser);
         if (!radial->position)
-          {
-            _gtk_css_parser_error (parser, "Expected a position after 'at'");
-            return FALSE;
-          }
+          return FALSE;
         found_one = has_position = TRUE;
       }
     else if (!has_size)
diff --git a/testsuite/css/parser/Makefile.am b/testsuite/css/parser/Makefile.am
index 4479ddd..6c5a6d9 100644
--- a/testsuite/css/parser/Makefile.am
+++ b/testsuite/css/parser/Makefile.am
@@ -407,6 +407,9 @@ test_data = \
        pseudo-classes-unknown.ref.css \
         radial.css \
         radial.ref.css \
+       radial-background-position-error.css \
+       radial-background-position-error.errors \
+       radial-background-position-error.ref.css \
        selector.css \
        selector.ref.css \
        shadow.css \
diff --git a/testsuite/css/parser/radial-background-position-error.css 
b/testsuite/css/parser/radial-background-position-error.css
new file mode 100644
index 0000000..6f65469
--- /dev/null
+++ b/testsuite/css/parser/radial-background-position-error.css
@@ -0,0 +1,3 @@
+a {
+  background: radial-gradient(at your mom);
+}
diff --git a/testsuite/css/parser/radial-background-position-error.errors 
b/testsuite/css/parser/radial-background-position-error.errors
new file mode 100644
index 0000000..252ab5a
--- /dev/null
+++ b/testsuite/css/parser/radial-background-position-error.errors
@@ -0,0 +1 @@
+radial-background-position-error.css:2: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
diff --git a/testsuite/css/parser/radial-background-position-error.ref.css 
b/testsuite/css/parser/radial-background-position-error.ref.css
new file mode 100644
index 0000000..e69de29


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]