Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / HoverselTest1.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 using System.Collections.Generic;
20
21 namespace ElmSharp.Test
22 {
23     public class HoverselTest1 : TestCaseBase
24     {
25         public override string TestName => "HoverselTest1";
26         public override string TestDescription => "To test basic operation of Hoversel";
27
28         public override void Run(Window window)
29         {
30             Background bg = new Background(window)
31             {
32                 AlignmentX = -1,
33                 AlignmentY = -1,
34                 WeightX = 1,
35                 WeightY = 1,
36                 Color = Color.White
37             };
38             bg.Show();
39             window.AddResizeObject(bg);
40
41             Hoversel hoversel = new Hoversel(window)
42             {
43                 IsHorizontal = false,
44                 HoverParent = window,
45                 Text = "Hoversel"
46             };
47             hoversel.ItemSelected += (s, e) =>
48             {
49                 Console.WriteLine("ItemSelected : " + e.Item.Label);
50             };
51             hoversel.Dismissed += (s, e) =>
52             {
53                 Console.WriteLine("Hoversel is dismissed");
54             };
55             hoversel.Clicked += (s, e) =>
56             {
57                 Console.WriteLine("Hoversel is Clicked");
58             };
59             hoversel.Expanded += (s, e) =>
60             {
61                 Console.WriteLine("Hoversel is Expanded");
62             };
63
64             HoverselItem item1 = hoversel.AddItem("item1");
65             HoverselItem item2 = hoversel.AddItem("item2");
66             HoverselItem item3 = hoversel.AddItem("item3");
67
68             EventHandler handler = (s, e) =>
69             {
70                 var item = s as HoverselItem;
71                 Console.WriteLine($"{item?.Label} is selected");
72             };
73             item1.ItemSelected += handler;
74             item2.ItemSelected += handler;
75             item3.ItemSelected += handler;
76
77             hoversel.Resize(200, 100);
78             hoversel.Move(100, 100);
79             hoversel.Show();
80
81             Button beginButton = new Button(window)
82             {
83                 Text = "Begin"
84             };
85             beginButton.Clicked += (s, e) =>
86             {
87                 hoversel.HoverBegin();
88             };
89             beginButton.Resize(200, 100);
90             beginButton.Move(100, 500);
91             beginButton.Show();
92         }
93     }
94 }