summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-11 15:46:12 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-03-11 16:08:04 -0300
commitf29ceef5002f7ab2a0f400adbed20299737bce20 (patch)
tree2324619326073a6a55f286723802553743feb3f9
parent2a003420f83134331c8b404df1905cba538cfad6 (diff)
downloadefl-f29ceef5002f7ab2a0f400adbed20299737bce20.tar.gz
efl-csharp: Respect beta for classes and other stuff.
Summary: In order to work around an issue with Efl.App, which is stable but inherits from Efl.Core.Command_Line, @beta interfaces/mixins in the inheritance chain are simply skipped. Also changed the class used int test for inheritance from C# Efl.Loop is stable but internally it uses a @beta class as argument to its Register() method in the constructor. When instantiating a user-defined C# subclass, the binding calls the C# override in the NativeInherit class and the marshalling fails as no code is generated for the beta class. Also moved Efl.Part test to a beta class. Efl.Part is still beta. Regarding parts, they are skipped if its class is @beta too. Also rejected all elm_* files in elm public eo files. They should get back in as they are converted to Efl.Ui.* api. An exception is elm_interface_scrollable.eo, as efl_ui_panel depends on it. Fixes T7730 Test Plan: Run tests Reviewers: vitor.sousa, segfaultxavi, felipealmeida, cedric, bu5hm4n, zmike Reviewed By: vitor.sousa Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7730 Differential Revision: https://phab.enlightenment.org/D8268
-rw-r--r--src/Makefile_Efl_Mono.am10
-rw-r--r--src/bin/eolian_mono/eolian/mono/blacklist.hh45
-rw-r--r--src/bin/eolian_mono/eolian/mono/events.hh12
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_pointer.hh12
-rw-r--r--src/bin/eolian_mono/eolian/mono/helpers.hh7
-rw-r--r--src/bin/eolian_mono/eolian/mono/klass.hh17
-rw-r--r--src/bin/eolian_mono/eolian/mono/part_definition.hh3
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh4
-rw-r--r--src/bindings/mono/efl_mono/efl_csharp_application.cs2
-rw-r--r--src/bindings/mono/meson.build6
-rw-r--r--src/examples/ecore/efl_mono_loop_timer_example.cs6
-rw-r--r--src/examples/elementary/efl_ui_slider_mono.cs6
-rw-r--r--src/examples/elementary/efl_ui_unit_converter.cs7
-rw-r--r--src/tests/efl_mono/Eo.cs6
-rw-r--r--src/tests/efl_mono/Parts.cs9
-rw-r--r--src/tests/efl_mono/dummy_part_holder.eo13
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo8
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c56
-rw-r--r--src/tests/efl_mono/meson.build2
19 files changed, 180 insertions, 51 deletions
diff --git a/src/Makefile_Efl_Mono.am b/src/Makefile_Efl_Mono.am
index e6d330cb1c..91bb1cd504 100644
--- a/src/Makefile_Efl_Mono.am
+++ b/src/Makefile_Efl_Mono.am
@@ -67,6 +67,7 @@ efl_mono_test_files = \
tests/efl_mono/dummy_test_iface.eo \
tests/efl_mono/dummy_another_iface.eo \
tests/efl_mono/dummy_child.eo \
+ tests/efl_mono/dummy_part_holder.eo \
tests/efl_mono/dummy_numberwrapper.eo \
tests/efl_mono/mono_test_driver.sh
@@ -177,6 +178,10 @@ lib/elementary/elm_genlist_eo.cs \
lib/elementary/elm_view_list_eo.cs \
lib/elementary/elm_genlist_item_eo.cs \
lib/elementary/elm_gengrid_eo.cs \
+lib/elementary/elm_code_widget.eo.cs \
+lib/elementary/elm_multibuttonentry_part.eo.cs \
+lib/elementary/elm_atspi_bridge.eo.cs \
+lib/elementary/elm_atspi_app_object.eo.cs \
lib/elementary/elm_glview_eo.cs
efl_mono_blacklisted_files = \
@@ -406,6 +411,8 @@ tests/efl_mono/libefl_mono_native_test.c: \
tests/efl_mono/dummy_another_iface.eo.c \
tests/efl_mono/dummy_child.eo.h \
tests/efl_mono/dummy_child.eo.c \
+ tests/efl_mono/dummy_part_holder.eo.h \
+ tests/efl_mono/dummy_part_holder.eo.c \
tests/efl_mono/dummy_numberwrapper.eo.h \
tests/efl_mono/dummy_numberwrapper.eo.c \
tests/efl_mono/dummy_inherit_iface.eo.h \
@@ -418,6 +425,7 @@ efl_mono_test_eolian_mono_files = tests/efl_mono/dummy_test_object.eo.cs \
tests/efl_mono/dummy_test_iface.eo.cs \
tests/efl_mono/dummy_another_iface.eo.cs \
tests/efl_mono/dummy_child.eo.cs \
+tests/efl_mono/dummy_part_holder.eo.cs \
tests/efl_mono/dummy_numberwrapper.eo.cs \
tests/efl_mono/dummy_inherit_iface.eo.cs \
tests/efl_mono/dummy_inherit_helper.eo.cs
@@ -493,7 +501,7 @@ tests/efl_mono/%.eo.cs: tests/efl_mono/%.eo $(_EOLIAN_MONO_DEP)
$(MKDIR_P) $(dir $@); \
$(EOLIAN_MONO) $(EOLIAN_FLAGS) $(EOLIAN_MONO_FLAGS) --dllimport "@DLIB_PREFIX_MONO@efl_mono_native_test@DLIB_SUFFIX_MONO@" -o $@ $(ALL_EO_REFS) $<
-CLEANFILES += tests/efl_mono/libefl_mono_test.dll tests/efl_mono/dummy_test_object.eo.cs tests/efl_mono/dummy_child.eo.cs tests/efl_mono/dummy_numberwrapper.eo.cs tests/efl_mono/dummy_test_object.eo.c tests/efl_mono/dummy_child.eo.c tests/efl_mono/dummy_numberwrapper.eo.c tests/efl_mono/dummy_test_object.eo.h tests/efl_mono/dummy_child.eo.h tests/efl_mono/dummy_numberwrapper.eo.h tests/efl_mono/efl_mono.config
+CLEANFILES += tests/efl_mono/libefl_mono_test.dll tests/efl_mono/dummy_test_object.eo.cs tests/efl_mono/dummy_child.eo.cs tests/efl_mono/dummy_numberwrapper.eo.cs tests/efl_mono/dummy_test_object.eo.c tests/efl_mono/dummy_child.eo.c tests/efl_mono/dummy_numberwrapper.eo.c tests/efl_mono/dummy_test_object.eo.h tests/efl_mono/dummy_child.eo.h tests/efl_mono/dummy_part_holder.eo.cs tests/efl_mono/dummy_part_holder.eo.c tests/efl_mono/dummy_part_holder.eo.h tests/efl_mono/dummy_numberwrapper.eo.h tests/efl_mono/efl_mono.config
endif
diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh
index c11437b2df..2b9d8ad4bf 100644
--- a/src/bin/eolian_mono/eolian/mono/blacklist.hh
+++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh
@@ -67,6 +67,7 @@ inline bool is_function_blacklisted(attributes::function_def const& func, Contex
// Blacklist structs that require some kind of manual binding.
inline bool is_struct_blacklisted(std::string const& full_name)
{
+ // For now, these manual structs are blacklisted regardless of beta status
return full_name == "Efl.Event_Description"
|| full_name == "Eina.Binbuf"
|| full_name == "Eina.Strbuf"
@@ -78,11 +79,28 @@ inline bool is_struct_blacklisted(std::string const& full_name)
|| full_name == "Eina.Future";
}
-inline bool is_struct_blacklisted(attributes::struct_def const& struct_)
+template <typename Context>
+inline bool is_struct_blacklisted(attributes::struct_def const& struct_, Context context)
{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
+ if (struct_.is_beta && !options.want_beta)
+ return true;
+
return is_struct_blacklisted(name_helpers::struct_full_eolian_name(struct_));
}
+// Struct as type_def is for places where the struct is used as a struct field or parameter/return.
+template <typename Context>
+inline bool is_struct_blacklisted(attributes::type_def const& struct_, Context context)
+{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
+ if (struct_.is_beta && !options.want_beta)
+ return true;
+
+ auto regular = efl::eina::get<attributes::regular_type_def>(struct_.original_type);
+ return is_struct_blacklisted(name_helpers::type_full_eolian_name(regular));
+}
+
inline bool is_struct_blacklisted(attributes::regular_type_def const& struct_)
{
return is_struct_blacklisted(name_helpers::type_full_eolian_name(struct_));
@@ -114,6 +132,31 @@ inline bool is_property_blacklisted(attributes::property_def const& property, Co
return is_property_blacklisted(name);
}
+template<typename Context>
+inline bool is_class_blacklisted(attributes::klass_def const& cls, Context context)
+{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
+
+ return cls.is_beta && !options.want_beta;
+}
+
+template<typename Context>
+inline bool is_class_blacklisted(attributes::klass_name const& cls, Context context)
+{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
+
+ return cls.is_beta && !options.want_beta;
+}
+
+
+template<typename Context>
+inline bool is_event_blacklisted(attributes::event_def const& evt, Context context)
+{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
+
+ return evt.beta && !options.want_beta;
+}
+
}
}
diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh
index 76e82bdbb1..d8dc043ada 100644
--- a/src/bin/eolian_mono/eolian/mono/events.hh
+++ b/src/bin/eolian_mono/eolian/mono/events.hh
@@ -93,6 +93,9 @@ struct event_argument_wrapper_generator
if (!etype.is_engaged())
return true;
+ if (blacklist::is_event_blacklisted(evt, context))
+ return true;
+
std::string evt_name = name_helpers::managed_event_name(evt.name);
return as_generator("///<summary>Event argument wrapper for event <see cref=\""
@@ -119,6 +122,9 @@ struct event_declaration_generator
std::string wrapper_args_type;
std::string evt_name = name_helpers::managed_event_name(evt.name);
+ if (blacklist::is_event_blacklisted(evt, context))
+ return true;
+
if (evt.type.is_engaged())
wrapper_args_type = "<" + name_helpers::managed_event_args_name(evt) + ">";
@@ -143,6 +149,9 @@ struct event_registration_generator
{
std::string wrapper_event_name;
+ if (blacklist::is_event_blacklisted(evt, context))
+ return true;
+
if (is_inherited_event && !helpers::is_unique_event(evt, leaf_klass))
wrapper_event_name = name_helpers::translate_inherited_event_name(evt, klass);
else
@@ -172,6 +181,9 @@ struct event_definition_generator
template<typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::event_def const& evt, Context context) const
{
+ if (blacklist::is_event_blacklisted(evt, context))
+ return true;
+
std::string managed_evt_name = name_helpers::managed_event_name(evt.name);
bool is_unique = helpers::is_unique_event(evt, leaf_klass);
diff --git a/src/bin/eolian_mono/eolian/mono/function_pointer.hh b/src/bin/eolian_mono/eolian/mono/function_pointer.hh
index a7e692bbad..f3918f1c26 100644
--- a/src/bin/eolian_mono/eolian/mono/function_pointer.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_pointer.hh
@@ -9,15 +9,17 @@
#include "function_helpers.hh"
#include "documentation.hh"
#include "generation_contexts.hh"
+#include "blacklist.hh"
namespace eolian_mono {
// Blacklist structs that require some kind of manual binding.
-static bool is_function_ptr_blacklisted(attributes::function_def const& func)
+template <typename Context>
+static bool is_function_ptr_blacklisted(attributes::function_def const& func, Context context)
{
std::string name = name_helpers::function_ptr_full_eolian_name(func);
- return false;
+ return blacklist::is_function_blacklisted(func, context);
}
struct function_pointer {
@@ -28,13 +30,13 @@ struct function_pointer {
// FIXME export Typedecl in eolian_cxx API
auto funcptr_ctx = context_add_tag(class_context{class_context::function_ptr}, context);
+ if (is_function_ptr_blacklisted(f, context))
+ return true;
+
std::string return_type;
if(!as_generator(eolian_mono::type(true)).generate(std::back_inserter(return_type), f.return_type, context))
return false;
- if (is_function_ptr_blacklisted(f))
- return true;
-
if (!name_helpers::open_namespaces(sink, f.namespaces, funcptr_ctx))
return false;
diff --git a/src/bin/eolian_mono/eolian/mono/helpers.hh b/src/bin/eolian_mono/eolian/mono/helpers.hh
index 87a1e9db39..a4bb169593 100644
--- a/src/bin/eolian_mono/eolian/mono/helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/helpers.hh
@@ -102,8 +102,10 @@ std::set<attributes::klass_name, attributes::compare_klass_name_by_name> interfa
// Returns the set of interfaces implemented by this type that haven't been implemented
// by a regular parent class.
-std::set<attributes::klass_name, attributes::compare_klass_name_by_name> non_implemented_interfaces(attributes::klass_def const& cls)
+template<typename Context>
+std::set<attributes::klass_name, attributes::compare_klass_name_by_name> non_implemented_interfaces(attributes::klass_def const& cls, Context context)
{
+ auto options = efl::eolian::grammar::context_find_tag<options_context>(context);
std::set<attributes::klass_name, attributes::compare_klass_name_by_name> implemented_interfaces;
std::set<attributes::klass_name, attributes::compare_klass_name_by_name> interfaces;
@@ -114,6 +116,9 @@ std::set<attributes::klass_name, attributes::compare_klass_name_by_name> non_imp
attributes::klass_def c(get_klass(klass, cls.unit), cls.unit);
for(auto&& inherit : c.immediate_inherits)
{
+ if (inherit.is_beta && !options.want_beta)
+ continue;
+
switch(inherit.type)
{
case attributes::class_type::mixin:
diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh
index 0689648779..a9f270d15f 100644
--- a/src/bin/eolian_mono/eolian/mono/klass.hh
+++ b/src/bin/eolian_mono/eolian/mono/klass.hh
@@ -95,6 +95,13 @@ struct klass
bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& context) const
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "klass_generator: " << cls.eolian_name << std::endl;
+
+ if (blacklist::is_class_blacklisted(cls, context))
+ {
+ EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "class " << cls.eolian_name << " is blacklisted. Skipping." << std::endl;
+ return true;
+ }
+
std::string suffix, class_type;
switch(cls.type)
{
@@ -183,7 +190,7 @@ struct klass
return false;
bool root = !helpers::has_regular_ancestor(cls);
- std::set<attributes::klass_name, attributes::compare_klass_name_by_name> inherit_interfaces = helpers::non_implemented_interfaces(cls);
+ std::set<attributes::klass_name, attributes::compare_klass_name_by_name> inherit_interfaces = helpers::non_implemented_interfaces(cls, context);
std::vector<attributes::klass_name> inherit_classes;
std::copy_if(cls.immediate_inherits.begin(), cls.immediate_inherits.end()
, std::back_inserter(inherit_classes)
@@ -268,7 +275,7 @@ struct klass
if (!as_generator(*(property_wrapper_definition)).generate(sink, cls.properties, concrete_cxt))
return false;
- for (auto&& klass : helpers::non_implemented_interfaces(cls))
+ for (auto&& klass : helpers::non_implemented_interfaces(cls, concrete_cxt))
{
attributes::klass_def c(get_klass(klass, cls.unit), cls.unit);
if (!as_generator(*(property_wrapper_definition)).generate(sink, c.properties, concrete_cxt))
@@ -340,7 +347,7 @@ struct klass
if (!as_generator(*(property_wrapper_definition)).generate(sink, cls.properties, inherit_cxt))
return false;
- for (auto&& klass : helpers::non_implemented_interfaces(cls))
+ for (auto&& klass : helpers::non_implemented_interfaces(cls, inherit_cxt))
{
attributes::klass_def c(get_klass(klass, cls.unit), cls.unit);
if (!as_generator(*(property_wrapper_definition)).generate(sink, c.properties, inherit_cxt))
@@ -644,7 +651,7 @@ struct klass
if (!as_generator(*(event_registration(cls, cls))).generate(sink, cls.events, context))
return false;
- for (auto&& c : helpers::non_implemented_interfaces(cls))
+ for (auto&& c : helpers::non_implemented_interfaces(cls, context))
{
// Only non-regular types (which declare events through interfaces) need to register them.
if (c.type == attributes::class_type::regular)
@@ -742,7 +749,7 @@ struct klass
// Inherited events
// For now, as mixins can inherit from regular classes, we can't filter out inherited events.
- auto inherits = helpers::non_implemented_interfaces(cls);
+ auto inherits = helpers::non_implemented_interfaces(cls, context);
for (auto&& c : inherits)
{
attributes::klass_def klass(get_klass(c, cls.unit), cls.unit);
diff --git a/src/bin/eolian_mono/eolian/mono/part_definition.hh b/src/bin/eolian_mono/eolian/mono/part_definition.hh
index 47951f4bf1..2a8d2e1b00 100644
--- a/src/bin/eolian_mono/eolian/mono/part_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/part_definition.hh
@@ -18,6 +18,9 @@ struct part_definition_generator
template <typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::part_def const& part, Context const& context) const
{
+ if (blacklist::is_class_blacklisted(part.klass, context))
+ return true;
+
auto part_klass_name = name_helpers::klass_full_concrete_or_interface_name(part.klass);
return as_generator(scope_tab << documentation
<< scope_tab << "public " << part_klass_name << " " << name_helpers::managed_part_name(part) << "\n"
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index 17485d12e4..ba058d0817 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -196,6 +196,7 @@ struct to_internal_field_convert_generator
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
{
auto field_name = name_helpers::to_field_name(field.name);
+ // FIXME Replace need_struct_conversion(regular) with need_struct_conversion(type)
auto regular = efl::eina::get<attributes::regular_type_def>(&field.type.original_type);
auto klass = efl::eina::get<attributes::klass_name>(&field.type.original_type);
auto complex = efl::eina::get<attributes::complex_type_def>(&field.type.original_type);
@@ -496,10 +497,9 @@ struct struct_entities_generator
template <typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
{
- if (blacklist::is_struct_blacklisted(struct_))
+ if (blacklist::is_struct_blacklisted(struct_, context))
return true;
-
if (!name_helpers::open_namespaces(sink, struct_.namespaces, context))
return false;
diff --git a/src/bindings/mono/efl_mono/efl_csharp_application.cs b/src/bindings/mono/efl_mono/efl_csharp_application.cs
index 84732d3993..b487cf6289 100644
--- a/src/bindings/mono/efl_mono/efl_csharp_application.cs
+++ b/src/bindings/mono/efl_mono/efl_csharp_application.cs
@@ -106,7 +106,9 @@ namespace Efl {
Efl.App app = Efl.App.AppMain;
Eina.Array<String> command_line = new Eina.Array<String>();
command_line.Append(Environment.GetCommandLineArgs());
+#if EFL_BETA
app.SetCommandArray(command_line);
+#endif
app.ArgumentsEvt += (object sender, LoopArgumentsEvt_Args evt) => {
if (evt.arg.Initialization) {
OnInitialize(evt.arg.Argv);
diff --git a/src/bindings/mono/meson.build b/src/bindings/mono/meson.build
index 4f04a01278..13fe4caada 100644
--- a/src/bindings/mono/meson.build
+++ b/src/bindings/mono/meson.build
@@ -85,7 +85,11 @@ blacklisted_files = [
'elm_view_list.eo',
'elm_genlist_item.eo',
'elm_gengrid.eo',
- 'elm_glview_eo.cs'
+ 'elm_glview_eo.cs',
+ 'elm_code_widget.eo',
+ 'elm_multibuttonentry_part.eo',
+ 'elm_atspi_bridge.eo',
+ 'elm_atspi_app_object.eo',
]
efl_mono_lib = library('eflcustomexportsmono',
diff --git a/src/examples/ecore/efl_mono_loop_timer_example.cs b/src/examples/ecore/efl_mono_loop_timer_example.cs
index 5b5af06200..a6ad05b491 100644
--- a/src/examples/ecore/efl_mono_loop_timer_example.cs
+++ b/src/examples/ecore/efl_mono_loop_timer_example.cs
@@ -4,6 +4,7 @@ using System.Runtime.CompilerServices;
class TestMain
{
+#if EFL_BETA
private Efl.Loop loop;
private int count;
@@ -48,6 +49,11 @@ class TestMain
{
Console.WriteLine("Ooops. Should not have been called...");
}
+#else
+ public static void Main()
+ {
+ }
+#endif
}
diff --git a/src/examples/elementary/efl_ui_slider_mono.cs b/src/examples/elementary/efl_ui_slider_mono.cs
index 3ef10cbb0e..c2a3232f14 100644
--- a/src/examples/elementary/efl_ui_slider_mono.cs
+++ b/src/examples/elementary/efl_ui_slider_mono.cs
@@ -2,6 +2,7 @@ using System;
public class Example
{
+#if EFL_BETA
public static Efl.Ui.Button CreateButton(Efl.Object parent,
string text,
int w, int h,
@@ -73,5 +74,10 @@ public class Example
Efl.All.Shutdown();
}
+#else
+ public static void Main()
+ {
+ }
+#endif
}
diff --git a/src/examples/elementary/efl_ui_unit_converter.cs b/src/examples/elementary/efl_ui_unit_converter.cs
index 5bbbe1723a..3460af3f5f 100644
--- a/src/examples/elementary/efl_ui_unit_converter.cs
+++ b/src/examples/elementary/efl_ui_unit_converter.cs
@@ -2,7 +2,7 @@ using System;
public class Example
{
-
+#if EFL_BETA
private static double KMS_PER_MILE = 1.609344;
private static double KmsToMiles(double kms)
@@ -146,5 +146,10 @@ public class Example
Efl.All.Shutdown();
}
+#else
+ public static void Main()
+ {
+ }
+#endif
}
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index 08c5e2dc4c..9329fbae12 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -95,16 +95,16 @@ class TestEo
}
-class MyLoop : Efl.Loop
+class MyObject : Efl.Object
{
- public MyLoop() : base(null) { }
+ public MyObject() : base(null) { }
}
class TestEoInherit
{
public static void instantiate_inherited()
{
- Efl.Loop loop = new MyLoop();
+ Efl.Object loop = new MyObject();
Test.Assert(loop.NativeHandle != System.IntPtr.Zero);
}
}
diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs
index 5afed1fdd6..50527c1c63 100644
--- a/src/tests/efl_mono/Parts.cs
+++ b/src/tests/efl_mono/Parts.cs
@@ -7,17 +7,18 @@ using System.Diagnostics.CodeAnalysis;
namespace TestSuite {
+#if EFL_BETA
[SuppressMessage("Gendarme.Rules.Portability", "DoNotHardcodePathsRule")]
public static class TestParts
{
public static void basic_part_test()
{
- var t = new Dummy.TestObject();
+ var t = new Dummy.PartHolder();
do_part_test(t);
}
- private class Child : Dummy.TestObject
+ private class Child : Dummy.PartHolder
{
public Child() : base(null) {}
}
@@ -27,7 +28,7 @@ public static class TestParts
do_part_test(t);
}
- private static void do_part_test(Dummy.TestObject t)
+ private static void do_part_test(Dummy.PartHolder t)
{
var p1 = t.PartOne;
var p2 = t.PartTwo;
@@ -38,4 +39,6 @@ public static class TestParts
}
}
+#endif
+
}
diff --git a/src/tests/efl_mono/dummy_part_holder.eo b/src/tests/efl_mono/dummy_part_holder.eo
new file mode 100644
index 0000000000..2dc5ad79f2
--- /dev/null
+++ b/src/tests/efl_mono/dummy_part_holder.eo
@@ -0,0 +1,13 @@
+import eina_types;
+
+class @beta Dummy.Part_Holder extends Dummy.Test_Object implements Efl.Part {
+
+ parts {
+ part_one: Dummy.Test_Object; [[ Part number one. ]]
+ part_two: Dummy.Test_Object; [[ Part number two. ]]
+ }
+ implements {
+ Efl.Part.part_get;
+ Efl.Object.constructor;
+ }
+}
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index 517c783fe1..d0311e96ac 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -101,12 +101,7 @@ function Dummy.FormatCb {
}
};
-class Dummy.Test_Object extends Efl.Object implements Efl.Part, Dummy.Test_Iface, Dummy.Another_Iface {
-
- parts {
- part_one: Dummy.Test_Object; [[ Part number one. ]]
- part_two: Dummy.Test_Object; [[ Part number two. ]]
- }
+class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface, Dummy.Another_Iface {
methods {
return_object {
return: Dummy.Test_Object;
@@ -1395,7 +1390,6 @@ class Dummy.Test_Object extends Efl.Object implements Efl.Part, Dummy.Test_Iface
class.constructor;
class.destructor;
Efl.Object.constructor;
- Efl.Part.part_get;
Efl.Object.provider_find;
Dummy.Test_Iface.emit_test_conflicted;
Dummy.Test_Iface.emit_nonconflicted;
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index e4c7d72e50..8968e46801 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -52,6 +52,7 @@
#include "dummy_another_iface.eo.h"
#include "dummy_inherit_iface.eo.h"
#include "dummy_inherit_helper.eo.h"
+#include "dummy_part_holder.eo.h"
#include <interfaces/efl_part.eo.h>
@@ -67,8 +68,6 @@ typedef struct Dummy_Test_Object_Data
Eina_Value *stored_value;
Dummy_StructSimple stored_struct;
int stored_int;
- Eo *part_one;
- Eo *part_two;
Eina_Promise *promise;
Eina_List *list_for_accessor;
int setter_only;
@@ -91,6 +90,12 @@ typedef struct Dummy_Child_Data
Eina_Bool optional_beta_ctor_was_called;
} Dummy_Child_Data;
+typedef struct Dummy_Part_Holder_Data
+{
+ Eo *part_one;
+ Eo *part_two;
+} Dummy_Part_Holder_Data;
+
typedef struct Dummy_Inherit_Helper_Data
{
} Dummy_Inherit_Helper_Data;
@@ -145,14 +150,6 @@ static Efl_Object*
_dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd)
{
efl_constructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS));
-
- // To avoid an infinite loop calling the same constructor
- if (!efl_parent_get(obj))
- {
- pd->part_one = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_one"));
- pd->part_two = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_two"));
- }
-
pd->provider = efl_add(DUMMY_NUMBERWRAPPER_CLASS, obj);
dummy_numberwrapper_number_set(pd->provider, 1999);
@@ -3792,16 +3789,6 @@ void _dummy_test_object_emit_event_with_list(Eo *obj, EINA_UNUSED Dummy_Test_Obj
efl_event_callback_legacy_call(obj, DUMMY_TEST_OBJECT_EVENT_EVT_WITH_LIST, data);
}
-Efl_Object *_dummy_test_object_efl_part_part_get(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd, const char *name)
-{
- if (!strcmp(name, "part_one"))
- return pd->part_one;
- else if (!strcmp(name, "part_two"))
- return pd->part_two;
- else
- return NULL;
-}
-
void _dummy_test_object_append_to_strbuf(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Strbuf *buf, const char *str)
{
eina_strbuf_append(buf, str);
@@ -4024,6 +4011,34 @@ const char* _dummy_inherit_helper_receive_dummy_and_call_in_stringshare(Dummy_Te
return dummy_inherit_iface_stringshare_test (x, eina_stringshare_add("hello world"));
}
+// Part holder
+static Efl_Object*
+_dummy_part_holder_efl_object_constructor(Eo *obj, Dummy_Part_Holder_Data *pd)
+{
+ efl_constructor(efl_super(obj, DUMMY_PART_HOLDER_CLASS));
+
+ // To avoid an infinite loop calling the same constructor
+ if (!efl_parent_get(obj))
+ {
+ pd->part_one = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_one"));
+ pd->part_two = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_two"));
+ }
+
+ return obj;
+}
+
+Efl_Object *_dummy_part_holder_efl_part_part_get(EINA_UNUSED const Eo *obj, Dummy_Part_Holder_Data *pd, const char *name)
+{
+ if (!strcmp(name, "part_one"))
+ return pd->part_one;
+ else if (!strcmp(name, "part_two"))
+ return pd->part_two;
+ else
+ return NULL;
+}
+
+
+
#include "dummy_test_object.eo.c"
#include "dummy_numberwrapper.eo.c"
#include "dummy_child.eo.c"
@@ -4031,4 +4046,5 @@ const char* _dummy_inherit_helper_receive_dummy_and_call_in_stringshare(Dummy_Te
#include "dummy_another_iface.eo.c"
#include "dummy_inherit_helper.eo.c"
#include "dummy_inherit_iface.eo.c"
+#include "dummy_part_holder.eo.c"
diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build
index 52c6e3152e..f9fcbcf88c 100644
--- a/src/tests/efl_mono/meson.build
+++ b/src/tests/efl_mono/meson.build
@@ -1,4 +1,4 @@
-eo_files = ['dummy_child.eo', 'dummy_numberwrapper.eo', 'dummy_test_object.eo', 'dummy_test_iface.eo', 'dummy_another_iface.eo', 'dummy_inherit_helper.eo', 'dummy_inherit_iface.eo']
+eo_files = ['dummy_child.eo', 'dummy_numberwrapper.eo', 'dummy_test_object.eo', 'dummy_test_iface.eo', 'dummy_another_iface.eo', 'dummy_inherit_helper.eo', 'dummy_inherit_iface.eo', 'dummy_part_holder.eo']
eo_file_targets = []