aboutsummaryrefslogtreecommitdiff
path: root/tests/test-libappindicator-fallback-item.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-12 16:44:13 -0600
committerTed Gould <ted@gould.cx>2010-01-12 16:44:13 -0600
commit9a2102419fa43910995539a90981727838cc6c40 (patch)
tree593e1ec220a9813f27d57767c4069f23c9c0c343 /tests/test-libappindicator-fallback-item.c
parenta216db21dd72d491edaca5c7746d3a2a23b17dd1 (diff)
downloadlibayatana-appindicator-9a2102419fa43910995539a90981727838cc6c40.tar.gz
libayatana-appindicator-9a2102419fa43910995539a90981727838cc6c40.tar.bz2
libayatana-appindicator-9a2102419fa43910995539a90981727838cc6c40.zip
Adding state transitions that'll get us to a passed state.
Diffstat (limited to 'tests/test-libappindicator-fallback-item.c')
-rw-r--r--tests/test-libappindicator-fallback-item.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c
index 83dc876..ce3182c 100644
--- a/tests/test-libappindicator-fallback-item.c
+++ b/tests/test-libappindicator-fallback-item.c
@@ -51,10 +51,29 @@ test_libappindicator_fallback_item_init (TestLibappindicatorFallbackItem *self)
GMainLoop * mainloop = NULL;
gboolean passed = FALSE;
+enum {
+ STATE_INIT,
+ STATE_FALLBACK,
+ STATE_UNFALLBACK,
+ STATE_REFALLBACK
+};
+
+gint state = STATE_INIT;
+
static GtkStatusIcon *
fallback (AppIndicator * indicator)
{
g_debug("Fallback");
+ if (state == STATE_INIT) {
+ state = STATE_FALLBACK;
+ } else if (state == STATE_UNFALLBACK) {
+ state = STATE_REFALLBACK;
+ passed = TRUE;
+ g_main_loop_quit(mainloop);
+ } else {
+ g_debug("Error, fallback in state: %d", state);
+ passed = FALSE;
+ }
return NULL;
}
@@ -62,6 +81,12 @@ static void
unfallback (AppIndicator * indicator, GtkStatusIcon * status_icon)
{
g_debug("Unfallback");
+ if (state == STATE_FALLBACK) {
+ state = STATE_UNFALLBACK;
+ } else {
+ g_debug("Error, unfallback in state: %d", state);
+ passed = FALSE;
+ }
return;
}