[libshumate] tests: Add new marker test for the new API



commit 35e38229638f58cea70dcbc2ffd73d777f8c0ca4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Mar 2 14:49:35 2021 -0300

    tests: Add new marker test for the new API
    
    Who doesn't like an unit test anyway? :)

 tests/marker.c    | 30 ++++++++++++++++++++++++++++++
 tests/meson.build |  1 +
 2 files changed, 31 insertions(+)
---
diff --git a/tests/marker.c b/tests/marker.c
new file mode 100644
index 0000000..94e6861
--- /dev/null
+++ b/tests/marker.c
@@ -0,0 +1,30 @@
+#include <gtk/gtk.h>
+#include <shumate/shumate.h>
+
+static void
+test_marker_child (void)
+{
+  ShumateMarker *marker;
+  GtkWidget *button;
+
+  marker = shumate_marker_new ();
+  g_assert_null (gtk_widget_get_first_child (GTK_WIDGET (marker)));
+
+  button = gtk_button_new ();
+  shumate_marker_set_child (marker, button);
+  g_assert_true (gtk_widget_get_first_child (GTK_WIDGET (marker)) == button);
+
+  shumate_marker_set_child (marker, NULL);
+  g_assert_null (gtk_widget_get_first_child (GTK_WIDGET (marker)));
+}
+
+int
+main (int argc, char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+  gtk_init ();
+
+  g_test_add_func ("/marker/child", test_marker_child);
+
+  return g_test_run ();
+}
diff --git a/tests/meson.build b/tests/meson.build
index 739b2b5..c8d71da 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -8,6 +8,7 @@ test_env = [
 
 tests = [
   'coordinate',
+  'marker',
 ]
 
 foreach test : tests


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