3 using NUnit.Framework.TUnit;
5 using Tizen.NUI.Components;
6 using Tizen.NUI.BaseComponents;
8 namespace Tizen.NUI.Components.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("Controls/Navigation/Navigator")]
14 public class NavigationNavigatorTest
16 private const string tag = "NUITEST";
18 internal class MyPage : Page { }
23 tlog.Info(tag, "Init() is called!");
29 tlog.Info(tag, "Destroy() is called!");
34 [Description("PoppedEventArgs Page.")]
35 [Property("SPEC", "Tizen.NUI.Components.PoppedEventArgs.Page A")]
36 [Property("SPEC_URL", "-")]
37 [Property("CRITERIA", "PRW")]
38 [Property("COVPARAM", "")]
39 [Property("AUTHOR", "guowei.wang@samsung.com")]
40 public void PoppedEventArgsPage()
42 tlog.Debug(tag, $"PoppedEventArgsPage START");
44 var testingTarget = new PoppedEventArgs();
45 Assert.IsNotNull(testingTarget, "null handle");
46 Assert.IsInstanceOf<PoppedEventArgs>(testingTarget, "Should return PoppedEventArgs instance.");
48 tlog.Debug(tag, "Page : " + testingTarget.Page);
50 tlog.Debug(tag, $"PoppedEventArgsPage END (OK)");
55 [Description("Navigator Transition.")]
56 [Property("SPEC", "Tizen.NUI.Components.Navigator.Transition A")]
57 [Property("SPEC_URL", "-")]
58 [Property("CRITERIA", "PRW")]
59 [Property("COVPARAM", "")]
60 [Property("AUTHOR", "guowei.wang@samsung.com")]
61 public void NavigatorTransition()
63 tlog.Debug(tag, $"NavigatorTransition START");
65 var testingTarget = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
66 Assert.IsNotNull(testingTarget, "null handle");
67 Assert.IsInstanceOf<Navigator>(testingTarget, "Should return Navigator instance.");
69 Transition ts = new Transition()
71 AlphaFunction = new AlphaFunction(Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn),
72 TimePeriod = new TimePeriod(300)
75 testingTarget.Transition = ts;
76 tlog.Debug(tag, "AppearingTransition : " + testingTarget.Transition);
78 tlog.Debug(tag, $"NavigatorTransition END (OK)");
83 [Description("Navigator PushWithTransition.")]
84 [Property("SPEC", "Tizen.NUI.Components.Navigator.PushWithTransition M")]
85 [Property("SPEC_URL", "-")]
86 [Property("CRITERIA", "MR")]
87 [Property("COVPARAM", "")]
88 [Property("AUTHOR", "guowei.wang@samsung.com")]
89 public void NavigatorPushWithTransition()
91 tlog.Debug(tag, $"NavigatorPushWithTransition START");
93 var testingTarget = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
94 Assert.IsNotNull(testingTarget, "null handle");
95 Assert.IsInstanceOf<Navigator>(testingTarget, "Should return Navigator instance.");
97 Window.Instance.Add(testingTarget);
99 var page1 = CreateFirstPage(testingTarget);
100 var page2 = CreateSecondPage(testingTarget);
101 var page3 = CreateThirdPage(testingTarget);
102 var page4 = CreateFourthPage(testingTarget);
104 Transition ts = new Transition()
106 AlphaFunction = new AlphaFunction(Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn),
107 TimePeriod = new TimePeriod(300)
110 testingTarget.Transition = ts;
111 tlog.Debug(tag, "Transition : " + testingTarget.Transition);
115 testingTarget.PushWithTransition(page1);
116 testingTarget.PopWithTransition();
118 testingTarget.PushWithTransition(page2);
119 testingTarget.PopWithTransition();
121 testingTarget.PushWithTransition(page3);
122 testingTarget.PopWithTransition();
124 testingTarget.PushWithTransition(page4);
125 testingTarget.PopWithTransition();
129 tlog.Debug(tag, e.Message.ToString());
130 Assert.Fail("Caught Exception : Failed!");
133 tlog.Debug(tag, $"NavigatorPushWithTransition END (OK)");
138 [Description("Navigator PushWithTransition.")]
139 [Property("SPEC", "Tizen.NUI.Components.Navigator.PushWithTransition M")]
140 [Property("SPEC_URL", "-")]
141 [Property("CRITERIA", "MR")]
142 [Property("COVPARAM", "")]
143 [Property("AUTHOR", "guowei.wang@samsung.com")]
144 public void NavigatorPushWithTransitionWithNullPage()
146 tlog.Debug(tag, $"NavigatorPushWithTransitionWithNullPage START");
148 var testingTarget = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
150 Assert.IsNotNull(testingTarget, "null handle");
151 Assert.IsInstanceOf<Navigator>(testingTarget, "Should return Navigator instance.");
153 Transition ts = new Transition()
155 AlphaFunction = new AlphaFunction(Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn),
156 TimePeriod = new TimePeriod(300)
159 testingTarget.Transition = ts;
165 testingTarget.PushWithTransition(page);
167 catch (ArgumentNullException)
169 tlog.Debug(tag, $"NavigatorPushWithTransitionWithNullPage END (OK)");
170 Assert.Pass("Caught ArgumentNullException : Passed!");
174 private Page CreateFirstPage(Navigator navigator)
176 var button = new Button()
179 WidthResizePolicy = ResizePolicyType.FillToParent,
180 HeightResizePolicy = ResizePolicyType.FillToParent,
183 var page = new MyPage();
185 page.Appearing += (object sender, PageAppearingEventArgs e) =>
187 global::System.Console.WriteLine("First Page is appearing!");
189 page.Disappearing += (object sender, PageDisappearingEventArgs e) =>
191 global::System.Console.WriteLine("First Page is disappearing!");
194 navigator.Push(page);
199 private Page CreateSecondPage(Navigator navigator)
201 var button = new Button()
203 Text = "Second Page",
204 WidthResizePolicy = ResizePolicyType.FillToParent,
205 HeightResizePolicy = ResizePolicyType.FillToParent,
208 var page = new MyPage();
210 page.Appearing += (object sender, PageAppearingEventArgs e) =>
212 global::System.Console.WriteLine("Second Page is appearing!");
214 page.Disappearing += (object sender, PageDisappearingEventArgs e) =>
216 global::System.Console.WriteLine("Second Page is disappearing!");
219 navigator.Push(page);
224 private Page CreateThirdPage(Navigator navigator)
226 var button = new Button()
229 WidthResizePolicy = ResizePolicyType.FillToParent,
230 HeightResizePolicy = ResizePolicyType.FillToParent,
233 var page = new DialogPage();
235 page.Appearing += (object sender, PageAppearingEventArgs e) =>
237 global::System.Console.WriteLine("Third Page is appearing!");
239 page.Disappearing += (object sender, PageDisappearingEventArgs e) =>
241 global::System.Console.WriteLine("Third Page is disappearing!");
244 navigator.Push(page);
249 private Page CreateFourthPage(Navigator navigator)
251 var button = new Button()
253 Text = "Fourth Page",
254 WidthResizePolicy = ResizePolicyType.FillToParent,
255 HeightResizePolicy = ResizePolicyType.FillToParent,
258 var page = new DialogPage();
260 page.Appearing += (object sender, PageAppearingEventArgs e) =>
262 global::System.Console.WriteLine("Third Page is appearing!");
264 page.Disappearing += (object sender, PageDisappearingEventArgs e) =>
266 global::System.Console.WriteLine("Third Page is disappearing!");
269 navigator.Push(page);