diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2018-03-19 20:35:36 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2018-03-20 16:50:30 -0300 |
commit | f9586a831b8ba13542f59c9e1143c3d7b276bd51 (patch) | |
tree | bf1c81ace60441c4cf4007709ae32580db8ee58d /src/tests/efl_mono/Parts.cs | |
parent | 9a6dd32cb1e8f5b1bcd23d32fc4b2d5fa425abbd (diff) | |
download | efl-f9586a831b8ba13542f59c9e1143c3d7b276bd51.tar.gz |
csharp: Add support for efl parts as Properties
Instead of
var bg = efl.ui.Background.static_cast(myobj.Part("background"));
Now do
var bg = myobj.Background;
Also a couple helper functions were added.
Diffstat (limited to 'src/tests/efl_mono/Parts.cs')
-rw-r--r-- | src/tests/efl_mono/Parts.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/tests/efl_mono/Parts.cs b/src/tests/efl_mono/Parts.cs new file mode 100644 index 0000000000..b6ed9a882c --- /dev/null +++ b/src/tests/efl_mono/Parts.cs @@ -0,0 +1,41 @@ +#define CODE_ANALYSIS + +#pragma warning disable 1591 + +using System; +using System.Diagnostics.CodeAnalysis; + +namespace TestSuite { + + +[SuppressMessage("Gendarme.Rules.Portability", "DoNotHardcodePathsRule")] +public static class TestParts +{ + public static void basic_part_test() + { + test.Testing t = new test.TestingConcrete(); + do_part_test(t); + } + + private class Child : test.TestingInherit + { + public Child() : base(null) {} + } + + public static void inherited_part_test() { + var t = new Child(); + do_part_test(t); + } + + private static void do_part_test(test.Testing t) + { + var p1 = t.Part1; + var p2 = t.Part2; + Test.Assert(p1 is test.Testing); + Test.AssertEquals("part1", p1.GetName()); + Test.Assert(p2 is test.Testing); + Test.AssertEquals("part2", p2.GetName()); + } +} + +} |