aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-27 10:50:40 -0500
committerTed Gould <ted@canonical.com>2009-04-27 10:50:40 -0500
commit73e576b120f91aa42d8040af16a2310fb60d62c1 (patch)
tree20062dd5d0ff2f06f0b73e8540b57367ed439bbf
parent183d218f7c7d22da792b90c0014d44b088d91008 (diff)
parent0f174a8a4904e33f912fae70a6345a861306b474 (diff)
downloadlibayatana-indicator-73e576b120f91aa42d8040af16a2310fb60d62c1.tar.gz
libayatana-indicator-73e576b120f91aa42d8040af16a2310fb60d62c1.tar.bz2
libayatana-indicator-73e576b120f91aa42d8040af16a2310fb60d62c1.zip
Upstream Snapshot: Adding in a test suite.
-rw-r--r--.bzrignore18
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac1
-rw-r--r--debian/changelog6
-rw-r--r--examples/Makefile.am72
-rw-r--r--examples/im-client.c (renamed from tests/im-client.c)0
-rw-r--r--examples/indicate-alot.c (renamed from tests/indicate-alot.c)0
-rw-r--r--examples/indicate-and-crash.c (renamed from tests/indicate-and-crash.c)0
-rw-r--r--examples/listen-and-print.c (renamed from tests/listen-and-print.c)0
-rw-r--r--examples/show-hide-server.c (renamed from tests/show-hide-server.c)0
-rwxr-xr-xexamples/test.js (renamed from tests/test.js)0
-rw-r--r--libindicate/listener.c4
-rw-r--r--tests/Makefile.am153
-rw-r--r--tests/test-interests-client.c63
-rw-r--r--tests/test-interests-server.c45
-rw-r--r--tests/test-interests-server1.c41
-rw-r--r--tests/test-interests-server2.c41
-rw-r--r--tests/test-interests-server3.c41
-rw-r--r--tests/test-interests-server4.c41
-rw-r--r--tests/test-interests-server5.c41
-rw-r--r--tests/test-simple-client.c30
-rw-r--r--tests/test-simple-server.c39
-rw-r--r--tests/test-thousand-indicators-client.c34
-rw-r--r--tests/test-thousand-indicators-server.c43
-rwxr-xr-xtests/test_interests5
-rwxr-xr-xtests/test_interests_multi5
-rwxr-xr-xtests/test_simple5
-rwxr-xr-xtests/test_thousand_indicators5
28 files changed, 692 insertions, 42 deletions
diff --git a/.bzrignore b/.bzrignore
index a8561af..6e10243 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -61,3 +61,21 @@ libindicate/libindicate_la-indicate-enum-types.lo
libindicate/s-enum-types-c
libindicate/s-enum-types-h
indicator.pc
+examples/.deps
+examples/.libs
+examples/im-client
+examples/indicate-alot
+examples/indicate-and-crash
+examples/listen-and-print
+examples/show-hide-server
+test-simple-client
+test-simple-server
+test-interests-client
+test-interests-server
+test-interests-server1
+test-interests-server2
+test-interests-server3
+test-interests-server4
+test-interests-server5
+test-thousand-indicators-server
+test-thousand-indicators-client
diff --git a/Makefile.am b/Makefile.am
index a523c3a..ac6fe90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,7 @@ SUBDIRS = \
src \
libindicate \
libindicator \
+ examples \
tests \
data \
po \
diff --git a/configure.ac b/configure.ac
index 3df81f5..939accd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,7 @@ libindicate/Makefile
libindicate/indicate.pc
libindicator/Makefile
libindicator/indicator.pc
+examples/Makefile
tests/Makefile
data/Makefile
po/Makefile.in
diff --git a/debian/changelog b/debian/changelog
index b51b603..11bdc8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+indicator-applet (0.2.0~bzr307-0ubuntu1) UNRELEASED; urgency=low
+
+ * Upstream Snapshot: Adding in a test suite.
+
+ -- Ted Gould <ted@ubuntu.com> Mon, 27 Apr 2009 10:50:10 -0500
+
indicator-applet (0.2.0~bzr305-0ubuntu1) jaunty; urgency=low
* Upstream snapshot
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..862046e
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,72 @@
+
+libexec_PROGRAMS = \
+ indicate-and-crash \
+ indicate-alot \
+ listen-and-print \
+ im-client \
+ show-hide-server
+
+indicate_and_crash_SOURCES = \
+ indicate-and-crash.c
+
+indicate_and_crash_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+indicate_and_crash_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+indicate_alot_SOURCES = \
+ indicate-alot.c
+
+indicate_alot_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+indicate_alot_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+listen_and_print_SOURCES = \
+ listen-and-print.c
+
+listen_and_print_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+listen_and_print_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+im_client_SOURCES = \
+ im-client.c
+
+im_client_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+im_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+show_hide_server_SOURCES = \
+ show-hide-server.c
+
+show_hide_server_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+show_hide_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+examplesdir = $(docdir)/examples/
+
+examples_DATA = \
+ $(indicate_and_crash_SOURCES) \
+ $(indicate_alot_SOURCES) \
+ $(listen_and_print_SOURCES) \
+ $(im_client_SOURCES)
+
+EXTRA_DIST = $(examples_DATA)
diff --git a/tests/im-client.c b/examples/im-client.c
index bf2fbb2..bf2fbb2 100644
--- a/tests/im-client.c
+++ b/examples/im-client.c
diff --git a/tests/indicate-alot.c b/examples/indicate-alot.c
index 479040b..479040b 100644
--- a/tests/indicate-alot.c
+++ b/examples/indicate-alot.c
diff --git a/tests/indicate-and-crash.c b/examples/indicate-and-crash.c
index c002a54..c002a54 100644
--- a/tests/indicate-and-crash.c
+++ b/examples/indicate-and-crash.c
diff --git a/tests/listen-and-print.c b/examples/listen-and-print.c
index dcad92b..dcad92b 100644
--- a/tests/listen-and-print.c
+++ b/examples/listen-and-print.c
diff --git a/tests/show-hide-server.c b/examples/show-hide-server.c
index 23c1ea1..23c1ea1 100644
--- a/tests/show-hide-server.c
+++ b/examples/show-hide-server.c
diff --git a/tests/test.js b/examples/test.js
index 45b0d05..45b0d05 100755
--- a/tests/test.js
+++ b/examples/test.js
diff --git a/libindicate/listener.c b/libindicate/listener.c
index fddeb71..bd3639d 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -1003,6 +1003,10 @@ interest_cb (DBusGProxy *proxy, GError *error, gpointer userdata)
void
indicate_listener_server_show_interest (IndicateListener * listener, IndicateListenerServer * server, IndicateInterests interest)
{
+ if (!(interest > INDICATE_INTEREST_NONE && interest < INDICATE_INTEREST_LAST)) {
+ return;
+ }
+
if (!server->interests[interest]) {
org_freedesktop_indicator_show_interest_async (server->proxy, interest_to_string(interest), interest_cb, server);
server->interests[interest] = TRUE;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 862046e..03bd980 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,72 +1,141 @@
+TESTS = \
+ test_simple \
+ test_interests \
+ test_interests_multi \
+ test_thousand_indicators
+
libexec_PROGRAMS = \
- indicate-and-crash \
- indicate-alot \
- listen-and-print \
- im-client \
- show-hide-server
+ test-interests-client \
+ test-interests-server \
+ test-interests-server1 \
+ test-interests-server2 \
+ test-interests-server3 \
+ test-interests-server4 \
+ test-interests-server5 \
+ test-thousand-indicators-client \
+ test-thousand-indicators-server \
+ test-simple-client \
+ test-simple-server
+
+EXTRA_DIST = \
+ $(TESTS)
+
+test_simple: test-simple-client test-simple-server
+
+test_simple_client_SOURCES = \
+ test-simple-client.c
+
+test_simple_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_simple_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
-indicate_and_crash_SOURCES = \
- indicate-and-crash.c
+test_simple_server_SOURCES = \
+ test-simple-server.c
-indicate_and_crash_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_simple_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-indicate_and_crash_LDADD = \
+test_simple_server_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-indicate_alot_SOURCES = \
- indicate-alot.c
+test_interests: test-interests-client test-interests-server
+
+test_interests_client_SOURCES = \
+ test-interests-client.c
+
+test_interests_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_server_SOURCES = \
+ test-interests-server.c
+
+test_interests_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_multi: test-interests-client test-interests-server1 test-interests-server2 test-interests-server3 test-interests-server4 test-interests-server5
+
+test_interests_server1_SOURCES = \
+ test-interests-server1.c
-indicate_alot_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server1_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-indicate_alot_LDADD = \
+test_interests_server1_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-listen_and_print_SOURCES = \
- listen-and-print.c
+test_interests_server2_SOURCES = \
+ test-interests-server2.c
-listen_and_print_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server2_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-listen_and_print_LDADD = \
+test_interests_server2_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-im_client_SOURCES = \
- im-client.c
+test_interests_server3_SOURCES = \
+ test-interests-server3.c
-im_client_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server3_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-im_client_LDADD = \
+test_interests_server3_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-show_hide_server_SOURCES = \
- show-hide-server.c
+test_interests_server4_SOURCES = \
+ test-interests-server4.c
-show_hide_server_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_interests_server4_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-show_hide_server_LDADD = \
+test_interests_server4_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-examplesdir = $(docdir)/examples/
+test_interests_server5_SOURCES = \
+ test-interests-server5.c
-examples_DATA = \
- $(indicate_and_crash_SOURCES) \
- $(indicate_alot_SOURCES) \
- $(listen_and_print_SOURCES) \
- $(im_client_SOURCES)
+test_interests_server5_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server5_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_thousand_indicators: test-thousand-indicators-client test-thousand-indicators-server
+
+test_thousand_indicators_client_SOURCES = \
+ test-thousand-indicators-client.c
+
+test_thousand_indicators_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_thousand_indicators_client_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_thousand_indicators_server_SOURCES = \
+ test-thousand-indicators-server.c
+
+test_thousand_indicators_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_thousand_indicators_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
-EXTRA_DIST = $(examples_DATA)
diff --git a/tests/test-interests-client.c b/tests/test-interests-client.c
new file mode 100644
index 0000000..bde3b26
--- /dev/null
+++ b/tests/test-interests-client.c
@@ -0,0 +1,63 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+#include "libindicate/server.h"
+#include "libindicate/interests.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+static gboolean interests[INDICATE_INTEREST_LAST] = {0};
+
+static gboolean
+check_interests (void)
+{
+ guint i;
+ for (i = INDICATE_INTEREST_NONE + 1; i < INDICATE_INTEREST_LAST; i++) {
+ if (!interests[i]) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+interest_added (IndicateServer * server, IndicateInterests interest)
+{
+ g_debug("Oh, someone is interested in my for: %d", interest);
+ interests[interest] = TRUE;
+
+ if (check_interests()) {
+ g_main_loop_quit(mainloop);
+ }
+
+ return;
+}
+
+static gboolean
+done_timeout_cb (gpointer data)
+{
+ g_debug("All interests not set");
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+
+ IndicateServer * server = indicate_server_ref_default();
+ g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_ADDED, G_CALLBACK(interest_added), NULL);
+
+ g_timeout_add_seconds(2, done_timeout_cb, indicator);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server.c b/tests/test-interests-server.c
new file mode 100644
index 0000000..e1433d8
--- /dev/null
+++ b/tests/test-interests-server.c
@@ -0,0 +1,45 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+
+ gint i;
+ for (i = INDICATE_INTEREST_NONE - 2; i < INDICATE_INTEREST_LAST + 2; i++) {
+ g_debug("Indicating Interests: %d", i);
+ indicate_listener_server_show_interest(listener, server, i);
+ }
+
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server1.c b/tests/test-interests-server1.c
new file mode 100644
index 0000000..e0d77f3
--- /dev/null
+++ b/tests/test-interests-server1.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 1
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server2.c b/tests/test-interests-server2.c
new file mode 100644
index 0000000..0416c21
--- /dev/null
+++ b/tests/test-interests-server2.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 2
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server3.c b/tests/test-interests-server3.c
new file mode 100644
index 0000000..7d889b1
--- /dev/null
+++ b/tests/test-interests-server3.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 3
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server4.c b/tests/test-interests-server4.c
new file mode 100644
index 0000000..50e6db1
--- /dev/null
+++ b/tests/test-interests-server4.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 4
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server5.c b/tests/test-interests-server5.c
new file mode 100644
index 0000000..d415716
--- /dev/null
+++ b/tests/test-interests-server5.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 5
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-simple-client.c b/tests/test-simple-client.c
new file mode 100644
index 0000000..f8db55a
--- /dev/null
+++ b/tests/test-simple-client.c
@@ -0,0 +1,30 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static gboolean
+done_timeout_cb (gpointer data)
+{
+ g_debug("All done.");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+
+ g_timeout_add_seconds(2, done_timeout_cb, indicator);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-simple-server.c b/tests/test-simple-server.c
new file mode 100644
index 0000000..0a04e85
--- /dev/null
+++ b/tests/test-simple-server.c
@@ -0,0 +1,39 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ g_main_loop_quit(mainloop);
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Failed to get a server in 5 seconds.");
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(5, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-thousand-indicators-client.c b/tests/test-thousand-indicators-client.c
new file mode 100644
index 0000000..0ac7305
--- /dev/null
+++ b/tests/test-thousand-indicators-client.c
@@ -0,0 +1,34 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static gboolean
+done_timeout_cb (gpointer data)
+{
+ g_debug("All done.");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ int i;
+ for (i = 0; i < 1000; i++) {
+ /* Memory leak :) */
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+ }
+
+ g_timeout_add_seconds(2, done_timeout_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-thousand-indicators-server.c b/tests/test-thousand-indicators-server.c
new file mode 100644
index 0000000..285e56b
--- /dev/null
+++ b/tests/test-thousand-indicators-server.c
@@ -0,0 +1,43 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+static guint indicator_count = 0;
+
+static void
+indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data)
+{
+ g_debug("Indicator Added: %s %d %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), INDICATE_LISTENER_INDICATOR_ID(indicator), type);
+ indicator_count++;
+ if (indicator_count == 1000) {
+ g_main_loop_quit(mainloop);
+ }
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Failed to get a server in 5 seconds.");
+ passed = FALSE;
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL);
+
+ g_timeout_add_seconds(5, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test_interests b/tests/test_interests
new file mode 100755
index 0000000..750a789
--- /dev/null
+++ b/tests/test_interests
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-interests-client --task-name Client --task ./test-interests-server --task-name Server
diff --git a/tests/test_interests_multi b/tests/test_interests_multi
new file mode 100755
index 0000000..4dbdee8
--- /dev/null
+++ b/tests/test_interests_multi
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-interests-client --task-name Client --task ./test-interests-server1 --task-name Server1 --task ./test-interests-server2 --task-name Server2 --task ./test-interests-server3 --task-name Server3 --task ./test-interests-server4 --task-name Server4 --task ./test-interests-server5 --task-name Server5
diff --git a/tests/test_simple b/tests/test_simple
new file mode 100755
index 0000000..1b0dc4c
--- /dev/null
+++ b/tests/test_simple
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-simple-client --task-name Client --task ./test-simple-server --task-name Server
diff --git a/tests/test_thousand_indicators b/tests/test_thousand_indicators
new file mode 100755
index 0000000..fb1079d
--- /dev/null
+++ b/tests/test_thousand_indicators
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf"
+
+${DBUS_RUNNER} --task ./test-thousand-indicators-client --task-name Client --task ./test-thousand-indicators-server --task-name Server