1 /*
2 * Copyright (C) 2019 Alexander Mikhaylenko <exalm7659@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1+
5 */
6
7 #include <handy.h>
8
9 static void
test_hdy_swipe_group_add_remove(void)10 test_hdy_swipe_group_add_remove (void)
11 {
12 g_autoptr (HdySwipeGroup) group = NULL;
13 g_autoptr (HdySwipeable) swipeable1 = NULL;
14 g_autoptr (HdySwipeable) swipeable2 = NULL;
15
16 group = hdy_swipe_group_new ();
17
18 swipeable1 = HDY_SWIPEABLE (hdy_carousel_new ());
19 swipeable2 = HDY_SWIPEABLE (hdy_carousel_new ());
20
21 g_assert_cmpint (g_slist_length (hdy_swipe_group_get_swipeables (group)), ==, 0);
22
23 hdy_swipe_group_add_swipeable (group, swipeable1);
24 g_assert_cmpint (g_slist_length (hdy_swipe_group_get_swipeables (group)), ==, 1);
25
26 hdy_swipe_group_add_swipeable (group, swipeable2);
27 g_assert_cmpint (g_slist_length (hdy_swipe_group_get_swipeables (group)), ==, 2);
28
29 hdy_swipe_group_remove_swipeable (group, swipeable2);
30 g_assert_cmpint (g_slist_length (hdy_swipe_group_get_swipeables (group)), ==, 1);
31
32 hdy_swipe_group_remove_swipeable (group, swipeable1);
33 g_assert_cmpint (g_slist_length (hdy_swipe_group_get_swipeables (group)), ==, 0);
34 }
35
36 gint
main(gint argc,gchar * argv[])37 main (gint argc,
38 gchar *argv[])
39 {
40 gtk_test_init (&argc, &argv, NULL);
41 hdy_init ();
42
43 g_test_add_func("/Handy/SwipeGroup/add_remove", test_hdy_swipe_group_add_remove);
44 return g_test_run();
45 }
46