/* TEST CODE */
var navigator = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
Assert.IsNotNull(navigator, "Can't create success object Navigator");
- Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+ Assert.IsInstanceOf<Navigator>(navigator, "Construct Navigator Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Transition. Check whether Transition is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.Transition A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+ public void Transition_CHECK_SET_GET_VALUE()
+ {
+ /* PRECONDITION */
+ var navigator = new Navigator();
+ Assert.IsNotNull(navigator, "Can't create success object Navigator");
+ Assert.IsInstanceOf<Navigator>(navigator, "Construct Navigator Fail");
+
+ /* TEST CODE */
+ var transition = new Transition();
+ Assert.IsNotNull(transition, "Can't create success object Transition");
+ Assert.IsInstanceOf<Transition>(transition, "Construct Transition Fail");
+
+ navigator.Transition = transition;
+ Assert.AreSame(transition, navigator.Transition, "Retrieved Transition should be the same with the set value.");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Push a page with PushWithTransition method")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.PushWithTransition M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+ public async Task PushWithTransition_CHECK()
+ {
+ /* PRECONDITION */
+ var navigator = new Navigator()
+ {
+ Transition = new Transition()
+ {
+ AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
+ TimePeriod = new TimePeriod(500),
+ }
+ };
+ Assert.IsNotNull(navigator, "Can't create success object Navigator");
+ Assert.IsInstanceOf<Navigator>(navigator, "Construct Navigator Fail");
+
+ var page1 = new ContentPage();
+ Assert.IsNotNull(page1, "Can't create success object ContentPage");
+ Assert.IsInstanceOf<ContentPage>(page1, "Construct ContentPage Fail");
+
+ var page2 = new ContentPage();
+ Assert.IsNotNull(page2, "Can't create success object ContentPage");
+ Assert.IsInstanceOf<ContentPage>(page2, "Construct ContentPage Fail");
+
+ /* TEST CODE */
+ navigator.Push(page1);
+ Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+ Assert.AreSame(page1, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+ navigator.PushWithTransition(page2);
+ await Task.Delay(1000);
+ Assert.AreEqual(2, navigator.PageCount, "Retrieved PageCount should be equal to 2.");
+ Assert.AreSame(page2, navigator.GetPage(1), "Retrieved Page should be the same with the pushed page.");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Push a page with PushWithTransition method")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.PushWithTransition M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+ public void PushWithTransition_CHECK_Exception()
+ {
+ /* PRECONDITION */
+ var navigator = new Navigator()
+ {
+ Transition = new Transition()
+ {
+ AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
+ TimePeriod = new TimePeriod(500),
+ }
+ };
+
+ var page1 = new ContentPage();
+
+ /* TEST CODE */
+ navigator.Push(page1);
+
+ /* TEST CODE */
+ try
+ {
+ navigator.PushWithTransition(null);
+ Assert.Fail("Should throw the ArgumentNullException!");
+ }
+ catch(ArgumentNullException e)
+ {
+ Assert.Pass("ArgumentNullException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Push a page with PopWithTransition method")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.PopWithTransition M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+ public async Task PopWithTransition_CHECK()
+ {
+ /* PRECONDITION */
+ var navigator = new Navigator()
+ {
+ Transition = new Transition()
+ {
+ AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
+ TimePeriod = new TimePeriod(500),
+ }
+ };
+ Assert.IsNotNull(navigator, "Can't create success object Navigator");
+ Assert.IsInstanceOf<Navigator>(navigator, "Construct Navigator Fail");
+
+ var page1 = new ContentPage();
+ Assert.IsNotNull(page1, "Can't create success object ContentPage");
+ Assert.IsInstanceOf<ContentPage>(page1, "Construct ContentPage Fail");
+
+ var page2 = new ContentPage();
+ Assert.IsNotNull(page2, "Can't create success object ContentPage");
+ Assert.IsInstanceOf<ContentPage>(page2, "Construct ContentPage Fail");
+
+ /* TEST CODE */
+ navigator.Push(page1);
+ Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+ Assert.AreSame(page1, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+ navigator.Insert(1, page2);
+ Assert.AreEqual(2, navigator.PageCount, "Retrieved PageCount should be equal to 2.");
+ Assert.AreSame(page2, navigator.GetPage(1), "Retrieved Page should be the same with the pushed page.");
+
+ navigator.PopWithTransition();
+ await Task.Delay(1000);
+ Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+ Assert.AreSame(page1, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Push a page with PopWithTransition method")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.PopWithTransition M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+ public void PopWithTransition_CHECK_Exception()
+ {
+ /* PRECONDITION */
+ var navigator = new Navigator()
+ {
+ Transition = new Transition()
+ {
+ AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
+ TimePeriod = new TimePeriod(500),
+ }
+ };
+
+ /* TEST CODE */
+ try
+ {
+ navigator.PopWithTransition();
+ Assert.Fail("Should throw the InvalidOperationException!");
+ }
+ catch(InvalidOperationException e)
+ {
+ Assert.Pass("InvalidOperationException: passed!");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TransitionFinished. Test whether the TransitionFinished event will be triggered when the Transition is finished.")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.TransitionFinished E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Seungho Baek, sbsh.baek@samsung.com")]
+ public async Task TransitionFinished_CHECK_EVENT()
+ {
+ /* PRECONDITION */
+ var navigator = new Navigator();
+
+ var page1 = new ContentPage()
+ {
+ Content = new View(),
+ DisappearingTransition = new FadeTransition()
+ {
+ TimePeriod = new TimePeriod(1000)
+ }
+ };
+ var page2 = new ContentPage();
+
+ /* TEST CODE */
+ navigator.Push(page1);
+ navigator.Insert(0, page2);
+ Assert.AreEqual(2, navigator.PageCount, "Retrieved PageCount should be equal to 2.");
+ Assert.AreSame(page2, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+ transitionFinished = false;
+ navigator.TransitionFinished += OnTransitionFinished;
+
+ navigator.PopWithTransition();
+
+ await Task.Delay(300);
+ Assert.False(transitionFinished, "transitionFinished should be false.");
+
+ await Task.Delay(1000);
+ Assert.True(transitionFinished, "transitionFinished should be true.");
+
+ navigator.TransitionFinished -= OnTransitionFinished;
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Popped event. Check if Popped event is callable.")]
+ [Property("SPEC", "Tizen.NUI.Components.Navigator.Popped E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+ public async Task Popped_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ bool isCalled = false;
+
+ var navigator = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
+ Assert.IsNotNull(navigator, "Can't create success object Navigator");
+ Assert.IsInstanceOf<Navigator>(navigator, "Construct Navigator Fail");
+
+ var page = new ContentPage();
+ Assert.IsNotNull(page, "Can't create success object ContentPage");
+ Assert.IsInstanceOf<ContentPage>(page, "Construct ContentPage Fail");
+ navigator.Push(page);
+
+ page = new ContentPage();
+ Assert.IsNotNull(page, "Can't create success object ContentPage");
+ Assert.IsInstanceOf<ContentPage>(page, "Construct ContentPage Fail");
+
+ EventHandler<PoppedEventArgs> popped = (sender, args) =>
+ {
+ if (args.Page == page)
+ {
+ isCalled = true;
+ }
+ };
+ navigator.Popped += popped;
+
+ navigator.Push(page);
+
+ await Task.Delay(2000);
+
+ /* TEST CODE */
+ navigator.Pop();
+
+ await Task.Delay(2000);
+
+ Assert.AreEqual(true, isCalled, "Popped event should be called after popping is finished.");
+
+ navigator.Popped -= popped;
+ }
}
}