[Xfce4-commits] <xfce4-notifyd:master> Add some programs to test the notification daemon.
Jérôme Guelfucci
noreply at xfce.org
Sat Aug 20 17:18:03 CEST 2011
Updating branch refs/heads/master
to 37c016d5202ef90fa6e2cc68f50f163ef6e68862 (commit)
from fcb39157b0a55c3b54fb61c91eda48765475a4ac (commit)
commit 37c016d5202ef90fa6e2cc68f50f163ef6e68862
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sat Aug 20 17:11:26 2011 +0200
Add some programs to test the notification daemon.
The first sample program tests basic text support.
Makefile.am | 17 ++++++++++++-
configure.ac.in | 4 +++
tests/test-text.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 87 insertions(+), 1 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 1d25421..3bd720b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,7 +62,7 @@ xfce4_notifyd_xfce4_notifyd_LDADD = \
$(LIBX11_LIBS)
xfce4_notifyd_config_xfce4_notifyd_config_LDADD = \
- $(common_ldadd)
+ $(common_ldadd)
servicedir = $(datadir)/dbus-1/services
@@ -232,3 +232,18 @@ release: gpg-sign
-mkdir releases/
mv $(PACKAGE)-$(VERSION).tar.bz2* releases/
-rm $(PACKAGE)-$(VERSION).tar.gz
+
+#Tests
+noinst_PROGRAMS = \
+ tests/test-text
+
+tests_cflags = \
+ -I$(top_srcdir) \
+ $(LIBNOTIFY_CFLAGS)
+
+tests_ldadd = \
+ $(LIBNOTIFY_LIBS)
+
+tests_test_text_SOURCES = tests/test-text.c
+tests_test_text_CFLAGS = $(tests_cflags)
+tests_test_text_LDADD = $(tests_ldadd)
diff --git a/configure.ac.in b/configure.ac.in
index b30713b..51afe16 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -67,6 +67,10 @@ XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
XDT_CHECK_PACKAGE([DBUS], [dbus-1], [1.0.0])
XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.72])
+dnl optionnal
+XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY], [libnotify], [0.7.0], [notifications],
+ [Test suite support], [yes])
+
AC_PATH_PROG([DBUS_BINDING_TOOL], [dbus-binding-tool])
AS_IF([test -z "$DBUS_BINDING_TOOL"],
[
diff --git a/tests/test-text.c b/tests/test-text.c
new file mode 100644
index 0000000..5c58500
--- /dev/null
+++ b/tests/test-text.c
@@ -0,0 +1,67 @@
+/*
+ * xfce4-notifyd
+ *
+ * Copyright (c) 2011 Jérôme Guelfucci <jeromeg at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <stdlib.h>
+#include <libnotify/notify.h>
+
+int main (int argc, char **argv)
+{
+ NotifyNotification *notification;
+
+ notify_init ("Notification with text test");
+
+ g_print ("%s", "Testing notification with text summary and body\n");
+
+ notification = notify_notification_new ("Test text support",
+ "Does it work?",
+ NULL);
+
+ if (!notify_notification_show (notification, NULL))
+ {
+ g_error ("Failed");
+ g_object_unref (notification);
+
+ return EXIT_FAILURE;
+ }
+
+ g_object_unref (notification);
+
+ g_print ("%s", "Testing notification with text summary and no body\n");
+
+ notification = notify_notification_new ("Summary only support",
+ NULL,
+ NULL);
+
+ if (!notify_notification_show (notification, NULL))
+ {
+ g_error ("Failed");
+ g_object_unref (notification);
+
+ return EXIT_FAILURE;
+ }
+
+ g_object_unref (notification);
+
+ return EXIT_SUCCESS;
+}
More information about the Xfce4-commits
mailing list