Merge "[Telephony] Sample App implementation."
[platform/core/csapi/tizenfx.git] / test / ElmSharp.Test / TC / ButtonTest1.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     class ButtonTest1 : TestCaseBase
23     {
24         public override string TestName => "ButtonTest1";
25         public override string TestDescription => "To test basic operation of Button";
26
27         void SetButtonEventHandler(Button button)
28         {
29             button.Clicked += (s, e) =>
30             {
31                 Console.WriteLine("{0} Clicked! : {1}", button.Text, button.BackgroundColor);
32                 Console.WriteLine("{0} Clicked! : {1}", button.Text, button.ClassName);
33                 Console.WriteLine("{0} Clicked! : {1}", button.Text, button.ClassName.ToLower());
34                 Console.WriteLine("{0} Clicked! : {1}", button.Text, button.ClassName.ToLower().Replace("elm_", ""));
35                 Console.WriteLine("{0} Clicked! : {1}", button.Text, button.ClassName.ToLower().Replace("elm_", "") + "/" + "bg");
36             };
37
38             button.Pressed += (s, e) =>
39             {
40                 Console.WriteLine("{0} Pressed!", button.Text);
41             };
42
43             button.Released += (s, e) =>
44             {
45                 Console.WriteLine("{0} Released!", button.Text);
46             };
47
48             button.Repeated += (s, e) =>
49             {
50                 Console.WriteLine("{0} Repeated!", button.Text);
51             };
52
53             button.Show();
54         }
55
56         public override void Run(Window window)
57         {
58             Button button1 = new Button(window) {
59                 Text = "Button 1",
60             };
61             button1.SetPartColor("bg", Color.Red);
62             SetButtonEventHandler(button1);
63             button1.Resize(500, 100);
64             button1.Move(0, 0);
65
66             Button button2 = new Button(window) {
67                 Text = "Button 2",
68                 BackgroundColor = Color.Red,
69             };
70             SetButtonEventHandler(button2);
71             button2.Resize(500, 100);
72             button2.Move(0, 200);
73
74             Button button3 = new Button(window) {
75                 Text = "Button 3",
76                 BackgroundColor = new Color(125,200,255, 150)
77             };
78             SetButtonEventHandler(button3);
79             button3.Resize(500, 100);
80             button3.Move(0, 400);
81
82             Button button4 = new Button(window) {
83                 Text = "Button 4",
84                 BackgroundColor = new Color(125, 200, 255, 10)
85             };
86             SetButtonEventHandler(button4);
87             button4.Resize(500, 100);
88             button4.Move(0, 600);
89         }
90
91     }
92 }