Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / RadioTest1.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 RadioTest1 : TestCaseBase
26     {
27         public override string TestName => "RadioTest1";
28         public override string TestDescription => "To test basic operation of Radio";
29
30         Label _lb1;
31
32         public override void Run(Window window)
33         {
34             Conformant conformant = new Conformant(window);
35             conformant.Show();
36             Box box = new Box(window);
37             conformant.SetContent(box);
38             box.Show();
39
40             Radio rd1 = new Radio(window)
41             {
42                 StateValue = 1,
43                 Text = "<span color=#ffffff>Value #1</span>",
44                 AlignmentX = -1,
45                 AlignmentY = 0,
46                 WeightX = 1,
47                 WeightY = 1
48             };
49             Radio rd2 = new Radio(window)
50             {
51                 StateValue = 2,
52                 Text = "<span color=#ffffff>Value #2</span>",
53                 AlignmentX = -1,
54                 AlignmentY = 0,
55                 WeightX = 1,
56                 WeightY = 1
57             };
58             Radio rd3 = new Radio(window)
59             {
60                 StateValue = 3,
61                 Text = "<span color=#ffffff>Value #3</span>",
62                 AlignmentX = -1,
63                 AlignmentY = 0,
64                 WeightX = 1,
65                 WeightY = 1
66             };
67             rd2.SetGroup(rd1);
68             rd3.SetGroup(rd2);
69
70             rd1.ValueChanged += OnRadioValueChanged;
71             rd2.ValueChanged += OnRadioValueChanged;
72             rd3.ValueChanged += OnRadioValueChanged;
73
74             _lb1 = new Label(window)
75             {
76                 AlignmentX = -1,
77                 AlignmentY = 0,
78                 WeightX = 1,
79                 WeightY = 1
80             };
81
82             box.PackEnd(_lb1);
83             box.PackEnd(rd1);
84             box.PackEnd(rd2);
85             box.PackEnd(rd3);
86
87             _lb1.Show();
88             rd1.Show();
89             rd2.Show();
90             rd3.Show();
91         }
92
93         void OnRadioValueChanged(object sender, EventArgs e)
94         {
95             _lb1.Text = string.Format("Value Changed: {0}", ((Radio)sender).GroupValue);
96             _lb1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#ffffff'";
97         }
98     }
99 }