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.
21 using System.Diagnostics;
23 namespace ElmSharp.Test
25 class WindowUtilTest : TestCaseBase
27 public override string TestName => "WindowUtilTest";
28 public override string TestDescription => "Window Util Test";
30 void DeleteWin(Window window)
35 GC.WaitForPendingFinalizers();
38 Window CreateWin(Window parent, WindowType type, bool whiteBg)
40 Window win = new Window(parent, "testwin", type);
43 win.BackButtonPressed += (s, e) =>
50 Conformant conformant = new Conformant(win);
52 Box box = new Box(win)
60 var bg = new Background(win);
61 bg.Color = Color.White;
63 conformant.SetContent(bg);
66 Button button = new Button(win)
68 Text = "Delete Window",
70 button.Resize(win.ScreenSize.Width, 100);
71 button.Move(0, win.ScreenSize.Height - 105);
72 button.SetPartColor("bg", Color.Red);
75 button.Clicked += (e, o) =>
83 public override void Run(Window window)
85 int buttonW = window.ScreenSize.Width / 2 - 10;
88 Button button1 = new Button(window)
90 Text = "Brightness</br>30",
92 button1.Resize(buttonW, buttonH);
96 button1.Clicked += (e, o) =>
98 window.Brightness = 30;
101 Button button2 = new Button(window)
103 Text = "Brightness</br>Default",
105 button2.Resize(buttonW, buttonH);
106 button2.Move(buttonW + 15, 5);
109 button2.Clicked += (e, o) =>
111 window.Brightness = -1;
114 Button button3 = new Button(window)
116 Text = "ScreenMode</br>AlwaysOn",
118 button3.Resize(buttonW, buttonH);
119 button3.Move(5, buttonH + 15);
122 button3.Clicked += (e, o) =>
124 window.ScreenMode = ScreenMode.AlwaysOn;
127 Button button4 = new Button(window)
129 Text = "ScreenMode</br>Default",
131 button4.Resize(buttonW, buttonH);
132 button4.Move(buttonW + 15, buttonH + 15);
135 button4.Clicked += (e, o) =>
137 window.ScreenMode = ScreenMode.Default;
140 Button button5 = new Button(window)
142 Text = "Window Notification Level</br>Top",
144 button5.Resize(window.ScreenSize.Width - 10, buttonH);
145 button5.Move(5, (buttonH +10)* 2 + 5);
148 button5.Clicked += (e, o) =>
150 Window win = CreateWin(window, WindowType.Notification, true);
152 Console.WriteLine("Notifiaction Level : {0}", win.NotificationLevel);
153 win.NotificationLevel = NotificationLevel.Top;
154 Console.WriteLine("Notifiaction Level : {0}", win.NotificationLevel);
156 Label label = new Label(win)
158 Text = string.Format("This Notification Window Level : {0}", win.NotificationLevel),
161 label.Resize(window.ScreenSize.Width, 100);