]> git.draconx.ca Git - gob-dx.git/blobdiff - t/test-fooable.c
Expand the interface implementation test cases.
[gob-dx.git] / t / test-fooable.c
diff --git a/t/test-fooable.c b/t/test-fooable.c
new file mode 100644 (file)
index 0000000..d4b2d30
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  Copyright © 2020 Nick Bowler
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "test-fooable.h"
+
+GType test_fooable_get_type(void)
+{
+       static const GTypeInfo info = { sizeof (TestFooableIface), 0, 0 };
+       static GType type = 0;
+
+       if (!type) {
+               type = g_type_register_static(G_TYPE_INTERFACE,
+                                             "TestFooable", &info, 0);
+       }
+
+       return type;
+}
+
+int test_foo(GObject *go)
+{
+       g_return_val_if_fail(TEST_IS_FOOABLE(go), -1);
+
+       return TEST_FOOABLE_GET_INTERFACE(go)->foo(go);
+}