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 BoxLayoutTest1 : TestCaseBase
24 public override string TestName => "BoxLayoutTest1";
25 public override string TestDescription => "Box Layout callback test";
30 public override void Run(Window window)
32 Conformant conformant = new Conformant(window);
35 Naviframe navi = new Naviframe(window)
37 PreserveContentOnPop = true,
38 DefaultBackButtonEnabled = true
42 navi.Popped += (s, e) =>
44 Console.WriteLine("----- Naviframe was popped {0:x} ", (int)(IntPtr)e.Content);
47 navi.Push(CreatePage(window), "0 Page");
49 conformant.SetContent(navi);
52 EvasObject CreatePage(Window parent)
54 Box box = new Box(parent);
57 Label label = new Label(parent)
59 Text = string.Format("{0} Page", _sequence++),
63 Button push = new Button(parent)
69 Button pop = new Button(parent)
80 push.Clicked += (s, e) =>
82 _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence - 1));
85 pop.Clicked += (s, e) =>
87 var item = _navi.NavigationStack.LastOrDefault();
88 int nativePointer = (int)(IntPtr)(item.Content);
89 Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer);
91 Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer);
94 push.Resize(500, 100);
96 label.Resize(500, 100);
97 box.SetLayoutCallback(() =>
99 Console.WriteLine("Layout callback with : {0}", box.Geometry);
100 var rect = box.Geometry;
101 label.Move(rect.X, rect.Y);
102 push.Move(rect.X, rect.Y + 100);
103 pop.Move(rect.X, rect.Y + 200);