efl-csharp: Respect beta in constructor parameters.

Summary:
Fixes compilation after Efl.Ui.Win parameter changes.

Also removed an unused var and now we pass the beta option to the eolian
mono invocation for the tests.

Fixes T7723

Reviewers: segfaultxavi, felipealmeida, vitor.sousa

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7723

Differential Revision: https://phab.enlightenment.org/D8150
This commit is contained in:
Lauro Moura 2019-03-07 10:54:35 +01:00 committed by Xavi Artigas
parent 76c67957b0
commit c67f199b2f
6 changed files with 100 additions and 8 deletions

View File

@ -510,7 +510,12 @@ struct klass
).generate(sink, attributes::unused, context))
return false;
auto constructors = helpers::reorder_constructors(cls.get_all_constructors());
auto all_constructors = helpers::reorder_constructors(cls.get_all_constructors());
decltype (all_constructors) constructors;
std::copy_if(all_constructors.cbegin(), all_constructors.cend(), std::back_inserter(constructors), [&context](attributes::constructor_def const& ctor) {
return !blacklist::is_function_blacklisted(ctor.function, context);
});
// Public (API) constructors
if (!as_generator(

View File

@ -146,11 +146,17 @@ efl_mono_dll_config = configure_file(input : 'efl_mono.dll.config.in',
output : 'efl_mono.dll.config',
configuration : efl_mono_conf_data)
extra_cs_args = runtime_assemblies
if get_option('mono-beta')
extra_cs_args += '-d:EFL_BETA'
endif
efl_mono = library('efl_mono',
mono_generator_target + mono_files + [efl_src],
install : true,
install_dir : join_paths(dir_lib, 'efl-mono-'+version_major),
cs_args : runtime_assemblies
cs_args : extra_cs_args
)
efl_mono_test_suite_path=join_paths(meson.current_build_dir())

View File

@ -354,7 +354,11 @@ class TestEoGrandChildrenFinalize
public sealed class GrandChild : Dummy.Child
{
#if EFL_BETA
public GrandChild() : base(null, "", 0.0, 0) { }
#else
public GrandChild() : base(null, "", 0.0) { }
#endif
public int receivedValue = 0;
public override Efl.Object FinalizeAdd()
@ -378,18 +382,43 @@ class TestConstructors
int iface_prop = 42;
string a = "LFE";
double b = 3.14;
#if EFL_BETA
int beta = 1337;
#endif
#if EFL_BETA
var obj = new Dummy.Child(null, a, b, beta, iface_prop, 0);
#else
var obj = new Dummy.Child(null, a, b, iface_prop);
#endif
Test.AssertEquals(iface_prop, obj.IfaceProp);
#if EFL_BETA
obj = new Dummy.Child(parent: null, ifaceProp : iface_prop, doubleParamsA : a, doubleParamsB : b,
obligatoryBetaCtor : beta,
optionalBetaCtor : -beta);
#else
obj = new Dummy.Child(parent: null, ifaceProp : iface_prop, doubleParamsA : a, doubleParamsB : b);
#endif
Test.AssertEquals(iface_prop, obj.IfaceProp);
#if EFL_BETA
Test.Assert(obj.ObligatoryBetaCtorWasCalled);
Test.Assert(obj.OptionalBetaCtorWasCalled);
#endif
}
public static void test_optional_constructor()
{
string a = "LFE";
double b = 3.14;
#if EFL_BETA
int beta = 2241;
var obj = new Dummy.Child(null, a, b, obligatoryBetaCtor : beta);
Test.Assert(!obj.OptionalBetaCtorWasCalled);
#else
var obj = new Dummy.Child(null, a, b);
#endif
Test.Assert(!obj.GetIfaceWasSet());
}
}
@ -412,7 +441,6 @@ class TestProvider
public static void test_find_provider()
{
// Tests only the direction C# -> C
var tmp = new Dummy.Numberwrapper();
var obj = new Dummy.TestObject();
Dummy.Numberwrapper provider = Dummy.Numberwrapper.static_cast(obj.FindProvider(typeof(Dummy.Numberwrapper)));
Test.AssertEquals(provider.GetType(), typeof(Dummy.Numberwrapper));

View File

@ -13,13 +13,41 @@ class Dummy.Child extends Dummy.Test_Object {
@property iface_was_set {
get {}
values {
data: bool;
}
data: bool;
}
}
obligatory_beta_ctor @beta {
params {
@in a: int;
}
}
optional_beta_ctor @beta {
params {
@in a: int;
}
}
@property obligatory_beta_ctor_was_called {
get{}
values {
data: bool;
}
}
@property optional_beta_ctor_was_called {
get{}
values {
data: bool;
}
}
}
constructors {
Dummy.Test_Iface.iface_prop @optional;
.double_params;
.obligatory_beta_ctor;
.optional_beta_ctor @optional;
}
implements {
Dummy.Test_Iface.iface_prop { get; set; }

View File

@ -87,6 +87,8 @@ typedef struct Dummy_Child_Data
const char* a;
double b;
Eina_Bool iface_was_set;
Eina_Bool obligatory_beta_ctor_was_called;
Eina_Bool optional_beta_ctor_was_called;
} Dummy_Child_Data;
typedef struct Dummy_Inherit_Helper_Data
@ -3946,6 +3948,8 @@ _dummy_child_efl_object_constructor(Eo *obj, Dummy_Child_Data *pd)
pd->iface_prop = 1984;
pd->iface_was_set = EINA_FALSE;
pd->obligatory_beta_ctor_was_called = EINA_FALSE;
pd->optional_beta_ctor_was_called = EINA_FALSE;
return obj;
}
@ -3974,6 +3978,27 @@ Eina_Bool _dummy_child_iface_was_set_get(EINA_UNUSED const Eo* obj, Dummy_Child_
{
return pd->iface_was_set;
}
void _dummy_child_obligatory_beta_ctor(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, EINA_UNUSED int a)
{
pd->obligatory_beta_ctor_was_called = EINA_TRUE;
}
void _dummy_child_optional_beta_ctor(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, EINA_UNUSED int a)
{
pd->optional_beta_ctor_was_called = EINA_TRUE;
}
Eina_Bool _dummy_child_obligatory_beta_ctor_was_called_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
{
return pd->obligatory_beta_ctor_was_called;
}
Eina_Bool _dummy_child_optional_beta_ctor_was_called_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
{
return pd->optional_beta_ctor_was_called;
}
EOLIAN static void
_dummy_child_class_constructor(Efl_Class *klass)
{

View File

@ -25,7 +25,7 @@ foreach mono_gen_file : eo_files
eo_file_targets += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'',
input : mono_gen_file,
output : [mono_gen_file + '.cs'],
command : [eolian_mono_gen, '-I', meson.current_source_dir(), eolian_include_directories,
command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
'--dllimport', 'efl_mono_native_test',
'-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
'@INPUT@'])
@ -34,7 +34,7 @@ endforeach
efl_mono_test = library('efl_mono_test',
eo_file_targets,
link_with : [efl_mono],
cs_args : runtime_assemblies
cs_args : extra_cs_args
)
efl_mono_src = [
@ -64,7 +64,7 @@ efl_mono_src = [
efl_mono_suite = executable('efl-mono-suite',
efl_mono_src,
link_with : [efl_mono, efl_mono_test],
cs_args : runtime_assemblies
cs_args : extra_cs_args
)
env = environment()