[libadwaita/wip/cdavis/spin-row] tests: Add AdwSpinRow test



commit 4074c32288b00b9009a8b9ca272946e85d9845d8
Author: Christopher Davis <christopherdavis gnome org>
Date:   Tue Aug 23 15:51:30 2022 -0400

    tests: Add AdwSpinRow test

 tests/meson.build     |  1 +
 tests/test-spin-row.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
---
diff --git a/tests/meson.build b/tests/meson.build
index 2f17a06c..b61b0180 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -48,6 +48,7 @@ test_names = [
   'test-preferences-page',
   'test-preferences-row',
   'test-preferences-window',
+  'test-spin-row',
   'test-split-button',
   'test-squeezer',
   'test-status-page',
diff --git a/tests/test-spin-row.c b/tests/test-spin-row.c
new file mode 100644
index 00000000..0e7a7f8a
--- /dev/null
+++ b/tests/test-spin-row.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2022 Christopher Davis <christopherdavis gnome org>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include <adwaita.h>
+
+static void
+test_adw_spin_row_new_with_range (void)
+{
+  AdwSpinRow *row = g_object_ref_sink (ADW_SPIN_ROW (adw_spin_row_new_with_range (1998.0, 2022.0, 1.0)));
+  GtkAdjustment *adjustment = adw_spin_row_get_adjustment (row);
+
+  g_assert_cmpfloat (gtk_adjustment_get_lower (adjustment), ==, 1998.0);
+  g_assert_cmpfloat (gtk_adjustment_get_upper (adjustment), ==, 2022.0);
+  g_assert_cmpfloat (gtk_adjustment_get_step_increment (adjustment), ==, 1.0);
+  g_assert_cmpfloat (gtk_adjustment_get_page_increment (adjustment), ==, 10.0);
+
+  g_assert_finalize_object (row);
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+  gtk_test_init (&argc, &argv, NULL);
+  adw_init ();
+
+  g_test_add_func("/Adwaita/SpinRow/new_with_range", test_adw_spin_row_new_with_range);
+
+  return g_test_run();
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]