diff options
author | Benjamin Otte <otte@redhat.com> | 2017-01-13 01:43:07 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-01-13 03:38:36 +0100 |
commit | e5e5beafa5b86eeb33e8384942e96e8fcf20c514 (patch) | |
tree | 1d74e4a807f12ee9fd585f4a50a632d72898922c | |
parent | a06b1ea1baecf6f0211726e901af93995f01a923 (diff) | |
download | gtk+-e5e5beafa5b86eeb33e8384942e96e8fcf20c514.tar.gz |
cssimage: Fallback images have no aspect ratio
The aspect ratio for fallback image was incorrectly set to 1.
Reftest is included.
-rw-r--r-- | gtk/gtkcssimagefallback.c | 2 | ||||
-rw-r--r-- | testsuite/reftests/Makefile.am | 3 | ||||
-rw-r--r-- | testsuite/reftests/css-image-color-aspect-ratio.css | 9 | ||||
-rw-r--r-- | testsuite/reftests/css-image-color-aspect-ratio.ref.ui | 11 | ||||
-rw-r--r-- | testsuite/reftests/css-image-color-aspect-ratio.ui | 10 |
5 files changed, 34 insertions, 1 deletions
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c index 316f422377..a1f74e6859 100644 --- a/gtk/gtkcssimagefallback.c +++ b/gtk/gtkcssimagefallback.c @@ -56,7 +56,7 @@ gtk_css_image_fallback_get_aspect_ratio (GtkCssImage *image) GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image); if (fallback->used < 0) - return 1; + return 0; return _gtk_css_image_get_aspect_ratio (fallback->images[fallback->used]); } diff --git a/testsuite/reftests/Makefile.am b/testsuite/reftests/Makefile.am index 31645d23f0..8644e1cdfb 100644 --- a/testsuite/reftests/Makefile.am +++ b/testsuite/reftests/Makefile.am @@ -201,6 +201,9 @@ testdata = \ css-image-aspect-ratio.css \ css-image-aspect-ratio.ui \ css-image-aspect-ratio.ref.ui \ + css-image-color-aspect-ratio.css \ + css-image-color-aspect-ratio.ui \ + css-image-color-aspect-ratio.ref.ui \ css-match-class.css \ css-match-class.ref.ui \ css-match-class.ui \ diff --git a/testsuite/reftests/css-image-color-aspect-ratio.css b/testsuite/reftests/css-image-color-aspect-ratio.css new file mode 100644 index 0000000000..6c83a76985 --- /dev/null +++ b/testsuite/reftests/css-image-color-aspect-ratio.css @@ -0,0 +1,9 @@ +window { + background-color: blue; + background-image: image(red); + background-repeat: no-repeat; +} + +#reference { + background: red; +} diff --git a/testsuite/reftests/css-image-color-aspect-ratio.ref.ui b/testsuite/reftests/css-image-color-aspect-ratio.ref.ui new file mode 100644 index 0000000000..982e3d8f8d --- /dev/null +++ b/testsuite/reftests/css-image-color-aspect-ratio.ref.ui @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkWindow" id="window1"> + <property name="width_request">20</property> + <property name="height_request">10</property> + <property name="can_focus">False</property> + <property name="type">popup</property> + <property name="name">reference</property> + </object> +</interface> diff --git a/testsuite/reftests/css-image-color-aspect-ratio.ui b/testsuite/reftests/css-image-color-aspect-ratio.ui new file mode 100644 index 0000000000..d26485622a --- /dev/null +++ b/testsuite/reftests/css-image-color-aspect-ratio.ui @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkWindow" id="window1"> + <property name="width_request">20</property> + <property name="height_request">10</property> + <property name="can_focus">False</property> + <property name="type">popup</property> + </object> +</interface> |