[NUI][TCSACR-417] Add Page Navigation API 00/258300/3
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 10 May 2021 10:02:37 +0000 (19:02 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 14 May 2021 02:37:28 +0000 (11:37 +0900)
File - src/Tizen.NUI.Components/Controls/Navigation/Navigator.cs

  - Property
    [Add] int PageCount{ get; }

   - Method
    [Add] public void Push(Page page)
    [Add] public Page Pop()
    [Add] public Page GetPage(int index)
    [Add] public int IndexOf(Page page)
    [Add] public void Insert(int index, Page page)
    [Add] public void InsertBefore(Page before, Page page)
    [Add] public void Remove(Page page)
    [Add] public void RemoveAt(int index)
    [Add] public Page Peek()
    [Add] public static Navigator GetDefaultNavigator(Window window)

File - src/Tizen.NUI.Components/Controls/Navigation/Page.cs

  - Property

    [Add] public Navigator Navigator { get; }

Change-Id: I2554a5ff620659906a36ad538ad05e7c2297571b
Signed-off-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSNavigator.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPage.cs [new file with mode: 0755]

diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSNavigator.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSNavigator.cs
new file mode 100755 (executable)
index 0000000..5c6e5f5
--- /dev/null
@@ -0,0 +1,323 @@
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components.Test;
+
+namespace Tizen.NUI.Components.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.Components.Navigator Tests")]
+    public class NavigatorTests
+    {
+        private const string TAG = "Components";
+
+        public NavigatorTests()
+        {
+        }
+
+        ~NavigatorTests()
+        {
+        }
+
+        [SetUp]
+        public void Init()
+        {
+            Tizen.Log.Info(TAG, "Init() is called!");
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            Tizen.Log.Info(TAG, "Destroy() is called!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Create a Navigator object. Check whether Navigator is successfully created or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.Navigator C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Navigator_INIT()
+        {
+            /* TEST CODE */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test PageCount. Check PageCount is readable.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.PageCount A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void PageCount_CHECK_GET_VALUE()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            /* TEST CODE */
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Push. Check Push works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.Push M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Push_CHECK()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            /* TEST CODE */
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Pop. Check Pop works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.Pop M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Pop_CHECK_RETURN_VALUE()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+            /* TEST CODE */
+            var ret = navigator.Pop();
+            Assert.AreEqual(0, navigator.PageCount, "Retrieved PageCount should be equal to 0.");
+            Assert.AreSame(page, ret, "Retrieved Page should be the same with the pushed page.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test GetPage. Check GetPage works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.GetPage M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void GetPage_CHECK_RETURN_VALUE()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            /* TEST CODE */
+            navigator.Push(page);
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test IndexOf. Check IndexOf works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.IndexOf M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void IndexOf_CHECK_RETURN_VALUE()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            /* TEST CODE */
+            navigator.Push(page);
+            Assert.AreEqual(0, navigator.IndexOf(page), "Retrieved IndexOf should be equal to 0.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Insert. Check Insert works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.Insert M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Insert_CHECK()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            /* TEST CODE */
+            navigator.Insert(0, page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the inserted page.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test InsertBefore. Check InsertBefore works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.InsertBefore M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void InsertBefore_CHECK()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+            var page2 = new ContentPage();
+            Assert.IsNotNull(page2, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page2, "Costruct ContentPage Fail");
+
+            /* TEST CODE */
+            navigator.InsertBefore(page, 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 inserted page.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Remove. Check Remove works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.Remove M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Remove_CHECK()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+            /* TEST CODE */
+            navigator.Remove(page);
+            Assert.AreEqual(0, navigator.PageCount, "Retrieved PageCount should be equal to 0.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test RemoveAt. Check RemoveAt works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.RemoveAt M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void RemoveAt_CHECK()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+            /* TEST CODE */
+            navigator.RemoveAt(0);
+            Assert.AreEqual(0, navigator.PageCount, "Retrieved PageCount should be equal to 0.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Peek. Check Peek works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.Peek M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Peek_CHECK_RETURN_VALUE()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new ContentPage();
+            Assert.IsNotNull(page, "Can't create success object ContentPage");
+            Assert.IsInstanceOf<ContentPage>(page, "Costruct ContentPage Fail");
+
+            navigator.Push(page);
+            Assert.AreEqual(1, navigator.PageCount, "Retrieved PageCount should be equal to 1.");
+            Assert.AreSame(page, navigator.GetPage(0), "Retrieved Page should be the same with the pushed page.");
+
+            /* TEST CODE */
+            Assert.AreSame(page, navigator.Peek(), "Retrieved Page should be the same with the pushed page.");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test GetDefaultNavigator. Check GetDefaultNavigator works or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Navigator.GetDefaultNavigator M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void GetDefaultNavigator_CHECK_RETURN_VALUE()
+        {
+            /* TEST CODE */
+            var navigator = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+        }
+    }
+}
diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPage.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSPage.cs
new file mode 100755 (executable)
index 0000000..e974626
--- /dev/null
@@ -0,0 +1,78 @@
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components.Test;
+
+namespace Tizen.NUI.Components.Tests
+{
+    [TestFixture]
+    [Description("Tizen.NUI.Components.Page Tests")]
+    public class PageTests
+    {
+        private const string TAG = "Components";
+
+        public PageTests()
+        {
+        }
+
+        ~PageTests()
+        {
+        }
+
+        [SetUp]
+        public void Init()
+        {
+            Tizen.Log.Info(TAG, "Init() is called!");
+        }
+
+        [TearDown]
+        public void Destroy()
+        {
+            Tizen.Log.Info(TAG, "Destroy() is called!");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Create a Page object. Check whether Page is successfully created or not.")]
+        [Property("SPEC", "Tizen.NUI.Components.Page.Page C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Page_INIT()
+        {
+            /* TEST CODE */
+            var page = new MyPage();
+            Assert.IsNotNull(page, "Can't create success object Page");
+            Assert.IsInstanceOf<Page>(page, "Costruct Page Fail");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Test Navigator. Check Navigator is readable.")]
+        [Property("SPEC", "Tizen.NUI.Components.Page.Navigator A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRO")]
+        [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")]
+        public void Navigator_CHECK_GET_VALUE()
+        {
+            /* PRECONDITION */
+            var navigator = new Navigator();
+            Assert.IsNotNull(navigator, "Can't create success object Navigator");
+            Assert.IsInstanceOf<Navigator>(navigator, "Costruct Navigator Fail");
+
+            var page = new MyPage();
+            Assert.IsNotNull(page, "Can't create success object Page");
+            Assert.IsInstanceOf<Page>(page, "Costruct Page Fail");
+
+            /* TEST CODE */
+            navigator.Push(page);
+            Assert.AreSame(navigator, page.Navigator, "Retrieved Navigator should be the same with the navigator which pushes the page.");
+        }
+
+        public class MyPage : Page
+        {
+        }
+    }
+}