a06edc15169c4a68a71f09bc233beed5c254b944
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / PanelTest2.cs
1 using System;
2 using ElmSharp;
3
4 namespace ElmSharp.Test
5 {
6     public class PanelTest2 : TestCaseBase
7     {
8         public override string TestName => "PanelTest2";
9         public override string TestDescription => "To test basic operation of Panel";
10
11         public override void Run(Window window)
12         {
13             Conformant conformant = new Conformant(window);
14             conformant.Show();
15             Box box = new Box(window);
16             conformant.SetContent(box);
17             box.Show();
18
19             Label label = new Label(window)
20             {
21                 Text = "<span color=#ffffff font_size=50>Panel as Scrollable</span>",
22                 AlignmentX = -1,
23                 WeightX = 1,
24             };
25             label.Show();
26             box.PackEnd(label);
27
28             Panel panel = new Panel(window)
29             {
30                 Direction = PanelDirection.Left,
31                 AlignmentX = -1,
32                 AlignmentY = -1,
33                 WeightX = 1,
34                 WeightY = 1,
35             };
36             panel.SetScrollable(true);
37             panel.SetScrollableArea(1.0);
38
39             Rectangle redbox = new Rectangle(window)
40             {
41                 AlignmentX = -1,
42                 AlignmentY = -1,
43                 WeightX = 1,
44                 WeightY = 1,
45                 Color = Color.Red,
46             };
47             redbox.Show();
48             panel.SetContent(redbox);
49             panel.Show();
50             panel.IsOpen = true;
51             box.PackEnd(panel);
52
53             Button button1 = new Button(window)
54             {
55                 Text = "Toggle open",
56                 AlignmentX = -1,
57                 AlignmentY = -1,
58                 WeightX = 1,
59             };
60             Button button2 = new Button(window)
61             {
62                 Text = "Toggle direction",
63                 AlignmentX = -1,
64                 AlignmentY = -1,
65                 WeightX = 1,
66             };
67             box.PackEnd(button1);
68             box.PackEnd(button2);
69             button1.Show();
70             button2.Show();
71
72             button1.Clicked += (s, e) =>
73             {
74                 panel.Toggle();
75             };
76             button2.Clicked += (s, e) =>
77             {
78                 panel.Direction = (PanelDirection)((int)(panel.Direction + 1) % 4);
79             };
80         }
81
82     }
83 }