From 835e0a098ba97cee71e4e0913634fbd0d7b50256 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Thu, 13 May 2021 20:47:11 +0900 Subject: [PATCH] [NUI][TCSACR-420] Add TabView, TabBar, TabButton, TabContent classes File - src/Tizen.NUI.Components/Controls/TabView.cs - Class [Add] public class TabView - Constructor [Add] public TabView() - Property [Add] public TabBar TabBar { get; } [Add] public TabContent Content { get; } - Method [Add] public void AddTab(TabButton tabButton, View view) [Add] public void RemoveTab(int index) File - src/Tizen.NUI.Components/Controls/TabBar.cs - Class [Add] public class TabBar - Constructor [Add] public TabBar() - Property [Add] public int TabButtonCount { get; } - Method [Add] public TabButton GetTabButton(int index) File - src/Tizen.NUI.Components/Controls/TabButton.cs - Class [Add] public class TabButton - Constructor [Add] public TabButton() File - src/Tizen.NUI.Components/Controls/TabContent.cs - Class [Add] public class TabContent - Constructor [Add] public TabContent() - Property [Add] public int ViewCount { get; } - Method [Add] public View GetView(int index) Change-Id: Idc11a01cbad6fac3bc4ca35b17601e02cccf0a08 --- .../testcase/TSTabBar.cs | 155 ++++++++++++++++ .../testcase/TSTabButton.cs | 51 ++++++ .../testcase/TSTabContent.cs | 155 ++++++++++++++++ .../testcase/TSTabView.cs | 204 +++++++++++++++++++++ 4 files changed, 565 insertions(+) create mode 100755 tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabBar.cs create mode 100755 tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabButton.cs create mode 100755 tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabContent.cs create mode 100755 tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabView.cs diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabBar.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabBar.cs new file mode 100755 index 0000000..8005874 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabBar.cs @@ -0,0 +1,155 @@ +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.TabBar Tests")] + public class TabBarTests + { + private const string TAG = "Components"; + + public TabBarTests() + { + } + + ~TabBarTests() + { + } + + [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 TabBar object. Check whether TabBar is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabBar.TabBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TabBar_INIT() + { + /* TEST CODE */ + var tabBar = new TabBar(); + Assert.IsNotNull(tabBar, "Can't create success object TabBar"); + Assert.IsInstanceOf(tabBar, "Costruct TabBar Fail"); + } + + [Test] + [Category("P1")] + [Description("Test TabButtonCount. Check whether TabButtonCount is readable.")] + [Property("SPEC", "Tizen.NUI.Components.TabBar.TabButtonCount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TabButtonCount_CHECK_GET_VALUE() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Should not be null"); + + var content = new View(); + Assert.IsNotNull(content, "Should not be null"); + + tabView.AddTab(tabButton, content); + + Assert.AreEqual(1, tabView.TabBar.TabButtonCount, "Retrieved TabBar.TabButtonCount should be equal to 1."); + } + + [Test] + [Category("P1")] + [Description("Test GetTabButton. Check whether GetTabButton works or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabBar.GetTabButton M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void GetTabButton_CHECK_RETURN_VALUE() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Should not be null"); + + var content = new View(); + Assert.IsNotNull(content, "Should not be null"); + + tabView.AddTab(tabButton, content); + + Assert.AreSame(tabButton, tabView.TabBar.GetTabButton(0), "Retrieved TabBar.GetTabButton(0) should be the same with the set value."); + } + + [Test] + [Category("P2")] + [Description("Test GetTabButton with invalid argument.")] + [Property("SPEC", "Tizen.NUI.Components.TabBar.GetTabButton M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void GetTabButton_CHECK_INVALID_ARGUMENTS() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + try + { + var tabButton = tabView.TabBar.GetTabButton(-1); + Assert.Fail("Should return argument exception"); + } + catch(ArgumentException e) + { + Assert.Pass("ArgumentException: passed!"); + } + } + + [Test] + [Category("P2")] + [Description("Test GetTabButton with invalid argument.")] + [Property("SPEC", "Tizen.NUI.Components.TabBar.GetTabButton M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void GetTabButton_CHECK_INVALID_ARGUMENTS2() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + try + { + var tabButton = tabView.TabBar.GetTabButton(0); + Assert.Fail("Should return argument exception"); + } + catch(ArgumentException e) + { + Assert.Pass("ArgumentException: passed!"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabButton.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabButton.cs new file mode 100755 index 0000000..46a1629 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabButton.cs @@ -0,0 +1,51 @@ +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.TabButton Tests")] + public class TabButtonTests + { + private const string TAG = "Components"; + + public TabButtonTests() + { + } + + ~TabButtonTests() + { + } + + [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 TabButton object. Check whether TabButton is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabButton.TabButton C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TabButton_INIT() + { + /* TEST CODE */ + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Can't create success object TabButton"); + Assert.IsInstanceOf(tabButton, "Costruct TabButton Fail"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabContent.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabContent.cs new file mode 100755 index 0000000..dd5a718 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabContent.cs @@ -0,0 +1,155 @@ +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.TabContent Tests")] + public class TabContentTests + { + private const string TAG = "Components"; + + public TabContentTests() + { + } + + ~TabContentTests() + { + } + + [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 TabContent object. Check whether TabContent is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabContent.TabContent C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TabContent_INIT() + { + /* TEST CODE */ + var tabContent = new TabContent(); + Assert.IsNotNull(tabContent, "Can't create success object TabContent"); + Assert.IsInstanceOf(tabContent, "Costruct TabContent Fail"); + } + + [Test] + [Category("P1")] + [Description("Test ViewCount. Check whether ViewCount is readable.")] + [Property("SPEC", "Tizen.NUI.Components.TabContent.ViewCount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void ViewCount_CHECK_GET_VALUE() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Should not be null"); + + var content = new View(); + Assert.IsNotNull(content, "Should not be null"); + + tabView.AddTab(tabButton, content); + + Assert.AreEqual(1, tabView.Content.ViewCount, "Retrieved Content.ViewCount should be equal to 1."); + } + + [Test] + [Category("P1")] + [Description("Test GetView. Check whether GetView works or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabContent.GetView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void GetView_CHECK_RETURN_VALUE() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Should not be null"); + + var content = new View(); + Assert.IsNotNull(content, "Should not be null"); + + tabView.AddTab(tabButton, content); + + Assert.AreSame(content, tabView.Content.GetView(0), "Retrieved Content.GetView(0) should be the same with the set value."); + } + + [Test] + [Category("P2")] + [Description("Test GetView with invalid argument.")] + [Property("SPEC", "Tizen.NUI.Components.TabContent.GetView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void GetView_CHECK_INVALID_ARGUMENTS() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + try + { + var view = tabView.Content.GetView(-1); + Assert.Fail("Should return argument exception"); + } + catch(ArgumentException e) + { + Assert.Pass("ArgumentException: passed!"); + } + } + + [Test] + [Category("P2")] + [Description("Test GetView with invalid argument.")] + [Property("SPEC", "Tizen.NUI.Components.TabContent.GetView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void GetView_CHECK_INVALID_ARGUMENTS2() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + try + { + var view = tabView.Content.GetView(0); + Assert.Fail("Should return argument exception"); + } + catch(ArgumentException e) + { + Assert.Pass("ArgumentException: passed!"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabView.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabView.cs new file mode 100755 index 0000000..bfc9349 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSTabView.cs @@ -0,0 +1,204 @@ +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.TabView Tests")] + public class TabViewTests + { + private const string TAG = "Components"; + + public TabViewTests() + { + } + + ~TabViewTests() + { + } + + [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 TabView object. Check whether TabView is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.TabView C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TabView_INIT() + { + /* TEST CODE */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + } + + [Test] + [Category("P1")] + [Description("Test TabBar. Check whether TabBar is readable.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.TabBar A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TabBar_CHECK_GET_VALUE() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + Assert.IsNotNull(tabView.TabBar, "Can't get object TabBar"); + Assert.IsInstanceOf(tabView.TabBar, "Get TabBar Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Content. Check whether Content is readable.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.Content A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void Content_CHECK_GET_VALUE() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + Assert.IsNotNull(tabView.Content, "Can't get object TabContent"); + Assert.IsInstanceOf(tabView.Content, "Get TabContent Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AddTab. Check whether AddTab works or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.AddTab M")] + [Property("SPEC_URL", " - ")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AddTab_CHECK() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Should not be null"); + + var content = new View(); + Assert.IsNotNull(content, "Should not be null"); + + tabView.AddTab(tabButton, content); + + Assert.AreEqual(1, tabView.TabBar.TabButtonCount, "Retrieved TabBar.TabButtonCount should be equal to 1."); + Assert.AreSame(tabButton, tabView.TabBar.GetTabButton(0), "Retrieved TabBar.GetTabButton(0) should be the same with the set value."); + Assert.AreEqual(1, tabView.Content.ViewCount, "Retrieved Content.ViewCount should be equal to 1."); + Assert.AreSame(content, tabView.Content.GetView(0), "Retrieved Content.GetView(0) should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test RemoveTab. Check whether RemoveTab works or not.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.RemoveTab M")] + [Property("SPEC_URL", " - ")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void RemoveTab_CHECK() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + var tabButton = new TabButton(); + Assert.IsNotNull(tabButton, "Should not be null"); + + var content = new View(); + Assert.IsNotNull(content, "Should not be null"); + + tabView.AddTab(tabButton, content); + + Assert.AreEqual(1, tabView.TabBar.TabButtonCount, "Retrieved TabBar.TabButtonCount should be equal to 1."); + Assert.AreSame(tabButton, tabView.TabBar.GetTabButton(0), "Retrieved TabBar.GetTabButton(0) should be the same with the set value."); + Assert.AreEqual(1, tabView.Content.ViewCount, "Retrieved Content.ViewCount should be equal to 1."); + Assert.AreSame(content, tabView.Content.GetView(0), "Retrieved Content.GetView(0) should be the same with the set value."); + + /* TEST CODE */ + tabView.RemoveTab(0); + + Assert.AreEqual(0, tabView.TabBar.TabButtonCount, "Retrieved TabBar.TabButtonCount should be equal to 0."); + Assert.AreEqual(0, tabView.Content.ViewCount, "Retrieved Content.ViewCount should be equal to 0."); + } + + [Test] + [Category("P2")] + [Description("Test RemoveTab with invalid argument.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.RemoveTab M")] + [Property("SPEC_URL", " - ")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void RemoveTab_CHECK_INVALID_ARGUMENTS() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + try + { + tabView.RemoveTab(-1); + Assert.Fail("Should return argument exception"); + } + catch(ArgumentException e) + { + Assert.Pass("ArgumentException: passed!"); + } + } + + [Test] + [Category("P2")] + [Description("Test RemoveTab with invalid argument.")] + [Property("SPEC", "Tizen.NUI.Components.TabView.RemoveTab M")] + [Property("SPEC_URL", " - ")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void RemoveTab_CHECK_INVALID_ARGUMENTS2() + { + /* PRECONDITION */ + var tabView = new TabView(); + Assert.IsNotNull(tabView, "Can't create success object TabView"); + Assert.IsInstanceOf(tabView, "Costruct TabView Fail"); + + /* TEST CODE */ + try + { + tabView.RemoveTab(0); + Assert.Fail("Should return argument exception"); + } + catch(ArgumentException e) + { + Assert.Pass("ArgumentException: passed!"); + } + } + } +} -- 2.7.4