25
25
static void test_active (void);
26
26
static void test_active_event (void);
27
static void test_active_event_count (void);
27
28
static void test_allocation (void);
28
29
static void test_child_added_event (void);
29
30
static void test_child_removed_event (void);
54
55
g_test_add_func (DOMAIN"/Path/Collision", test_path_collision);
55
56
g_test_add_func (DOMAIN"/Events/Close", test_closed_event);
56
57
g_test_add_func (DOMAIN"/Events/Active", test_active_event);
58
g_test_add_func (DOMAIN"/Events/Active/Count", test_active_event_count);
57
59
g_test_add_func (DOMAIN"/Events/Running", test_running_event);
58
60
g_test_add_func (DOMAIN"/Events/ChildAdded", test_child_added_event);
59
61
g_test_add_func (DOMAIN"/Events/ChildRemoved", test_child_removed_event);
317
319
active_event_fired = FALSE;
318
320
bamf_view_set_active (view, TRUE);
319
321
g_assert (bamf_view_is_active (view));
322
g_assert (!active_event_fired);
324
while (g_main_context_pending (NULL)) g_main_context_iteration (NULL, TRUE);
321
325
g_assert (active_event_fired);
322
326
g_assert (active_event_result);
324
328
active_event_fired = FALSE;
325
329
bamf_view_set_active (view, FALSE);
326
330
g_assert (!bamf_view_is_active (view));
331
g_assert (!active_event_fired);
333
while (g_main_context_pending (NULL)) g_main_context_iteration (NULL, TRUE);
328
334
g_assert (active_event_fired);
329
335
g_assert (!active_event_result);
332
338
g_assert (!BAMF_IS_VIEW (view));
341
guint active_event_calls;
344
on_active_event_count (BamfView *view, gboolean active, gpointer pointer)
346
active_event_calls++;;
347
active_event_result = active;
351
test_active_event_count (void)
355
view = g_object_new (BAMF_TYPE_VIEW, NULL);
356
g_assert (!bamf_view_is_active (view));
358
g_signal_connect (G_OBJECT (view), "active-changed",
359
(GCallback) on_active_event_count, NULL);
361
active_event_calls = 0;
362
bamf_view_set_active (view, TRUE);
363
g_assert (bamf_view_is_active (view));
364
g_assert_cmpuint (active_event_calls, ==, 0);
366
while (g_main_context_pending (NULL)) g_main_context_iteration (NULL, TRUE);
367
g_assert_cmpuint (active_event_calls, ==, 1);
368
g_assert (active_event_result);
370
active_event_calls = 0;
371
bamf_view_set_active (view, FALSE);
372
bamf_view_set_active (view, TRUE);
373
bamf_view_set_active (view, FALSE);
375
while (g_main_context_pending (NULL)) g_main_context_iteration (NULL, TRUE);
376
g_assert_cmpuint (active_event_calls, ==, 1);
377
g_assert (!active_event_result);
335
380
static gboolean running_event_fired;
336
381
static gboolean running_event_result;