[glib] Improve test coverage in gobject/tests



commit 8b618eb7f1eec1632c164053097f3e41150782ce
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 23 08:17:40 2012 -0400

    Improve test coverage in gobject/tests
    
    This is just making sure that we execute property getters/setters.

 gobject/tests/dynamictests.c |    3 +++
 gobject/tests/properties.c   |    9 +++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gobject/tests/dynamictests.c b/gobject/tests/dynamictests.c
index 2cd44ca..6c5d39f 100644
--- a/gobject/tests/dynamictests.c
+++ b/gobject/tests/dynamictests.c
@@ -342,11 +342,14 @@ test_dynamic_interface_properties (void)
 {
   GTypeModule *module;
   DynObj *obj;
+  gint val;
 
   module = test_module_new (mod_register);
   g_assert (module != NULL);
 
   obj = g_object_new (dyn_obj_get_type (), "foo", 1, NULL);
+  g_object_get (obj, "foo", &val, NULL);
+  g_assert_cmpint (val, ==, 1);
 
   g_object_unref (obj);
 }
diff --git a/gobject/tests/properties.c b/gobject/tests/properties.c
index 296adc3..b0bee2a 100644
--- a/gobject/tests/properties.c
+++ b/gobject/tests/properties.c
@@ -213,6 +213,8 @@ properties_construct (void)
 {
   TestObject *obj;
   gint val;
+  gboolean b;
+  gchar *s;
 
   g_test_bug ("630357");
 
@@ -223,11 +225,13 @@ properties_construct (void)
                       "foo", 3,
                       "foo", 4,
                       "foo", 5,
+                      "bar", FALSE,
                       "foo", 6,
                       "foo", 7,
                       "foo", 8,
                       "foo", 9,
                       "foo", 10,
+                      "baz", "boo",
                       "foo", 11,
                       "foo", 12,
                       "foo", 13,
@@ -240,6 +244,11 @@ properties_construct (void)
 
   g_object_get (obj, "foo", &val, NULL);
   g_assert (val == 18);
+  g_object_get (obj, "bar", &b, NULL);
+  g_assert (!b);
+  g_object_get (obj, "baz", &s, NULL);
+  g_assert_cmpstr (s, ==, "boo");
+  g_free (s);
 
   g_object_unref (obj);
 }



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