Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / PanelTest2.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 PanelTest2 : TestCaseBase
23     {
24         public override string TestName => "PanelTest2";
25         public override string TestDescription => "To test basic operation of Panel";
26
27         public override void Run(Window window)
28         {
29             Conformant conformant = new Conformant(window);
30             conformant.Show();
31             Box box = new Box(window);
32             conformant.SetContent(box);
33             box.Show();
34
35             Label label = new Label(window)
36             {
37                 Text = "<span color=#ffffff font_size=50>Panel as Scrollable</span>",
38                 AlignmentX = -1,
39                 WeightX = 1,
40             };
41             label.Show();
42             box.PackEnd(label);
43
44             Panel panel = new Panel(window)
45             {
46                 Direction = PanelDirection.Left,
47                 AlignmentX = -1,
48                 AlignmentY = -1,
49                 WeightX = 1,
50                 WeightY = 1,
51             };
52             panel.SetScrollable(true);
53             panel.SetScrollableArea(1.0);
54
55             Rectangle redbox = new Rectangle(window)
56             {
57                 AlignmentX = -1,
58                 AlignmentY = -1,
59                 WeightX = 1,
60                 WeightY = 1,
61                 Color = Color.Red,
62             };
63             redbox.Show();
64             panel.SetContent(redbox);
65             panel.Show();
66             panel.IsOpen = true;
67             box.PackEnd(panel);
68
69             Button button1 = new Button(window)
70             {
71                 Text = "Toggle open",
72                 AlignmentX = -1,
73                 AlignmentY = -1,
74                 WeightX = 1,
75             };
76             Button button2 = new Button(window)
77             {
78                 Text = "Toggle direction",
79                 AlignmentX = -1,
80                 AlignmentY = -1,
81                 WeightX = 1,
82             };
83             box.PackEnd(button1);
84             box.PackEnd(button2);
85             button1.Show();
86             button2.Show();
87
88             button1.Clicked += (s, e) =>
89             {
90                 panel.Toggle();
91             };
92             button2.Clicked += (s, e) =>
93             {
94                 panel.Direction = (PanelDirection)((int)(panel.Direction + 1) % 4);
95             };
96             panel.Toggled += (s, e) =>
97             {
98                 Console.WriteLine("Panel Toggled!");
99             };
100         }
101
102     }
103 }