a104a8273df9d28883980e927714efe70037e435
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / LabelValignTest1.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 using System;
18 using ElmSharp;
19 using System.Collections.Generic;
20
21 namespace ElmSharp.Test
22 {
23     public class LabelValignTest1 : TestCaseBase
24     {
25         public override string TestName => "LabelValignTest1";
26         public override string TestDescription => "To test Vertical align of Label";
27
28         public override void Run(Window window)
29         {
30             Background bg = new Background(window)
31             {
32                 AlignmentX = -1,
33                 AlignmentY = -1,
34                 WeightX = 1,
35                 WeightY = 1,
36                 Color = Color.White
37             };
38             bg.Show();
39             window.AddResizeObject(bg);
40
41             Conformant conformant = new Conformant(window);
42             conformant.Show();
43             Box box = new Box(window)
44             {
45                 AlignmentX = -1,
46                 AlignmentY = -1,
47                 WeightX = 1,
48                 WeightY = 1
49             };
50             box.Show();
51             conformant.SetContent(box);
52
53             Box labelBox = new Box(window)
54             {
55                 AlignmentX = -1,
56                 AlignmentY = -1,
57                 WeightX = 1,
58                 WeightY = 1,
59                 MinimumHeight = 400,
60                 BackgroundColor = Color.Blue,
61             };
62             labelBox.Show();
63
64
65
66             Label label1 = new Label(window)
67             {
68                 Text = "Align Test",
69                 AlignmentX = -1,
70                 AlignmentY = -1,
71                 WeightX = 1,
72                 WeightY = 1
73             };
74             label1.TextStyle = "DEFAULT = 'color=#000000FF font_size=100 align=center wrap=word'";
75             label1.Show();
76             labelBox.PackEnd(label1);
77
78             Button top = new Button(window)
79             {
80                 Text = "Top",
81                 AlignmentX = -1,
82                 AlignmentY = -1,
83                 WeightX = 1,
84             };
85
86             Button middle = new Button(window)
87             {
88                 Text = "Middle",
89                 AlignmentX = -1,
90                 AlignmentY = -1,
91                 WeightX = 1,
92             };
93             Button bottom = new Button(window)
94             {
95                 Text = "bottom",
96                 AlignmentX = -1,
97                 AlignmentY = -1,
98                 WeightX = 1,
99             };
100
101             top.Clicked += (s, e) =>
102             {
103                 label1.SetPartValign("elm.text", 0);
104             };
105
106             middle.Clicked += (s, e) =>
107             {
108                 label1.SetPartValign("elm.text", 0.5);
109             };
110
111             bottom.Clicked += (s, e) =>
112             {
113                 label1.SetPartValign("elm.text", 1.0);
114             };
115
116             top.Show();
117             labelBox.Show();
118             middle.Show();
119             bottom.Show();
120             box.PackEnd(labelBox);
121             box.PackEnd(top);
122             box.PackEnd(middle);
123             box.PackEnd(bottom);
124         }
125     }
126 }