aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore9
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac1
-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--tests/Makefile.am74
-rw-r--r--tests/test-simple-client.c30
-rw-r--r--tests/test-simple-server.c39
-rwxr-xr-xtests/test_simple5
14 files changed, 173 insertions, 58 deletions
diff --git a/.bzrignore b/.bzrignore
index 2e5dd36..f9d8412 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -60,3 +60,12 @@ libindicate/indicate-enum-types.h
libindicate/libindicate_la-indicate-enum-types.lo
libindicate/s-enum-types-c
libindicate/s-enum-types-h
+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
diff --git a/Makefile.am b/Makefile.am
index d4f7ca2..2f11251 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,7 @@
SUBDIRS = \
src \
libindicate \
+ examples \
tests \
data \
po \
diff --git a/configure.ac b/configure.ac
index ca46ff9..496ae6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,6 +161,7 @@ Makefile
src/Makefile
libindicate/Makefile
libindicate/indicate.pc
+examples/Makefile
tests/Makefile
data/Makefile
po/Makefile.in
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/tests/Makefile.am b/tests/Makefile.am
index 862046e..9f1c6d3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,72 +1,30 @@
-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)
+TESTS = \
+ test_simple
-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)
+libexec_PROGRAMS = \
+ test-simple-client \
+ test-simple-server
-listen_and_print_LDADD = \
- ../libindicate/libindicate.la \
- $(LIBINDICATE_LIBS)
+test_simple: test-simple-client test-simple-server
-im_client_SOURCES = \
- im-client.c
+test_simple_client_SOURCES = \
+ test-simple-client.c
-im_client_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_simple_client_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-im_client_LDADD = \
+test_simple_client_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
-show_hide_server_SOURCES = \
- show-hide-server.c
+test_simple_server_SOURCES = \
+ test-simple-server.c
-show_hide_server_CFLAGS = \
- -I $(srcdir)/.. \
- $(LIBINDICATE_CFLAGS)
+test_simple_server_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
-show_hide_server_LDADD = \
+test_simple_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/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_simple b/tests/test_simple
new file mode 100755
index 0000000..8c4263e
--- /dev/null
+++ b/tests/test_simple
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="/home/ted/Development/dbus-play/dbus-test-runner --dbus-config /home/ted/Development/dbus-play/session.conf"
+
+${DBUS_RUNNER} --task ./test-simple-client --task-name Client --task ./test-simple-server --task-name Server