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 public class ScreenInformationTest : TestCaseBase
24 public override string TestName => "ScreenInformationTest";
25 public override string TestDescription => "To get screen information";
30 public override void Run(Window window)
32 Conformant conformant = new Conformant(window);
34 Box box = new Box(window);
36 conformant.SetContent(box);
37 Label label = new Label(window);
38 label.SetAlignment(-1, 0);
39 label.SetWeight(1, 0);
40 label.Text = string.Format("<span color=#FFFFFF , font_size=50>ScreenSize : {0}x{1}", window.ScreenSize.Width, window.ScreenSize.Height);
43 Label label2 = new Label(window);
44 label2.SetAlignment(-1, 0);
45 label2.SetWeight(1, 0);
46 label2.Text = string.Format("<span color=#FFFFFF , font_size=50>ScreenDPI : xdpi : {0} ydpi : {1}", window.ScreenDpi.X, window.ScreenDpi.Y);
51 EvasObject CreatePage(Window parent)
53 Box box = new Box(parent);
56 Label label = new Label(parent)
58 Text = string.Format("{0} Page", _sequence++),
62 Button push = new Button(parent)
68 Button pop = new Button(parent)
79 push.Clicked += (s, e) =>
81 _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence - 1));
84 pop.Clicked += (s, e) =>
86 var item = _navi.NavigationStack.LastOrDefault();
87 int nativePointer = (int)(IntPtr)(item.Content);
88 Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer);
90 Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer);
93 push.Resize(500, 100);
95 label.Resize(500, 100);
96 box.SetLayoutCallback(() =>
98 Console.WriteLine("Layout callback with : {0}", box.Geometry);
99 var rect = box.Geometry;
100 label.Move(rect.X, rect.Y);
101 push.Move(rect.X, rect.Y + 100);
102 pop.Move(rect.X, rect.Y + 200);