[libgd/wip/ernestask/gtk4: 1/10] Add test for GdNotification
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/ernestask/gtk4: 1/10] Add test for GdNotification
- Date: Sun, 11 Mar 2018 13:29:27 +0000 (UTC)
commit 7bfbc0dd49cc89099fd5b1a051a60bf63720b658
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat Mar 10 21:57:40 2018 +0200
Add test for GdNotification
tests/meson.build | 6 +++++
tests/test-notification.c | 48 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/tests/meson.build b/tests/meson.build
index 4ba780d..e875b7d 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -30,3 +30,9 @@ if get_option('with-main-view')
'test-main-view.c',
dependencies: libgd_dep)
endif
+
+if get_option('with-notification')
+ executable('test-notification',
+ 'test-notification.c',
+ dependencies: libgd_dep)
+endif
diff --git a/tests/test-notification.c b/tests/test-notification.c
new file mode 100644
index 0000000..abd6c23
--- /dev/null
+++ b/tests/test-notification.c
@@ -0,0 +1,48 @@
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+
+#include <libgd/gd-notification.h>
+
+static void
+on_destroy (GtkWidget *widget,
+ gpointer user_data)
+{
+ gtk_main_quit ();
+}
+
+gint
+main (gint argc,
+ GStrv argv)
+{
+ GtkWidget *label;
+ GtkWidget *notification;
+ GtkWidget *text_view;
+ GtkWidget *overlay;
+ GtkWidget *window;
+
+ gtk_init ();
+
+ label = gtk_label_new ("This is a test.");
+
+ notification = gd_notification_new ();
+ gd_notification_set_timeout (GD_NOTIFICATION (notification), 3);
+ gtk_container_add (GTK_CONTAINER (notification), label);
+ gtk_widget_show (notification);
+
+ text_view = gtk_text_view_new ();
+
+ overlay = gtk_overlay_new ();
+ gtk_container_add (GTK_CONTAINER (overlay), text_view);
+ gtk_overlay_add_overlay (GTK_OVERLAY (overlay), notification);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_signal_connect (window, "destroy", G_CALLBACK (on_destroy), NULL);
+ gtk_container_add (GTK_CONTAINER (window), overlay);
+ gtk_widget_set_size_request (window, 640, 480);
+ gtk_widget_show (window);
+
+ gtk_main ();
+
+ return EXIT_SUCCESS;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]