Debian Codegraph @

tests/test-basic.c

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 *
3 * @file tests/test-basic.c Unit test: basics
4 *
5 * @Copyright (C) 2004 Mike Hearn <[email protected]>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23 #include <libnotify/notify.h>
24 #include <stdio.h>
25 #include <unistd.h>
26
27 int
28 main ()
29 {
30 NotifyNotification *n;
31
32 notify_init ("Basics");
33
34 /* Long summary */
35 n = notify_notification_new ("Summary that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
36 "Content",
37 NULL);
38 notify_notification_set_timeout (n, 3000); //3 seconds
39
40 if (!notify_notification_show (n, NULL)) {
41 fprintf (stderr, "failed to send notification\n");
42 return 1;
43 }
44
45 g_object_unref (G_OBJECT (n));
46
47 /* Long message */
48 n = notify_notification_new ("Summary",
49 "Content that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
50 NULL);
51 notify_notification_set_timeout (n, 3000); //3 seconds
52
53 if (!notify_notification_show (n, NULL)) {
54 fprintf (stderr, "failed to send notification\n");
55 return 1;
56 }
57
58 g_object_unref (G_OBJECT (n));
59
60 /* Summary only */
61 n = notify_notification_new ("Summary only there is no message content",
62 NULL,
63 NULL);
64 notify_notification_set_timeout (n, NOTIFY_EXPIRES_NEVER);
65
66 if (!notify_notification_show (n, NULL)) {
67 fprintf (stderr, "failed to send notification\n");
68 return 1;
69 }
70
71 g_object_unref (G_OBJECT (n));
72
73 return 0;
74 }