| 1 |
/* |
|---|
| 2 |
* @file tests/test-size-changes.c Unit test: Notification size changes |
|---|
| 3 |
* |
|---|
| 4 |
* @Copyright (C) 2006 Christian Hammond <chipx86@chipx86.com> |
|---|
| 5 |
* |
|---|
| 6 |
* This library is free software; you can redistribute it and/or |
|---|
| 7 |
* modify it under the terms of the GNU Lesser General Public |
|---|
| 8 |
* License as published by the Free Software Foundation; either |
|---|
| 9 |
* version 2.1 of the License, or (at your option) any later version. |
|---|
| 10 |
* |
|---|
| 11 |
* This library is distributed in the hope that it will be useful, |
|---|
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 |
* Lesser General Public License for more details. |
|---|
| 15 |
* |
|---|
| 16 |
* You should have received a copy of the GNU Lesser General Public |
|---|
| 17 |
* License along with this library; if not, write to the |
|---|
| 18 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|---|
| 19 |
* Boston, MA 02111-1307, USA. |
|---|
| 20 |
*/ |
|---|
| 21 |
|
|---|
| 22 |
#include <libnotify/notify.h> |
|---|
| 23 |
#include <stdio.h> |
|---|
| 24 |
#include <unistd.h> |
|---|
| 25 |
|
|---|
| 26 |
int |
|---|
| 27 |
main() |
|---|
| 28 |
{ |
|---|
| 29 |
NotifyNotification *n1, *n2, *n3; |
|---|
| 30 |
|
|---|
| 31 |
notify_init("Size Changes"); |
|---|
| 32 |
|
|---|
| 33 |
n1 = notify_notification_new("Notification 1", "Notification number 1!", |
|---|
| 34 |
NULL, NULL); |
|---|
| 35 |
notify_notification_set_timeout(n1, 7000); |
|---|
| 36 |
|
|---|
| 37 |
if (!notify_notification_show(n1, NULL)) |
|---|
| 38 |
{ |
|---|
| 39 |
fprintf(stderr, "failed to send notification\n"); |
|---|
| 40 |
return 1; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
g_object_unref(G_OBJECT(n1)); |
|---|
| 44 |
|
|---|
| 45 |
n2 = notify_notification_new("Notification 2", "Notification number 2!", |
|---|
| 46 |
NULL, NULL); |
|---|
| 47 |
notify_notification_set_timeout(n2, 7000); |
|---|
| 48 |
|
|---|
| 49 |
if (!notify_notification_show(n2, NULL)) |
|---|
| 50 |
{ |
|---|
| 51 |
fprintf(stderr, "failed to send notification\n"); |
|---|
| 52 |
return 1; |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
n3 = notify_notification_new("Notification 3", "Notification number 3!", |
|---|
| 57 |
NULL, NULL); |
|---|
| 58 |
notify_notification_set_timeout(n3, 7000); |
|---|
| 59 |
|
|---|
| 60 |
if (!notify_notification_show(n3, NULL)) |
|---|
| 61 |
{ |
|---|
| 62 |
fprintf(stderr, "failed to send notification\n"); |
|---|
| 63 |
return 1; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
g_object_unref(G_OBJECT(n3)); |
|---|
| 67 |
|
|---|
| 68 |
sleep(2); |
|---|
| 69 |
|
|---|
| 70 |
notify_notification_update(n2, "Longer Notification 2", |
|---|
| 71 |
"This is a much longer notification.\n" |
|---|
| 72 |
"Two lines.\n" |
|---|
| 73 |
"Well, okay, three.\n" |
|---|
| 74 |
"Last one.", |
|---|
| 75 |
NULL); |
|---|
| 76 |
|
|---|
| 77 |
if (!notify_notification_show(n2, NULL)) |
|---|
| 78 |
{ |
|---|
| 79 |
fprintf(stderr, "failed to send notification\n"); |
|---|
| 80 |
return 1; |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
return 0; |
|---|
| 84 |
} |
|---|