2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 namespace ElmSharp.Test
22 class ButtonTest1 : TestCaseBase
24 public override string TestName => "ButtonTest1";
25 public override string TestDescription => "To test basic operation of Button";
27 void SetButtonEventHandler(Button button)
29 button.Clicked += (s, e) =>
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");
38 button.Pressed += (s, e) =>
40 Console.WriteLine("{0} Pressed!", button.Text);
43 button.Released += (s, e) =>
45 Console.WriteLine("{0} Released!", button.Text);
48 button.Repeated += (s, e) =>
50 Console.WriteLine("{0} Repeated!", button.Text);
56 public override void Run(Window window)
58 Button button1 = new Button(window) {
61 button1.SetPartColor("bg", Color.Red);
62 SetButtonEventHandler(button1);
63 button1.Resize(500, 100);
66 Button button2 = new Button(window) {
68 BackgroundColor = Color.Red,
70 SetButtonEventHandler(button2);
71 button2.Resize(500, 100);
74 Button button3 = new Button(window) {
76 BackgroundColor = new Color(125,200,255, 150)
78 SetButtonEventHandler(button3);
79 button3.Resize(500, 100);
82 Button button4 = new Button(window) {
84 BackgroundColor = new Color(125, 200, 255, 10)
86 SetButtonEventHandler(button4);
87 button4.Resize(500, 100);