From 4e02be948b7761a56fb572aa8704643d24b3735c Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 13 Mar 2022 19:44:31 +0100 Subject: [PATCH] Moving gobject tests from tests/gobjects to gobjects/tests The test files concerned are: - tests/gobjects/accumulator.c - tests/gobjects/defaultiface.c - tests/gobjects/deftype.c - tests/gobjects/dynamictype.c - tests/gobjects/override.c - tests/gobjects/references.c - tests/gobjects/signals.c - tests/gobjects/singleton.c Related to issue #1434 --- .../gobject => gobject/tests}/accumulator.c | 10 ++--- .../tests/basic-signals.c | 4 +- .../gobject => gobject/tests}/defaultiface.c | 0 {tests/gobject => gobject/tests}/deftype.c | 0 .../gobject => gobject/tests}/dynamictype.c | 0 gobject/tests/marshalers.list | 3 ++ gobject/tests/meson.build | 14 +++++++ {tests/gobject => gobject/tests}/override.c | 0 {tests/gobject => gobject/tests}/references.c | 0 {tests/gobject => gobject/tests}/singleton.c | 0 {tests/gobject => gobject/tests}/testmodule.c | 0 {tests/gobject => gobject/tests}/testmodule.h | 0 tests/gobject/meson.build | 42 ------------------- tests/gobject/testmarshal.list | 4 -- 14 files changed, 24 insertions(+), 53 deletions(-) rename {tests/gobject => gobject/tests}/accumulator.c (97%) rename tests/gobject/signals.c => gobject/tests/basic-signals.c (97%) rename {tests/gobject => gobject/tests}/defaultiface.c (100%) rename {tests/gobject => gobject/tests}/deftype.c (100%) rename {tests/gobject => gobject/tests}/dynamictype.c (100%) rename {tests/gobject => gobject/tests}/override.c (100%) rename {tests/gobject => gobject/tests}/references.c (100%) rename {tests/gobject => gobject/tests}/singleton.c (100%) rename {tests/gobject => gobject/tests}/testmodule.c (100%) rename {tests/gobject => gobject/tests}/testmodule.h (100%) delete mode 100644 tests/gobject/testmarshal.list diff --git a/tests/gobject/accumulator.c b/gobject/tests/accumulator.c similarity index 97% rename from tests/gobject/accumulator.c rename to gobject/tests/accumulator.c index e99cbd6a1..f2051f376 100644 --- a/tests/gobject/accumulator.c +++ b/gobject/tests/accumulator.c @@ -17,7 +17,7 @@ #include -#include "testmarshal.h" +#include "marshalers.h" #include "testcommon.h" /* What this test tests is the behavior of signal accumulators @@ -68,7 +68,7 @@ test_signal1_accumulator (GSignalInvocationHint *ihint, else result_string = NULL; - g_value_set_string_take_ownership (return_accu, result_string); + g_value_take_string (return_accu, result_string); return TRUE; } @@ -214,21 +214,21 @@ test_object_class_init (TestObjectClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TestObjectClass, test_signal1), test_signal1_accumulator, NULL, - test_marshal_STRING__INT, + test_STRING__INT, G_TYPE_STRING, 1, G_TYPE_INT); g_signal_new ("test-signal2", G_OBJECT_CLASS_TYPE (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TestObjectClass, test_signal2), g_signal_accumulator_true_handled, NULL, - test_marshal_BOOLEAN__INT, + test_BOOLEAN__INT, G_TYPE_BOOLEAN, 1, G_TYPE_INT); g_signal_new ("test-signal3", G_OBJECT_CLASS_TYPE (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (TestObjectClass, test_signal3), test_signal3_accumulator, NULL, - test_marshal_VARIANT__POINTER, + test_VARIANT__POINTER, G_TYPE_VARIANT, 1, G_TYPE_POINTER); } diff --git a/tests/gobject/signals.c b/gobject/tests/basic-signals.c similarity index 97% rename from tests/gobject/signals.c rename to gobject/tests/basic-signals.c index 330f68737..e58965b47 100644 --- a/tests/gobject/signals.c +++ b/gobject/tests/basic-signals.c @@ -101,7 +101,7 @@ static DEFINE_TYPE(TestObject, test_object, G_TYPE_OBJECT) static void -test_signals (void) +test_basic_signals (void) { TestObject *object; @@ -131,7 +131,7 @@ main (int argc, g_test_init (&argc, &argv, NULL); - g_test_add_func ("/gobject/signals", test_signals); + g_test_add_func ("/gobject/basic-signals", test_basic_signals); return g_test_run (); } diff --git a/tests/gobject/defaultiface.c b/gobject/tests/defaultiface.c similarity index 100% rename from tests/gobject/defaultiface.c rename to gobject/tests/defaultiface.c diff --git a/tests/gobject/deftype.c b/gobject/tests/deftype.c similarity index 100% rename from tests/gobject/deftype.c rename to gobject/tests/deftype.c diff --git a/tests/gobject/dynamictype.c b/gobject/tests/dynamictype.c similarity index 100% rename from tests/gobject/dynamictype.c rename to gobject/tests/dynamictype.c diff --git a/gobject/tests/marshalers.list b/gobject/tests/marshalers.list index 19167ead5..ee699d83e 100644 --- a/gobject/tests/marshalers.list +++ b/gobject/tests/marshalers.list @@ -1,3 +1,6 @@ VOID:INT,BOOLEAN,CHAR,UCHAR,UINT,LONG,ULONG,ENUM,FLAGS,FLOAT,DOUBLE,STRING,PARAM,BOXED,POINTER,OBJECT,VARIANT,INT64,UINT64 +BOOLEAN:INT INT:VOID +STRING:INT UINT:VOID +VARIANT:POINTER diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build index 8d568f00e..c324b6f5d 100644 --- a/gobject/tests/meson.build +++ b/gobject/tests/meson.build @@ -28,12 +28,26 @@ marshalers_c = custom_target('marshalers_c', gobject_tests = { 'qdata' : {}, + 'accumulator' : { + 'source' : ['accumulator.c', marshalers_h, marshalers_c], + }, 'boxed' : {}, 'cxx' : { 'source' : ['cxx.cpp'], }, + 'defaultiface' : { + 'source' : ['defaultiface.c', 'testmodule.c'], + }, + 'deftype' : {}, + 'dynamictype' : { + 'source' : ['dynamictype.c', 'testmodule.c'], + }, 'enums' : {}, + 'override' : {}, 'param' : {}, + 'references' : {}, + 'basic-signals' : {}, + 'singleton' : {}, 'threadtests' : {}, 'dynamictests' : {}, 'binding' : {}, diff --git a/tests/gobject/override.c b/gobject/tests/override.c similarity index 100% rename from tests/gobject/override.c rename to gobject/tests/override.c diff --git a/tests/gobject/references.c b/gobject/tests/references.c similarity index 100% rename from tests/gobject/references.c rename to gobject/tests/references.c diff --git a/tests/gobject/singleton.c b/gobject/tests/singleton.c similarity index 100% rename from tests/gobject/singleton.c rename to gobject/tests/singleton.c diff --git a/tests/gobject/testmodule.c b/gobject/tests/testmodule.c similarity index 100% rename from tests/gobject/testmodule.c rename to gobject/tests/testmodule.c diff --git a/tests/gobject/testmodule.h b/gobject/tests/testmodule.h similarity index 100% rename from tests/gobject/testmodule.h rename to gobject/tests/testmodule.h diff --git a/tests/gobject/meson.build b/tests/gobject/meson.build index a02480e02..8766932f5 100644 --- a/tests/gobject/meson.build +++ b/tests/gobject/meson.build @@ -1,47 +1,5 @@ -# We cannot use gnome.genmarshal() here -testmarshal_h = custom_target('testmarshal_h', - output : 'testmarshal.h', - input : 'testmarshal.list', - command : [ - python, glib_genmarshal, - '--prefix=test_marshal', - '--output=@OUTPUT@', - '--quiet', - '--header', - '@INPUT@', - ], -) - -testmarshal_c = custom_target('testmarshal_c', - output : 'testmarshal.c', - input : 'testmarshal.list', - command : [ - python, glib_genmarshal, - '--prefix=test_marshal', - '--include-header=testmarshal.h', - '--output=@OUTPUT@', - '--quiet', - '--body', - '@INPUT@', - ], -) - gobject_tests = { - 'deftype' : {}, - 'defaultiface' : { - 'extra_sources' : ['testmodule.c'], - }, - 'dynamictype' : { - 'extra_sources' : ['testmodule.c'], - }, - 'override' : {}, - 'signals' : {}, - 'singleton' : {}, - 'references' : {}, 'testgobject' : {}, - 'accumulator' : { - 'extra_sources' : [testmarshal_c, testmarshal_h], - }, } if host_system != 'windows' diff --git a/tests/gobject/testmarshal.list b/tests/gobject/testmarshal.list deleted file mode 100644 index 198c4f9af..000000000 --- a/tests/gobject/testmarshal.list +++ /dev/null @@ -1,4 +0,0 @@ -# Marshallers used in tests -BOOLEAN:INT -STRING:INT -VARIANT:POINTER