aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-12 16:31:59 -0600
committerTed Gould <ted@gould.cx>2010-01-12 16:31:59 -0600
commitcc31c237cd5da314e584570220bd0bf359b725be (patch)
tree0edbf8f656acd9b06a94622cf6ca2acdd04e22b5 /tests
parent348bcfba144c1e2f3025352f23f038829558bc7f (diff)
downloadayatana-indicator-application-cc31c237cd5da314e584570220bd0bf359b725be.tar.gz
ayatana-indicator-application-cc31c237cd5da314e584570220bd0bf359b725be.tar.bz2
ayatana-indicator-application-cc31c237cd5da314e584570220bd0bf359b725be.zip
Adding in the item side of things.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/test-libappindicator-fallback-item.c84
2 files changed, 85 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e5847c5..f543e92 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -77,7 +77,7 @@ test_libappindicator_fallback_watcher_LDADD = \
$(top_builddir)/src/libappindicator.la
test_libappindicator_fallback_item_SOURCES = \
- test-libappindicator-fallback-watcher.c
+ test-libappindicator-fallback-item.c
test_libappindicator_fallback_item_CFLAGS = \
$(INDICATOR_CFLAGS) \
diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c
new file mode 100644
index 0000000..02724fe
--- /dev/null
+++ b/tests/test-libappindicator-fallback-item.c
@@ -0,0 +1,84 @@
+#include <glib.h>
+#include <glib-object.h>
+#include <libappindicator/app-indicator.h>
+
+#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE (test_libappindicator_fallback_item_get_type ())
+#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItem))
+#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass))
+#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE))
+#define IS_TEST_LIBAPPINDICATOR_FALLBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE))
+#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemClass))
+
+typedef struct _TestLibappindicatorFallbackItem TestLibappindicatorFallbackItem;
+typedef struct _TestLibappindicatorFallbackItemClass TestLibappindicatorFallbackItemClass;
+
+struct _TestLibappindicatorFallbackItemClass {
+ AppIndicatorClass parent_class;
+
+};
+
+struct _TestLibappindicatorFallbackItem {
+ AppIndicator parent;
+
+};
+
+GType test_libappindicator_fallback_item_get_type (void);
+
+#define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItemPrivate))
+
+static void test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass);
+static void test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self);
+static GtkStatusIcon * fallback (AppIndicator * indicator);
+static void unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon);
+
+G_DEFINE_TYPE (TestLibappindicatorFallbackItem, test_libappindicator_fallback_item, APP_INDICATOR_TYPE);
+
+static void
+test_libappindicator_fallback_item_class_init (TestLibappindicatorFallbackItemClass *klass)
+{
+ AppIndicatorClass * aiclass = APP_INDICATOR_CLASS(klass);
+
+ aiclass->fallback = fallback;
+ aiclass->unfallback = unfallback;
+}
+
+static void
+test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self)
+{
+}
+
+GMainLoop * mainloop = NULL;
+
+static GtkStatusIcon *
+fallback (AppIndicator * indicator)
+{
+ g_debug("Fallback");
+ return NULL;
+}
+
+static void
+unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon)
+{
+ g_debug("Unfallback");
+ return;
+}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ TestLibappindicatorFallbackItem * item = g_object_new(TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE,
+ "id", "test-id",
+ "category", "other",
+ "icon-name", "bob",
+ NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ g_object_unref(G_OBJECT(item));
+
+ return 0;
+}