summaryrefslogtreecommitdiff
path: root/ElmSharp.Test
diff options
context:
space:
mode:
Diffstat (limited to 'ElmSharp.Test')
-rwxr-xr-xElmSharp.Test/ElmSharp.Test.csproj7
-rwxr-xr-x[-rw-r--r--]ElmSharp.Test/ElmSharp.Test.project.json7
-rw-r--r--ElmSharp.Test/TC/EcoreTimerTest1.cs86
-rw-r--r--ElmSharp.Test/TC/EvasMapTest2.cs131
-rw-r--r--[-rwxr-xr-x]ElmSharp.Test/TC/HoverselTest1.cs8
-rw-r--r--ElmSharp.Test/TC/ImageTest4.cs86
-rw-r--r--ElmSharp.Test/TC/MultibuttonEntryTest2.cs114
-rw-r--r--ElmSharp.Test/TC/SliderTest1.cs36
-rwxr-xr-xElmSharp.Test/TC/ToolbarTest3.cs83
9 files changed, 553 insertions, 5 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index e2d2cfd..7c54640 100755
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -45,7 +45,10 @@
<Compile Include="TC\BackgroundTest1.cs" />
<Compile Include="TC\BackgroundTest2.cs" />
<Compile Include="TC\BackgroundTest3.cs" />
+ <Compile Include="TC\EcoreTimerTest1.cs" />
+ <Compile Include="TC\EvasMapTest2.cs" />
<Compile Include="TC\GenListTest10.cs" />
+ <Compile Include="TC\ImageTest4.cs" />
<Compile Include="TC\LabelTest4.cs" />
<Compile Include="TC\Log.cs" />
<Compile Include="TC\LabelTest5.cs" />
@@ -57,6 +60,7 @@
<Compile Include="TC\GenListTest9.cs" />
<Compile Include="TC\FocusTest1.cs" />
<Compile Include="TC\HoverselTest1.cs" />
+ <Compile Include="TC\MultibuttonEntryTest2.cs" />
<Compile Include="TC\NaviframeTest3.cs" />
<Compile Include="TC\ScreenInformationTest.cs" />
<Compile Include="TC\BoxLayoutTest1.cs" />
@@ -109,6 +113,7 @@
<Compile Include="TC\SpinnerTest1.cs" />
<Compile Include="TC\ToolbarTest1.cs" />
<Compile Include="TC\ToolbarTest2.cs" />
+ <Compile Include="TC\ToolbarTest3.cs" />
<Compile Include="TC\WindowInternalTest.cs" />
<Compile Include="TestCaseBase.cs" />
<Compile Include="TestRunner.cs" />
diff --git a/ElmSharp.Test/ElmSharp.Test.project.json b/ElmSharp.Test/ElmSharp.Test.project.json
index fb635aa..4bd5e6c 100644..100755
--- a/ElmSharp.Test/ElmSharp.Test.project.json
+++ b/ElmSharp.Test/ElmSharp.Test.project.json
@@ -1,7 +1,8 @@
-{
+{
"dependencies": {
"Microsoft.NETCore.App": "1.0.0",
- "Tizen.Applications": "1.1.0"
+ "Tizen.Applications.Common": "1.5.8",
+ "Tizen.Applications.UI": "1.5.8"
},
"frameworks": {
"netcoreapp1.0": {}
@@ -9,4 +10,4 @@
"runtimes": {
"win": {}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp.Test/TC/EcoreTimerTest1.cs b/ElmSharp.Test/TC/EcoreTimerTest1.cs
new file mode 100644
index 0000000..325f6a4
--- /dev/null
+++ b/ElmSharp.Test/TC/EcoreTimerTest1.cs
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace ElmSharp.Test
+{
+ class EcoreTimerTest1 : TestCaseBase
+ {
+ public override string TestName => "EcoreTimerTest1";
+ public override string TestDescription => "To timer operation of EcoreMainLoop";
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ Color = Color.White
+ };
+ bg.Show();
+ window.AddResizeObject(bg);
+
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+
+
+ int number = 0;
+ bool bReturn = true;
+ Label label1 = new Label(window);
+ label1.Move(150, 150);
+ label1.Resize(300, 100);
+
+ Button btnTimerSwitch = new Button(window);
+ btnTimerSwitch.Text = "Timer : On";
+ btnTimerSwitch.Move(0, 300);
+ btnTimerSwitch.Resize(300, 100);
+
+ Func<bool> handler = () =>
+ {
+ label1.Text = (++number).ToString();
+ label1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#000000 font_size=64 align=left valign=bottom wrap=word'";
+ return bReturn;
+ };
+ IntPtr prevId = EcoreMainloop.AddTimer(1.0, handler);
+ btnTimerSwitch.Clicked += (s, e) =>
+ {
+ if(bReturn)
+ {
+ bReturn = false;
+ btnTimerSwitch.Text = "Timer : Off";
+ }
+ else
+ {
+ bReturn = true;
+ btnTimerSwitch.Text = "Timer : On";
+ EcoreMainloop.RemoveTimer(prevId);
+ prevId = EcoreMainloop.AddTimer(1.0, handler);
+ }
+ };
+
+ window.BackButtonPressed += (s, e) =>
+ {
+ EcoreMainloop.RemoveTimer(prevId);
+ };
+
+ label1.Show();
+ btnTimerSwitch.Show();
+ }
+ }
+}
diff --git a/ElmSharp.Test/TC/EvasMapTest2.cs b/ElmSharp.Test/TC/EvasMapTest2.cs
new file mode 100644
index 0000000..17d411e
--- /dev/null
+++ b/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
diff --git a/ElmSharp.Test/TC/HoverselTest1.cs b/ElmSharp.Test/TC/HoverselTest1.cs
index 4c94557..122d98b 100755..100644
--- a/ElmSharp.Test/TC/HoverselTest1.cs
+++ b/ElmSharp.Test/TC/HoverselTest1.cs
@@ -52,6 +52,14 @@ namespace ElmSharp.Test
{
Console.WriteLine("Hoversel is dismissed");
};
+ hoversel.Clicked += (s, e) =>
+ {
+ Console.WriteLine("Hoversel is Clicked");
+ };
+ hoversel.Expanded += (s, e) =>
+ {
+ Console.WriteLine("Hoversel is Expanded");
+ };
HoverselItem item1 = hoversel.AddItem("item1");
HoverselItem item2 = hoversel.AddItem("item2");
diff --git a/ElmSharp.Test/TC/ImageTest4.cs b/ElmSharp.Test/TC/ImageTest4.cs
new file mode 100644
index 0000000..6c54c35
--- /dev/null
+++ b/ElmSharp.Test/TC/ImageTest4.cs
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace ElmSharp.Test
+{
+ public class ImageTest4 : TestCaseBase
+ {
+ public override string TestName => "ImageTest4";
+ public override string TestDescription => "To test border operation of Image";
+
+ Image image, image2;
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window);
+ bg.Color = Color.White;
+ bg.Move(0, 0);
+ bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
+ bg.Show();
+
+ Button btnBorder = new Button(window)
+ {
+ Text = "Border Set : off",
+ };
+ btnBorder.Move(10, 10);
+ btnBorder.Resize(300, 100);
+ btnBorder.Show();
+
+ Button btnBorderCenterFillMode = new Button(window)
+ {
+ Text = "BoderCenterFillMode",
+ };
+ btnBorderCenterFillMode.Move(310, 10);
+ btnBorderCenterFillMode.Resize(300, 100);
+ btnBorderCenterFillMode.Show();
+
+ image2 = new Image(window);
+ image2.Load(Path.Combine(TestRunner.ResourceDir, "TED/large/a.jpg"));
+ image2.MinimumWidth = 300;
+ image2.MinimumHeight = 300;
+ image2.Move(50, 500);
+ image2.Resize(600, 500);
+ image2.Show();
+
+ image = new Image(window);
+ image.Load(Path.Combine(TestRunner.ResourceDir, "picture.png"));
+ image.MinimumWidth = image.ObjectSize.Width;
+ image.MinimumHeight = image.ObjectSize.Height;
+ image.Move(100, 600);
+ image.Resize(image.ObjectSize.Width, image.ObjectSize.Height);
+ image.Show();
+
+
+ btnBorder.Clicked += (s, e) =>
+ {
+ int nX = image.ObjectSize.Width / 6;
+ int nY = image.ObjectSize.Height / 6;
+ image.SetBorder(nX, nX, nY, nY);
+ btnBorder.Text = "Border Set : on";
+ };
+
+ btnBorderCenterFillMode.Clicked += (s, e) =>
+ {
+ image.BorderCenterFillMode = ((ImageBorderFillMode)Enum.ToObject(typeof(ImageBorderFillMode), ((int)image.BorderCenterFillMode + 1) % Enum.GetValues(typeof(ImageBorderFillMode)).Length));
+ btnBorderCenterFillMode.Text = image.BorderCenterFillMode.ToString();
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/ElmSharp.Test/TC/MultibuttonEntryTest2.cs b/ElmSharp.Test/TC/MultibuttonEntryTest2.cs
new file mode 100644
index 0000000..8639099
--- /dev/null
+++ b/ElmSharp.Test/TC/MultibuttonEntryTest2.cs
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using ElmSharp;
+
+namespace ElmSharp.Test
+{
+ class MultiButtonEntryTest2 : TestCaseBase
+ {
+ public override string TestName => "MultiButtonEntryTest2";
+ public override string TestDescription => "To test basic operation of MultiButtonEntry";
+
+ bool _setCallback = false;
+
+ public override void Run(Window window)
+ {
+ Background bg = new Background(window);
+ bg.Color = Color.White;
+ bg.Move(0, 0);
+ bg.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
+ bg.Show();
+
+ MultiButtonEntry mbe = new MultiButtonEntry(window)
+ {
+ IsEditable = true,
+ IsExpanded = true,
+ Text = "To: "
+ };
+
+ mbe.Append("Append1");
+ mbe.Append("Append2");
+ mbe.Append("Append3");
+ mbe.Append("Append4");
+ mbe.Append("Append5");
+ mbe.Append("Append6");
+ mbe.Append("Append7");
+ mbe.Append("Append8");
+ mbe.Append("Append9");
+ mbe.Append("Append10");
+ mbe.Append("Append11");
+ mbe.Append("Append12");
+
+ Label label1 = new Label(window)
+ {
+ Text = "MultiButtonEntry Test",
+ Color = Color.Blue
+ };
+
+ var expandButton = new Button(window)
+ {
+ Text = "IsExpanded",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+
+ var formatButton = new Button(window)
+ {
+ Text = "format",
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+
+ expandButton.Clicked += (sender, e) =>
+ {
+ mbe.IsExpanded = !mbe.IsExpanded;
+ };
+
+ formatButton.Clicked += (sender, e) =>
+ {
+ if (_setCallback)
+ {
+ mbe.SetFormatCallback(null);
+ _setCallback = false;
+ }
+ else
+ {
+ mbe.SetFormatCallback((count) => { return "(" + count + ")"; });
+ _setCallback = true;
+ }
+ };
+
+ label1.Resize(600, 100);
+ label1.Move(50, 50);
+ label1.Show();
+
+ mbe.Resize(600, 600);
+ mbe.Move(0, 100);
+ mbe.Show();
+
+ expandButton.Resize(200, 100);
+ expandButton.Move(50, 700);
+ expandButton.Show();
+
+ formatButton.Resize(200, 100);
+ formatButton.Move(300, 700);
+ formatButton.Show();
+ }
+ }
+} \ No newline at end of file
diff --git a/ElmSharp.Test/TC/SliderTest1.cs b/ElmSharp.Test/TC/SliderTest1.cs
index 9113836..c59b9a8 100644
--- a/ElmSharp.Test/TC/SliderTest1.cs
+++ b/ElmSharp.Test/TC/SliderTest1.cs
@@ -70,6 +70,38 @@ namespace ElmSharp.Test
}
};
+ Button btn2 = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Set IndicatorVisibleMode"
+ };
+ btn2.Clicked += (s, e) =>
+ {
+ if (sld1.IndicatorVisibleMode == SliderIndicatorVisibleMode.Default)
+ {
+ sld1.IndicatorVisibleMode = SliderIndicatorVisibleMode.Always;
+ btn2.Text = "Always";
+ }
+ else if (sld1.IndicatorVisibleMode == SliderIndicatorVisibleMode.Always)
+ {
+ sld1.IndicatorVisibleMode = SliderIndicatorVisibleMode.OnFocus;
+ btn2.Text = "OnFocus";
+ }
+ else if (sld1.IndicatorVisibleMode == SliderIndicatorVisibleMode.OnFocus)
+ {
+ sld1.IndicatorVisibleMode = SliderIndicatorVisibleMode.None;
+ btn2.Text = "None";
+ }
+ else
+ {
+ sld1.IndicatorVisibleMode = SliderIndicatorVisibleMode.Default;
+ btn2.Text = "Default";
+ }
+ };
+
Label lb1 = new Label(window)
{
AlignmentX = -1,
@@ -80,11 +112,13 @@ namespace ElmSharp.Test
table.Pack(sld1, 1, 1, 2, 1);
table.Pack(btn, 1, 2, 2, 1);
- table.Pack(lb1, 1, 3, 2, 1);
+ table.Pack(btn2, 1, 3, 2, 1);
+ table.Pack(lb1, 1, 4, 2, 1);
sld1.Show();
btn.Show();
lb1.Show();
+ btn2.Show();
sld1.ValueChanged += (s, e) =>
{
diff --git a/ElmSharp.Test/TC/ToolbarTest3.cs b/ElmSharp.Test/TC/ToolbarTest3.cs
new file mode 100755
index 0000000..5568088
--- /dev/null
+++ b/ElmSharp.Test/TC/ToolbarTest3.cs
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using ElmSharp;
+using System.Collections.Generic;
+
+namespace ElmSharp.Test
+{
+ public class ToolbarTest3 : TestCaseBase
+ {
+ Dictionary<ToolbarItem, int> _itemTable = new Dictionary<ToolbarItem, int>();
+ Dictionary<int, ToolbarItem> _reverseItemTable = new Dictionary<int, ToolbarItem>();
+ public override string TestName => "ToolbarTest3";
+ public override string TestDescription => "To test basic operation of Toolbar for changing bg color";
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box outterBox = new Box(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = -1,
+ WeightX = 1,
+ WeightY = 1,
+ IsHorizontal = false,
+ BackgroundColor = Color.Aqua,
+ };
+ outterBox.Show();
+
+ Toolbar toolbar = new Toolbar(window)
+ {
+ AlignmentX = -1,
+ WeightX = 1,
+ };
+
+ var rnd = new Random();
+ toolbar.BackgroundColor = Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ toolbar.Show();
+ outterBox.PackEnd(toolbar);
+
+ toolbar.Selected += (s, e) =>
+ {
+ e.Item.DeletePartColor("bg");
+ };
+
+ Label lb = new Label(window)
+ {
+ Text = "Please, click an item for delete part color",
+ };
+ lb.Show();
+ outterBox.PackEnd(lb);
+
+ for (int i = 0; i < 5; i++)
+ {
+ ToolbarItem item = toolbar.Append(string.Format("{0} home", i), "home");
+ Color bgColor = Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ item.SetPartColor("bg", bgColor);
+
+ item.Clicked += (s, e) =>
+ {
+ lb.Text = (s as ToolbarItem).Text+" clicked";
+ };
+ }
+
+
+ conformant.SetContent(outterBox);
+ }
+ }
+}