csharp: Fix factory instantiation
authorLauro Moura <lauromoura@expertisesolutions.com.br>
Tue, 24 Sep 2019 20:06:29 +0000 (20:06 +0000)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 24 Sep 2019 21:49:49 +0000 (06:49 +0900)
After 892c26f906d23595b709b834dde6b032bdd6d89d, widget factories require
a widget to be their parents.

This commit updates C# tests and adds a warning message to elementary if the user does
not provide one.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10122

src/lib/elementary/efl_ui_widget_factory.c
src/tests/efl_mono/Model.cs
src/tests/efl_mono/Parts.cs
src/tests/efl_mono/meson.build

index b1c339d..00ba103 100644 (file)
@@ -49,7 +49,11 @@ static Efl_Object *
 _efl_ui_widget_factory_efl_object_finalize(Eo *obj, Efl_Ui_Widget_Factory_Data *pd)
 {
    pd->parenting_widget = efl_provider_find(obj, EFL_UI_WIDGET_CLASS);
-   if (!pd->parenting_widget) return NULL;
+   if (!pd->parenting_widget)
+     {
+        ERR("Widget_Factory requires a Widget as parent.");
+        return NULL;
+     }
 
    return efl_finalize(efl_super(obj, EFL_UI_WIDGET_FACTORY_CLASS));
 }
@@ -397,7 +401,7 @@ _efl_ui_property_bind_part_efl_ui_property_bind_property_bind(Eo *obj EINA_UNUSE
 
    if (!pd->pd)
      {
-        EINA_LOG_ERR("Trying to bind part property without specifying which part");
+        ERR("Trying to bind part property without specifying which part");
         return ENOENT;
      }
 
index 4ec6ef3..13e0d15 100644 (file)
@@ -65,7 +65,9 @@ public class TestModel {
     {
         string propertyBound = null;
         bool callbackCalled = false;
-        var factory = new Efl.Ui.ItemFactory<Efl.Ui.Button>();
+        var parent = new Efl.Ui.Win(null);
+        parent.Visible = false;
+        var factory = new Efl.Ui.ItemFactory<Efl.Ui.Button>(parent);
         factory.PropertyBoundEvent += (object sender, Efl.Ui.PropertyBindPropertyBoundEventArgs args) => {
             propertyBound = args.arg;
             callbackCalled = true;
index 14743ac..bf47fed 100644 (file)
@@ -43,7 +43,9 @@ public static class TestMVVMParts
 {
     public static void mvvm_dynamic_parts()
     {
-        var factory = new Efl.Ui.ItemFactory<Efl.Ui.ListDefaultItem>();
+        var parent = new Efl.Ui.Win(null);
+        parent.Visible = false;
+        var factory = new Efl.Ui.ItemFactory<Efl.Ui.ListDefaultItem>(parent);
 
         var bindablePart = factory.TextPart();
         var error = bindablePart.Markup().Bind("name");
@@ -53,7 +55,9 @@ public static class TestMVVMParts
 
     public static void mvvm_factory_properties()
     {
-        var factory = new Efl.Ui.ItemFactory<Efl.Ui.ListDefaultItem>();
+        var parent = new Efl.Ui.Win(null);
+        parent.Visible = false;
+        var factory = new Efl.Ui.ItemFactory<Efl.Ui.ListDefaultItem>(parent);
         var iconFactory = new Efl.Ui.ImageFactory(null);
         iconFactory.BindProperty("filename", "modelProperty");
         var error = factory.IconPart().BindFactory(iconFactory);
index 8dedc3e..202c09f 100644 (file)
@@ -92,6 +92,7 @@ efl_mono_suite = executable('efl-mono-suite',
 
 env_mono = environment()
 env_mono.set('MONO_PATH', efl_mono_test_suite_path )
+env_mono.set('EFL_RUN_IN_TREE', '1')
 
 if (cs_is_dotnet)
 copy_prog = find_program(['cp', 'copy'])