aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am38
-rw-r--r--tests/indicate-alot.c24
-rw-r--r--tests/indicate-and-crash.c20
-rw-r--r--tests/listen-and-print.c51
-rwxr-xr-xtests/test.js6
5 files changed, 139 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..03ec716
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,38 @@
+
+noinst_PROGRAMS = \
+ indicate-and-crash \
+ indicate-alot \
+ listen-and-print
+
+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)
diff --git a/tests/indicate-alot.c b/tests/indicate-alot.c
new file mode 100644
index 0000000..bebf726
--- /dev/null
+++ b/tests/indicate-alot.c
@@ -0,0 +1,24 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+#define ALOT 30
+
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicators[ALOT];
+ int i;
+
+ for (i = 0; i < ALOT; i++) {
+ indicators[i] = indicate_indicator_new();
+ indicate_indicator_show(indicators[i]);
+ }
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}
diff --git a/tests/indicate-and-crash.c b/tests/indicate-and-crash.c
new file mode 100644
index 0000000..5a50e30
--- /dev/null
+++ b/tests/indicate-and-crash.c
@@ -0,0 +1,20 @@
+
+#include <glib.h>
+#include "libindicate/indicator.h"
+
+gboolean crashfunc (gpointer data) { *(int *)data = 5; return FALSE;}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ IndicateIndicator * indicator = indicate_indicator_new();
+ indicate_indicator_show(indicator);
+
+ g_timeout_add_seconds(15, crashfunc, NULL);
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}
diff --git a/tests/listen-and-print.c b/tests/listen-and-print.c
new file mode 100644
index 0000000..9ad2cc8
--- /dev/null
+++ b/tests/listen-and-print.c
@@ -0,0 +1,51 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static void
+indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data)
+{
+ g_debug("Indicator Added: %s %d %s", (gchar *)server, (guint)indicator, type);
+}
+
+static void
+indicator_removed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data)
+{
+ g_debug("Indicator Removed: %s %d %s", (gchar *)server, (guint)indicator, type);
+}
+
+static void
+indicator_modified (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gchar * property, gpointer data)
+{
+ g_debug("Indicator Modified: %s %d %s %s", (gchar *)server, (guint)indicator, type, property);
+}
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gpointer data)
+{
+ g_debug("Indicator Server Added: %s", (gchar *)server);
+}
+
+static void
+server_removed (IndicateListener * listener, IndicateListenerServer * server, gpointer data)
+{
+ g_debug("Indicator Server Removed: %s", (gchar *)server);
+}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_new();
+
+ g_signal_connect(listener, "indicator-added", G_CALLBACK(indicator_added), NULL);
+ g_signal_connect(listener, "indicator-removed", G_CALLBACK(indicator_removed), NULL);
+ g_signal_connect(listener, "indicator-modified", G_CALLBACK(indicator_modified), NULL);
+ g_signal_connect(listener, "server-added", G_CALLBACK(server_added), NULL);
+ g_signal_connect(listener, "server-removed", G_CALLBACK(server_removed), NULL);
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}
diff --git a/tests/test.js b/tests/test.js
new file mode 100755
index 0000000..45b0d05
--- /dev/null
+++ b/tests/test.js
@@ -0,0 +1,6 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("Indicate");
+
+var indicator = new Indicate.Indicator();
+
+indicator.show();