Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / BoxTest1.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     class BoxTest1 : TestCaseBase
23     {
24         public override string TestName => "BoxTest1";
25         public override string TestDescription => "To test basic operation of Box";
26
27         Box box;
28
29         public override void Run(Window window)
30         {
31             Conformant conformant = new Conformant(window);
32             conformant.Show();
33             box = new Box(window);
34             box.BackgroundColor = Color.Orange;
35             conformant.SetContent(box);
36             box.Show();
37
38             Button button1 = new Button(window) {
39                 Text = "Button 1",
40                 AlignmentX = -1,
41                 AlignmentY = -1,
42                 WeightX = 1,
43                 WeightY = 1
44             };
45             Button button2 = new Button(window) {
46                 Text = "Button 2",
47                 AlignmentX = -1,
48                 AlignmentY = -1,
49                 WeightX = 1,
50                 WeightY = 1,
51                 BackgroundColor = new Color(50,100,200,75)
52             };
53             Button button3 = new Button(window) {
54                 Text = "Button 3",
55                 AlignmentX = -1,
56                 AlignmentY = -1,
57                 WeightX = 1,
58                 WeightY = 1,
59                 BackgroundColor = Color.Olive
60             };
61
62             box.PackEnd(button1);
63             box.PackEnd(button2);
64             box.PackEnd(button3);
65
66             button1.Show();
67             button2.Show();
68             button3.Show();
69
70             button1.Clicked += Button1_Clicked;
71             button2.Clicked += Button1_Clicked;
72             button3.Clicked += Button1_Clicked;
73         }
74
75         private void Button1_Clicked(object sender, EventArgs e)
76         {
77             Console.WriteLine("{0} Clicked! - Button's BG Color : {1}, Box's BG Color : {2}", ((Button)sender).Text, ((Button)sender).BackgroundColor, box.BackgroundColor);
78         }
79     }
80 }