Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / PanelTest1.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 PanelTest1 : TestCaseBase
23     {
24         public override string TestName => "PanelTest1";
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 NonScrollable</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(false);
53
54             Rectangle redbox = new Rectangle(window)
55             {
56                 AlignmentX = -1,
57                 AlignmentY = -1,
58                 WeightX = 1,
59                 WeightY = 1,
60                 Color = Color.Red,
61             };
62             redbox.Show();
63             panel.SetContent(redbox);
64             panel.Show();
65             panel.IsOpen = true;
66             box.PackEnd(panel);
67
68             Button button1 = new Button(window)
69             {
70                 Text = "Toggle open",
71                 AlignmentX = -1,
72                 AlignmentY = -1,
73                 WeightX = 1,
74             };
75             Button button2 = new Button(window)
76             {
77                 Text = "Toggle direction",
78                 AlignmentX = -1,
79                 AlignmentY = -1,
80                 WeightX = 1,
81             };
82             box.PackEnd(button1);
83             box.PackEnd(button2);
84             button1.Show();
85             button2.Show();
86
87             button1.Clicked += (s, e) =>
88             {
89                 panel.Toggle();
90             };
91             button2.Clicked += (s, e) =>
92             {
93                 panel.Direction = (PanelDirection)((int)(panel.Direction+1) % 4);
94             };
95             panel.Toggled += (s, e) =>
96             {
97                 Console.WriteLine("Panel Toggled!");
98             };
99         }
100         
101     }
102 }