[gtk+] cssimage: Fallback images have no aspect ratio



commit e5e5beafa5b86eeb33e8384942e96e8fcf20c514
Author: Benjamin Otte <otte redhat com>
Date:   Fri Jan 13 01:43:07 2017 +0100

    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 +++
 .../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 deletions(-)
---
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c
index 316f422..a1f74e6 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 31645d2..8644e1c 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 0000000..6c83a76
--- /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 0000000..982e3d8
--- /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 0000000..d264856
--- /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>


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