Add label/Table Test case for Circular Widgets
authorHyunjin <hj.na.park@samsung.com>
Tue, 25 Jul 2017 07:11:02 +0000 (16:11 +0900)
committerHyunjin <hj.na.park@samsung.com>
Mon, 31 Jul 2017 09:48:23 +0000 (18:48 +0900)
Add Label Test 1,2,3,4,5
Add Table Test

Change-Id: Idcf4b729e2ad96f1a5baff8183e33d28bcbf1b07

test/ElmSharp.Test/ElmSharp.Test.csproj [changed mode: 0755->0644]
test/ElmSharp.Test/TC/Wearable/LabelTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/LabelTest2.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/LabelTest3.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/LabelTest4.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/LabelTest5.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs [new file with mode: 0644]
test/ElmSharp.Test/TC/Wearable/TableTest1.cs [new file with mode: 0644]

old mode 100755 (executable)
new mode 100644 (file)
index d8b242d..6d61c76
     <Compile Include="TC\Wearable\SpinnerTest1.cs" />
     <Compile Include="TC\Wearable\TransitTest.cs" />
     <Compile Include="TC\Wearable\WindowInternalTest.cs" />
+    <Compile Include="TC\Wearable\LabelTest1.cs" />
+    <Compile Include="TC\Wearable\LabelTest2.cs" />
+    <Compile Include="TC\Wearable\LabelTest3.cs" />
+    <Compile Include="TC\Wearable\LabelTest4.cs" />
+    <Compile Include="TC\Wearable\LabelTest5.cs" />
+    <Compile Include="TC\Wearable\LabelValignTest1.cs" />
+    <Compile Include="TC\Wearable\TableTest1.cs" />
     <Compile Include="TC\WindowInternalTest.cs" />
     <Compile Include="TestCaseBase.cs" />
     <Compile Include="TestRunner.cs" />
diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest1.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest1.cs
new file mode 100644 (file)
index 0000000..808e52f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+
+namespace ElmSharp.Test.Wearable
+{
+    class LabelTest1 : WearableTestCase
+    {
+        public override string TestName => "LabelTest1";
+        public override string TestDescription => "To test basic operation of Label";
+
+        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();
+
+            Label label1 = new Label(window);
+            label1.Color = Color.Black;
+            label1.Text = "Label Test!!!";
+
+            label1.Show();
+            int width = 200;
+            int height = 30;
+            label1.Resize(width, height);
+            label1.Move(window.ScreenSize.Width/2 - width/2, window.ScreenSize.Height/2 - height/2);
+        }
+
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest2.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest2.cs
new file mode 100644 (file)
index 0000000..7f707a5
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+
+namespace ElmSharp.Test.Wearable
+{
+    class LabelTest2 : WearableTestCase
+    {
+        public override string TestName => "LabelTest2";
+        public override string TestDescription => "To test basic operation of Label";
+
+        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();
+
+            Label label1 = new Label(window);
+            label1.Text = "[default valign=top] gyj <span valign=bottom>[bottom gyp]</span>, <span valign=top>[top gyp]</span>, <span valign=middle>[middle gyp]</span>";
+            label1.TextStyle = "DEFAULT = 'color=#000000FF backing_color=#ff0000 backing=on font_size=25 align=left valign=top wrap=word'";
+            label1.Resize(650, 0);
+            var size = label1.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label1.Show();
+            label1.Resize(size.Width, size.Height);
+            label1.Move(0, 0);
+
+            Label label2 = new Label(window);
+            label2.Move(0, size.Height + 10);
+            label2.Text = "[default valign=middle] gyj <span valign=bottom>[bottom gyp]</span>, <span valign=top>[top gyp]</span>, <span valign=middle>[middle gyp]</span>";
+            label2.TextStyle = "DEFAULT = 'color=#000000FF backing_color=#ff0000 backing=on font_size=25 align=left valign=middle wrap=word'";
+            label2.Resize(650, 0);
+            size = label2.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label2.Show();
+            label2.Resize(size.Width, size.Height);
+
+            Label label3 = new Label(window);
+            label3.Move(0, label2.Geometry.Y + size.Height + 10);
+            label3.Text = "[default valign=bottom] gyj <span valign=bottom>[bottom gyp]</span>, <span valign=top>[top gyp]</span>, <span valign=middle>[middle gyp]</span>";
+            label3.TextStyle = "DEFAULT = 'color=#000000FF backing_color=#ff0000 backing=on font_size=25 align=left valign=bottom wrap=word'";
+            label3.Resize(650, 0);
+            size = label3.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label3.Show();
+            label3.Resize(size.Width, size.Height);
+
+            Label label4 = new Label(window);
+            label4.Move(0, label3.Geometry.Y + size.Height + 10);
+            label4.Text = "<span color=#000000>[No TextStyle]</span>" +
+                "<span color=#000000 valign=bottom>[bottom gyp]</span>, " +
+                "<span color=#000000 valign=top>[top gyp]</span>, " +
+                "<span color=#000000 valign=middle>[middle gyp]</span>";
+            label4.Resize(650, 0);
+            size = label4.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label4.Show();
+            label4.Resize(size.Width, size.Height);
+
+            Label label5 = new Label(window);
+            label5.Move(0, label4.Geometry.Y + size.Height + 10);
+            label5.Text = "<span valign=top color=#000000 font_size=50>[top gyp]</span>";
+            label5.Resize(650, 0);
+            size = label5.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label5.Show();
+            label5.Resize(size.Width, size.Height);
+        }
+
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest3.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest3.cs
new file mode 100644 (file)
index 0000000..666b996
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+
+namespace ElmSharp.Test.Wearable
+{
+    public class LabelTest3 : WearableTestCase
+    {
+        public override string TestName => "LabelTest3";
+        public override string TestDescription => "To test basic operation of Label";
+
+        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();
+            Scroller scroller = new Scroller(window);
+            scroller.Show();
+            conformant.SetContent(scroller);
+            Box box = new Box(window);
+            box.SetLayoutCallback(() => { });
+            box.Show();
+            scroller.SetContent(box);
+
+            Size size;
+
+            Label label1 = new Label(window);
+            box.PackEnd(label1);
+            Label label2 = new Label(window);
+            box.PackEnd(label2);
+
+
+            label1.Text = "Jo Ann Buckner";
+            label1.TextStyle = "DEFAULT='color=#000000FF font_size=24 align=left valign=bottom wrap=word'";
+            label1.Show();
+            label1.Resize(100000, 0);
+            size = label1.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label1.Geometry = new Rect(55, 213, size.Width, size.Height);
+
+            label2.Text = "Customer Success Engineer";
+            label2.TextStyle = "DEFAULT='color=#000000FF font_size=16 align=left valign=bottom wrap=word'";
+            label2.Show();
+
+            label2.Resize(100000, 0);
+            size = label2.EdjeObject["elm.text"].TextBlockFormattedSize;
+            label2.Geometry = new Rect(55, 300, size.Width, size.Height);
+
+
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest4.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest4.cs
new file mode 100644 (file)
index 0000000..503b981
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+
+namespace ElmSharp.Test.Wearable
+{
+    public class LabelTest4 : WearableTestCase
+    {
+        public override string TestName => "LabelTest4";
+        public override string TestDescription => "To test slide Animation of Label";
+
+        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();
+
+            Label label1 = new Label(window)
+            {
+                Style = "slide_long",
+                SlideDuration = 3,
+                SlideMode = LabelSlideMode.Always,
+                Color = Color.Black,
+                Text = "Lab test12345678"
+            };
+
+            label1.Show();
+            int width = 200;
+            int height = 30;
+            label1.Resize(width, height);
+            label1.Move(window.ScreenSize.Width/2 - width/2, window.ScreenSize.Height/2 - height/2);
+            label1.PlaySlide();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/LabelTest5.cs b/test/ElmSharp.Test/TC/Wearable/LabelTest5.cs
new file mode 100644 (file)
index 0000000..432a5ff
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+
+namespace ElmSharp.Test.Wearable
+{
+    public class LabelTest5 : WearableTestCase
+    {
+        public override string TestName => "LabelTest5";
+        public override string TestDescription => "To test Slide Animation Speed of Label";
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Background bg = new Background(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                Color = Color.White
+            };
+            bg.Geometry = square;
+            bg.Show();
+
+            Rect pieces = square;
+            pieces.Height /= 4;
+
+            Label label1 = new Label(window)
+            {
+                Text = "Test Slide Animaiton",
+                Color = Color.Black,
+                Style = "slide_long",
+                SlideSpeed = 100,
+                SlideMode = LabelSlideMode.Always,
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1
+            };
+
+            Button btnCurrentSpeed = new Button(window)
+            {
+                Text = "Current Speed : 100",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+
+            Button btnSpeedUp = new Button(window)
+            {
+                Text = "Speed + 10",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+            btnSpeedUp.Clicked += (s, e) =>
+            {
+                label1.SlideSpeed += 10;
+                btnCurrentSpeed.Text = string.Format("Current Speed : {0}", label1.SlideSpeed);
+                label1.PlaySlide();
+            };
+            Button btnSpeedDown = new Button(window)
+            {
+                Text = "Speed - 10",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+            btnSpeedDown.Clicked += (s, e) =>
+            {
+                label1.SlideSpeed -= 10;
+                btnCurrentSpeed.Text = string.Format("Current Speed : {0}", label1.SlideSpeed);
+                label1.PlaySlide();
+            };
+
+            label1.Geometry = new Rect(pieces.X, pieces.Y, pieces.Width, pieces.Height);
+            label1.Show();
+            label1.PlaySlide();
+
+            btnCurrentSpeed.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height, pieces.Width, pieces.Height);
+            btnCurrentSpeed.Show();
+
+            btnSpeedUp.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*2, pieces.Width, pieces.Height);
+            btnSpeedUp.Show();
+
+            btnSpeedDown.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*3, pieces.Width, pieces.Height);
+            btnSpeedDown.Show();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs b/test/ElmSharp.Test/TC/Wearable/LabelValignTest1.cs
new file mode 100644 (file)
index 0000000..622d4c3
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+
+namespace ElmSharp.Test.Wearable
+{
+    public class LabelValignTest1 : WearableTestCase
+    {
+        public override string TestName => "LabelValignTest1";
+        public override string TestDescription => "To test Vertical align of Label";
+
+        public override void Run(Window window)
+        {
+            Rect square = window.GetInnerSquare();
+
+            Background bg = new Background(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                Color = Color.White
+            };
+            bg.Geometry = square;
+            bg.Show();
+
+            Rect pieces = square;
+            pieces.Height /= 4;
+
+            Label label1 = new Label(window)
+            {
+                Text = "Align Test",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1
+            };
+            label1.TextStyle = "DEFAULT = 'color=#000000FF font_size=30 align=center wrap=word'";
+            label1.Geometry = new Rect(pieces.X, pieces.Y, pieces.Width, pieces.Height);
+            label1.Show();
+
+            Button top = new Button(window)
+            {
+                Text = "Top",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+
+            Button middle = new Button(window)
+            {
+                Text = "Middle",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+            Button bottom = new Button(window)
+            {
+                Text = "bottom",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+            };
+
+            top.Clicked += (s, e) =>
+            {
+                label1.SetVerticalTextAlignment("elm.text", 0);
+            };
+
+            middle.Clicked += (s, e) =>
+            {
+                label1.SetVerticalTextAlignment("elm.text", 0.5);
+            };
+
+            bottom.Clicked += (s, e) =>
+            {
+                label1.SetVerticalTextAlignment("elm.text", 1.0);
+            };
+
+            top.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height, pieces.Width, pieces.Height);
+            top.Show();
+
+            middle.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*2, pieces.Width, pieces.Height);
+            middle.Show();
+
+            bottom.Geometry = new Rect(pieces.X, pieces.Y + pieces.Height*3, pieces.Width, pieces.Height);
+            bottom.Show();
+        }
+    }
+}
diff --git a/test/ElmSharp.Test/TC/Wearable/TableTest1.cs b/test/ElmSharp.Test/TC/Wearable/TableTest1.cs
new file mode 100644 (file)
index 0000000..ce31133
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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.Wearable
+{
+    public class TableTest1 : WearableTestCase
+    {
+        public override string TestName => "TableTest1";
+        public override string TestDescription => "To test basic operation of Table";
+
+        public override void Run(Window window)
+        {
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+            Table table = new Table(window) {
+                PaddingX = 10,
+                PaddingY = 10
+            };
+           // table.BackgroundColor = Color.Orange;
+            conformant.SetContent(table);
+            table.Show();
+
+            Button button1 = new Button(window) {
+                Text = "Button (set Color.Oranage)",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1
+            };
+            button1.Clicked += (e,o) =>
+            {
+                table.BackgroundColor = Color.Orange;
+                Console.WriteLine("{0} Clicked! - Button's BG Color : {1}, Table's BG Color : {2}", ((Button)e).Text, ((Button)e).BackgroundColor, table.BackgroundColor);
+            };
+
+            Button button2 = new Button(window) {
+                Text = "Button 2 (set Color.Defalut)",
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                BackgroundColor = new Color(50, 100, 200, 75)
+            };
+            button2.Clicked += (e, o) =>
+            {
+                table.BackgroundColor = Color.Default;
+                Console.WriteLine("{0} Clicked! - Button's BG Color : {1}, Table's BG Color : {2}", ((Button)e).Text, ((Button)e).BackgroundColor, table.BackgroundColor);
+            };
+
+            table.Pack(button1,0,0,3,3);
+            table.Pack(button2,3,1,1,1);
+
+            button1.Show();
+            button2.Show();
+        }
+    }
+}