diff options
author | Benjamin Otte <otte@redhat.com> | 2015-11-16 17:36:50 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-11-16 17:39:15 +0100 |
commit | 0a4e88b79b9fa20ae0bd61ff68e99abeb5753da3 (patch) | |
tree | 686e75c7c5f6a7aa07ac4fbe5fea372e9c5c1b4d /testsuite/gtk | |
parent | 81cb57b260b22ab2e1a0cb2b29c7c09fd3de128c (diff) | |
download | gtk+-0a4e88b79b9fa20ae0bd61ff68e99abeb5753da3.tar.gz |
cssprovider: Have a section on import error
When loading a nonexisting CSS file using
gtk_css_provider_load_from_file() or gtk_css_provider_load_from_path()
we would emit the error using a NULL scanner. Don't do that, because
we'll have a NULL section in that case and error handlers don't like
that.
Testcase attached.
https://bugzilla.redhat.com/show_bug.cgi?id=1277959
Diffstat (limited to 'testsuite/gtk')
-rw-r--r-- | testsuite/gtk/cssprovider.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/gtk/cssprovider.c b/testsuite/gtk/cssprovider.c index 5222620986..413c75087d 100644 --- a/testsuite/gtk/cssprovider.c +++ b/testsuite/gtk/cssprovider.c @@ -50,6 +50,18 @@ G_GNUC_END_IGNORE_DEPRECATIONS; g_object_unref (provider); } +static void +test_section_load_nonexisting_file (void) +{ + GtkCssProvider *provider; + + provider = gtk_css_provider_new (); + g_signal_connect (provider, "parsing-error", + G_CALLBACK (assert_section_is_not_null), NULL); + gtk_css_provider_load_from_path (provider, "this/path/does/absolutely/not/exist.css", NULL); + g_object_unref (provider); +} + int main (int argc, char *argv[]) { @@ -58,6 +70,7 @@ main (int argc, char *argv[]) g_test_add_func ("/cssprovider/section-in-load-from-data", test_section_in_load_from_data); g_test_add_func ("/cssprovider/section-in-style-property", test_section_in_style_property); + g_test_add_func ("/cssprovider/load-nonexisting-file", test_section_load_nonexisting_file); return g_test_run (); } |