TC for Label HorizontalTextAlignment
authorSeungkeun Lee <sngn.lee@samsung.com>
Thu, 3 Aug 2017 07:54:53 +0000 (16:54 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Thu, 3 Aug 2017 07:54:53 +0000 (16:54 +0900)
Change-Id: I8cc24169ea5ab8c5ad8d8eda5c04cde64667ead9

test/ElmSharp.Test/ElmSharp.Test.csproj
test/ElmSharp.Test/TC/LabelTest6.cs [new file with mode: 0644]

index 6d61c76..f29b5e5 100644 (file)
     <Compile Include="TC\Wearable\ImageTest4.cs" />
     <Compile Include="TC\Wearable\IndexTest1.cs" />
     <Compile Include="TC\Wearable\IndexTest2.cs" />
+    <Compile Include="TC\LabelTest6.cs" />
     <Compile Include="TC\Wearable\ListTest1.cs" />
     <Compile Include="TC\Wearable\ProgressBarTest1.cs" />
     <Compile Include="TC\Wearable\ProgressBarTest2.cs" />
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/test/ElmSharp.Test/TC/LabelTest6.cs b/test/ElmSharp.Test/TC/LabelTest6.cs
new file mode 100644 (file)
index 0000000..31a2c10
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * 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 LabelTest6 : TestCaseBase
+    {
+        public override string TestName => "LabelTest6";
+        public override string TestDescription => "To test Horizontal align of Label";
+
+        int count = 0;
+        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();
+            Box box = new Box(window);
+            box.Show();
+            conformant.SetContent(box);
+
+            box.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
+
+            var label = new Label(window);
+            var label2 = new Label(window);
+            var button = new Button(window);
+
+            box.SetLayoutCallback(() =>
+            {
+                label.Geometry = new Rect(10, box.Geometry.Y, box.Geometry.Width - 20, 100);
+                label2.Geometry = new Rect(10, label.Geometry.Y + 120, box.Geometry.Width - 20, 100);
+                button.Geometry = new Rect(0, box.Geometry.Y + 300, box.Geometry.Width, 200);
+            });
+
+
+            label.BackgroundColor = Color.Aqua;
+            label.LineWrapType = WrapType.Word;
+            label.IsEllipsis = false;
+            label.TextStyle = "DEFAULT = 'align=left'";
+
+            label2.BackgroundColor = Color.Aqua;
+            label2.LineWrapType = WrapType.None;
+            label2.IsEllipsis = false;
+            label2.TextStyle = "DEFAULT = 'align=left'";
+
+            label.Show();
+            label2.Show();
+            box.PackEnd(label);
+            box.PackEnd(label2);
+
+            
+            button.SetAlignment(-1, -1);
+            button.SetWeight(1, 1);
+            button.Text = "Append";
+            button.Show();
+            box.PackEnd(button);
+
+
+            button.Clicked += (s, e) =>
+            {
+                string alpahbat = "ABCDEFGHIJKLMOPQRSTUVWXYZ";
+                label.Text += alpahbat[count % alpahbat.Length];
+                label.Text += alpahbat[count % alpahbat.Length];
+                label2.Text += alpahbat[count % alpahbat.Length];
+                label2.Text += alpahbat[count % alpahbat.Length];
+                count++;
+            };
+
+        }
+    }
+}