From 8705b75a6302313469e155471e11a30b577bd60a Mon Sep 17 00:00:00 2001 From: Christian Hammond Date: Sat, 4 Feb 2006 09:47:18 +0000 Subject: [PATCH] Add a test-urgency testcase. --- ChangeLog | 6 ++++ tests/Makefile.am | 16 ++++------ tests/test-image.c | 2 +- tests/test-urgency.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 tests/test-urgency.c diff --git a/ChangeLog b/ChangeLog index c66bc8d..0b1cef6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Feb 04 01:47:00 PST 2006 Christian Hammond + + A tests/test-urgency.c: + * tests/Makefile.am: + - Add a test-urgency testcase. + Sun Jan 29 13:26:31 PST 2006 Christian Hammond * Doxyfile.in: diff --git a/tests/Makefile.am b/tests/Makefile.am index 4b8b9a3..5287073 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,12 +1,3 @@ -if HAVE_GDK -gdk_tests = \ - test-xy-stress - -test_xy_stress_SOURCES = test-xy-stress.c -else -gdk_tests = -endif - noinst_PROGRAMS = \ test-replace \ test-replace-widget \ @@ -17,8 +8,9 @@ noinst_PROGRAMS = \ test-basic \ test-error \ test-markup \ + test-urgency \ test-xy \ - $(gdk_tests) + test-xy-stress common_ldflags = \ $(top_builddir)/libnotify/libnotify.la \ @@ -52,9 +44,13 @@ test_error_LDADD = $(common_ldflags) test_markup_SOURCES = test-markup.c test_markup_LDADD = $(common_ldflags) +test_urgency_SOURCES = test-urgency.c +test_urgency_LDADD = $(common_ldflags) + test_xy_SOURCES = test-xy.c test_xy_LDADD = $(common_ldflags) +test_xy_stress_SOURCES = test-xy-stress.c test_xy_stress_LDADD = $(common_ldflags) INCLUDES = $(PACKAGE_CFLAGS) \ diff --git a/tests/test-image.c b/tests/test-image.c index 32f5471..3fcb534 100644 --- a/tests/test-image.c +++ b/tests/test-image.c @@ -58,7 +58,7 @@ main(int argc, char *argv[]) /* Stock icon */ n = notify_notification_new("Icon Test", "Testing stock icon", - "stock_help", NULL); + "stock_samples", NULL); if (!notify_notification_show(n, NULL)) { diff --git a/tests/test-urgency.c b/tests/test-urgency.c new file mode 100644 index 0000000..a159718 --- /dev/null +++ b/tests/test-urgency.c @@ -0,0 +1,70 @@ +/* + * @file tests/test-urgency.c Unit test: urgency levels + * + * @Copyright(C) 2006 Christian Hammond + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or(at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include + +int +main(int argc, char *argv[]) +{ + NotifyNotification *n; + + notify_init("Urgency"); + + n = notify_notification_new("Low Urgency", "Joe signed online.", + NULL, NULL); + if (!notify_notification_show(n, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + exit(1); + } + + g_object_unref(G_OBJECT(n)); + + + n = notify_notification_new("Normal Urgency", + "You have a meeting in 10 minutes.", + NULL, NULL); + if (!notify_notification_show(n, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + exit(1); + } + + g_object_unref(G_OBJECT(n)); + + + n = notify_notification_new("Critical Urgency", + "This message will self-destruct in 10 " + "seconds.", + NULL, NULL); + notify_notification_set_timeout(n, 10000); // 10 seconds + + if (!notify_notification_show(n, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + exit(1); + } + + g_object_unref(G_OBJECT(n)); + + return 0; +}