Add a test-urgency testcase.

This commit is contained in:
Christian Hammond 2006-02-04 09:47:18 +00:00
parent 626c43f126
commit 8705b75a63
4 changed files with 83 additions and 11 deletions

View File

@ -1,3 +1,9 @@
Sat Feb 04 01:47:00 PST 2006 Christian Hammond <chipx86@chipx86.com>
A tests/test-urgency.c:
* tests/Makefile.am:
- Add a test-urgency testcase.
Sun Jan 29 13:26:31 PST 2006 Christian Hammond <chipx86@chipx86.com>
* Doxyfile.in:

View File

@ -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) \

View File

@ -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))
{

70
tests/test-urgency.c Normal file
View File

@ -0,0 +1,70 @@
/*
* @file tests/test-urgency.c Unit test: urgency levels
*
* @Copyright(C) 2006 Christian Hammond <chipx8@chipx86.com>
*
* 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 <libnotify/notify.h>
#include <stdlib.h>
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;
}