From 4728177e089c462ff610e2ca00126fdc149be5d0 Mon Sep 17 00:00:00 2001 From: darkleem Date: Wed, 7 Jun 2017 15:46:41 +0900 Subject: [PATCH] Add evasMap TC - TASK=TCAPI-2217 Signed-off-by: darkleem Change-Id: I2fbee1ba3261301807cd50abadc5d327a85d0c77 --- test/ElmSharp.Test/ElmSharp.Test.csproj | 1 + test/ElmSharp.Test/TC/EvasMapTest2.cs | 131 ++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 test/ElmSharp.Test/TC/EvasMapTest2.cs diff --git a/test/ElmSharp.Test/ElmSharp.Test.csproj b/test/ElmSharp.Test/ElmSharp.Test.csproj index 9e0b6cf..c40186b 100755 --- a/test/ElmSharp.Test/ElmSharp.Test.csproj +++ b/test/ElmSharp.Test/ElmSharp.Test.csproj @@ -46,6 +46,7 @@ + diff --git a/test/ElmSharp.Test/TC/EvasMapTest2.cs b/test/ElmSharp.Test/TC/EvasMapTest2.cs new file mode 100644 index 0000000..17d411e --- /dev/null +++ b/test/ElmSharp.Test/TC/EvasMapTest2.cs @@ -0,0 +1,131 @@ +using System; +using ElmSharp; + +namespace ElmSharp.Test +{ + class EvasMapTest2 : TestCaseBase + { + public override string TestName => "EvasMapTest2"; + public override string TestDescription => "Test EvasMap on different levels of hierarchy"; + + public override void Run(Window window) + { + var box = new Box(window) + { + IsHorizontal = false, + }; + box.SetAlignment(-1.0, -1.0); // fill + box.SetWeight(1.0, 1.0); // expand + box.Show(); + + var group = new Box(box) + { + IsHorizontal = true, + BackgroundColor = Color.White, + }; + group.Show(); + + var x = new Label(group) + { + Text = "X", + }; + x.Show(); + + var y = new Label(group) + { + Text = "Y", + }; + y.Show(); + + var z = new Label(group) + { + Text = "Z", + }; + z.Show(); + group.PackEnd(x); + group.PackEnd(y); + group.PackEnd(z); + + var top = new Rectangle(box) + { + Color = Color.Red, + }; + top.SetAlignment(-1.0, -1.0); // fill + top.SetWeight(1.0, 1.0); // expand + top.Show(); + + var bottom = new Rectangle(box) + { + Color = Color.Green, + }; + bottom.SetAlignment(-1.0, -1.0); // fill + bottom.SetWeight(1.0, 1.0); // expand + bottom.Show(); + + double angle = 0.0; + + var reset = new Button(box) + { + Text = "Reset", + AlignmentX = -1.0, + WeightX = 1.0, + }; + reset.Show(); + + reset.Clicked += (object sender, EventArgs e) => + { + group.IsMapEnabled = false; + x.IsMapEnabled = false; + angle = 0.0; + }; + + var zoom = new Button(box) + { + Text = "Zoom group", + AlignmentX = -1.0, + WeightX = 1.0, + }; + zoom.Show(); + + zoom.Clicked += (object sender, EventArgs e) => + { + var map = new EvasMap(4); + var g = group.Geometry; + map.PopulatePoints(g, 0); + map.Zoom(3.0, 3.0, g.X + g.Width / 2, g.Y + g.Height / 2); + group.EvasMap = map; + group.IsMapEnabled = true; + }; + + var rotate = new Button(box) + { + Text = "Rotate X", + AlignmentX = -1.0, + WeightX = 1.0, + }; + rotate.Show(); + + rotate.Clicked += (object sender, EventArgs e) => + { + angle += 5.0; + + var map = new EvasMap(4); + var g = x.Geometry; + map.PopulatePoints(g, 0); + map.Rotate3D(0, 0, angle, g.X + g.Width / 2, g.Y + g.Height / 2, 0); + x.EvasMap = map; + x.IsMapEnabled = true; + }; + + box.PackEnd(top); + box.PackEnd(group); + box.PackEnd(bottom); + box.PackEnd(reset); + box.PackEnd(zoom); + box.PackEnd(rotate); + + box.Resize(window.ScreenSize.Width, window.ScreenSize.Height); + box.Move(0, 0); + } + } +} \ No newline at end of file -- 2.7.4