Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / SliderTest2.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 System.Collections.Generic;
19 using System.Linq;
20 using System.Text;
21 using System.Threading.Tasks;
22
23 namespace ElmSharp.Test
24 {
25     class SliderTest2 : TestCaseBase
26     {
27         public override string TestName => "SliderTest2";
28         public override string TestDescription => "To test basic operation of Slider";
29
30         public override void Run(Window window)
31         {
32             Conformant conformant = new Conformant(window);
33             conformant.Show();
34             Table table = new Table(window);
35             conformant.SetContent(table);
36             table.Show();
37
38             Slider sld = new Slider(window)
39             {
40                 Text = "Slider Test",
41                 IndicatorFormat = "%1.2f meters",
42                 Minimum = 0.0,
43                 Maximum = 100.0,
44                 Value = 0.1,
45                 AlignmentX = -1,
46                 AlignmentY = 0.5,
47                 WeightX = 1,
48                 WeightY = 1,
49                 IsIndicatorFocusable = true
50             };
51
52             Label lb1 = new Label(window)
53             {
54                 AlignmentX = -1,
55                 AlignmentY = 0,
56                 WeightX = 1,
57                 WeightY = 1,
58                 Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString()),
59             };
60             lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
61
62             Label lb2 = new Label(window)
63             {
64                 AlignmentX = -1,
65                 AlignmentY = 0,
66                 WeightX = 1,
67                 WeightY = 1,
68                 Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString()),
69             };
70             lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
71
72             Button btn1 = new Button(window)
73             {
74                 AlignmentX = -1,
75                 AlignmentY = 0,
76                 WeightX = 1,
77                 WeightY = 1,
78                 Text = "Change IndicatorVisibleMode"
79             };
80             btn1.Clicked += (s, e) =>
81             {
82                 sld.IndicatorVisibleMode = (SliderIndicatorVisibleMode)(((int)sld.IndicatorVisibleMode + 1) % 4);
83                 lb1.Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString());
84                 lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
85             };
86
87             Button btn2 = new Button(window)
88             {
89                 AlignmentX = -1,
90                 AlignmentY = 0,
91                 WeightX = 1,
92                 WeightY = 1,
93                 Text = "Change IsIndicatorVisible"
94             };
95             btn2.Clicked += (s, e) =>
96             {
97                 sld.IsIndicatorVisible = !sld.IsIndicatorVisible;
98                 lb2.Text = string.Format("IsIndicatorVisible={0}", sld.IsIndicatorVisible.ToString());
99                 lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
100             };
101
102             table.Pack(sld, 1, 1, 2, 1);
103             table.Pack(lb1, 1, 2, 2, 1);
104             table.Pack(lb2, 1, 3, 2, 1);
105             table.Pack(btn1, 1, 4, 2, 1);
106             table.Pack(btn2, 1, 5, 2, 1);
107
108             sld.Show();
109             lb1.Show();
110             lb2.Show();
111             btn1.Show();
112             btn2.Show();
113
114             sld.ValueChanged += (s, e) =>
115             {
116                 lb1.Text = string.Format("IndicatorVisibleMode={0}", sld.IndicatorVisibleMode.ToString());
117                 lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
118
119                 lb2.Text = string.Format("IsIndicatorVisible={0}", sld.IsIndicatorVisible.ToString());
120                 lb2.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
121             };
122         }
123     }
124 }