aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-09 16:47:45 -0500
committerTed Gould <ted@gould.cx>2010-07-09 16:47:45 -0500
commit8072a97d30c0e3aaa9f02b89f53ae9af247e473b (patch)
treedebb9a1b27c278b23240695722a159f507e55c1f /tests
parent306a78b6a438f0702d7f8475e726de53a7a7b66c (diff)
downloadlibayatana-appindicator-8072a97d30c0e3aaa9f02b89f53ae9af247e473b.tar.gz
libayatana-appindicator-8072a97d30c0e3aaa9f02b89f53ae9af247e473b.tar.bz2
libayatana-appindicator-8072a97d30c0e3aaa9f02b89f53ae9af247e473b.zip
Adding a new sample approver
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am16
-rw-r--r--tests/test-approver.c74
2 files changed, 90 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8d356bc..a920a20 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,6 @@
check_PROGRAMS = \
+ test-approver \
test-libappindicator \
test-libappindicator-dbus-client \
test-libappindicator-dbus-server \
@@ -99,6 +100,21 @@ test_libappindicator_status_server_LDADD = \
$(top_builddir)/src/libappindicator.la
#########################################
+## test-approver
+#########################################
+
+test_approver_SOURCES = \
+ test-approver.c
+
+test_approver_CFLAGS = \
+ $(INDICATOR_CFLAGS) \
+ -Wall -Werror \
+ -I$(top_srcdir)/src
+
+test_approver_LDADD = \
+ $(INDICATOR_LIBS)
+
+#########################################
## test-libappindicator-fallback
#########################################
diff --git a/tests/test-approver.c b/tests/test-approver.c
new file mode 100644
index 0000000..f411b0d
--- /dev/null
+++ b/tests/test-approver.c
@@ -0,0 +1,74 @@
+#include <glib.h>
+#include <glib-object.h>
+
+#define APPROVER_PATH "/my/approver"
+
+#define TEST_APPROVER_TYPE (test_approver_get_type ())
+#define TEST_APPROVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_APPROVER_TYPE, TestApprover))
+#define TEST_APPROVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_APPROVER_TYPE, TestApproverClass))
+#define IS_TEST_APPROVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_APPROVER_TYPE))
+#define IS_TEST_APPROVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_APPROVER_TYPE))
+#define TEST_APPROVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_APPROVER_TYPE, TestApproverClass))
+
+typedef struct _TestApprover TestApprover;
+typedef struct _TestApproverClass TestApproverClass;
+
+struct _TestApproverClass {
+ GObjectClass parent_class;
+};
+
+struct _TestApprover {
+ GObject parent;
+};
+
+GType test_approver_get_type (void);
+
+static void test_approver_class_init (TestApproverClass *klass);
+static void test_approver_init (TestApprover *self);
+static void _notification_approver_server_approve_item (void);
+
+#include "../src/notification-approver-server.h"
+
+G_DEFINE_TYPE (TestApprover, test_approver, G_TYPE_OBJECT);
+
+static void
+test_approver_class_init (TestApproverClass *klass)
+{
+ dbus_g_object_type_install_info(TEST_APPROVER_TYPE,
+ &dbus_glib__notification_approver_server_object_info);
+
+ return;
+}
+
+static void
+test_approver_init (TestApprover *self)
+{
+ DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+
+ dbus_g_connection_register_g_object(session_bus,
+ APPROVER_PATH,
+ G_OBJECT(self));
+
+ return;
+}
+
+static void
+_notification_approver_server_approve_item (void)
+{
+ return;
+}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ TestApprover * approver = g_object_new(TEST_APPROVER_TYPE, NULL);
+
+ GMainLoop * main_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(main_loop);
+
+ g_object_unref(approver);
+
+ return 0;
+}