Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/everything
diff options
context:
space:
mode:
Diffstat (limited to 'tests/everything')
-rw-r--r--tests/everything/everything.c25
-rw-r--r--tests/everything/everything.h6
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/everything/everything.c b/tests/everything/everything.c
index 75842bf..c597f85 100644
--- a/tests/everything/everything.c
+++ b/tests/everything/everything.c
@@ -789,6 +789,12 @@ test_obj_dispose (GObject *gobject)
G_OBJECT_CLASS (test_obj_parent_class)->dispose (gobject);
}
+static int
+test_obj_default_matrix (TestObj *obj, const char *somestr)
+{
+ return 42;
+}
+
static void
test_obj_class_init (TestObjClass *klass)
{
@@ -819,6 +825,8 @@ test_obj_class_init (TestObjClass *klass)
g_object_class_install_property (gobject_class,
PROP_TEST_OBJ_BARE,
pspec);
+
+ klass->matrix = test_obj_default_matrix;
}
static void
@@ -854,6 +862,23 @@ test_obj_static_method (int x)
}
/**
+ * test_obj_do_matrix:
+ * @obj: A #TestObj
+ * @somestr: Meaningless string
+ *
+ * This method is virtual. Notably its name differs from the virtual
+ * slot name, which makes it useful for testing bindings handle this
+ * case.
+ *
+ * Virtual: matrix
+ */
+int
+test_obj_do_matrix (TestObj *obj, const char *somestr)
+{
+ return TEST_OBJ_GET_CLASS (obj)->matrix (obj, somestr);
+}
+
+/**
* test_callback:
* @callback: (scope call):
*
diff --git a/tests/everything/everything.h b/tests/everything/everything.h
index dbb7995..2474566 100644
--- a/tests/everything/everything.h
+++ b/tests/everything/everything.h
@@ -178,6 +178,7 @@ gboolean test_boxed_equals (TestBoxed *boxed,
#define TEST_TYPE_OBJ (test_obj_get_type ())
#define TEST_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_OBJ, TestObj))
#define TEST_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_OBJ))
+#define TEST_OBJ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_OBJ, TestObjClass))
typedef struct _TestObj TestObj;
typedef struct _TestObjClass TestObjClass;
@@ -197,6 +198,8 @@ struct _TestObjClass
{
GObjectClass parent_class;
+ int (*matrix) (TestObj *obj, const char *somestr);
+
guint test_signal;
};
@@ -205,6 +208,9 @@ TestObj* test_obj_new_from_file (const char *x, GError **error);
void test_obj_set_bare (TestObj *obj, GObject *bare);
double test_obj_static_method (int x);
+/* virtual */
+int test_obj_do_matrix (TestObj *obj, const char *somestr);
+
/* callback */
typedef int (*TestCallback) ();
typedef int (*TestCallbackUserData) (gpointer user_data);