summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2021-10-26 17:02:56 +0200
committerBenjamin Otte <otte@redhat.com>2021-10-26 23:52:38 +0200
commitac8c4245b2fb2f1fe8e660c4ad2541efb39cf3d6 (patch)
tree050b8b9b26940bf4936075ea193d506ddedfc712 /testsuite
parentd726ecdb5d1ece870585c7be89eb6355b2482544 (diff)
downloadgtk+-ac8c4245b2fb2f1fe8e660c4ad2541efb39cf3d6.tar.gz
css: Don't throw warnings on broken URL in image css
If a URL can't be loaded, we might end up with a NULL file. Handle that case properly by creating an invalid image instead and don't crash or complain to stderr when files are NULL. This was broken since 0886ade182f1a958024202d5c20248d57fcdb053 A new reftest has been included. We need a reftest instead of a CSS parser test, because the error only becomes visible when compute()ing the actual image. Fixes #4373
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/reftests/css-image-broken-url.css4
-rw-r--r--testsuite/reftests/css-image-broken-url.ref.ui8
-rw-r--r--testsuite/reftests/css-image-broken-url.ui9
-rw-r--r--testsuite/reftests/meson.build3
4 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/reftests/css-image-broken-url.css b/testsuite/reftests/css-image-broken-url.css
new file mode 100644
index 0000000000..d7035a5e6d
--- /dev/null
+++ b/testsuite/reftests/css-image-broken-url.css
@@ -0,0 +1,4 @@
+#test {
+ /* The url should fail as early as possible */
+ background-image: url('data::::');
+}
diff --git a/testsuite/reftests/css-image-broken-url.ref.ui b/testsuite/reftests/css-image-broken-url.ref.ui
new file mode 100644
index 0000000000..3c0e77e927
--- /dev/null
+++ b/testsuite/reftests/css-image-broken-url.ref.ui
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkWindow" id="window1">
+ <property name="width_request">10</property>
+ <property name="height_request">10</property>
+ <property name="decorated">0</property>
+ </object>
+</interface>
diff --git a/testsuite/reftests/css-image-broken-url.ui b/testsuite/reftests/css-image-broken-url.ui
new file mode 100644
index 0000000000..286c35fe09
--- /dev/null
+++ b/testsuite/reftests/css-image-broken-url.ui
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkWindow" id="window1">
+ <property name="width_request">10</property>
+ <property name="height_request">10</property>
+ <property name="decorated">0</property>
+ <property name="name">test</property>
+ </object>
+</interface>
diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build
index 8e1b8bd501..b033760ed7 100644
--- a/testsuite/reftests/meson.build
+++ b/testsuite/reftests/meson.build
@@ -221,6 +221,9 @@ testdata = [
'css-image-aspect-ratio.css',
'css-image-aspect-ratio.ui',
'css-image-aspect-ratio.ref.ui',
+ 'css-image-broken-url.css',
+ 'css-image-broken-url.ref.ui',
+ 'css-image-broken-url.ui',
'css-image-color-aspect-ratio.css',
'css-image-color-aspect-ratio.ui',
'css-image-color-aspect-ratio.ref.ui',