summaryrefslogtreecommitdiffstats
path: root/subprojects/libhandy/tests/test-carousel-indicator-dots.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:36:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:36:24 +0000
commit9b6d8e63db85c30007b463e91f91a791969fa83f (patch)
tree0899af51d73c1bf986f73ae39a03c4436083018a /subprojects/libhandy/tests/test-carousel-indicator-dots.c
parentInitial commit. (diff)
downloadgnome-control-center-9b6d8e63db85c30007b463e91f91a791969fa83f.tar.xz
gnome-control-center-9b6d8e63db85c30007b463e91f91a791969fa83f.zip
Adding upstream version 1:3.38.4.upstream/1%3.38.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'subprojects/libhandy/tests/test-carousel-indicator-dots.c')
-rw-r--r--subprojects/libhandy/tests/test-carousel-indicator-dots.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/subprojects/libhandy/tests/test-carousel-indicator-dots.c b/subprojects/libhandy/tests/test-carousel-indicator-dots.c
new file mode 100644
index 0000000..bd02d10
--- /dev/null
+++ b/subprojects/libhandy/tests/test-carousel-indicator-dots.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2020 Alexander Mikhaylenko <alexm@gnome.org>
+ *
+ * SPDX-License-Identifier: LGPL-2.1+
+ */
+
+#include <handy.h>
+
+gint notified;
+
+static void
+notify_cb (GtkWidget *widget, gpointer data)
+{
+ notified++;
+}
+
+static void
+test_hdy_carousel_indicator_dots_carousel (void)
+{
+ g_autoptr (HdyCarouselIndicatorDots) dots = NULL;
+ HdyCarousel *carousel;
+
+ dots = g_object_ref_sink (HDY_CAROUSEL_INDICATOR_DOTS (hdy_carousel_indicator_dots_new ()));
+ g_assert_nonnull (dots);
+
+ notified = 0;
+ g_signal_connect (dots, "notify::carousel", G_CALLBACK (notify_cb), NULL);
+
+ carousel = HDY_CAROUSEL (hdy_carousel_new ());
+ g_assert_nonnull (carousel);
+
+ g_assert_null (hdy_carousel_indicator_dots_get_carousel (dots));
+ g_assert_cmpint (notified, ==, 0);
+
+ hdy_carousel_indicator_dots_set_carousel (dots, carousel);
+ g_assert (hdy_carousel_indicator_dots_get_carousel (dots) == carousel);
+ g_assert_cmpint (notified, ==, 1);
+
+ hdy_carousel_indicator_dots_set_carousel (dots, NULL);
+ g_assert_null (hdy_carousel_indicator_dots_get_carousel (dots));
+ g_assert_cmpint (notified, ==, 2);
+}
+
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ gtk_test_init (&argc, &argv, NULL);
+ hdy_init ();
+
+ g_test_add_func("/Handy/CarouselIndicatorDots/carousel", test_hdy_carousel_indicator_dots_carousel);
+ return g_test_run();
+}