TC for Label HorizontalTextAlignment
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / LabelTest6.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 namespace ElmSharp.Test.Wearable
19 {
20     public class LabelTest6 : TestCaseBase
21     {
22         public override string TestName => "LabelTest6";
23         public override string TestDescription => "To test Horizontal align of Label";
24
25         int count = 0;
26         public override void Run(Window window)
27         {
28
29             Background bg = new Background(window)
30             {
31                 AlignmentX = -1,
32                 AlignmentY = -1,
33                 WeightX = 1,
34                 WeightY = 1,
35                 Color = Color.White
36             };
37             bg.Show();
38             window.AddResizeObject(bg);
39
40             Conformant conformant = new Conformant(window);
41             conformant.Show();
42             Box box = new Box(window);
43             box.Show();
44             conformant.SetContent(box);
45
46             box.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
47
48             var label = new Label(window);
49             var label2 = new Label(window);
50             var button = new Button(window);
51
52             box.SetLayoutCallback(() =>
53             {
54                 label.Geometry = new Rect(10, box.Geometry.Y, box.Geometry.Width - 20, 100);
55                 label2.Geometry = new Rect(10, label.Geometry.Y + 120, box.Geometry.Width - 20, 100);
56                 button.Geometry = new Rect(0, box.Geometry.Y + 300, box.Geometry.Width, 200);
57             });
58
59
60             label.BackgroundColor = Color.Aqua;
61             label.LineWrapType = WrapType.Word;
62             label.IsEllipsis = false;
63             label.TextStyle = "DEFAULT = 'align=left'";
64
65             label2.BackgroundColor = Color.Aqua;
66             label2.LineWrapType = WrapType.None;
67             label2.IsEllipsis = false;
68             label2.TextStyle = "DEFAULT = 'align=left'";
69
70             label.Show();
71             label2.Show();
72             box.PackEnd(label);
73             box.PackEnd(label2);
74
75             
76             button.SetAlignment(-1, -1);
77             button.SetWeight(1, 1);
78             button.Text = "Append";
79             button.Show();
80             box.PackEnd(button);
81
82
83             button.Clicked += (s, e) =>
84             {
85                 string alpahbat = "ABCDEFGHIJKLMOPQRSTUVWXYZ";
86                 label.Text += alpahbat[count % alpahbat.Length];
87                 label.Text += alpahbat[count % alpahbat.Length];
88                 label2.Text += alpahbat[count % alpahbat.Length];
89                 label2.Text += alpahbat[count % alpahbat.Length];
90                 count++;
91             };
92
93         }
94     }
95 }