From bdf8640cabacb31aaacc8d004f4c49737c85106a Mon Sep 17 00:00:00 2001 From: Christian Hammond Date: Tue, 14 Nov 2006 07:42:35 +0000 Subject: [PATCH] Added a test program that displays three notifications and then changes the amount of text in one of them. --- ChangeLog | 8 ++++ tests/Makefile.am | 4 ++ tests/test-default-action.c | 1 + tests/test-size-changes.c | 84 +++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 tests/test-size-changes.c diff --git a/ChangeLog b/ChangeLog index f75b7dc..f20c3b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Nov 13 23:42:07 PST 2006 Christian Hammond + + * tests/Makefile.am: + A tests/test-size-changes.c: + * tests/test-default-action.c: + - Added a test program that displays three notifications and then + changes the amount of text in one of them. + Sun Nov 05 12:06:01 PST 2006 Christian Hammond * libnotify/notify.c: diff --git a/tests/Makefile.am b/tests/Makefile.am index ba128ec..ac31762 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,6 +8,7 @@ noinst_PROGRAMS = \ test-basic \ test-error \ test-markup \ + test-size-changes \ test-urgency \ test-xy \ test-xy-actions \ @@ -27,6 +28,9 @@ test_replace_widget_LDADD = $(common_ldflags) test_server_info_SOURCES = test-server-info.c test_server_info_LDADD = $(common_ldflags) +test_size_changes_SOURCES = test-size-changes.c +test_size_changes_LDADD = $(common_ldflags) + test_default_action_SOURCES = test-default-action.c test_default_action_LDADD = $(common_ldflags) diff --git a/tests/test-default-action.c b/tests/test-default-action.c index 6d4bb93..d7376de 100644 --- a/tests/test-default-action.c +++ b/tests/test-default-action.c @@ -37,6 +37,7 @@ static GMainLoop *loop; static void callback(NotifyNotification *n, const char *action, void *user_data) { + printf("callback\n"); assert (action != NULL); assert (strcmp ("default", action) == 0); diff --git a/tests/test-size-changes.c b/tests/test-size-changes.c new file mode 100644 index 0000000..103b75b --- /dev/null +++ b/tests/test-size-changes.c @@ -0,0 +1,84 @@ +/* + * @file tests/test-size-changes.c Unit test: Notification size changes + * + * @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 +#include + +int +main() +{ + NotifyNotification *n1, *n2, *n3; + + notify_init("Size Changes"); + + n1 = notify_notification_new("Notification 1", "Notification number 1!", + NULL, NULL); + notify_notification_set_timeout(n1, 7000); + + if (!notify_notification_show(n1, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + return 1; + } + + g_object_unref(G_OBJECT(n1)); + + n2 = notify_notification_new("Notification 2", "Notification number 2!", + NULL, NULL); + notify_notification_set_timeout(n2, 7000); + + if (!notify_notification_show(n2, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + return 1; + } + + + n3 = notify_notification_new("Notification 3", "Notification number 3!", + NULL, NULL); + notify_notification_set_timeout(n3, 7000); + + if (!notify_notification_show(n3, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + return 1; + } + + g_object_unref(G_OBJECT(n3)); + + sleep(2); + + notify_notification_update(n2, "Longer Notification 2", + "This is a much longer notification.\n" + "Two lines.\n" + "Well, okay, three.\n" + "Last one.", + NULL); + + if (!notify_notification_show(n2, NULL)) + { + fprintf(stderr, "failed to send notification\n"); + return 1; + } + + return 0; +}