summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-07-17 15:59:23 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-07-17 16:11:17 -0400
commit2b105dc3d925dc4ad16906afb532968ba6ff9750 (patch)
tree078da2676205741ed015ee7a90b1171d891aa193 /tests
parent0ee14211b117725eff658bf78fbabce9039ab443 (diff)
downloadgtk+-2b105dc3d925dc4ad16906afb532968ba6ff9750.tar.gz
testdialog: Error out if templates are missing
Coverity complained about us ignoring the return value here, and it is nicer to get an error message about this.
Diffstat (limited to 'tests')
-rw-r--r--tests/testdialog.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/testdialog.c b/tests/testdialog.c
index 3c955074d5..df36f0fc28 100644
--- a/tests/testdialog.c
+++ b/tests/testdialog.c
@@ -215,7 +215,9 @@ my_dialog_class_init (MyDialogClass *class)
gsize size;
GBytes *bytes;
- g_file_get_contents ("mydialog.ui", &buffer, &size, NULL);
+ if (!g_file_get_contents ("mydialog.ui", &buffer, &size, NULL))
+ g_error ("Template file mydialog.ui not found");
+
bytes = g_bytes_new_static (buffer, size);
gtk_widget_class_set_template (GTK_WIDGET_CLASS (class), bytes);
g_bytes_unref (bytes);
@@ -283,7 +285,9 @@ my_dialog2_class_init (MyDialog2Class *class)
gsize size;
GBytes *bytes;
- g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL);
+ if (!g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL))
+ g_error ("Template file mydialog2.ui not found");
+
bytes = g_bytes_new_static (buffer, size);
gtk_widget_class_set_template (GTK_WIDGET_CLASS (class), bytes);
g_bytes_unref (bytes);