summaryrefslogtreecommitdiff
path: root/src/tests/efl_mono
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-01-26 17:01:03 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-04-03 17:29:41 -0300
commite2fafe5b0c1a8902136d7872b9e424347c7ce717 (patch)
treeb307c3d999638ee51a6f0c0b6d5d0b6a6c4b6d8a /src/tests/efl_mono
parent92f5383e3c983756e05bd11c7e7ad9d53a332b14 (diff)
downloadefl-e2fafe5b0c1a8902136d7872b9e424347c7ce717.tar.gz
efl_mono: Initial version of Strbuf support.
Also moved the ValueOwnership enum from eina value to eina.Ownership. It can be shared among the eina structures if needed.
Diffstat (limited to 'src/tests/efl_mono')
-rw-r--r--src/tests/efl_mono/Strbuf.cs59
-rw-r--r--src/tests/efl_mono/ValueEolian.cs20
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c10
-rw-r--r--src/tests/efl_mono/test_testing.eo15
4 files changed, 94 insertions, 10 deletions
diff --git a/src/tests/efl_mono/Strbuf.cs b/src/tests/efl_mono/Strbuf.cs
new file mode 100644
index 0000000000..3f2c484a54
--- /dev/null
+++ b/src/tests/efl_mono/Strbuf.cs
@@ -0,0 +1,59 @@
+using System;
+
+namespace TestSuite {
+
+class TestStrBuf
+{
+ public static void test_steal()
+ {
+ eina.Strbuf buf = new eina.Strbuf();
+
+ buf.Append("Here's");
+ buf.Append(' ');
+ buf.Append("Johnny!");
+
+ Test.AssertEquals("Here's Jonnny!".Length, buf.Length);
+ Test.AssertEquals("Here's Johnny!", buf.Steal());
+ }
+
+ public static void test_eolian()
+ {
+ test.Testing obj = new test.TestingConcrete();
+ eina.Strbuf buf = new eina.Strbuf();
+
+ obj.AppendToStrbuf(buf, "Appended");
+ obj.AppendToStrbuf(buf, " to buf");
+
+ Test.AssertEquals("Appended to buf", buf.Steal());
+ }
+
+ private class Appender : test.TestingInherit
+ {
+ public bool called;
+ public Appender() : base(null)
+ {
+ called = false;
+ }
+
+ public override void AppendToStrbuf(eina.Strbuf buf, string str)
+ {
+ eina.Log.Error("Virtual wrapper called");
+ called = true;
+ buf.Append(str);
+ }
+ }
+
+ public static void test_virtual_eolian()
+ {
+ Appender obj = new Appender();
+ eina.Strbuf buf = new eina.Strbuf();
+
+ obj.CallAppendToStrbuf(buf, "Is");
+ obj.CallAppendToStrbuf(buf, " this");
+ obj.CallAppendToStrbuf(buf, " virtual?");
+
+ Test.Assert(obj.called);
+ Test.AssertEquals("Is this virtual?", buf.Steal());
+ }
+}
+} // namespace TestSuite
diff --git a/src/tests/efl_mono/ValueEolian.cs b/src/tests/efl_mono/ValueEolian.cs
index ec95e42269..0f8e1fa869 100644
--- a/src/tests/efl_mono/ValueEolian.cs
+++ b/src/tests/efl_mono/ValueEolian.cs
@@ -16,10 +16,10 @@ public static class TestEinaValueEolian {
using (eina.Value v = new eina.Value(eina.ValueType.Int32)) {
v.Set(42);
obj.SetValuePtr(v);
- Test.AssertEquals(eina.ValueOwnership.Managed, v.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v.Ownership);
eina.Value v_received = obj.GetValuePtrOwn();
- Test.AssertEquals(eina.ValueOwnership.Managed, v_received.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v_received.Ownership);
Test.AssertEquals(v, v_received);
v_received.Dispose();
}
@@ -31,13 +31,13 @@ public static class TestEinaValueEolian {
using (eina.Value v = new eina.Value(eina.ValueType.Int32)) {
v.Set(2001);
- Test.AssertEquals(eina.ValueOwnership.Managed, v.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v.Ownership);
obj.SetValuePtrOwn(v);
- Test.AssertEquals(eina.ValueOwnership.Unmanaged, v.Ownership);
+ Test.AssertEquals(eina.Ownership.Unmanaged, v.Ownership);
eina.Value v_received = obj.GetValuePtr();
- Test.AssertEquals(eina.ValueOwnership.Unmanaged, v_received.Ownership);
+ Test.AssertEquals(eina.Ownership.Unmanaged, v_received.Ownership);
Test.AssertEquals(v, v_received);
@@ -57,7 +57,7 @@ public static class TestEinaValueEolian {
obj.OutValuePtr(out v_out);
Test.AssertEquals(v, v_out);
- Test.AssertEquals(eina.ValueOwnership.Unmanaged, v_out.Ownership);
+ Test.AssertEquals(eina.Ownership.Unmanaged, v_out.Ownership);
}
}
@@ -73,7 +73,7 @@ public static class TestEinaValueEolian {
obj.OutValuePtrOwn(out v_out);
Test.AssertEquals(v, v_out);
- Test.AssertEquals(eina.ValueOwnership.Managed, v_out.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v_out.Ownership);
}
}
@@ -84,11 +84,11 @@ public static class TestEinaValueEolian {
using (eina.Value v = new eina.Value(eina.ValueType.Int32)) {
v.Set(42);
obj.SetValue(v);
- Test.AssertEquals(eina.ValueOwnership.Managed, v.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v.Ownership);
// Using get_value_ptr while get_value() is not supported.
eina.Value v_received = obj.GetValuePtrOwn();
- Test.AssertEquals(eina.ValueOwnership.Managed, v_received.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v_received.Ownership);
Test.AssertEquals(v, v_received);
v_received.Dispose();
}
@@ -106,7 +106,7 @@ public static class TestEinaValueEolian {
obj.OutValue(out v_out);
Test.AssertEquals(v, v_out);
- Test.AssertEquals(eina.ValueOwnership.Managed, v_out.Ownership);
+ Test.AssertEquals(eina.Ownership.Managed, v_out.Ownership);
}
}
}
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index e68ec27730..ce6865213f 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -3741,6 +3741,16 @@ Efl_Object *_test_testing_efl_part_part(const Eo *obj, Test_Testing_Data *pd, co
return NULL;
}
+void _test_testing_append_to_strbuf(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Strbuf *buf, const char *str)
+{
+ eina_strbuf_append(buf, str);
+}
+
+void _test_testing_call_append_to_strbuf(Eo * obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Strbuf *buf, const char *str)
+{
+ test_testing_append_to_strbuf(obj, buf, str);
+}
+
#include "test_testing.eo.c"
#include "test_numberwrapper.eo.c"
diff --git a/src/tests/efl_mono/test_testing.eo b/src/tests/efl_mono/test_testing.eo
index 90d512e763..725d3cec69 100644
--- a/src/tests/efl_mono/test_testing.eo
+++ b/src/tests/efl_mono/test_testing.eo
@@ -1548,6 +1548,21 @@ class Test.Testing (Efl.Object, Efl.Part) {
@in data: Test.Testing;
}
}
+
+ append_to_strbuf {
+ params {
+ @in buf: strbuf;
+ @in str: string;
+ }
+ }
+
+ call_append_to_strbuf {
+ params {
+ @in buf: strbuf;
+ @in str: string;
+ }
+ }
+
}
implements {
class.constructor;