From 21a71e94c6bcb2cf58bb4074e9b0eec880f15b20 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 13 Jan 2017 01:43:07 +0100 Subject: [PATCH] cssimage: Fallback images have no aspect ratio The aspect ratio for fallback image was incorrectly set to 1. Reftest is included. --- gtk/gtkcssimagefallback.c | 2 +- testsuite/reftests/Makefile.am | 3 +++ testsuite/reftests/css-image-color-aspect-ratio.css | 9 +++++++++ .../reftests/css-image-color-aspect-ratio.ref.ui | 11 +++++++++++ testsuite/reftests/css-image-color-aspect-ratio.ui | 10 ++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 testsuite/reftests/css-image-color-aspect-ratio.css create mode 100644 testsuite/reftests/css-image-color-aspect-ratio.ref.ui create mode 100644 testsuite/reftests/css-image-color-aspect-ratio.ui diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c index a9b50da22e..08206b8204 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 fa968e9105..969c99527f 100644 --- a/testsuite/reftests/Makefile.am +++ b/testsuite/reftests/Makefile.am @@ -209,6 +209,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 @@ + + + + + 20 + 10 + False + popup + reference + + 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 @@ + + + + + 20 + 10 + False + popup + +