1 using Tizen.Applications;
3 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 using System.Diagnostics;
22 namespace ElmSharp.Test
24 class WindowInternalTest : TestCaseBase
26 public override string TestName => "WindowInternalTest";
27 public override string TestDescription => "Window Test";
29 public override void Run(Window window)
31 var firstWindow = (Application.Current as TestRunner)?._firstPageWindow;
33 firstWindow.Unrealize();
35 Button button1 = new Button(window) {
38 button1.Resize(window.ScreenSize.Width, 100);
42 button1.Clicked += (e, o) =>
44 window.Iconified = true;
47 Button button2 = new Button(window)
51 button2.Resize(window.ScreenSize.Width, 100);
55 button2.Clicked += (e, o) =>
57 Debug.WriteLine("@@KeyGrab");
58 window.KeyGrab(EvasKeyEventArgs.PlatformHomeButtonName, true);
59 window.WinKeyGrab(EvasKeyEventArgs.PlatformHomeButtonName, KeyGrabMode.Exclusive);
62 Button button3 = new Button(window)
64 Text = "WinUnKeyGrab",
66 button3.Resize(window.ScreenSize.Width, 100);
70 button3.Clicked += (e, o) =>
72 Debug.WriteLine("@@UnKeyGrab");
73 window.WinKeyUngrab(EvasKeyEventArgs.PlatformHomeButtonName);
74 window.KeyUngrab(EvasKeyEventArgs.PlatformHomeButtonName);
77 window.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, true);
78 EventHandler<EvasKeyEventArgs> handler = (s, e) =>
80 Debug.WriteLine("@@KeyDown start" + e.KeyName);
82 if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
84 Application.Current.Exit();
86 if (e.KeyName == EvasKeyEventArgs.PlatformHomeButtonName)
88 Debug.WriteLine("@@KeyDown OK : " + window.Iconified);
89 window.Iconified = !window.Iconified;
93 window.KeyUp += handler;