forked from enlightenment/efl
csharp: Disposing IDisposable objects.
Summary: ref T8423 Reviewers: lauromoura, felipealmeida, YOhoho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8423 Differential Revision: https://phab.enlightenment.org/D10644
This commit is contained in:
parent
37b55172b0
commit
cd113d7aae
|
@ -29,7 +29,10 @@ internal class ModelHelper
|
||||||
var properties = typeof(T).GetProperties();
|
var properties = typeof(T).GetProperties();
|
||||||
foreach (var prop in properties)
|
foreach (var prop in properties)
|
||||||
{
|
{
|
||||||
child.SetProperty(prop.Name, ValueFromProperty(o, prop));
|
using (var tmp = ValueFromProperty(o, prop))
|
||||||
|
{
|
||||||
|
child.SetProperty(prop.Name, tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ class TestIntDirections
|
||||||
t.IntOut(original, out received);
|
t.IntOut(original, out received);
|
||||||
|
|
||||||
Test.AssertEquals(-original, received);
|
Test.AssertEquals(-original, received);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,6 +28,7 @@ class TestEo
|
||||||
var testing = new Dummy.TestObject();
|
var testing = new Dummy.TestObject();
|
||||||
var o1 = testing.ReturnNullObject();
|
var o1 = testing.ReturnNullObject();
|
||||||
Test.Assert(o1 == null);
|
Test.Assert(o1 == null);
|
||||||
|
testing.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -42,6 +43,7 @@ class TestEo
|
||||||
var o2 = o1.ReturnObject();
|
var o2 = o1.ReturnObject();
|
||||||
Test.Assert(o2.NativeHandle != IntPtr.Zero);
|
Test.Assert(o2.NativeHandle != IntPtr.Zero);
|
||||||
Test.Assert(o2.NativeHandle == o1.NativeHandle);
|
Test.Assert(o2.NativeHandle == o1.NativeHandle);
|
||||||
|
testing.Dispose();
|
||||||
}
|
}
|
||||||
/* Commented out as adding the event listener seems to prevent it from being GC'd.
|
/* Commented out as adding the event listener seems to prevent it from being GC'd.
|
||||||
public static void destructor_really_frees()
|
public static void destructor_really_frees()
|
||||||
|
@ -121,12 +123,12 @@ class TestEoInherit
|
||||||
{
|
{
|
||||||
Efl.Object loop = new MyObject();
|
Efl.Object loop = new MyObject();
|
||||||
Test.Assert(loop.NativeHandle != System.IntPtr.Zero);
|
Test.Assert(loop.NativeHandle != System.IntPtr.Zero);
|
||||||
|
loop.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WeakReference CreateCollectableInherited()
|
private static WeakReference CreateCollectableInherited()
|
||||||
{
|
{
|
||||||
var obj = new MyObject();
|
return new WeakReference(new MyObject());
|
||||||
return new WeakReference(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void inherited_collected()
|
public static void inherited_collected()
|
||||||
|
@ -147,6 +149,7 @@ class TestEoNames
|
||||||
string name = "Dummy";
|
string name = "Dummy";
|
||||||
obj.SetName(name);
|
obj.SetName(name);
|
||||||
Test.AssertEquals(name, obj.GetName());
|
Test.AssertEquals(name, obj.GetName());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +164,8 @@ class TestEoParent
|
||||||
|
|
||||||
var parent_retrieved = child.GetParent() as Dummy.TestObject;
|
var parent_retrieved = child.GetParent() as Dummy.TestObject;
|
||||||
Test.AssertEquals(parent, parent_retrieved);
|
Test.AssertEquals(parent, parent_retrieved);
|
||||||
|
child.Dispose();
|
||||||
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void parent_inherited_class()
|
public static void parent_inherited_class()
|
||||||
|
@ -172,6 +177,8 @@ class TestEoParent
|
||||||
|
|
||||||
Dummy.Numberwrapper parent_retrieved = child.GetParent() as Dummy.Numberwrapper;
|
Dummy.Numberwrapper parent_retrieved = child.GetParent() as Dummy.Numberwrapper;
|
||||||
Test.AssertEquals(parent, parent_retrieved);
|
Test.AssertEquals(parent, parent_retrieved);
|
||||||
|
child.Dispose();
|
||||||
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Derived : Dummy.TestObject
|
private class Derived : Dummy.TestObject
|
||||||
|
@ -190,6 +197,8 @@ class TestEoParent
|
||||||
|
|
||||||
var parent_from_cast = child.GetParent() as Derived;
|
var parent_from_cast = child.GetParent() as Derived;
|
||||||
Test.AssertEquals(parent, parent_from_cast);
|
Test.AssertEquals(parent, parent_from_cast);
|
||||||
|
child.Dispose();
|
||||||
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +231,7 @@ class TestTypedefs
|
||||||
|
|
||||||
Test.AssertEquals((Dummy.MyInt)ret, input);
|
Test.AssertEquals((Dummy.MyInt)ret, input);
|
||||||
Test.AssertEquals(receiver, input);
|
Test.AssertEquals(receiver, input);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +271,8 @@ class TestEoAccessors
|
||||||
{
|
{
|
||||||
Test.AssertEquals(pair.Item1, pair.Item2);
|
Test.AssertEquals(pair.Item1, pair.Item2);
|
||||||
}
|
}
|
||||||
|
lst.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +293,7 @@ class TestEoFinalize
|
||||||
{
|
{
|
||||||
Inherit inherit = new Inherit();
|
Inherit inherit = new Inherit();
|
||||||
Test.Assert(inherit.finalizeCalled);
|
Test.Assert(inherit.finalizeCalled);
|
||||||
|
inherit.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,8 +327,11 @@ class TestEoMultipleChildClasses
|
||||||
SecondChild obj2 = new SecondChild();
|
SecondChild obj2 = new SecondChild();
|
||||||
Test.AssertEquals(2, obj2.receivedValue);
|
Test.AssertEquals(2, obj2.receivedValue);
|
||||||
|
|
||||||
|
obj.Dispose();
|
||||||
obj = new FirstChild();
|
obj = new FirstChild();
|
||||||
Test.AssertEquals(1, obj.receivedValue);
|
Test.AssertEquals(1, obj.receivedValue);
|
||||||
|
obj2.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,12 +344,14 @@ class TestCsharpProperties
|
||||||
obj.Name = name;
|
obj.Name = name;
|
||||||
|
|
||||||
Test.AssertEquals(name, obj.Name);
|
Test.AssertEquals(name, obj.Name);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_getter_only()
|
public static void test_getter_only()
|
||||||
{
|
{
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Test.Assert(!obj.Invalidating);
|
Test.Assert(!obj.Invalidating);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_setter_only()
|
public static void test_setter_only()
|
||||||
|
@ -344,6 +361,7 @@ class TestCsharpProperties
|
||||||
|
|
||||||
obj.SetterOnly = val;
|
obj.SetterOnly = val;
|
||||||
Test.AssertEquals(val, obj.GetSetterOnly());
|
Test.AssertEquals(val, obj.GetSetterOnly());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_class_property()
|
public static void test_class_property()
|
||||||
|
@ -359,6 +377,7 @@ class TestCsharpProperties
|
||||||
Dummy.ITestIface iface = new Dummy.TestObject();
|
Dummy.ITestIface iface = new Dummy.TestObject();
|
||||||
iface.IfaceProp = val;
|
iface.IfaceProp = val;
|
||||||
Test.AssertEquals(val, iface.IfaceProp);
|
Test.AssertEquals(val, iface.IfaceProp);
|
||||||
|
iface.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_csharp_multi_valued_prop()
|
public static void test_csharp_multi_valued_prop()
|
||||||
|
@ -367,6 +386,7 @@ class TestCsharpProperties
|
||||||
obj.MultiValuedProp = (1, 2);
|
obj.MultiValuedProp = (1, 2);
|
||||||
var ret = obj.MultiValuedProp;
|
var ret = obj.MultiValuedProp;
|
||||||
Test.AssertEquals(ret, (1, 2));
|
Test.AssertEquals(ret, (1, 2));
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +406,7 @@ class TestEoGrandChildrenFinalize
|
||||||
{
|
{
|
||||||
Child obj = new Child();
|
Child obj = new Child();
|
||||||
Test.AssertEquals(42, obj.receivedValue);
|
Test.AssertEquals(42, obj.receivedValue);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class GrandChild : Dummy.Child
|
public sealed class GrandChild : Dummy.Child
|
||||||
|
@ -409,6 +430,7 @@ class TestEoGrandChildrenFinalize
|
||||||
{
|
{
|
||||||
GrandChild obj = new GrandChild();
|
GrandChild obj = new GrandChild();
|
||||||
Test.AssertEquals(-42, obj.receivedValue);
|
Test.AssertEquals(-42, obj.receivedValue);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +451,7 @@ class TestConstructors
|
||||||
var obj = new Dummy.Child(null, a, b, iface_prop);
|
var obj = new Dummy.Child(null, a, b, iface_prop);
|
||||||
#endif
|
#endif
|
||||||
Test.AssertEquals(iface_prop, obj.IfaceProp);
|
Test.AssertEquals(iface_prop, obj.IfaceProp);
|
||||||
|
obj.Dispose();
|
||||||
#if EFL_BETA
|
#if EFL_BETA
|
||||||
obj = new Dummy.Child(parent: null, ifaceProp : iface_prop, doubleParamsA : a, doubleParamsB : b,
|
obj = new Dummy.Child(parent: null, ifaceProp : iface_prop, doubleParamsA : a, doubleParamsB : b,
|
||||||
obligatoryBetaCtor : beta,
|
obligatoryBetaCtor : beta,
|
||||||
|
@ -443,6 +465,7 @@ class TestConstructors
|
||||||
Test.Assert(obj.ObligatoryBetaCtorWasCalled);
|
Test.Assert(obj.ObligatoryBetaCtorWasCalled);
|
||||||
Test.Assert(obj.OptionalBetaCtorWasCalled);
|
Test.Assert(obj.OptionalBetaCtorWasCalled);
|
||||||
#endif
|
#endif
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_optional_constructor()
|
public static void test_optional_constructor()
|
||||||
|
@ -457,6 +480,7 @@ class TestConstructors
|
||||||
var obj = new Dummy.Child(null, a, b);
|
var obj = new Dummy.Child(null, a, b);
|
||||||
#endif
|
#endif
|
||||||
Test.Assert(!obj.GetIfaceWasSet());
|
Test.Assert(!obj.GetIfaceWasSet());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,6 +494,7 @@ class TestInterfaceConcrete
|
||||||
|
|
||||||
iface.IfaceProp = 1970;
|
iface.IfaceProp = 1970;
|
||||||
Test.AssertEquals(iface.IfaceProp, 1970);
|
Test.AssertEquals(iface.IfaceProp, 1970);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,6 +507,7 @@ class TestProvider
|
||||||
Dummy.Numberwrapper provider = obj.FindProvider(typeof(Dummy.Numberwrapper)) as Dummy.Numberwrapper;
|
Dummy.Numberwrapper provider = obj.FindProvider(typeof(Dummy.Numberwrapper)) as Dummy.Numberwrapper;
|
||||||
Test.AssertEquals(provider.GetType(), typeof(Dummy.Numberwrapper));
|
Test.AssertEquals(provider.GetType(), typeof(Dummy.Numberwrapper));
|
||||||
Test.AssertEquals(provider.GetNumber(), 1999);
|
Test.AssertEquals(provider.GetNumber(), 1999);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProviderHolder : Dummy.TestObject
|
private class ProviderHolder : Dummy.TestObject
|
||||||
|
@ -526,7 +552,7 @@ class TestProvider
|
||||||
provider = obj.CallFindProviderForIface();
|
provider = obj.CallFindProviderForIface();
|
||||||
Test.AssertNotNull(provider, msg : "Provider of ITestIFace must not be null");
|
Test.AssertNotNull(provider, msg : "Provider of ITestIFace must not be null");
|
||||||
Test.AssertEquals(provider.Name, obj.ProviderName, "Provider name does not match expected");
|
Test.AssertEquals(provider.Name, obj.ProviderName, "Provider name does not match expected");
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,6 +568,7 @@ class TestObjectDeletion
|
||||||
part.Del();
|
part.Del();
|
||||||
|
|
||||||
Test.AssertNull(obj.OnePart);
|
Test.AssertNull(obj.OnePart);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,12 +591,14 @@ class TestProtectedInterfaceMembers
|
||||||
{
|
{
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Test.AssertEquals(obj.CallMethodProtected(42), -42);
|
Test.AssertEquals(obj.CallMethodProtected(42), -42);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_protected_interface_in_inherited_class_called_from_c()
|
public static void test_protected_interface_in_inherited_class_called_from_c()
|
||||||
{
|
{
|
||||||
var obj = new MyObject();
|
var obj = new MyObject();
|
||||||
Test.AssertEquals(obj.CallMethodProtected(42), 42 * 42);
|
Test.AssertEquals(obj.CallMethodProtected(42), 42 * 42);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_interface_skipped_protected()
|
public static void test_interface_skipped_protected()
|
||||||
|
@ -640,6 +669,7 @@ class TestHiddenClasses
|
||||||
var hidden = obj.HiddenObject;
|
var hidden = obj.HiddenObject;
|
||||||
|
|
||||||
Test.AssertEquals(hidden.Name, "hidden_object");
|
Test.AssertEquals(hidden.Name, "hidden_object");
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ class TestEoPromises
|
||||||
loop.Iterate();
|
loop.Iterate();
|
||||||
Test.Assert(callbackCalled, "Future callback must have been called.");
|
Test.Assert(callbackCalled, "Future callback must have been called.");
|
||||||
Test.AssertEquals(receivedValue, sentValue);
|
Test.AssertEquals(receivedValue, sentValue);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_object_promise_cancel()
|
public static void test_object_promise_cancel()
|
||||||
|
@ -97,6 +98,7 @@ class TestEoPromises
|
||||||
loop.Iterate();
|
loop.Iterate();
|
||||||
Test.Assert(callbackCalled, "Future callback must have been called.");
|
Test.Assert(callbackCalled, "Future callback must have been called.");
|
||||||
Test.AssertEquals(receivedError, sentError);
|
Test.AssertEquals(receivedError, sentError);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -144,6 +146,7 @@ class TestEoAsyncMethods
|
||||||
int receivedValue;
|
int receivedValue;
|
||||||
v.Get(out receivedValue);
|
v.Get(out receivedValue);
|
||||||
Test.AssertEquals(receivedValue, sentValue);
|
Test.AssertEquals(receivedValue, sentValue);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_async_cancel()
|
public static void test_async_cancel()
|
||||||
|
@ -173,6 +176,8 @@ class TestEoAsyncMethods
|
||||||
}
|
}
|
||||||
|
|
||||||
Test.Assert(raised, "AggregateException must have been raised.");
|
Test.Assert(raised, "AggregateException must have been raised.");
|
||||||
|
cancelSrc.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_async_reject()
|
public static void test_async_reject()
|
||||||
|
@ -205,6 +210,7 @@ class TestEoAsyncMethods
|
||||||
}
|
}
|
||||||
|
|
||||||
Test.Assert(raised, "AggregateException must have been raised.");
|
Test.Assert(raised, "AggregateException must have been raised.");
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ class TestEolianError
|
||||||
var obj = new Overrider();
|
var obj = new Overrider();
|
||||||
|
|
||||||
Test.AssertRaises<Efl.EflException>(obj.CallChildrenRaiseError);
|
Test.AssertRaises<Efl.EflException>(obj.CallChildrenRaiseError);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// return eina_error
|
// return eina_error
|
||||||
|
@ -70,6 +71,7 @@ class TestEolianError
|
||||||
error = obj.ReturnsError();
|
error = obj.ReturnsError();
|
||||||
|
|
||||||
Test.AssertEquals(expected, error);
|
Test.AssertEquals(expected, error);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReturnOverride : Dummy.TestObject {
|
class ReturnOverride : Dummy.TestObject {
|
||||||
|
@ -97,6 +99,7 @@ class TestEolianError
|
||||||
error = obj.ReturnsError();
|
error = obj.ReturnsError();
|
||||||
|
|
||||||
Test.AssertEquals(new Eina.Error(expected * 2), error);
|
Test.AssertEquals(new Eina.Error(expected * 2), error);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// events
|
// events
|
||||||
|
@ -114,11 +117,13 @@ class TestEolianError
|
||||||
// An event whose managed delegate generates an exception
|
// An event whose managed delegate generates an exception
|
||||||
// must set an eina_error so it can be reported back to
|
// must set an eina_error so it can be reported back to
|
||||||
// the managed code
|
// the managed code
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Listener listener = new Listener();
|
Listener listener = new Listener();
|
||||||
obj.EvtWithIntEvent += listener.callback;
|
obj.EvtWithIntEvent += listener.callback;
|
||||||
|
|
||||||
Test.AssertRaises<Efl.EflException>(() => { obj.EmitEventWithInt(2); });
|
Test.AssertRaises<Efl.EflException>(() =>
|
||||||
|
{ obj.EmitEventWithInt(2); });
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ class TestEoEvents
|
||||||
Eina.Value v = new Eina.Value(Eina.ValueType.Int32);
|
Eina.Value v = new Eina.Value(Eina.ValueType.Int32);
|
||||||
v.Set(0);
|
v.Set(0);
|
||||||
loop.Quit(v);
|
loop.Quit(v);
|
||||||
|
v.Dispose();
|
||||||
}
|
}
|
||||||
protected void another_callback(object sender, EventArgs e) { }
|
protected void another_callback(object sender, EventArgs e) { }
|
||||||
|
|
||||||
|
@ -70,6 +71,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithString("Some args");
|
obj.EmitEventWithString("Some args");
|
||||||
|
|
||||||
Test.AssertEquals("Some args", received_string);
|
Test.AssertEquals("Some args", received_string);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_int_payload()
|
public static void event_with_int_payload()
|
||||||
|
@ -84,6 +86,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithInt(-1984);
|
obj.EmitEventWithInt(-1984);
|
||||||
|
|
||||||
Test.AssertEquals(-1984, received_int);
|
Test.AssertEquals(-1984, received_int);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_bool_payload()
|
public static void event_with_bool_payload()
|
||||||
|
@ -102,6 +105,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithBool(false);
|
obj.EmitEventWithBool(false);
|
||||||
|
|
||||||
Test.AssertEquals(false, received_bool);
|
Test.AssertEquals(false, received_bool);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_uint_payload()
|
public static void event_with_uint_payload()
|
||||||
|
@ -115,6 +119,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithUint(0xbeef);
|
obj.EmitEventWithUint(0xbeef);
|
||||||
|
|
||||||
Test.AssertEquals<uint>(0xbeef, received_uint);
|
Test.AssertEquals<uint>(0xbeef, received_uint);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_float_payload()
|
public static void event_with_float_payload()
|
||||||
|
@ -128,6 +133,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithFloat(3.14f);
|
obj.EmitEventWithFloat(3.14f);
|
||||||
|
|
||||||
Test.AssertAlmostEquals(3.14f, received_float);
|
Test.AssertAlmostEquals(3.14f, received_float);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_double_payload()
|
public static void event_with_double_payload()
|
||||||
|
@ -142,6 +148,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithDouble(reference);
|
obj.EmitEventWithDouble(reference);
|
||||||
|
|
||||||
Test.AssertAlmostEquals(reference, received_double);
|
Test.AssertAlmostEquals(reference, received_double);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_object_payload()
|
public static void event_with_object_payload()
|
||||||
|
@ -158,6 +165,8 @@ class TestEoEvents
|
||||||
obj.EmitEventWithObj(sent_obj);
|
obj.EmitEventWithObj(sent_obj);
|
||||||
|
|
||||||
Test.AssertEquals(sent_obj, received_obj);
|
Test.AssertEquals(sent_obj, received_obj);
|
||||||
|
sent_obj.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_error_payload()
|
public static void event_with_error_payload()
|
||||||
|
@ -174,6 +183,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithError(sent_error);
|
obj.EmitEventWithError(sent_error);
|
||||||
|
|
||||||
Test.AssertEquals(sent_error, received_error);
|
Test.AssertEquals(sent_error, received_error);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void event_with_struct_payload()
|
public static void event_with_struct_payload()
|
||||||
|
@ -191,6 +201,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithStruct(sent_struct);
|
obj.EmitEventWithStruct(sent_struct);
|
||||||
|
|
||||||
Test.AssertEquals(sent_struct.Fstring, received_struct.Fstring);
|
Test.AssertEquals(sent_struct.Fstring, received_struct.Fstring);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFL_BETA
|
#if EFL_BETA
|
||||||
|
@ -208,6 +219,7 @@ class TestEoEvents
|
||||||
obj.EmitEventWithStructComplex(sent_struct);
|
obj.EmitEventWithStructComplex(sent_struct);
|
||||||
|
|
||||||
Test.AssertEquals(sent_struct.Fobj, received_struct.Fobj);
|
Test.AssertEquals(sent_struct.Fobj, received_struct.Fobj);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -230,7 +242,12 @@ class TestEoEvents
|
||||||
Test.AssertEquals(sent.Length, received.Length);
|
Test.AssertEquals(sent.Length, received.Length);
|
||||||
var pairs = sent.Zip(received, (string sentItem, string receivedItem) => new { Sent = sentItem, Received = receivedItem } );
|
var pairs = sent.Zip(received, (string sentItem, string receivedItem) => new { Sent = sentItem, Received = receivedItem } );
|
||||||
foreach (var pair in pairs)
|
foreach (var pair in pairs)
|
||||||
|
{
|
||||||
Test.AssertEquals(pair.Sent, pair.Received);
|
Test.AssertEquals(pair.Sent, pair.Received);
|
||||||
|
}
|
||||||
|
sent.Dispose();
|
||||||
|
received.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +270,7 @@ class TestEventAddRemove
|
||||||
obj.EvtWithIntEvent -= evtCb;
|
obj.EvtWithIntEvent -= evtCb;
|
||||||
obj.EmitEventWithInt(42);
|
obj.EmitEventWithInt(42);
|
||||||
Test.Assert(!called);
|
Test.Assert(!called);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,6 +288,7 @@ class TestInterfaceEvents
|
||||||
obj.NonconflictedEvent += cb;
|
obj.NonconflictedEvent += cb;
|
||||||
obj.EmitNonconflicted();
|
obj.EmitNonconflicted();
|
||||||
Test.Assert(called);
|
Test.Assert(called);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +309,7 @@ class TestEventNaming
|
||||||
obj.EmitEventWithUnder();
|
obj.EmitEventWithUnder();
|
||||||
|
|
||||||
Test.Assert(test_called);
|
Test.Assert(test_called);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +361,7 @@ class TestEventWithDeadWrappers
|
||||||
Test.CollectAndIterate();
|
Test.CollectAndIterate();
|
||||||
|
|
||||||
Test.AssertNull(wref.Target);
|
Test.AssertNull(wref.Target);
|
||||||
|
manager.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,9 @@ class TestFunctionPointerMarshalling
|
||||||
|
|
||||||
Test.Assert(called, "Callback was not called");
|
Test.Assert(called, "Callback was not called");
|
||||||
Test.AssertEquals(reference, buf.Steal());
|
Test.AssertEquals(reference, buf.Steal());
|
||||||
|
v.Dispose();
|
||||||
|
buf.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ class TestFunctionPointers
|
||||||
|
|
||||||
Test.Assert(called, "call_callback must call a callback");
|
Test.Assert(called, "call_callback must call a callback");
|
||||||
Test.AssertEquals(42 * 2, x);
|
Test.AssertEquals(42 * 2, x);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set_callback_with_lambda()
|
public static void set_callback_with_lambda()
|
||||||
|
@ -71,6 +72,7 @@ class TestFunctionPointers
|
||||||
|
|
||||||
Test.Assert(called, "call_callback must call a callback");
|
Test.Assert(called, "call_callback must call a callback");
|
||||||
Test.AssertEquals(37 + 4, x);
|
Test.AssertEquals(37 + 4, x);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void replace_callback()
|
public static void replace_callback()
|
||||||
|
@ -96,6 +98,7 @@ class TestFunctionPointers
|
||||||
x = obj.CallCallback(42);
|
x = obj.CallCallback(42);
|
||||||
Test.Assert(new_called, "call_callback must call a callback");
|
Test.Assert(new_called, "call_callback must call a callback");
|
||||||
Test.AssertEquals(42 * 42, x);
|
Test.AssertEquals(42 * 42, x);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoOverride : Dummy.TestObject {
|
class NoOverride : Dummy.TestObject {
|
||||||
|
@ -112,6 +115,7 @@ class TestFunctionPointers
|
||||||
|
|
||||||
Test.Assert(called, "call_callback must call a callback");
|
Test.Assert(called, "call_callback must call a callback");
|
||||||
Test.AssertEquals(42 * 3, x);
|
Test.AssertEquals(42 * 3, x);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithOverride : Dummy.TestObject {
|
class WithOverride : Dummy.TestObject {
|
||||||
|
@ -151,6 +155,7 @@ class TestFunctionPointers
|
||||||
|
|
||||||
Test.Assert(called, "call_callback must call a callback");
|
Test.Assert(called, "call_callback must call a callback");
|
||||||
Test.AssertEquals(42 * 3, x);
|
Test.AssertEquals(42 * 3, x);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are needed due to issues calling methods on obj from the GC thread (where the
|
// These are needed due to issues calling methods on obj from the GC thread (where the
|
||||||
|
@ -202,7 +207,7 @@ class TestFunctionPointers
|
||||||
|
|
||||||
Test.Assert(called, "call_callback must call a callback");
|
Test.Assert(called, "call_callback must call a callback");
|
||||||
Test.AssertEquals(42 * 2, x);
|
Test.AssertEquals(42 * 2, x);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ class TestHash
|
||||||
Test.AssertEquals(hash.Count, 2);
|
Test.AssertEquals(hash.Count, 2);
|
||||||
|
|
||||||
Test.Assert(!hash.DelByValue(200));
|
Test.Assert(!hash.DelByValue(200));
|
||||||
|
hash.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_del_value_string()
|
public static void test_del_value_string()
|
||||||
|
@ -39,6 +40,7 @@ class TestHash
|
||||||
Test.AssertEquals(hash.Count, 2);
|
Test.AssertEquals(hash.Count, 2);
|
||||||
|
|
||||||
Test.Assert(!hash.DelByValue("Elementary"));
|
Test.Assert(!hash.DelByValue("Elementary"));
|
||||||
|
hash.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_del_key()
|
public static void test_del_key()
|
||||||
|
@ -50,6 +52,7 @@ class TestHash
|
||||||
|
|
||||||
hash.DelByKey(1);
|
hash.DelByKey(1);
|
||||||
Test.AssertEquals(hash.Count, 2);
|
Test.AssertEquals(hash.Count, 2);
|
||||||
|
hash.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace TestSuite
|
} // namespace TestSuite
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TestInheritance
|
||||||
return "Hello World";
|
return "Hello World";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Inherit3Parent : Dummy.TestObject
|
internal class Inherit3Parent : Dummy.TestObject
|
||||||
{
|
{
|
||||||
public bool disposed = false;
|
public bool disposed = false;
|
||||||
|
@ -95,6 +95,7 @@ class TestInheritance
|
||||||
var obj = new Inherit1();
|
var obj = new Inherit1();
|
||||||
int i = Dummy.InheritHelper.ReceiveDummyAndCallIntOut(obj);
|
int i = Dummy.InheritHelper.ReceiveDummyAndCallIntOut(obj);
|
||||||
Test.AssertEquals (50, i);
|
Test.AssertEquals (50, i);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_inherit_from_iface()
|
public static void test_inherit_from_iface()
|
||||||
|
@ -104,6 +105,7 @@ class TestInheritance
|
||||||
Test.AssertEquals (50, i);
|
Test.AssertEquals (50, i);
|
||||||
string s = Dummy.InheritHelper.ReceiveDummyAndCallInStringshare(obj);
|
string s = Dummy.InheritHelper.ReceiveDummyAndCallInStringshare(obj);
|
||||||
Test.AssertEquals ("Hello World", s);
|
Test.AssertEquals ("Hello World", s);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateAndCheckInheritedObjects(out WeakReference parentWRef, out WeakReference childWRef)
|
private static void CreateAndCheckInheritedObjects(out WeakReference parentWRef, out WeakReference childWRef)
|
||||||
|
@ -127,8 +129,8 @@ class TestInheritance
|
||||||
Test.AssertEquals(false, parent.disposed);
|
Test.AssertEquals(false, parent.disposed);
|
||||||
Test.AssertEquals(false, parent.childDisposed);
|
Test.AssertEquals(false, parent.childDisposed);
|
||||||
|
|
||||||
parent = null;
|
child.Dispose();
|
||||||
child = null;
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_inherit_lifetime()
|
public static void test_inherit_lifetime()
|
||||||
|
|
|
@ -32,7 +32,8 @@ public static class TestModel {
|
||||||
{
|
{
|
||||||
Efl.Loop loop = Efl.App.AppMain;
|
Efl.Loop loop = Efl.App.AppMain;
|
||||||
|
|
||||||
CreateModel(loop);
|
var model = CreateModel(loop);
|
||||||
|
model.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async Task EasyModelExtractionAsync (Efl.Loop loop)
|
internal static async Task EasyModelExtractionAsync (Efl.Loop loop)
|
||||||
|
@ -49,6 +50,8 @@ public static class TestModel {
|
||||||
Test.AssertEquals(r.Name, "Tomato");
|
Test.AssertEquals(r.Name, "Tomato");
|
||||||
|
|
||||||
loop.End();
|
loop.End();
|
||||||
|
model.Dispose();
|
||||||
|
veggies.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void easy_model_extraction ()
|
public static void easy_model_extraction ()
|
||||||
|
@ -77,6 +80,8 @@ public static class TestModel {
|
||||||
|
|
||||||
Test.Assert(callbackCalled, "Property bound callback must have been called.");
|
Test.Assert(callbackCalled, "Property bound callback must have been called.");
|
||||||
Test.AssertEquals(propertyBound, "style");
|
Test.AssertEquals(propertyBound, "style");
|
||||||
|
factory.Dispose();
|
||||||
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public static class TestParts
|
||||||
{
|
{
|
||||||
var t = new Dummy.PartHolder();
|
var t = new Dummy.PartHolder();
|
||||||
do_part_test(t);
|
do_part_test(t);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Child : Dummy.PartHolder
|
private class Child : Dummy.PartHolder
|
||||||
|
@ -41,6 +42,7 @@ public static class TestParts
|
||||||
public static void inherited_part_test() {
|
public static void inherited_part_test() {
|
||||||
var t = new Child();
|
var t = new Child();
|
||||||
do_part_test(t);
|
do_part_test(t);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void do_part_test(Dummy.PartHolder t)
|
private static void do_part_test(Dummy.PartHolder t)
|
||||||
|
@ -66,6 +68,8 @@ public static class TestMVVMParts
|
||||||
var error = bindablePart.Markup().Bind("name");
|
var error = bindablePart.Markup().Bind("name");
|
||||||
|
|
||||||
Test.AssertEquals(error, Eina.Error.NO_ERROR);
|
Test.AssertEquals(error, Eina.Error.NO_ERROR);
|
||||||
|
factory.Dispose();
|
||||||
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mvvm_factory_properties()
|
public static void mvvm_factory_properties()
|
||||||
|
@ -78,6 +82,9 @@ public static class TestMVVMParts
|
||||||
var error = factory.IconPart().BindFactory(iconFactory);
|
var error = factory.IconPart().BindFactory(iconFactory);
|
||||||
|
|
||||||
Test.AssertEquals(error, Eina.Error.NO_ERROR);
|
Test.AssertEquals(error, Eina.Error.NO_ERROR);
|
||||||
|
iconFactory.Dispose();
|
||||||
|
factory.Dispose();
|
||||||
|
parent.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +99,7 @@ public static class TestNamedParts
|
||||||
Test.AssertEquals("part_one", p1.GetName());
|
Test.AssertEquals("part_one", p1.GetName());
|
||||||
Test.Assert(p2 is Dummy.TestObject);
|
Test.Assert(p2 is Dummy.TestObject);
|
||||||
Test.AssertEquals("part_two", p2.GetName());
|
Test.AssertEquals("part_two", p2.GetName());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class TestPromises
|
||||||
Test.Assert(cleanCalled, "Promise clean callback should have been called.");
|
Test.Assert(cleanCalled, "Promise clean callback should have been called.");
|
||||||
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
||||||
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_simple_resolve()
|
public static void test_simple_resolve()
|
||||||
|
@ -55,6 +56,8 @@ class TestPromises
|
||||||
|
|
||||||
Test.Assert(callbackCalled, "Future callback should have been called.");
|
Test.Assert(callbackCalled, "Future callback should have been called.");
|
||||||
Test.AssertEquals(received_value, reference_value);
|
Test.AssertEquals(received_value, reference_value);
|
||||||
|
reference_value.Dispose();
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_simple_with_object()
|
public static void test_simple_with_object()
|
||||||
|
@ -74,12 +77,16 @@ class TestPromises
|
||||||
|
|
||||||
Eina.Value referenceValue = new Eina.Value(Eina.ValueType.Array, Eina.ValueType.Int32);
|
Eina.Value referenceValue = new Eina.Value(Eina.ValueType.Array, Eina.ValueType.Int32);
|
||||||
referenceValue.Append(32);
|
referenceValue.Append(32);
|
||||||
promise.Resolve(new Eina.Value(referenceValue));
|
var tmp = new Eina.Value(referenceValue);
|
||||||
|
promise.Resolve(tmp);
|
||||||
|
|
||||||
loop.Iterate();
|
loop.Iterate();
|
||||||
|
|
||||||
Test.Assert(callbackCalled, "Future callback should have been called.");
|
Test.Assert(callbackCalled, "Future callback should have been called.");
|
||||||
Test.AssertEquals(receivedValue, referenceValue);
|
Test.AssertEquals(receivedValue, referenceValue);
|
||||||
|
tmp.Dispose();
|
||||||
|
referenceValue.Dispose();
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_simple_reject()
|
public static void test_simple_reject()
|
||||||
|
@ -106,6 +113,7 @@ class TestPromises
|
||||||
|
|
||||||
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
||||||
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_simple_future_cancel()
|
public static void test_simple_future_cancel()
|
||||||
|
@ -128,6 +136,7 @@ class TestPromises
|
||||||
Test.Assert(promiseCallbackCalled, "Promise cancel callback should have been called.");
|
Test.Assert(promiseCallbackCalled, "Promise cancel callback should have been called.");
|
||||||
Test.Assert(callbackCalled, "Future callback should have been called.");
|
Test.Assert(callbackCalled, "Future callback should have been called.");
|
||||||
Test.AssertEquals(received_error, Eina.Error.ECANCELED);
|
Test.AssertEquals(received_error, Eina.Error.ECANCELED);
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,6 +181,8 @@ class TestPromises
|
||||||
|
|
||||||
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
||||||
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
||||||
|
reference_value.Dispose();
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_then_chain_array()
|
public static void test_then_chain_array()
|
||||||
|
@ -217,6 +228,8 @@ class TestPromises
|
||||||
|
|
||||||
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
||||||
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
||||||
|
reference_value.Dispose();
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_cancel_after_resolve()
|
public static void test_cancel_after_resolve()
|
||||||
|
@ -244,6 +257,7 @@ class TestPromises
|
||||||
|
|
||||||
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
Test.AssertRaises<ObjectDisposedException>(() => { promise.Resolve(null); });
|
||||||
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
Test.AssertRaises<ObjectDisposedException>(future.Cancel);
|
||||||
|
promise.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_constructor_with_callback()
|
public static void test_constructor_with_callback()
|
||||||
|
@ -270,6 +284,9 @@ class TestPromises
|
||||||
|
|
||||||
Test.Assert(callbackCalled, "Future callback should have been called.");
|
Test.Assert(callbackCalled, "Future callback should have been called.");
|
||||||
Test.AssertEquals(received_value, reference_value);
|
Test.AssertEquals(received_value, reference_value);
|
||||||
|
promise.Dispose();
|
||||||
|
loop.Dispose();
|
||||||
|
reference_value.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_reject_on_disposal()
|
public static void test_reject_on_disposal()
|
||||||
|
|
|
@ -29,6 +29,7 @@ class TestStrBuf
|
||||||
|
|
||||||
Test.AssertEquals("Here's Jonnny!".Length, buf.Length);
|
Test.AssertEquals("Here's Jonnny!".Length, buf.Length);
|
||||||
Test.AssertEquals("Here's Johnny!", buf.Steal());
|
Test.AssertEquals("Here's Johnny!", buf.Steal());
|
||||||
|
buf.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_tostring()
|
public static void test_tostring()
|
||||||
|
@ -39,6 +40,7 @@ class TestStrBuf
|
||||||
buf.Append("World!");
|
buf.Append("World!");
|
||||||
|
|
||||||
Test.AssertEquals("Hello World!", buf.ToString());
|
Test.AssertEquals("Hello World!", buf.ToString());
|
||||||
|
buf.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test_eolian()
|
public static void test_eolian()
|
||||||
|
@ -50,6 +52,8 @@ class TestStrBuf
|
||||||
obj.AppendToStrbuf(buf, " to buf");
|
obj.AppendToStrbuf(buf, " to buf");
|
||||||
|
|
||||||
Test.AssertEquals("Appended to buf", buf.Steal());
|
Test.AssertEquals("Appended to buf", buf.Steal());
|
||||||
|
buf.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Appender : Dummy.TestObject
|
private class Appender : Dummy.TestObject
|
||||||
|
@ -79,6 +83,8 @@ class TestStrBuf
|
||||||
|
|
||||||
Test.Assert(obj.called);
|
Test.Assert(obj.called);
|
||||||
Test.AssertEquals("Is this virtual?", buf.Steal());
|
Test.AssertEquals("Is this virtual?", buf.Steal());
|
||||||
|
buf.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace TestSuite
|
} // namespace TestSuite
|
||||||
|
|
|
@ -28,6 +28,7 @@ class TestStrings
|
||||||
String sent = "in_string";
|
String sent = "in_string";
|
||||||
String returned = obj.InString(sent);
|
String returned = obj.InString(sent);
|
||||||
Test.AssertEquals(sent, returned);
|
Test.AssertEquals(sent, returned);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -41,6 +42,7 @@ class TestStrings
|
||||||
String sent = "in_own_string";
|
String sent = "in_own_string";
|
||||||
String returned = obj.InOwnString(sent);
|
String returned = obj.InOwnString(sent);
|
||||||
Test.AssertEquals(sent, returned);
|
Test.AssertEquals(sent, returned);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -51,6 +53,7 @@ class TestStrings
|
||||||
{
|
{
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Test.AssertEquals("string", obj.ReturnString());
|
Test.AssertEquals("string", obj.ReturnString());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -61,6 +64,7 @@ class TestStrings
|
||||||
{
|
{
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Test.AssertEquals("own_string", obj.ReturnOwnString());
|
Test.AssertEquals("own_string", obj.ReturnOwnString());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -73,6 +77,7 @@ class TestStrings
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
obj.OutString(out str);
|
obj.OutString(out str);
|
||||||
Test.AssertEquals("out_string", str);
|
Test.AssertEquals("out_string", str);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -86,6 +91,7 @@ class TestStrings
|
||||||
obj.OutOwnString(out str);
|
obj.OutOwnString(out str);
|
||||||
Test.AssertEquals(str.ToString(CultureInfo.CurrentCulture),
|
Test.AssertEquals(str.ToString(CultureInfo.CurrentCulture),
|
||||||
"out_own_string");
|
"out_own_string");
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -143,6 +149,7 @@ class TestStrings
|
||||||
Test.AssertEquals(sent, obj.received_in);
|
Test.AssertEquals(sent, obj.received_in);
|
||||||
/* } */
|
/* } */
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The managed wrapper should take ownership of the in parameter */
|
/* The managed wrapper should take ownership of the in parameter */
|
||||||
|
@ -155,6 +162,7 @@ class TestStrings
|
||||||
Test.AssertEquals(sent, obj.received_in_own);
|
Test.AssertEquals(sent, obj.received_in_own);
|
||||||
/* } */
|
/* } */
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The managed wrapper still owns the returned C string. We need to cache it until
|
/* The managed wrapper still owns the returned C string. We need to cache it until
|
||||||
|
@ -165,6 +173,7 @@ class TestStrings
|
||||||
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
||||||
Test.AssertEquals("inherited", obj.CallReturnString());
|
Test.AssertEquals("inherited", obj.CallReturnString());
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The managed wrapper must surrender the ownership to the C after the virtual call. */
|
/* The managed wrapper must surrender the ownership to the C after the virtual call. */
|
||||||
|
@ -174,6 +183,7 @@ class TestStrings
|
||||||
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
||||||
Test.AssertEquals("own_inherited", obj.CallReturnOwnString());
|
Test.AssertEquals("own_inherited", obj.CallReturnOwnString());
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The managed wrapper still owns the C string after the call. Like return without own, we may
|
/* The managed wrapper still owns the C string after the call. Like return without own, we may
|
||||||
|
@ -184,6 +194,7 @@ class TestStrings
|
||||||
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
||||||
Test.AssertEquals("out_inherited", obj.CallOutString());
|
Test.AssertEquals("out_inherited", obj.CallOutString());
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The managed wrapper gives C the ownership of the filled out parameter */
|
/* The managed wrapper gives C the ownership of the filled out parameter */
|
||||||
|
@ -193,6 +204,7 @@ class TestStrings
|
||||||
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
/* for (int i = 0; i < 10000; i ++) // Uncomment this to check for memory leaks. */
|
||||||
Test.AssertEquals("out_own_inherited", obj.CallOutOwnString());
|
Test.AssertEquals("out_own_inherited", obj.CallOutOwnString());
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -206,6 +218,7 @@ class TestStringshare
|
||||||
String sent = "in_stringshare";
|
String sent = "in_stringshare";
|
||||||
String returned = obj.InStringshare(sent);
|
String returned = obj.InStringshare(sent);
|
||||||
Test.AssertEquals(sent, returned);
|
Test.AssertEquals(sent, returned);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -217,6 +230,7 @@ class TestStringshare
|
||||||
String sent = "in_own_stringshare";
|
String sent = "in_own_stringshare";
|
||||||
String returned = obj.InOwnStringshare(sent);
|
String returned = obj.InOwnStringshare(sent);
|
||||||
Test.AssertEquals(sent, returned);
|
Test.AssertEquals(sent, returned);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -226,6 +240,7 @@ class TestStringshare
|
||||||
{
|
{
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Test.AssertEquals("stringshare", obj.ReturnStringshare());
|
Test.AssertEquals("stringshare", obj.ReturnStringshare());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -235,6 +250,7 @@ class TestStringshare
|
||||||
{
|
{
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
Test.AssertEquals("own_stringshare", obj.ReturnOwnStringshare());
|
Test.AssertEquals("own_stringshare", obj.ReturnOwnStringshare());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -246,6 +262,7 @@ class TestStringshare
|
||||||
var obj = new Dummy.TestObject();
|
var obj = new Dummy.TestObject();
|
||||||
obj.OutStringshare(out str);
|
obj.OutStringshare(out str);
|
||||||
Test.AssertEquals("out_stringshare", str);
|
Test.AssertEquals("out_stringshare", str);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -258,6 +275,7 @@ class TestStringshare
|
||||||
obj.OutOwnStringshare(out str);
|
obj.OutOwnStringshare(out str);
|
||||||
Test.AssertEquals(str.ToString(CultureInfo.CurrentCulture),
|
Test.AssertEquals(str.ToString(CultureInfo.CurrentCulture),
|
||||||
"out_own_stringshare");
|
"out_own_stringshare");
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
System.GC.Collect();
|
System.GC.Collect();
|
||||||
}
|
}
|
||||||
|
@ -310,6 +328,7 @@ class TestStringshare
|
||||||
String sent = "in_inherited";
|
String sent = "in_inherited";
|
||||||
obj.CallInStringshare(sent);
|
obj.CallInStringshare(sent);
|
||||||
Test.AssertEquals(sent, obj.received_in);
|
Test.AssertEquals(sent, obj.received_in);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void in_own_stringshare_from_virtual()
|
public static void in_own_stringshare_from_virtual()
|
||||||
|
@ -318,6 +337,7 @@ class TestStringshare
|
||||||
String sent = "in_own_inherited";
|
String sent = "in_own_inherited";
|
||||||
obj.CallInOwnStringshare(sent);
|
obj.CallInOwnStringshare(sent);
|
||||||
Test.AssertEquals(sent, obj.received_in_own);
|
Test.AssertEquals(sent, obj.received_in_own);
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void return_stringshare_from_virtual()
|
public static void return_stringshare_from_virtual()
|
||||||
|
@ -325,6 +345,7 @@ class TestStringshare
|
||||||
var obj = new StringshareReturner();
|
var obj = new StringshareReturner();
|
||||||
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
||||||
Test.AssertEquals("inherited", obj.CallReturnStringshare());
|
Test.AssertEquals("inherited", obj.CallReturnStringshare());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void return_own_stringshare_from_virtual()
|
public static void return_own_stringshare_from_virtual()
|
||||||
|
@ -332,6 +353,7 @@ class TestStringshare
|
||||||
var obj = new StringshareReturner();
|
var obj = new StringshareReturner();
|
||||||
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
||||||
Test.AssertEquals("own_inherited", obj.CallReturnOwnStringshare());
|
Test.AssertEquals("own_inherited", obj.CallReturnOwnStringshare());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void out_stringshare_from_virtual()
|
public static void out_stringshare_from_virtual()
|
||||||
|
@ -339,6 +361,7 @@ class TestStringshare
|
||||||
var obj = new StringshareReturner();
|
var obj = new StringshareReturner();
|
||||||
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
||||||
Test.AssertEquals("out_inherited", obj.CallOutStringshare());
|
Test.AssertEquals("out_inherited", obj.CallOutStringshare());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void out_own_stringshare_from_virtual()
|
public static void out_own_stringshare_from_virtual()
|
||||||
|
@ -346,6 +369,7 @@ class TestStringshare
|
||||||
var obj = new StringshareReturner();
|
var obj = new StringshareReturner();
|
||||||
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
// for (int i = 0; i < 1000000; i ++) // Uncomment this to check for memory leaks.
|
||||||
Test.AssertEquals("out_own_inherited", obj.CallOutOwnStringshare());
|
Test.AssertEquals("out_own_inherited", obj.CallOutOwnStringshare());
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ internal class TestStructs
|
||||||
var t = new Dummy.TestObject();
|
var t = new Dummy.TestObject();
|
||||||
bool r = t.StructSimpleIn(simple);
|
bool r = t.StructSimpleIn(simple);
|
||||||
Test.Assert(r, "Function returned false");
|
Test.Assert(r, "Function returned false");
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -95,6 +96,7 @@ internal class TestStructs
|
||||||
bool r = t.StructSimpleOut(out simple);
|
bool r = t.StructSimpleOut(out simple);
|
||||||
Test.Assert(r, "Function returned false");
|
Test.Assert(r, "Function returned false");
|
||||||
checkStructSimple(simple);
|
checkStructSimple(simple);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -122,6 +124,7 @@ internal class TestStructs
|
||||||
var t = new Dummy.TestObject();
|
var t = new Dummy.TestObject();
|
||||||
var simple = t.StructSimpleReturn();
|
var simple = t.StructSimpleReturn();
|
||||||
checkStructSimple(simple);
|
checkStructSimple(simple);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -236,6 +239,7 @@ internal class TestStructs
|
||||||
t.CallStructSimpleIn(simple);
|
t.CallStructSimpleIn(simple);
|
||||||
Test.Assert(t.called);
|
Test.Assert(t.called);
|
||||||
Test.AssertEquals(simple.Fstring, t.received.Fstring);
|
Test.AssertEquals(simple.Fstring, t.received.Fstring);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -269,6 +273,7 @@ internal class TestStructs
|
||||||
t.CallStructSimpleOut(out simple);
|
t.CallStructSimpleOut(out simple);
|
||||||
Test.Assert(t.called, "override was not called");
|
Test.Assert(t.called, "override was not called");
|
||||||
Test.AssertEquals("Virtual Struct Out", simple.Fstring);
|
Test.AssertEquals("Virtual Struct Out", simple.Fstring);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -297,6 +302,7 @@ internal class TestStructs
|
||||||
Dummy.StructSimple simple = t.CallStructSimpleReturn();
|
Dummy.StructSimple simple = t.CallStructSimpleReturn();
|
||||||
Test.Assert(t.called, "override was not called");
|
Test.Assert(t.called, "override was not called");
|
||||||
Test.AssertEquals("Virtual Struct Return", simple.Fstring);
|
Test.AssertEquals("Virtual Struct Return", simple.Fstring);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -325,6 +331,7 @@ internal class TestStructs
|
||||||
var t = new Dummy.TestObject();
|
var t = new Dummy.TestObject();
|
||||||
bool r = t.StructComplexIn(complex);
|
bool r = t.StructComplexIn(complex);
|
||||||
Test.Assert(r, "Function returned false");
|
Test.Assert(r, "Function returned false");
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void complex_ptr_in()
|
// public static void complex_ptr_in()
|
||||||
|
@ -342,6 +349,7 @@ internal class TestStructs
|
||||||
bool r = t.StructComplexOut(out complex);
|
bool r = t.StructComplexOut(out complex);
|
||||||
Test.Assert(r, "Function returned false");
|
Test.Assert(r, "Function returned false");
|
||||||
checkStructComplex(complex);
|
checkStructComplex(complex);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void complex_ptr_out()
|
// public static void complex_ptr_out()
|
||||||
|
@ -357,6 +365,7 @@ internal class TestStructs
|
||||||
var t = new Dummy.TestObject();
|
var t = new Dummy.TestObject();
|
||||||
var complex = t.StructComplexReturn();
|
var complex = t.StructComplexReturn();
|
||||||
checkStructComplex(complex);
|
checkStructComplex(complex);
|
||||||
|
t.Dispose();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// public static void complex_ptr_return()
|
// public static void complex_ptr_return()
|
||||||
|
|
|
@ -172,6 +172,8 @@ public static class TestEinaValue {
|
||||||
Efl.Object target;
|
Efl.Object target;
|
||||||
Test.Assert(v.Get(out target));
|
Test.Assert(v.Get(out target));
|
||||||
Test.AssertEquals(target, obj);
|
Test.AssertEquals(target, obj);
|
||||||
|
target.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +331,8 @@ public static class TestEinaValue {
|
||||||
Efl.Object received = null;
|
Efl.Object received = null;
|
||||||
Test.Assert(a.Get(out received));
|
Test.Assert(a.Get(out received));
|
||||||
Test.AssertEquals(expected, received);
|
Test.AssertEquals(expected, received);
|
||||||
|
received.Dispose();
|
||||||
|
expected.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,6 +368,7 @@ public static class TestEinaValue {
|
||||||
|
|
||||||
Test.Assert(a.Reset());
|
Test.Assert(a.Reset());
|
||||||
Test.Assert(a.Set(expected));
|
Test.Assert(a.Set(expected));
|
||||||
|
actual.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void TestValueOptionalLists()
|
public static void TestValueOptionalLists()
|
||||||
|
@ -395,6 +400,7 @@ public static class TestEinaValue {
|
||||||
Eina.Value actual = null;
|
Eina.Value actual = null;
|
||||||
Test.Assert(a.Get(out actual));
|
Test.Assert(a.Get(out actual));
|
||||||
Test.AssertEquals(expected, actual);
|
Test.AssertEquals(expected, actual);
|
||||||
|
actual.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,6 +871,9 @@ public static class TestEinaValue {
|
||||||
|
|
||||||
Test.AssertEquals((Efl.Object)array[0], c);
|
Test.AssertEquals((Efl.Object)array[0], c);
|
||||||
Test.AssertEquals((Efl.Object)array[1], b);
|
Test.AssertEquals((Efl.Object)array[1], b);
|
||||||
|
c.Dispose();
|
||||||
|
b.Dispose();
|
||||||
|
a.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,6 +1036,7 @@ public static class TestEinaValue {
|
||||||
int rec_val;
|
int rec_val;
|
||||||
Test.Assert(v2.Get(out rec_val));
|
Test.Assert(v2.Get(out rec_val));
|
||||||
Test.AssertEquals(raw_val, rec_val);
|
Test.AssertEquals(raw_val, rec_val);
|
||||||
|
v2.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Add remaining list tests
|
// FIXME Add remaining list tests
|
||||||
|
@ -1123,6 +1133,7 @@ public static class TestValueFromObject
|
||||||
Test.Assert(v.Set(newObj));
|
Test.Assert(v.Set(newObj));
|
||||||
prop.SetValue(source, v.Unwrap());
|
prop.SetValue(source, v.Unwrap());
|
||||||
Test.AssertEquals(prop.GetValue(source), newObj);
|
Test.AssertEquals(prop.GetValue(source), newObj);
|
||||||
|
newObj.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,14 +1174,18 @@ public static class TestValueFromObject
|
||||||
Test.AssertEquals(toCheck[0], 100);
|
Test.AssertEquals(toCheck[0], 100);
|
||||||
Test.AssertEquals(toCheck[1], 200);
|
Test.AssertEquals(toCheck[1], 200);
|
||||||
Test.AssertEquals(toCheck[2], 300);
|
Test.AssertEquals(toCheck[2], 300);
|
||||||
|
v.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestObjectContainerFromToObject()
|
public static void TestObjectContainerFromToObject()
|
||||||
{
|
{
|
||||||
var initialBag = new Eina.Array<Efl.Object>();
|
var initialBag = new Eina.Array<Efl.Object>();
|
||||||
initialBag.Push(new Dummy.TestObject());
|
var tmp1 = new Dummy.TestObject();
|
||||||
initialBag.Push(new Dummy.TestObject());
|
var tmp2 = new Dummy.TestObject();
|
||||||
initialBag.Push(new Dummy.TestObject());
|
var tmp3 = new Dummy.TestObject();
|
||||||
|
initialBag.Push(tmp1);
|
||||||
|
initialBag.Push(tmp2);
|
||||||
|
initialBag.Push(tmp3);
|
||||||
|
|
||||||
var source = new ComplexHolder { BagOfObjects = initialBag };
|
var source = new ComplexHolder { BagOfObjects = initialBag };
|
||||||
var prop = source.GetType().GetProperty("BagOfObjects");
|
var prop = source.GetType().GetProperty("BagOfObjects");
|
||||||
|
@ -1199,6 +1214,10 @@ public static class TestValueFromObject
|
||||||
Test.AssertEquals(toCheck[0], first);
|
Test.AssertEquals(toCheck[0], first);
|
||||||
Test.AssertEquals(toCheck[1], second);
|
Test.AssertEquals(toCheck[1], second);
|
||||||
Test.AssertEquals(toCheck[2], third);
|
Test.AssertEquals(toCheck[2], third);
|
||||||
|
tmp3.Dispose();
|
||||||
|
tmp2.Dispose();
|
||||||
|
tmp1.Dispose();
|
||||||
|
v.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore 1591
|
#pragma warning restore 1591
|
||||||
|
|
|
@ -38,6 +38,7 @@ public static class TestEinaValueEolian {
|
||||||
Test.AssertEquals(v, v_received);
|
Test.AssertEquals(v, v_received);
|
||||||
v_received.Dispose();
|
v_received.Dispose();
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestEolianEinaValueInOwn()
|
public static void TestEolianEinaValueInOwn()
|
||||||
|
@ -58,6 +59,7 @@ public static class TestEinaValueEolian {
|
||||||
|
|
||||||
obj.ClearValue();
|
obj.ClearValue();
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestEolianEinaValueOut()
|
public static void TestEolianEinaValueOut()
|
||||||
|
@ -73,7 +75,9 @@ public static class TestEinaValueEolian {
|
||||||
|
|
||||||
Test.AssertEquals(v, v_out);
|
Test.AssertEquals(v, v_out);
|
||||||
Test.AssertEquals(Eina.Ownership.Unmanaged, v_out.Ownership);
|
Test.AssertEquals(Eina.Ownership.Unmanaged, v_out.Ownership);
|
||||||
|
v_out.Dispose();
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestEolianEinaValueOutOwn()
|
public static void TestEolianEinaValueOutOwn()
|
||||||
|
@ -89,7 +93,9 @@ public static class TestEinaValueEolian {
|
||||||
|
|
||||||
Test.AssertEquals(v, v_out);
|
Test.AssertEquals(v, v_out);
|
||||||
Test.AssertEquals(Eina.Ownership.Managed, v_out.Ownership);
|
Test.AssertEquals(Eina.Ownership.Managed, v_out.Ownership);
|
||||||
|
v_out.Dispose();
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestEolianEinaValueOutByValue()
|
public static void TestEolianEinaValueOutByValue()
|
||||||
|
@ -105,7 +111,9 @@ public static class TestEinaValueEolian {
|
||||||
|
|
||||||
Test.AssertEquals(v, v_out);
|
Test.AssertEquals(v, v_out);
|
||||||
Test.AssertEquals(Eina.Ownership.Managed, v_out.Ownership);
|
Test.AssertEquals(Eina.Ownership.Managed, v_out.Ownership);
|
||||||
|
v_out.Dispose();
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ValueHandler : Dummy.TestObject
|
private class ValueHandler : Dummy.TestObject
|
||||||
|
@ -130,6 +138,7 @@ public static class TestEinaValueEolian {
|
||||||
obj.CallSetValue(val);
|
obj.CallSetValue(val);
|
||||||
Test.AssertEquals(val, obj.value);
|
Test.AssertEquals(val, obj.value);
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestEolianEinaValueImplicitOperators()
|
public static void TestEolianEinaValueImplicitOperators()
|
||||||
|
@ -141,6 +150,7 @@ public static class TestEinaValueEolian {
|
||||||
var expected = new Eina.Value(1999);
|
var expected = new Eina.Value(1999);
|
||||||
var received = new Eina.Value(Eina.ValueType.String);
|
var received = new Eina.Value(Eina.ValueType.String);
|
||||||
|
|
||||||
|
received.Dispose();
|
||||||
obj.OutValue(out received);
|
obj.OutValue(out received);
|
||||||
Test.AssertEquals(expected, received);
|
Test.AssertEquals(expected, received);
|
||||||
Test.AssertEquals(Eina.ValueType.Int32, received.GetValueType());
|
Test.AssertEquals(Eina.ValueType.Int32, received.GetValueType());
|
||||||
|
@ -148,6 +158,7 @@ public static class TestEinaValueEolian {
|
||||||
int i = received;
|
int i = received;
|
||||||
Test.AssertEquals(i, 1999);
|
Test.AssertEquals(i, 1999);
|
||||||
|
|
||||||
|
expected.Dispose();
|
||||||
expected = new Eina.Value("Hallo");
|
expected = new Eina.Value("Hallo");
|
||||||
obj.SetValue("Hallo");
|
obj.SetValue("Hallo");
|
||||||
|
|
||||||
|
@ -159,9 +170,11 @@ public static class TestEinaValueEolian {
|
||||||
Test.AssertEquals(s, "Hallo");
|
Test.AssertEquals(s, "Hallo");
|
||||||
|
|
||||||
// Casting
|
// Casting
|
||||||
|
expected.Dispose();
|
||||||
expected = new Eina.Value((double)15);
|
expected = new Eina.Value((double)15);
|
||||||
obj.SetValue((double)15);
|
obj.SetValue((double)15);
|
||||||
|
|
||||||
|
received.Dispose();
|
||||||
obj.OutValue(out received);
|
obj.OutValue(out received);
|
||||||
Test.AssertEquals(expected, received);
|
Test.AssertEquals(expected, received);
|
||||||
Test.AssertEquals(Eina.ValueType.Double, received.GetValueType());
|
Test.AssertEquals(Eina.ValueType.Double, received.GetValueType());
|
||||||
|
@ -169,11 +182,16 @@ public static class TestEinaValueEolian {
|
||||||
// Check for 0
|
// Check for 0
|
||||||
// This is a special value, since C# can silently convert it to an enum
|
// This is a special value, since C# can silently convert it to an enum
|
||||||
// leading to collisions with Eina.ValueType
|
// leading to collisions with Eina.ValueType
|
||||||
|
expected.Dispose();
|
||||||
expected = new Eina.Value(0);
|
expected = new Eina.Value(0);
|
||||||
obj.SetValue(0);
|
obj.SetValue(0);
|
||||||
|
received.Dispose();
|
||||||
obj.OutValue(out received);
|
obj.OutValue(out received);
|
||||||
Test.AssertEquals(expected, received);
|
Test.AssertEquals(expected, received);
|
||||||
Test.AssertEquals(Eina.ValueType.Int32, received.GetValueType());
|
Test.AssertEquals(Eina.ValueType.Int32, received.GetValueType());
|
||||||
|
expected.Dispose();
|
||||||
|
received.Dispose();
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValueType in eolian context is beta, so not allowed.
|
// ValueType in eolian context is beta, so not allowed.
|
||||||
|
@ -188,6 +206,7 @@ public static class TestEinaValueEolian {
|
||||||
{
|
{
|
||||||
Test.AssertEquals(type, obj.MirrorValueType(type));
|
Test.AssertEquals(type, obj.MirrorValueType(type));
|
||||||
}
|
}
|
||||||
|
obj.Dispose();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue