Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / ProgressBarTest2.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 ProgressBarTest2 : TestCaseBase
26     {
27         public override string TestName => "ProgressBarTest2";
28         public override string TestDescription => "To test basic operation of ProgressBar";
29
30         public override void Run(Window window)
31         {
32             Conformant conformant = new Conformant(window);
33             conformant.Show();
34             Box table = new Box(window)
35             {
36                 BackgroundColor = Color.White,
37             };
38             conformant.SetContent(table);
39             table.Show();
40
41             ProgressBar pb1 = new ProgressBar(window)
42             {
43                 Text = "ProgressBar Test",
44                 Style = "process_medium",
45                 Value = 0.1,
46                 AlignmentX = 0,
47                 AlignmentY = 0,
48                 WeightX = 0,
49                 WeightY = 1
50             };
51             pb1.PlayPulse();
52             Label lb1 = new Label(window)
53             {
54                 AlignmentX = -1,
55                 AlignmentY = -1,
56                 WeightX = 1,
57                 WeightY = 1,
58             };
59
60             Button bt1 = new Button(window)
61             {
62                 Text = "Increase Value",
63                 AlignmentX = -1,
64                 AlignmentY = 0,
65                 WeightX = 1,
66                 WeightY = 1
67             };
68
69             bt1.Clicked += (s, e) =>
70             {
71                 Random rand = new Random(DateTime.UtcNow.Millisecond);
72                 pb1.Color = new Color(rand.Next(255), rand.Next(255), rand.Next(255));
73                 lb1.Text = pb1.Color.ToString();
74             };
75
76             Button bt2 = new Button(window)
77             {
78                 Text = "zoom",
79                 AlignmentX = -1,
80                 AlignmentY = 0,
81                 WeightX = 1,
82                 WeightY = 1
83             };
84
85             bt2.Clicked += (s, e) =>
86             {
87                 var map = new EvasMap(4);
88                 var g = pb1.Geometry;
89                 map.PopulatePoints(g, 0);
90                 map.Zoom(2, 2, g.X, g.Y);
91                 pb1.EvasMap = map;
92                 pb1.IsMapEnabled = true;
93             };
94
95             table.PackEnd(pb1);
96             table.PackEnd(lb1);
97             table.PackEnd(bt1);
98             table.PackEnd(bt2);
99
100             pb1.Show();
101             lb1.Show();
102             bt1.Show();
103             bt2.Show();
104         }
105     }
106 }