[libadwaita/ebassi/toast-format: 2/3] tests: Add unit for adw_toast_new_format()




commit 343f7e953362903a82a9c792f41373248bfc9118
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Feb 28 17:14:27 2022 +0000

    tests: Add unit for adw_toast_new_format()

 tests/test-toast.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/tests/test-toast.c b/tests/test-toast.c
index 26bdc59d..af0e6995 100644
--- a/tests/test-toast.c
+++ b/tests/test-toast.c
@@ -42,6 +42,24 @@ test_adw_toast_title (void)
   g_assert_finalize_object (toast);
 }
 
+static void
+test_adw_toast_title_format (void)
+{
+  AdwToast *toast;
+  const int n_value = 42;
+  char *title;
+
+  toast = adw_toast_new_format ("Title %d", n_value);
+
+  g_assert_nonnull (toast);
+
+  g_object_get (toast, "title", &title, NULL);
+  g_assert_cmpstr (title, ==, "Title 42");
+
+  g_free (title);
+  g_assert_finalize_object (toast);
+}
+
 static void
 test_adw_toast_button_label (void)
 {
@@ -224,6 +242,7 @@ main (int   argc,
   adw_init ();
 
   g_test_add_func ("/Adwaita/Toast/title", test_adw_toast_title);
+  g_test_add_func ("/Adwaita/Toast/title_format", test_adw_toast_title_format);
   g_test_add_func ("/Adwaita/Toast/button_label", test_adw_toast_button_label);
   g_test_add_func ("/Adwaita/Toast/action_name", test_adw_toast_action_name);
   g_test_add_func ("/Adwaita/Toast/action_target", test_adw_toast_action_target);


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