[gobject-introspection] tests: Add constructor with an error argument



commit a6f199ddf1fbe1ba3ed406e40bf114c0912ef346
Author: Garrett Regier <Garrett Regier riftio com>
Date:   Thu Aug 7 12:04:50 2014 -0400

    tests: Add constructor with an error argument
    
    Make sure a constructor that sets a GError works correctly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727004

 tests/gimarshallingtests.c |   13 +++++++++++++
 tests/gimarshallingtests.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 3e7713e..b900dbd 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3993,6 +3993,19 @@ gi_marshalling_tests_object_new (gint int_)
   return g_object_new (GI_MARSHALLING_TESTS_TYPE_OBJECT, "int", int_, NULL);
 }
 
+GIMarshallingTestsObject *
+gi_marshalling_tests_object_new_fail (gint int_, GError **error)
+{
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  g_set_error_literal (error,
+                       g_quark_from_static_string (GI_MARSHALLING_TESTS_CONSTANT_GERROR_DOMAIN),
+                       GI_MARSHALLING_TESTS_CONSTANT_GERROR_CODE,
+                       GI_MARSHALLING_TESTS_CONSTANT_GERROR_MESSAGE);
+
+  return NULL;
+}
+
 /**
  * gi_marshalling_tests_object_method_array_in:
  * @ints: (array length=length):
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index aa2c222..25a870b 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -877,6 +877,7 @@ void gi_marshalling_tests_object_static_method (void);
 void gi_marshalling_tests_object_method (GIMarshallingTestsObject *object);
 void gi_marshalling_tests_object_overridden_method (GIMarshallingTestsObject *object);
 GIMarshallingTestsObject *gi_marshalling_tests_object_new (gint int_);
+GIMarshallingTestsObject *gi_marshalling_tests_object_new_fail (gint int_, GError **error);
 
 void gi_marshalling_tests_object_method_array_in (GIMarshallingTestsObject *object, const gint *ints, gint 
length);
 void gi_marshalling_tests_object_method_array_out (GIMarshallingTestsObject *object, gint **ints, gint 
*length);


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