forked from enlightenment/efl
Merge branch 'master' into devs/hermet/lottie
This commit is contained in:
commit
645b76f03b
|
@ -139,6 +139,10 @@ struct unpack_event_args_visitor
|
|||
return as_generator("Efl.Eo.Globals.IteratorTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
||||
else if (types.outer.base_type == "accessor")
|
||||
return as_generator("Efl.Eo.Globals.AccessorTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
||||
else if (types.outer.base_type == "array")
|
||||
return as_generator("Efl.Eo.Globals.NativeArrayTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
||||
else if (types.outer.base_type == "list")
|
||||
return as_generator("Efl.Eo.Globals.NativeListTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
||||
else
|
||||
return as_generator("new " << eolian_mono::type << "(info, false, false)").generate(sink, type, *context);
|
||||
}
|
||||
|
@ -229,19 +233,28 @@ struct pack_event_info_and_call_visitor
|
|||
return as_generator(
|
||||
indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
||||
<< indent.inc() << "IntPtr info = e.arg.NativeHandle;\n"
|
||||
<< indent.inc() << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", IntPtr.Zero, null);\n"
|
||||
<< indent.inc() << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", info, null);\n"
|
||||
).generate(sink, attributes::unused, *context);
|
||||
}
|
||||
bool operator()(attributes::complex_type_def const& type) const
|
||||
{
|
||||
auto const& indent = current_indentation(*context);
|
||||
if ((type.outer.base_type == "iterator") || (type.outer.base_type == "accessor"))
|
||||
return true;
|
||||
bool is_own = type.outer.base_qualifier & attributes::qualifier_info::is_own;
|
||||
std::string info_variable;
|
||||
|
||||
return as_generator(
|
||||
indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
||||
<< indent.inc() << "IntPtr info = e.arg.Handle;\n"
|
||||
<< indent.inc() << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", IntPtr.Zero, null);\n"
|
||||
if (type.outer.base_type == "iterator")
|
||||
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IEnumerableToIterator(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
||||
else if (type.outer.base_type == "accessor")
|
||||
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IEnumerableToAccessor(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
||||
else if (type.outer.base_type == "array")
|
||||
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IListToNativeArray(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
||||
else if (type.outer.base_type == "list")
|
||||
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IListToNativeList(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
||||
else
|
||||
info_variable = "IntPtr info = e.arg.Handle;\n";
|
||||
return as_generator(indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
||||
<< indent.inc() << info_variable
|
||||
<< indent.inc() << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", info, null);\n"
|
||||
).generate(sink, attributes::unused, *context);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -625,20 +625,27 @@ struct native_convert_in_variable_generator
|
|||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.type), context);
|
||||
}
|
||||
else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *"
|
||||
|| param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *"
|
||||
)
|
||||
else if (param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
return as_generator(
|
||||
"var " << string << " = new " << type << "(" << escape_keyword(param.param_name)
|
||||
<< ", " << (param.type.has_own ? "true" : "false")
|
||||
<< ", " << (complex->subtypes.front().is_value_type || complex->subtypes.front().has_own ? "true" : "false")
|
||||
"var " << string << " = Efl.Eo.Globals.NativeListTo" << type << "(" << escape_keyword(param.param_name)
|
||||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.type), context);
|
||||
}
|
||||
else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
return as_generator(
|
||||
"var " << string << " = Efl.Eo.Globals.NativeArrayTo" << type << "(" << escape_keyword(param.param_name)
|
||||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.type), context);
|
||||
}
|
||||
|
||||
else if (param.type.c_type == "Eina_Iterator *" || param.type.c_type == "const Eina_Iterator *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
|
@ -729,29 +736,25 @@ struct convert_in_variable_generator
|
|||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
}
|
||||
else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *"
|
||||
|| param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *"
|
||||
)
|
||||
else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
if (!as_generator(
|
||||
"Contract.Requires(" << string << " != null, nameof(" << string << "));\n"
|
||||
<< "var " << string << " = " << string << ".Handle;\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), escape_keyword(param.param_name),
|
||||
in_variable_name(param.param_name), escape_keyword(param.param_name))
|
||||
, context))
|
||||
"var " << string << " = " << "Efl.Eo.Globals.IListToNativeArray(" << escape_keyword(param.param_name) << ", " << (param.type.has_own ? "true" : "false") << ");\n"
|
||||
).generate(sink, in_variable_name(param.param_name), context))
|
||||
return false;
|
||||
if (param.type.has_own && !as_generator(
|
||||
escape_keyword(param.param_name) << ".Own = false;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
}
|
||||
else if (param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
|
||||
if ((param.type.has_own && (complex->subtypes.front().is_value_type || complex->subtypes.front().has_own))
|
||||
&& !as_generator(
|
||||
escape_keyword(param.param_name) << ".OwnContent = false;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
auto var_name = in_variable_name(param.param_name);
|
||||
if (!as_generator(
|
||||
"var " << string << " = " << "Efl.Eo.Globals.IListToNativeList(" << escape_keyword(param.param_name) << ", " << (param.type.has_own ? "true" : "false") << ");\n"
|
||||
).generate(sink, var_name, context))
|
||||
return false;
|
||||
}
|
||||
else if (param.type.c_type == "Eina_Iterator *" || param.type.c_type == "const Eina_Iterator *")
|
||||
|
@ -999,7 +1002,17 @@ struct convert_out_assign_generator
|
|||
|| param_is_acceptable(param, "Eina_Array *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_List *", WANT_OWN, WANT_OUT)
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
return as_generator(
|
||||
string << " = Efl.Eo.Globals.NativeArrayTo" << type << "(" << string
|
||||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), param.type, out_variable_name(param.param_name)), context);
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
|
@ -1009,9 +1022,7 @@ struct convert_out_assign_generator
|
|||
if (!complex)
|
||||
return false;
|
||||
return as_generator(
|
||||
string << " = new " << type << "(" << string
|
||||
<< ", " << (param.type.has_own ? "true" : "false")
|
||||
<< ", " << (param.type.has_own && (complex->subtypes.front().is_value_type || complex->subtypes.front().has_own) ? "true" : "false")
|
||||
string << " = Efl.Eo.Globals.NativeListTo" << type << "(" << string
|
||||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), param.type, out_variable_name(param.param_name)), context);
|
||||
}
|
||||
|
@ -1084,6 +1095,17 @@ struct convert_in_ptr_assign_generator
|
|||
string << " = " << in_variable_name(param.param_name) << ";\n"
|
||||
).generate(sink, escape_keyword(param.param_name), context);
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_Array *", WANT_OWN, !WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Array *", !WANT_OWN, !WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", WANT_OWN, !WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", !WANT_OWN, !WANT_OUT)
|
||||
)
|
||||
{
|
||||
return as_generator(
|
||||
scope_tab(2) << lit("Efl.Eo.Globals.UpdateListFromNativeArray(") << escape_keyword(param.param_name) << ", " << in_variable_name(param.param_name) << ");\n"
|
||||
).generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1141,17 +1163,23 @@ struct convert_return_generator
|
|||
.generate(sink, ret_type, context))
|
||||
return false;
|
||||
}
|
||||
else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *"
|
||||
|| ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *"
|
||||
)
|
||||
else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
if (!as_generator("return new " << type << "(_ret_var, " << std::string{ret_type.has_own ? "true" : "false"}
|
||||
<< ", " << (ret_type.has_own && (complex->subtypes.front().is_value_type || complex->subtypes.front().has_own) ? "true" : "false")
|
||||
<< ");\n")
|
||||
.generate(sink, ret_type, context))
|
||||
|
||||
if (!as_generator("return Efl.Eo.Globals.NativeArrayTo" << type << "(_ret_var);")
|
||||
.generate(sink, ret_type, context))
|
||||
return false;
|
||||
}
|
||||
else if (ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
if (!as_generator("return Efl.Eo.Globals.NativeListTo" << type << "(_ret_var);")
|
||||
.generate(sink, ret_type, context))
|
||||
return false;
|
||||
}
|
||||
else if (ret_type.c_type == "Eina_Accessor *" || ret_type.c_type == "const Eina_Accessor *")
|
||||
|
@ -1274,30 +1302,30 @@ struct native_convert_out_assign_generator
|
|||
else if (param_is_acceptable(param, "Eina_Array *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Array *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", !WANT_OWN, WANT_OUT))
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
auto outvar = out_variable_name(param.param_name);
|
||||
if (!as_generator(
|
||||
string << " = " << string << ".Handle;\n"
|
||||
string << " = Efl.Eo.Globals.IListToNativeArray(" << string << ", " << (param.type.has_own ? "true" : "false")<< ");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), outvar), context))
|
||||
return false;
|
||||
if (param.type.has_own && !as_generator(
|
||||
string << ".Own = false;\n"
|
||||
).generate(sink, outvar, context))
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT))
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
|
||||
if ((param.type.has_own && (complex->subtypes.front().is_value_type && complex->subtypes.front().has_own))
|
||||
&& !as_generator(
|
||||
string << ".OwnContent = false;\n"
|
||||
).generate(sink, outvar, context))
|
||||
auto outvar = out_variable_name(param.param_name);
|
||||
if (!as_generator(
|
||||
string << " = Efl.Eo.Globals.IListToNativeList(" << string << ", " << (param.type.has_own ? "true" : "false")<<");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), outvar), context))
|
||||
return false;
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_Accessor *", WANT_OWN, WANT_OUT)
|
||||
|
@ -1439,18 +1467,22 @@ struct native_convert_return_generator
|
|||
return as_generator("return _ret_var.Handle;")
|
||||
.generate(sink, attributes::unused, context);
|
||||
}
|
||||
else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *"
|
||||
|| ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *"
|
||||
)
|
||||
else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
if (ret_type.has_own && !as_generator("_ret_var.Own = false; ")
|
||||
.generate(sink, attributes::unused, context))
|
||||
|
||||
return as_generator(lit("return Efl.Eo.Globals.IListToNativeArray(_ret_var, ") << (ret_type.has_own ? "true" : "false") << ");")
|
||||
.generate(sink, attributes::unused, context);
|
||||
}
|
||||
else if (ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *")
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
|
||||
return as_generator("return _ret_var.Handle;")
|
||||
return as_generator(lit("return Efl.Eo.Globals.IListToNativeList(_ret_var, ") << (ret_type.has_own ? "true" : "false") << ");")
|
||||
.generate(sink, attributes::unused, context);
|
||||
}
|
||||
else if (ret_type.c_type == "Eina_Accessor *" || ret_type.c_type == "const Eina_Accessor *")
|
||||
|
|
|
@ -69,6 +69,20 @@ struct to_internal_field_convert_generator
|
|||
.generate(sink, std::make_tuple(field_name, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if ((complex && (complex->outer.base_type == "array")))
|
||||
{
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << "_internal_struct." << string << " = Efl.Eo.Globals.IListToNativeArray(_external_struct." << string << ", " << (field.type.has_own ? "true" : "false") << ");\n")
|
||||
.generate(sink, std::make_tuple(field_name, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if ((complex && (complex->outer.base_type == "list")))
|
||||
{
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << "_internal_struct." << string << " = Efl.Eo.Globals.IListToNativeList(_external_struct." << string << ", " << (field.type.has_own ? "true" : "false") << ");\n")
|
||||
.generate(sink, std::make_tuple(field_name, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if ((complex && (complex->outer.base_type == "iterator")))
|
||||
{
|
||||
if (!as_generator(
|
||||
|
@ -76,9 +90,7 @@ struct to_internal_field_convert_generator
|
|||
.generate(sink, std::make_tuple(field_name, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if ((complex && (complex->outer.base_type == "array"
|
||||
|| complex->outer.base_type == "list"
|
||||
|| complex->outer.base_type == "hash"))
|
||||
else if ((complex && (complex->outer.base_type == "hash"))
|
||||
|| field.type.c_type == "Eina_Binbuf *" || field.type.c_type == "const Eina_Binbuf *")
|
||||
{
|
||||
// Always assumes pointer
|
||||
|
@ -193,12 +205,19 @@ struct to_external_field_convert_generator
|
|||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (complex && (complex->outer.base_type == "array"
|
||||
|| complex->outer.base_type == "list"))
|
||||
else if (complex && (complex->outer.base_type == "array"))
|
||||
{
|
||||
// Always assumes pointer
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << "_external_struct." << string << " = new " << type << "(_internal_struct." << string << ", false, false);\n")
|
||||
indent << scope_tab << scope_tab << "_external_struct." << string << " = Efl.Eo.Globals.NativeArrayTo" << type << "(_internal_struct." << string << ");\n")
|
||||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (complex && (complex->outer.base_type == "list"))
|
||||
{
|
||||
// Always assumes pointer
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << "_external_struct." << string << " = Efl.Eo.Globals.NativeListTo" << type << "(_internal_struct." << string << ");\n")
|
||||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -368,13 +368,13 @@ struct visitor_generate
|
|||
{"list", nullptr, nullptr, [&]
|
||||
{
|
||||
complex_type_def c = complex;
|
||||
c.outer.base_type = "Eina.List";
|
||||
c.outer.base_type = "IList";
|
||||
return c;
|
||||
}}
|
||||
, {"array", nullptr, nullptr, [&]
|
||||
{
|
||||
complex_type_def c = complex;
|
||||
c.outer.base_type = "Eina.Array";
|
||||
c.outer.base_type = "IList";
|
||||
return c;
|
||||
}}
|
||||
, {"hash", nullptr, nullptr
|
||||
|
|
|
@ -198,7 +198,7 @@ public abstract class Application
|
|||
{
|
||||
Init(components);
|
||||
Efl.App app = Efl.App.AppMain;
|
||||
var command_line = new Eina.Array<Eina.Stringshare>();
|
||||
var command_line = new List<Eina.Stringshare>();
|
||||
//command_line.Add(List.ConvertAll(Environment.GetCommandLineArgs(), s => (Eina.Stringshare)s));
|
||||
//command_line.AddRange(Environment.GetCommandLineArgs());
|
||||
#if EFL_BETA
|
||||
|
@ -234,7 +234,6 @@ public abstract class Application
|
|||
OnTerminate();
|
||||
};
|
||||
app.Begin();
|
||||
command_line.Dispose();
|
||||
Shutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -875,33 +875,107 @@ internal static class Globals
|
|||
return ret;
|
||||
}
|
||||
|
||||
internal static IEnumerable<T> ListToIEnumerable<T>(IntPtr list)
|
||||
internal static IList<T> NativeListToIList<T>(IntPtr nativeList)
|
||||
{
|
||||
if (list == IntPtr.Zero)
|
||||
throw new ArgumentException("list is null", nameof(list));
|
||||
if (nativeList == IntPtr.Zero)
|
||||
throw new ArgumentException("nativeList is null", nameof(nativeList));
|
||||
|
||||
IntPtr l;
|
||||
|
||||
for (l = list; l != IntPtr.Zero; l = Eina.ListNativeFunctions.eina_list_next_custom_export_mono(l))
|
||||
List<T> list = new List<T>();
|
||||
for (l = nativeList; l != IntPtr.Zero; l = Eina.ListNativeFunctions.eina_list_next_custom_export_mono(l))
|
||||
{
|
||||
yield return Eina.TraitFunctions.NativeToManaged<T>(Eina.ListNativeFunctions.eina_list_data_get_custom_export_mono(l));
|
||||
list.Add(Eina.TraitFunctions.NativeToManaged<T>(Eina.ListNativeFunctions.eina_list_data_get_custom_export_mono(l)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
internal static IntPtr IEnumerableToList<T>(IEnumerable<T> enumerable)
|
||||
internal static IntPtr IListToNativeList<T>(IList<T> list, bool isMoved)
|
||||
{
|
||||
if (enumerable == null)
|
||||
throw new ArgumentException("enumerable is null", nameof(enumerable));
|
||||
if (list == null)
|
||||
throw new ArgumentException("list is null", nameof(list));
|
||||
|
||||
IntPtr list = IntPtr.Zero;
|
||||
foreach (T data in enumerable)
|
||||
// If we are a wrapper around an existing Eina.List, we can just forward
|
||||
// it and avoid unnecessary copying in non-owning transfers.
|
||||
var wrappedList = list as Eina.List<T>;
|
||||
|
||||
if (wrappedList != null && !isMoved)
|
||||
{
|
||||
list = Eina.ListNativeFunctions.eina_list_append(list, Eina.TraitFunctions.ManagedToNativeAlloc(data));
|
||||
return wrappedList.Handle;
|
||||
}
|
||||
|
||||
IntPtr nativeList = IntPtr.Zero;
|
||||
foreach (T data in list)
|
||||
{
|
||||
nativeList = Eina.ListNativeFunctions.eina_list_append(nativeList, Eina.TraitFunctions.ManagedToNativeAlloc(data)); //FIXME: need to free
|
||||
}
|
||||
|
||||
if (!isMoved)
|
||||
{
|
||||
// FIXME Need to free ret and unpin pinnedArray in the future.
|
||||
}
|
||||
|
||||
return nativeList;
|
||||
}
|
||||
|
||||
internal static IList<T> NativeArrayToIList<T>(IntPtr nativeArray)
|
||||
{
|
||||
if (nativeArray == IntPtr.Zero)
|
||||
throw new ArgumentException("nativeArray is null", nameof(nativeArray));
|
||||
|
||||
List<T> list = new List<T>();
|
||||
UpdateListFromNativeArray(list, nativeArray);
|
||||
|
||||
// FIXME need to free `list` if the returned list is not @moved
|
||||
return list;
|
||||
}
|
||||
|
||||
internal static IntPtr IListToNativeArray<T>(IList<T> list, bool isMoved)
|
||||
{
|
||||
if (list == null)
|
||||
throw new ArgumentException("list is null", nameof(list));
|
||||
|
||||
// If we are a wrapper around an existing Eina.Array, we can just forward
|
||||
// it and avoid unnecessary copying in non-owning transfers.
|
||||
var wrappedArray = list as Eina.Array<T>;
|
||||
|
||||
if (wrappedArray != null && !isMoved)
|
||||
{
|
||||
return wrappedArray.Handle;
|
||||
}
|
||||
|
||||
IntPtr nativeArray = Eina.ArrayNativeFunctions.eina_array_new(4);
|
||||
foreach (T data in list)
|
||||
{
|
||||
Eina.ArrayNativeFunctions.eina_array_push_custom_export_mono(nativeArray, Eina.TraitFunctions.ManagedToNativeAlloc(data)); //FIXME: need to free
|
||||
}
|
||||
|
||||
if (!isMoved)
|
||||
{
|
||||
// FIXME Need to free ret and unpin pinnedArray in the future.
|
||||
}
|
||||
|
||||
return nativeArray;
|
||||
}
|
||||
|
||||
internal static void UpdateListFromNativeArray<T>(IList<T> list, IntPtr nativeArray)
|
||||
{
|
||||
// Do not update if list Handle is same to nativeArray. They already updated in native code.
|
||||
var wrappedArray = list as Eina.Array<T>;
|
||||
if (wrappedArray != null && wrappedArray.Handle == nativeArray)
|
||||
return;
|
||||
|
||||
list.Clear();
|
||||
if (nativeArray == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint count = Eina.ArrayNativeFunctions.eina_array_count_custom_export_mono(nativeArray);
|
||||
for (uint i = 0; i < count; i++)
|
||||
{
|
||||
list.Add(Eina.TraitFunctions.NativeToManaged<T>(Eina.ArrayNativeFunctions.eina_array_data_get_custom_export_mono(nativeArray, i)));
|
||||
}
|
||||
}
|
||||
|
||||
} // Globals
|
||||
|
||||
|
|
|
@ -4865,6 +4865,20 @@ _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED,
|
|||
_edje_entry_real_part_configure(ed, rp);
|
||||
}
|
||||
|
||||
static int
|
||||
_sort_cb(const void *a1, const void *a2)
|
||||
{
|
||||
Ecore_IMF_Preedit_Attr *attr1 = (Ecore_IMF_Preedit_Attr *)a1;
|
||||
Ecore_IMF_Preedit_Attr *attr2 = (Ecore_IMF_Preedit_Attr *)a2;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(attr1, 0);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(attr2, 0);
|
||||
|
||||
if (attr1->start_index < attr2->start_index) return -1;
|
||||
else if (attr1->start_index == attr2->start_index) return 0;
|
||||
else return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -4927,10 +4941,11 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
|
|||
buf = eina_strbuf_new();
|
||||
if (attrs)
|
||||
{
|
||||
attrs = eina_list_sort(attrs, 0, EINA_COMPARE_CB(_sort_cb));
|
||||
|
||||
EINA_LIST_FOREACH(attrs, l, attr)
|
||||
{
|
||||
if (attr->preedit_type < preedit_type_size &&
|
||||
tagname[attr->preedit_type])
|
||||
if (attr->preedit_type < preedit_type_size)
|
||||
{
|
||||
preedit_attr_str = eina_strbuf_new();
|
||||
if (preedit_attr_str)
|
||||
|
@ -4940,7 +4955,10 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
|
|||
|
||||
if (markup_txt)
|
||||
{
|
||||
eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);
|
||||
if (tagname[attr->preedit_type])
|
||||
eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "%s", markup_txt);
|
||||
free(markup_txt);
|
||||
}
|
||||
eina_strbuf_free(preedit_attr_str);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Clickable,
|
||||
Efl.Access.Text, Efl.Access.Editable.Text, Efl.File, Efl.Input_Text
|
||||
Efl.Access.Text, Efl.Access.Editable.Text, Efl.File
|
||||
composites
|
||||
Efl.Text_Interactive, Efl.Text_Markup
|
||||
Efl.Text_Interactive, Efl.Text_Markup, Efl.Input_Text
|
||||
{
|
||||
[[A flexible text widget which can be static (as a label) or editable by
|
||||
the user (as a text entry). It provides all sorts of editing facilities
|
||||
|
@ -31,7 +31,7 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click
|
|||
enabled: bool; [[$true to enable the contextual menu.]]
|
||||
}
|
||||
}
|
||||
@property cnp_mode {
|
||||
@property cnp_mode @beta {
|
||||
/* FIXME: Efl.Ui.Selection_Format does not allow markup without images! */
|
||||
[[Control pasting of text and images for the widget.
|
||||
|
||||
|
@ -59,7 +59,7 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click
|
|||
}
|
||||
}
|
||||
|
||||
@property item_factory {
|
||||
@property item_factory @beta {
|
||||
[[The factory that provides item in the text e.g.
|
||||
"emoticon/happy" or "href=file://image.jpg" etc.
|
||||
]]
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Wl2.h>
|
||||
#include <wayland-egl.h>
|
||||
|
||||
#ifdef GL_GLES
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_wl2_suite.h"
|
||||
#include "ecore_wl2_tests_helpers.h"
|
||||
|
@ -14,6 +20,27 @@
|
|||
#define WIDTH 480
|
||||
#define HEIGHT 360
|
||||
|
||||
typedef struct _Test_Data {
|
||||
Ecore_Wl2_Display *display;
|
||||
Ecore_Wl2_Window *win;
|
||||
Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler;
|
||||
Ecore_Event_Handler *handler;
|
||||
|
||||
struct wl_surface *surface;
|
||||
struct wl_egl_window *egl_window;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int frame_callback_count;
|
||||
|
||||
#ifdef GL_GLES
|
||||
EGLDisplay egl_display;
|
||||
EGLConfig egl_conf;
|
||||
EGLSurface egl_surface;
|
||||
EGLContext egl_context;
|
||||
#endif
|
||||
} Test_Data;
|
||||
|
||||
static Ecore_Wl2_Window *
|
||||
_window_create(Ecore_Wl2_Display *disp)
|
||||
{
|
||||
|
@ -26,6 +53,42 @@ _surface_get(Ecore_Wl2_Window *win)
|
|||
return ecore_wl2_window_surface_get(win);
|
||||
}
|
||||
|
||||
#ifdef GL_GLES
|
||||
static void
|
||||
_init_egl(Test_Data *td)
|
||||
{
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
EGLint num_config;
|
||||
|
||||
EGLint attributes[] = {
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
td->egl_display = eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display));
|
||||
eglInitialize(td->egl_display, NULL, NULL);
|
||||
eglChooseConfig(td->egl_display, attributes, &td->egl_conf, 1, &num_config);
|
||||
td->egl_context = eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL);
|
||||
|
||||
td->egl_window = wl_egl_window_create(td->surface, td->width, td->height);
|
||||
td->egl_surface = eglCreateWindowSurface(td->egl_display,
|
||||
td->egl_conf, td->egl_window, NULL);
|
||||
|
||||
eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface, td->egl_context);
|
||||
}
|
||||
|
||||
static void
|
||||
_term_egl(Test_Data *td)
|
||||
{
|
||||
eglDestroySurface(td->egl_display, td->egl_surface);
|
||||
wl_egl_window_destroy(td->egl_window);
|
||||
eglDestroyContext(td->egl_display, td->egl_context);
|
||||
eglTerminate(td->egl_display);
|
||||
}
|
||||
#endif
|
||||
|
||||
EFL_START_TEST(wl2_window_new)
|
||||
{
|
||||
Ecore_Wl2_Display *disp;
|
||||
|
@ -310,6 +373,94 @@ EFL_START_TEST(wl2_window_type)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
#ifdef GL_GLES
|
||||
static void
|
||||
_test_activated_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
|
||||
{
|
||||
Test_Data *td = data;
|
||||
|
||||
td->frame_callback_count++;
|
||||
if (td->frame_callback_count % 4 == 0)
|
||||
glClearColor(0.0, 1.0, 0.0, 0.0);
|
||||
else if (td->frame_callback_count % 4 == 1)
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
else if (td->frame_callback_count % 4 == 2)
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
else
|
||||
glClearColor(1.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glFlush();
|
||||
|
||||
eglSwapBuffers(td->egl_display, td->egl_surface);
|
||||
|
||||
ecore_wl2_window_commit(td->win, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_test_activated_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Test_Data *td = data;
|
||||
|
||||
td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_activated_frame_cb, td);
|
||||
ecore_wl2_window_commit(td->win, EINA_TRUE);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_test_activated_window_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
//TC Pass
|
||||
ecore_main_loop_quit();
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
EFL_START_TEST(wl2_window_activated)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
_init_egl(td);
|
||||
td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
|
||||
_test_activated_configure_complete, td);
|
||||
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE,
|
||||
_test_activated_window_activate, NULL);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
_term_egl(td);
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
#else
|
||||
EFL_START_TEST(wl2_window_activated)
|
||||
{
|
||||
fail_if("No GL enabled GL should be enabled for API test");
|
||||
}
|
||||
EFL_END_TEST
|
||||
#endif
|
||||
|
||||
EFL_START_TEST(wl2_window_aspect)
|
||||
{
|
||||
Ecore_Wl2_Display *disp;
|
||||
|
@ -494,6 +645,339 @@ EFL_START_TEST(wl2_window_popup_input)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static void
|
||||
_test_commit_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
|
||||
{
|
||||
Test_Data *td = data;
|
||||
td->frame_callback_count++;
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_test_commit_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Test_Data *td = data;
|
||||
|
||||
td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td);
|
||||
ecore_wl2_window_commit(td->win, EINA_TRUE);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
EFL_START_TEST(wl2_window_commit)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
|
||||
_test_commit_configure_complete, td);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
//Check if the frame callback was called properly by ecore_wl2_window_commit().
|
||||
fail_if(td->frame_callback_count == 0);
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static void
|
||||
_test_frame_callback_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
|
||||
{
|
||||
Test_Data *td = data;
|
||||
td->frame_callback_count++;
|
||||
if (td->frame_callback_count == 1)
|
||||
{
|
||||
ecore_wl2_window_frame_callback_del(td->frame_callback_handler);
|
||||
td->frame_callback_handler = NULL;
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_test_frame_callback_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Test_Data *td = data;
|
||||
|
||||
td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_frame_callback_frame_cb, td);
|
||||
ecore_wl2_window_commit(td->win, EINA_TRUE);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
EFL_START_TEST(wl2_window_frame_callback)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
|
||||
_test_frame_callback_configure_complete, td);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
//Check if the frame callback called after then it sets NULL or not.
|
||||
fail_if(td->frame_callback_count != 1);
|
||||
fail_if(td->frame_callback_handler != NULL);
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(wl2_window_free)
|
||||
{
|
||||
Ecore_Wl2_Window *t_win;
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface);
|
||||
|
||||
fail_if(td->win != t_win);
|
||||
|
||||
ecore_wl2_window_free(td->win);
|
||||
t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface);
|
||||
|
||||
//Check the returned window with freed window.
|
||||
fail_if(td->win == t_win);
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static Eina_Bool
|
||||
_test_hide_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
//TC pass
|
||||
ecore_main_loop_quit();
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
EFL_START_TEST(wl2_window_hide)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
ecore_wl2_window_hide(td->win);
|
||||
td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE,
|
||||
_test_hide_window_hide, NULL);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(wl2_window_shell_surface_exists)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
//window_show function will create shell surface. then checks it.
|
||||
fail_if(ecore_wl2_window_shell_surface_exists(td->win) == EINA_FALSE);
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static Eina_Bool
|
||||
_test_show_window_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
//TC pass
|
||||
ecore_main_loop_quit();
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
EFL_START_TEST(wl2_window_show)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW,
|
||||
_test_show_window_show, NULL);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static Eina_Bool _window_configure_event_called = EINA_FALSE;
|
||||
|
||||
static Eina_Bool
|
||||
_test_update_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
_window_configure_event_called = EINA_TRUE;
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_test_update_window_configure_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
//Checks if the configure_complete calling before configure calling
|
||||
//when ecore_wl2_window_update_begin() called.
|
||||
fail_if(_window_configure_event_called == EINA_TRUE);
|
||||
|
||||
ecore_main_loop_quit();
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
EFL_START_TEST(wl2_window_update_begin)
|
||||
{
|
||||
Test_Data *td;
|
||||
|
||||
ecore_wl2_init();
|
||||
|
||||
td = calloc(1, sizeof(Test_Data));
|
||||
td->width = WIDTH;
|
||||
td->height = HEIGHT;
|
||||
td->frame_callback_count = 0;
|
||||
|
||||
td->display = _display_connect();
|
||||
ck_assert(td->display != NULL);
|
||||
|
||||
td->win = _window_create(td->display);
|
||||
ck_assert(td->win != NULL);
|
||||
|
||||
ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
|
||||
|
||||
td->surface = _surface_get(td->win);
|
||||
ck_assert(td->surface != NULL);
|
||||
|
||||
ecore_wl2_window_show(td->win);
|
||||
|
||||
ecore_wl2_window_update_begin(td->win);
|
||||
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
|
||||
_test_update_window_configure, NULL);
|
||||
ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
|
||||
_test_update_window_configure_complete, NULL);
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
ecore_wl2_shutdown();
|
||||
free(td);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void
|
||||
ecore_wl2_test_window(TCase *tc)
|
||||
{
|
||||
|
@ -504,7 +988,17 @@ ecore_wl2_test_window(TCase *tc)
|
|||
tcase_add_test(tc, wl2_window_surface_test);
|
||||
tcase_add_test(tc, wl2_window_rotation);
|
||||
if (getenv("E_START"))
|
||||
tcase_add_test(tc, wl2_window_aux_hints_supported_get);
|
||||
{
|
||||
tcase_add_test(tc, wl2_window_aux_hints_supported_get);
|
||||
tcase_add_test(tc, wl2_window_commit);
|
||||
tcase_add_test(tc, wl2_window_frame_callback);
|
||||
tcase_add_test(tc, wl2_window_free);
|
||||
tcase_add_test(tc, wl2_window_hide);
|
||||
tcase_add_test(tc, wl2_window_shell_surface_exists);
|
||||
tcase_add_test(tc, wl2_window_show);
|
||||
tcase_add_test(tc, wl2_window_update_begin);
|
||||
tcase_add_test(tc, wl2_window_activated);
|
||||
}
|
||||
tcase_add_test(tc, wl2_window_display_get);
|
||||
tcase_add_test(tc, wl2_window_alpha);
|
||||
tcase_add_test(tc, wl2_window_floating_mode);
|
||||
|
|
|
@ -8,9 +8,17 @@ ecore_wl2_suite_src = [
|
|||
'ecore_wl2_test_input.c'
|
||||
]
|
||||
|
||||
wl2_test_gl_deps = []
|
||||
|
||||
if get_option('opengl') == 'es-egl'
|
||||
wl2_test_gl_deps += dependency('egl')
|
||||
wl2_test_gl_deps += dependency('gl')
|
||||
endif
|
||||
|
||||
ecore_wl2_suite = executable('ecore_wl2_suite',
|
||||
ecore_wl2_suite_src,
|
||||
dependencies: [ecore_wl2, ecore, check, wayland_protocol],
|
||||
dependencies: [ecore_wl2, ecore, ecore_input, check, wayland_protocol, wayland_client, dependency('wayland-egl'), wl2_test_gl_deps],
|
||||
|
||||
c_args : [
|
||||
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
|
||||
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
|
||||
|
|
|
@ -937,7 +937,7 @@ class TestEinaArray
|
|||
var arr = new Eina.Array<int>();
|
||||
arr.Append(base_seq_int);
|
||||
Test.Assert(t.EinaArrayIntInOwn(arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(modified_seq_int));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
|
@ -948,13 +948,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_int_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<int> arr;
|
||||
IList<int> arr;
|
||||
Test.Assert(t.EinaArrayIntOut(out arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_int));
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(append_seq_int));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_int) != null);
|
||||
Test.Assert(t.CheckEinaArrayIntOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -962,13 +959,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_int_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<int> arr;
|
||||
IList<int> arr;
|
||||
Test.Assert(t.EinaArrayIntOutOwn(out arr));
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_int));
|
||||
Test.Assert(arr.Append(append_seq_int));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_int) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -976,12 +970,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayIntReturn();
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_int));
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(append_seq_int));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_int) != null);
|
||||
Test.Assert(t.CheckEinaArrayIntReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -990,11 +980,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayIntReturnOwn();
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_int));
|
||||
Test.Assert(arr.Append(append_seq_int));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_int) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -1018,7 +1005,7 @@ class TestEinaArray
|
|||
var arr = new Eina.Array<string>();
|
||||
arr.Append(base_seq_str);
|
||||
Test.Assert(t.EinaArrayStrInOwn(arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(modified_seq_str));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
|
@ -1029,13 +1016,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_str_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<string> arr;
|
||||
IList<string> arr;
|
||||
Test.Assert(t.EinaArrayStrOut(out arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(append_seq_str));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_str) != null);
|
||||
Test.Assert(t.CheckEinaArrayStrOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -1043,13 +1027,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_str_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<string> arr;
|
||||
IList<string> arr;
|
||||
Test.Assert(t.EinaArrayStrOutOwn(out arr));
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
|
||||
Test.Assert(arr.Append(append_seq_str));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_str) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -1057,11 +1038,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayStrReturn();
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(append_seq_str));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_str) != null);
|
||||
Test.Assert(t.CheckEinaArrayStrReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -1070,11 +1048,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayStrReturnOwn();
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_str));
|
||||
Test.Assert(arr.Append(append_seq_str));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_str) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1073,7 @@ class TestEinaArray
|
|||
var arr = new Eina.Array<Eina.Stringshare>();
|
||||
arr.Append(base_seq_strshare);
|
||||
Test.Assert(t.EinaArrayStrshareInOwn(arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(modified_seq_strshare));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
|
@ -1109,13 +1084,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_strshare_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<Eina.Stringshare> arr;
|
||||
IList<Eina.Stringshare> arr;
|
||||
Test.Assert(t.EinaArrayStrshareOut(out arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(append_seq_strshare));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_strshare) != null);
|
||||
Test.Assert(t.CheckEinaArrayStrshareOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -1123,13 +1095,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_strshare_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<Eina.Stringshare> arr;
|
||||
IList<Eina.Stringshare> arr;
|
||||
Test.Assert(t.EinaArrayStrshareOutOwn(out arr));
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
|
||||
Test.Assert(arr.Append(append_seq_strshare));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_strshare) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -1137,11 +1106,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayStrshareReturn();
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(append_seq_strshare));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_strshare) != null);
|
||||
Test.Assert(t.CheckEinaArrayStrshareReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -1150,11 +1116,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayStrshareReturnOwn();
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
|
||||
Test.Assert(arr.Append(append_seq_strshare));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(append_seq_strshare) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -1179,7 +1142,7 @@ class TestEinaArray
|
|||
var arr = new Eina.Array<Dummy.Numberwrapper>();
|
||||
arr.Append(BaseSeqObj());
|
||||
Test.Assert(t.EinaArrayObjInOwn(arr));
|
||||
Test.Assert(!arr.Own);
|
||||
Test.Assert(arr.Own);
|
||||
NumberwrapperSequenceAssertEqual(arr.ToArray(), ModifiedSeqObj());
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
|
@ -1190,13 +1153,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_obj_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<Dummy.Numberwrapper> arr;
|
||||
IList<Dummy.Numberwrapper> arr;
|
||||
Test.Assert(t.EinaArrayObjOut(out arr));
|
||||
Test.Assert(!arr.Own);
|
||||
NumberwrapperSequenceAssertEqual(arr.ToArray(), BaseSeqObj());
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(AppendSeqObj()));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(AppendSeqObj()) != null);
|
||||
Test.Assert(t.CheckEinaArrayObjOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -1204,13 +1164,10 @@ class TestEinaArray
|
|||
public static void test_eina_array_obj_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.Array<Dummy.Numberwrapper> arr;
|
||||
IList<Dummy.Numberwrapper> arr;
|
||||
Test.Assert(t.EinaArrayObjOutOwn(out arr));
|
||||
Test.Assert(arr.Own);
|
||||
NumberwrapperSequenceAssertEqual(arr.ToArray(), BaseSeqObj());
|
||||
Test.Assert(arr.Append(AppendSeqObj()));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(AppendSeqObj()) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -1218,11 +1175,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayObjReturn();
|
||||
Test.Assert(!arr.Own);
|
||||
NumberwrapperSequenceAssertEqual(arr.ToArray(), BaseSeqObj());
|
||||
Test.AssertRaises<NotSupportedException>(() => arr.Append(AppendSeqObj()));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(AppendSeqObj()) != null);
|
||||
Test.Assert(t.CheckEinaArrayObjReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -1231,11 +1185,8 @@ class TestEinaArray
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var arr = t.EinaArrayObjReturnOwn();
|
||||
Test.Assert(arr.Own);
|
||||
NumberwrapperSequenceAssertEqual(arr.ToArray(), BaseSeqObj());
|
||||
Test.Assert(arr.Append(AppendSeqObj()));
|
||||
arr.Dispose();
|
||||
Test.Assert(arr.Handle == IntPtr.Zero);
|
||||
Test.Assert(arr.Concat(AppendSeqObj()) != null);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2119,8 +2070,8 @@ class TestEinaList
|
|||
var lst = new Eina.List<int>();
|
||||
lst.Append(base_seq_int);
|
||||
Test.Assert(t.EinaListIntInOwn(lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(!lst.OwnContent);
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.OwnContent);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListIntInOwn());
|
||||
|
@ -2130,13 +2081,9 @@ class TestEinaList
|
|||
public static void test_eina_list_int_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<int> lst;
|
||||
IList<int> lst;
|
||||
Test.Assert(t.EinaListIntOut(out lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(!lst.OwnContent);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_int));
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListIntOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2144,13 +2091,10 @@ class TestEinaList
|
|||
public static void test_eina_list_int_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<int> lst;
|
||||
IList<int> lst;
|
||||
Test.Assert(t.EinaListIntOutOwn(out lst));
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_int));
|
||||
lst.Append(append_seq_int);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(append_seq_int);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2158,11 +2102,7 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListIntReturn();
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(!lst.OwnContent);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_int));
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListIntReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2171,11 +2111,8 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListIntReturnOwn();
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_int));
|
||||
lst.Append(append_seq_int);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(append_seq_int);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2199,7 +2136,7 @@ class TestEinaList
|
|||
var lst = new Eina.List<string>();
|
||||
lst.Append(base_seq_str);
|
||||
Test.Assert(t.EinaListStrInOwn(lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.Own);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListStrInOwn());
|
||||
|
@ -2209,12 +2146,9 @@ class TestEinaList
|
|||
public static void test_eina_list_str_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<string> lst;
|
||||
IList<string> lst;
|
||||
Test.Assert(t.EinaListStrOut(out lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_str));
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListStrOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2222,13 +2156,10 @@ class TestEinaList
|
|||
public static void test_eina_list_str_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<string> lst;
|
||||
IList<string> lst;
|
||||
Test.Assert(t.EinaListStrOutOwn(out lst));
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_str));
|
||||
lst.Append(append_seq_str);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(append_seq_str);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2236,10 +2167,7 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListStrReturn();
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_str));
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListStrReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2248,11 +2176,8 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListStrReturnOwn();
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_str));
|
||||
lst.Append(append_seq_str);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(append_seq_str);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2276,7 +2201,7 @@ class TestEinaList
|
|||
var lst = new Eina.List<Eina.Stringshare>();
|
||||
lst.Append(base_seq_strshare);
|
||||
Test.Assert(t.EinaListStrshareInOwn(lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.Own);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListStrshareInOwn());
|
||||
|
@ -2286,12 +2211,9 @@ class TestEinaList
|
|||
public static void test_eina_list_strshare_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<Eina.Stringshare> lst;
|
||||
IList<Eina.Stringshare> lst;
|
||||
Test.Assert(t.EinaListStrshareOut(out lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListStrshareOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2299,13 +2221,10 @@ class TestEinaList
|
|||
public static void test_eina_list_strshare_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<Eina.Stringshare> lst;
|
||||
IList<Eina.Stringshare> lst;
|
||||
Test.Assert(t.EinaListStrshareOutOwn(out lst));
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
|
||||
lst.Append(append_seq_strshare);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(append_seq_strshare);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2313,10 +2232,7 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListStrshareReturn();
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListStrshareReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2325,11 +2241,8 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListStrshareReturnOwn();
|
||||
Test.Assert(lst.Own);
|
||||
Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
|
||||
lst.Append(append_seq_strshare);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(append_seq_strshare);
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2354,7 +2267,7 @@ class TestEinaList
|
|||
var lst = new Eina.List<Dummy.Numberwrapper>();
|
||||
lst.Append(BaseSeqObj());
|
||||
Test.Assert(t.EinaListObjInOwn(lst));
|
||||
Test.Assert(!lst.Own);
|
||||
Test.Assert(lst.Own);
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListObjInOwn());
|
||||
|
@ -2364,12 +2277,9 @@ class TestEinaList
|
|||
public static void test_eina_list_obj_out()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<Dummy.Numberwrapper> lst;
|
||||
IList<Dummy.Numberwrapper> lst;
|
||||
Test.Assert(t.EinaListObjOut(out lst));
|
||||
Test.Assert(!lst.Own);
|
||||
NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseSeqObj());
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListObjOut());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2377,13 +2287,10 @@ class TestEinaList
|
|||
public static void test_eina_list_obj_out_own()
|
||||
{
|
||||
var t = new Dummy.TestObject();
|
||||
Eina.List<Dummy.Numberwrapper> lst;
|
||||
IList<Dummy.Numberwrapper> lst;
|
||||
Test.Assert(t.EinaListObjOutOwn(out lst));
|
||||
Test.Assert(lst.Own);
|
||||
NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseSeqObj());
|
||||
lst.Append(AppendSeqObj());
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(AppendSeqObj());
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
@ -2391,10 +2298,7 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListObjReturn();
|
||||
Test.Assert(!lst.Own);
|
||||
NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseSeqObj());
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
Test.Assert(t.CheckEinaListObjReturn());
|
||||
t.Dispose();
|
||||
}
|
||||
|
@ -2403,11 +2307,8 @@ class TestEinaList
|
|||
{
|
||||
var t = new Dummy.TestObject();
|
||||
var lst = t.EinaListObjReturnOwn();
|
||||
Test.Assert(lst.Own);
|
||||
NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseSeqObj());
|
||||
lst.Append(AppendSeqObj());
|
||||
lst.Dispose();
|
||||
Test.Assert(lst.Handle == IntPtr.Zero);
|
||||
lst.Concat(AppendSeqObj());
|
||||
t.Dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TestSuite
|
||||
{
|
||||
|
@ -226,7 +227,7 @@ class TestEoEvents
|
|||
public static void event_with_array_payload()
|
||||
{
|
||||
var obj = new Dummy.TestObject();
|
||||
Eina.Array<string> received = null;
|
||||
List<string> received = null;
|
||||
Eina.Array<string> sent = new Eina.Array<string>();
|
||||
|
||||
sent.Append("Abc");
|
||||
|
@ -234,7 +235,7 @@ class TestEoEvents
|
|||
sent.Append("Ghi");
|
||||
|
||||
obj.EvtWithArrayEvent += (object sender, Dummy.TestObjectEvtWithArrayEventArgs e) => {
|
||||
received = e.arg;
|
||||
received = e.arg as List<string>;
|
||||
};
|
||||
|
||||
obj.EmitEventWithArray(sent);
|
||||
|
@ -246,7 +247,6 @@ class TestEoEvents
|
|||
Test.AssertEquals(pair.Sent, pair.Received);
|
||||
}
|
||||
sent.Dispose();
|
||||
received.Dispose();
|
||||
obj.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Eina;
|
||||
using static EinaTestData.BaseData;
|
||||
|
@ -139,21 +140,21 @@ internal class StructHelpers
|
|||
var complex = new Dummy.StructComplex();
|
||||
|
||||
complex.Farray = new Eina.Array<string>();
|
||||
complex.Farray.Push("0x0");
|
||||
complex.Farray.Push("0x2A");
|
||||
complex.Farray.Push("0x42");
|
||||
complex.Farray.Add("0x0");
|
||||
complex.Farray.Add("0x2A");
|
||||
complex.Farray.Add("0x42");
|
||||
|
||||
complex.Flist = new Eina.List<string>();
|
||||
complex.Flist.Append("0x0");
|
||||
complex.Flist.Append("0x2A");
|
||||
complex.Flist.Append("0x42");
|
||||
complex.Flist.Add("0x0");
|
||||
complex.Flist.Add("0x2A");
|
||||
complex.Flist.Add("0x42");
|
||||
|
||||
complex.Fhash = new Eina.Hash<string, string>();
|
||||
complex.Fhash["aa"] = "aaa";
|
||||
complex.Fhash["bb"] = "bbb";
|
||||
complex.Fhash["cc"] = "ccc";
|
||||
|
||||
complex.Fiterator = complex.Farray.GetIterator();
|
||||
complex.Fiterator = ((Eina.Array<string>)complex.Farray).GetIterator();
|
||||
|
||||
complex.Fany_value = new Eina.Value(Eina.ValueType.Double);
|
||||
complex.Fany_value.Set(-9007199254740992.0);
|
||||
|
|
Loading…
Reference in New Issue