Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / BackgroundTest3.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
20 namespace ElmSharp.Test
21 {
22     public class BackgroundTest3 : TestCaseBase
23     {
24         public override string TestName => "BackgroundTest3";
25         public override string TestDescription => "To test basic operation of Background";
26
27         public override void Run(Window window)
28         {
29
30             Conformant conformant = new Conformant(window);
31             conformant.Show();
32
33             Box box = new Box(window)
34             {
35                 AlignmentY = -1,
36                 AlignmentX = -1,
37                 WeightX = 1,
38                 WeightY = 1,
39             };
40             box.Show();
41             conformant.SetContent(box);
42             Background bg = new Background(window)
43             {
44                 AlignmentY = -1,
45                 AlignmentX = -1,
46                 WeightX = 1,
47                 WeightY = 1,
48             };
49             bg.Show();
50             box.PackEnd(bg);
51             Slider red = new Slider(window)
52             {
53                 Minimum = 0,
54                 Maximum = 255,
55                 Text = "Red",
56                 AlignmentX = -1,
57                 WeightX = 1
58             };
59             Slider green = new Slider(window)
60             {
61                 Minimum = 0,
62                 Maximum = 255,
63                 Text = "Green",
64                 AlignmentX = -1,
65                 WeightX = 1
66             };
67             Slider blue = new Slider(window)
68             {
69                 Minimum = 0,
70                 Maximum = 255,
71                 Text = "Blue",
72                 AlignmentX = -1,
73                 WeightX = 1
74             };
75             Slider alpha = new Slider(window)
76             {
77                 Minimum = 0,
78                 Maximum = 255,
79                 Text = "Alpha",
80                 AlignmentX = -1,
81                 WeightX = 1
82             };
83             red.Show();
84             green.Show();
85             blue.Show();
86             alpha.Show();
87             box.PackEnd(red);
88             box.PackEnd(green);
89             box.PackEnd(blue);
90             box.PackEnd(alpha);
91             red.Value = 255;
92             green.Value = 255;
93             blue.Value = 255;
94             alpha.Value = 255;
95
96             bg.Color = new Color(255, 255, 255, 255);
97
98             EventHandler handler = (s, e) =>
99             {
100                 bg.Color = new Color((int)red.Value, (int)green.Value, (int)blue.Value, (int)alpha.Value);
101             };
102
103             red.ValueChanged += handler;
104             green.ValueChanged += handler;
105             blue.ValueChanged += handler;
106             alpha.ValueChanged += handler;
107         }
108     }
109 }