[Xfce4-commits] <xfce4-notifyd:master> Add test for notification positioning.
Jérôme Guelfucci
noreply at xfce.org
Sun Aug 21 10:20:01 CEST 2011
Updating branch refs/heads/master
to d1de1d230ca800ef5d8a72e47b0cf1b94ac8aa15 (commit)
from 5014038d79447024636e0c910ac106550ded8684 (commit)
commit d1de1d230ca800ef5d8a72e47b0cf1b94ac8aa15
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sat Aug 20 17:50:01 2011 +0200
Add test for notification positioning.
Makefile.am | 7 +++-
tests/{test-text.c => test-positioning.c} | 56 ++++++++++++++++------------
2 files changed, 38 insertions(+), 25 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 8cfb764..331b7fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -236,7 +236,8 @@ release: gpg-sign
#Tests
if HAVE_LIBNOTIFY
noinst_PROGRAMS = \
- tests/test-text
+ tests/test-text \
+ tests/test-positioning
tests_cflags = \
-I$(top_srcdir) \
@@ -248,4 +249,8 @@ tests_ldadd = \
tests_test_text_SOURCES = tests/test-text.c
tests_test_text_CFLAGS = $(tests_cflags)
tests_test_text_LDADD = $(tests_ldadd)
+
+tests_test_positioning_SOURCES = tests/test-positioning.c
+tests_test_positioning_CFLAGS = $(tests_cflags)
+tests_test_positioning_LDADD = $(tests_ldadd)
endif
diff --git a/tests/test-text.c b/tests/test-positioning.c
similarity index 50%
copy from tests/test-text.c
copy to tests/test-positioning.c
index 5c58500..af35692 100644
--- a/tests/test-text.c
+++ b/tests/test-positioning.c
@@ -25,43 +25,51 @@
#include <stdlib.h>
#include <libnotify/notify.h>
+#define N_NOTIFICATIONS 30
+
int main (int argc, char **argv)
{
- NotifyNotification *notification;
-
- notify_init ("Notification with text test");
+ gint i;
- g_print ("%s", "Testing notification with text summary and body\n");
+ notify_init ("Test notification positioning");
- notification = notify_notification_new ("Test text support",
- "Does it work?",
- NULL);
+ g_print ("%s", "Testing notification positioning\n");
- if (!notify_notification_show (notification, NULL))
+ for (i = 0; i < N_NOTIFICATIONS; i++)
{
- g_error ("Failed");
- g_object_unref (notification);
+ NotifyNotification *notification;
+ const gchar *body;
+ gchar *summary;
+ gint type;
- return EXIT_FAILURE;
- }
+ summary = g_strdup_printf ("Notification %i", i);
- g_object_unref (notification);
+ type = rand () % 3;
- g_print ("%s", "Testing notification with text summary and no body\n");
+ if (type == 0)
+ body = "Short body";
+ else if (type == 1)
+ body = "Enlarge your body";
+ else
+ body = "Huge body with a lot of text.\nAnd with a new line too!";
- notification = notify_notification_new ("Summary only support",
- NULL,
- NULL);
+ notification = notify_notification_new (summary,
+ body,
+ NULL);
- if (!notify_notification_show (notification, NULL))
- {
- g_error ("Failed");
- g_object_unref (notification);
+ if (!notify_notification_show (notification, NULL))
+ {
+ g_error ("Failed");
- return EXIT_FAILURE;
- }
+ g_object_unref (notification);
+ g_free (summary);
+
+ return EXIT_FAILURE;
+ }
- g_object_unref (notification);
+ g_object_unref (notification);
+ g_free (summary);
+ }
return EXIT_SUCCESS;
}
More information about the Xfce4-commits
mailing list