[glib/wip/otte/interface-types: 443/448] Add more test for g_type_interface_instantiable_prerequisite
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/otte/interface-types: 443/448] Add more test for g_type_interface_instantiable_prerequisite
- Date: Sat, 24 Oct 2020 03:35:48 +0000 (UTC)
commit a65d8d729795f8dde896d54a558295e44f7de092
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jul 12 15:27:37 2020 -0400
Add more test for g_type_interface_instantiable_prerequisite
Test that we return G_TYPE_INVALID if there's no instantiable
prerequisite.
gobject/tests/type.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
diff --git a/gobject/tests/type.c b/gobject/tests/type.c
index 9ed1806e9..ba4b70a23 100644
--- a/gobject/tests/type.c
+++ b/gobject/tests/type.c
@@ -40,6 +40,34 @@ foo_default_init (FooInterface *iface)
{
}
+typedef struct {
+ GTypeInterface g_iface;
+} BaaInterface;
+
+GType baa_get_type (void);
+
+G_DEFINE_INTERFACE (Baa, baa, G_TYPE_INVALID)
+
+static void
+baa_default_init (BaaInterface *iface)
+{
+}
+
+typedef struct {
+ GTypeInterface g_iface;
+} BooInterface;
+
+GType boo_get_type (void);
+
+G_DEFINE_INTERFACE_WITH_CODE (Boo, boo, G_TYPE_INVALID,
+ g_type_interface_add_prerequisite (g_define_type_id, baa_get_type ()))
+
+static void
+boo_default_init (BooInterface *iface)
+{
+}
+
+
static void
test_interface_prerequisite (void)
{
@@ -60,6 +88,9 @@ test_interface_prerequisite (void)
g_type_default_interface_unref (iface);
g_free (prereqs);
+
+ g_assert (g_type_interface_instantiable_prerequisite (baa_get_type ()) == G_TYPE_INVALID);
+ g_assert (g_type_interface_instantiable_prerequisite (boo_get_type ()) == G_TYPE_INVALID);
}
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]