summaryrefslogtreecommitdiff
path: root/ElmSharp.Test
diff options
context:
space:
mode:
Diffstat (limited to 'ElmSharp.Test')
-rwxr-xr-xElmSharp.Test/ElmSharp.Test.csproj2
-rw-r--r--ElmSharp.Test/TC/BackgroundTest1.cs14
-rw-r--r--ElmSharp.Test/TC/ProgressBarTest1.cs94
-rwxr-xr-xElmSharp.Test/TC/SliderTest2.cs125
-rwxr-xr-xElmSharp.Test/TC/ToolbarTest4.cs135
5 files changed, 349 insertions, 21 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index e7347fb..9014a3e 100755
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -111,10 +111,12 @@
<Compile Include="TC\ScrollerTest1.cs" />
<Compile Include="TC\ScrollerTest2.cs" />
<Compile Include="TC\SliderTest1.cs" />
+ <Compile Include="TC\SliderTest2.cs" />
<Compile Include="TC\SpinnerTest1.cs" />
<Compile Include="TC\ToolbarTest1.cs" />
<Compile Include="TC\ToolbarTest2.cs" />
<Compile Include="TC\ToolbarTest3.cs" />
+ <Compile Include="TC\ToolbarTest4.cs" />
<Compile Include="TC\WindowInternalTest.cs" />
<Compile Include="TestCaseBase.cs" />
<Compile Include="TestRunner.cs" />
diff --git a/ElmSharp.Test/TC/BackgroundTest1.cs b/ElmSharp.Test/TC/BackgroundTest1.cs
index a9514d5..ed2a447 100644
--- a/ElmSharp.Test/TC/BackgroundTest1.cs
+++ b/ElmSharp.Test/TC/BackgroundTest1.cs
@@ -31,13 +31,17 @@ namespace ElmSharp.Test
Color = Color.Orange
};
- Background bg2 = new Background(window) {
- File = "/opt/home/owner/res/tizen.png",
- BackgroundOption = BackgroundOptions.Tile
+ Background bg2 = new Background(window)
+ {
+ File = "/home/owner/apps_rw/ElmSharpTest/res/picture.png",
+ BackgroundOption = BackgroundOptions.Center,
+ BackgroundColor = Color.Gray
};
+ bg2.SetFileLoadSize(50, 50);
+
Show(bg1, 0, 0, 100, 100);
- Show(bg2, 100, 100, 500, 500);
+ Show(bg2, 0, 100, 700, 700);
}
void Show(Background bg, int x, int y, int w, int h)
@@ -47,4 +51,4 @@ namespace ElmSharp.Test
bg.Resize(w, h);
}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp.Test/TC/ProgressBarTest1.cs b/ElmSharp.Test/TC/ProgressBarTest1.cs
index 3e28ead..04a04cf 100644
--- a/ElmSharp.Test/TC/ProgressBarTest1.cs
+++ b/ElmSharp.Test/TC/ProgressBarTest1.cs
@@ -54,9 +54,17 @@ namespace ElmSharp.Test
WeightY = 1
};
+ Label lb2 = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1
+ };
+
Button bt1 = new Button(window)
{
- Text = "Increase",
+ Text = "Increase Value",
AlignmentX = -1,
AlignmentY = 0,
WeightX = 1,
@@ -65,38 +73,92 @@ namespace ElmSharp.Test
Button bt2 = new Button(window)
{
- Text = "Decrease",
+ Text = "Decrease Value",
AlignmentX = -1,
AlignmentY = 0,
WeightX = 1,
WeightY = 1
};
- table.Pack(pb1, 1, 1, 2, 1);
- table.Pack(lb1, 1, 2, 2, 1);
- table.Pack(bt1, 1, 3, 1, 1);
- table.Pack(bt2, 2, 3, 1, 1);
+ Button bt3 = new Button(window)
+ {
+ Text = "Increase PartValue",
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1
+ };
- pb1.Show();
- lb1.Show();
- bt1.Show();
- bt2.Show();
+ Button bt4 = new Button(window)
+ {
+ Text = "Decrease PartValue",
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1
+ };
+
+ string part = "elm.cur.progressbar";
+ double unit = 0.1;
+ double max = 1.0;
+ double min = 0;
+
+ pb1.ValueChanged += (s, e) =>
+ {
+ lb1.Text = string.Format("Value Changed: {0}", pb1.Value);
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ lb2.Text = string.Format("PartValue Changed: {0}", pb1.GetPartValue(part));
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
bt1.Clicked += (s, e) =>
{
- pb1.Value += 0.1;
+ var val = pb1.Value + unit;
+ if (val <= max)
+ pb1.Value = val;
};
bt2.Clicked += (s, e) =>
{
- pb1.Value -= 0.1;
+ var val = pb1.Value - unit;
+ if (val >= min)
+ {
+ pb1.Value = val;
+ }
};
- pb1.ValueChanged += (s, e) =>
+ bt3.Clicked += (s, e) =>
{
- lb1.Text = string.Format("Value Changed: {0}", pb1.Value);
- lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ var val = pb1.GetPartValue(part) + unit;
+ if (val <= max)
+ pb1.SetPartValue(part, val);
};
+
+ bt4.Clicked += (s, e) =>
+ {
+ var val = pb1.GetPartValue(part) - unit;
+ if (val >= min)
+ {
+ pb1.SetPartValue(part, val);
+ }
+ };
+
+ table.Pack(pb1, 1, 1, 2, 1);
+ table.Pack(lb1, 1, 2, 2, 1);
+ table.Pack(lb2, 1, 3, 2, 1);
+ table.Pack(bt1, 1, 4, 1, 1);
+ table.Pack(bt2, 1, 5, 1, 1);
+ table.Pack(bt3, 1, 6, 1, 1);
+ table.Pack(bt4, 1, 7, 1, 1);
+
+ pb1.Show();
+ lb1.Show();
+ lb2.Show();
+ bt1.Show();
+ bt2.Show();
+ bt3.Show();
+ bt4.Show();
}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp.Test/TC/SliderTest2.cs b/ElmSharp.Test/TC/SliderTest2.cs
new file mode 100755
index 0000000..7fe3ec6
--- /dev/null
+++ b/ElmSharp.Test/TC/SliderTest2.cs
@@ -0,0 +1,125 @@
+/*
+ * 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 System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ElmSharp.Test
+{
+ class SliderTest2 : TestCaseBase
+ {
+ public override string TestName => "SliderTest2";
+ public override string TestDescription => "To test basic operation of Slider";
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Table table = new Table(window);
+ conformant.SetContent(table);
+ table.Show();
+
+ Slider sld = new Slider(window)
+ {
+ Text = "Slider Test",
+ UnitFormat = "%1.2f meters",
+ IndicatorFormat = "%1.2f meters",
+ Minimum = 0.0,
+ Maximum = 100.0,
+ Value = 0.1,
+ AlignmentX = -1,
+ AlignmentY = 0.5,
+ WeightX = 1,
+ WeightY = 1,
+ IsIndicatorFocusable = true
+ };
+
+ Label lb1 = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString()),
+ };
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ Label lb2 = new Label(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString()),
+ };
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ Button btn1 = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Change IndicatorVisibleMode"
+ };
+ btn1.Clicked += (s, e) =>
+ {
+ sld.IndicatorVisibleMode = (SliderIndicatorVisibleMode)(((int)sld.IndicatorVisibleMode + 1) % 4);
+ lb1.Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString());
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
+
+ Button btn2 = new Button(window)
+ {
+ AlignmentX = -1,
+ AlignmentY = 0,
+ WeightX = 1,
+ WeightY = 1,
+ Text = "Change IsIndicatorVisible"
+ };
+ btn2.Clicked += (s, e) =>
+ {
+ sld.IsIndicatorVisible = !sld.IsIndicatorVisible;
+ lb2.Text = string.Format("IsIndicatorVisible={0}", sld.IsIndicatorVisible.ToString());
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
+
+ table.Pack(sld, 1, 1, 2, 1);
+ table.Pack(lb1, 1, 2, 2, 1);
+ table.Pack(lb2, 1, 3, 2, 1);
+ table.Pack(btn1, 1, 4, 2, 1);
+ table.Pack(btn2, 1, 5, 2, 1);
+
+ sld.Show();
+ lb1.Show();
+ lb2.Show();
+ btn1.Show();
+ btn2.Show();
+
+ sld.ValueChanged += (s, e) =>
+ {
+ lb1.Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString());
+ lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+
+ lb2.Text = string.Format("IsIndicatorVisible={0}", sld.IsIndicatorVisible.ToString());
+ lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/ElmSharp.Test/TC/ToolbarTest4.cs b/ElmSharp.Test/TC/ToolbarTest4.cs
new file mode 100755
index 0000000..db2ee47
--- /dev/null
+++ b/ElmSharp.Test/TC/ToolbarTest4.cs
@@ -0,0 +1,135 @@
+/*
+ * 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
+ {
+ public override string TestName => "ToolbarTest3";
+ public override string TestDescription => "To test basic operation of Toolbar";
+
+ 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,
+ ShrinkMode = ToolbarShrinkMode.Scroll,
+ IconLookupOrder = ToolbarIconLookupOrder.ThemeFreedesktop,
+ };
+ toolbar.Show();
+ outterBox.PackEnd(toolbar);
+
+ toolbar.Append("FirstItem", "home");
+ toolbar.Append("LastItem", "home");
+ ToolbarItem result = toolbar.InsertAfter(toolbar.FirstItem, "Result", "");
+
+ Button bt1 = new Button(window)
+ {
+ Text = "Change IconSize",
+ MinimumWidth = 400
+ };
+ bt1.Clicked += (s, e) =>
+ {
+ if (toolbar.IconSize < 50)
+ toolbar.IconSize = 100;
+ else
+ toolbar.IconSize = 32;
+ result.Text = string.Format("IconSize{0}", toolbar.IconSize.ToString());
+ };
+ bt1.Show();
+ outterBox.PackEnd(bt1);
+
+ Button bt2 = new Button(window)
+ {
+ Text = "Find FirstItem",
+ MinimumWidth = 400
+ };
+ bt2.Clicked += (s, e) =>
+ {
+ ToolbarItem item1 = toolbar.FirstItem;
+ ToolbarItem item2 = toolbar.FindItemByLabel("FirstItem");
+ if (item1 == null || item2 == null || item1 != item2)
+ result.Text = "FAIL";
+ else
+ result.Text = "PASS";
+ };
+ bt2.Show();
+ outterBox.PackEnd(bt2);
+
+ Button bt3 = new Button(window)
+ {
+ Text = "Find LastItem",
+ MinimumWidth = 400
+ };
+ bt3.Clicked += (s, e) =>
+ {
+ ToolbarItem item1 = toolbar.LastItem;
+ ToolbarItem item2 = toolbar.FindItemByLabel("LastItem");
+ if (item1 == null || item2 == null || item1 != item2)
+ result.Text = "FAIL";
+ else
+ result.Text = "PASS";
+ };
+ bt3.Show();
+ outterBox.PackEnd(bt3);
+
+ Button bt4 = new Button(window)
+ {
+ Text = "Get ItemsCount",
+ MinimumWidth = 400
+ };
+ bt4.Clicked += (s, e) =>
+ {
+ result.Text = toolbar.ItemsCount.ToString();
+ };
+ bt4.Show();
+ outterBox.PackEnd(bt4);
+
+ Button bt5 = new Button(window)
+ {
+ Text = "Change IconLookupOrder",
+ MinimumWidth = 400
+ };
+ bt5.Clicked += (s, e) =>
+ {
+ toolbar.IconLookupOrder = (ToolbarIconLookupOrder)(((int)toolbar.IconLookupOrder + 1) % 4);
+ result.Text = toolbar.IconLookupOrder.ToString();
+ };
+ bt5.Show();
+ outterBox.PackEnd(bt5);
+
+ conformant.SetContent(outterBox);
+ }
+ }
+} \ No newline at end of file