From: Jaehyun Cho Date: Thu, 13 May 2021 06:54:48 +0000 (+0900) Subject: [NUI][TCSACR-418] Add AppBar class X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F258301%2F3;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI][TCSACR-418] Add AppBar class File - src/Tizen.NUI.Components/Controls/Navigation/AppBar.cs - Class [Add] public class AppBar - Constructor [Add] public AppBar() [Add] public AppBar(string style) [Add] public AppBar(AppBarStyle appBarStyle) - Property [Add] public bool AutoNavigationContent { get; set; } [Add] public string Title { get; set; } [Add] public IEnumerable Actions { get; set; } [Add] public View NavigationContent { get; set; } [Add] public View TitleContent { get; set; } [Add] public View ActionContent { get; set; } - Method [Add] public override void ApplyStyle(ViewStyle viewStyle) File - src/Tizen.NUI.Components/Controls/Navigation/ContentPage.cs - Property [Add] public AppBar AppBar { get; set; } File - src/Tizen.NUI.Components/Style/Navigation/AppBarStyle.cs - Class [Add] public class AppBarStyle - Constructor [Add] public AppBarStyle() [Add] public AppBarStyle(AppBarStyle appBarStyle) - Property [Add] public ButtonStyle BackButton { get; set; } [Add] public TextLabelStyle TitleTextLabel { get; set; } [Add] public ViewStyle ActionView { get; set; } [Add] public ButtonStyle ActionButton { get; set; } - Method [Add] public override void CopyFrom(BindableObject bindableObject) Change-Id: I96c5a3e9110dae3c6d69cc504d2f42567c318b6e --- diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAppBar.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAppBar.cs new file mode 100755 index 0000000..a7b46f3 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAppBar.cs @@ -0,0 +1,283 @@ +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.AppBar Tests")] + public class AppBarTests + { + private const string TAG = "Components"; + + public AppBarTests() + { + } + + ~AppBarTests() + { + } + + [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 AppBar object. Check whether AppBar is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.AppBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBar_INIT() + { + /* TEST CODE */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Costruct AppBar Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AppBar constructor using style. Check whether AppBar is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.AppBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBar_INIT_WITH_STRING() + { + /* PRECONDITION */ + StyleManager.Instance.Theme = "default"; + StyleManager.Instance.RegisterStyle("defaultAppBar", "default", typeof(DefaultAppBarStyle)); + + /* TEST CODE */ + var appBar = new AppBar("defaultAppBar"); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Costruct AppBar with style Fail"); + } + + [Test] + [Category("P2")] + [Description("Check exception when constructing a AppBar with null string style.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.AppBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("COVPARAM", "string")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBar_INIT_WITH_NULL_STRING_Exception() + { + /* TEST CODE */ + try + { + var appBar = new AppBar(""); + Assert.Fail("Should throw the Exception: There is null string style!"); + } + catch (InvalidOperationException e) + { + Assert.Pass("InvalidOperationException: passed!"); + } + } + + [Test] + [Category("P1")] + [Description("Test AppBar constructor using style. Check whether AppBar is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.AppBar C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "AppBarStyle")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBar_INIT_WITH_STYLE() + { + /* PRECONDITION */ + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style, "Costruct AppBarStyle Fail"); + + /* TEST CODE */ + var appBar = new AppBar(style); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Costruct AppBar with style Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AutoNavigationContent. Check whether AutoNavigationContent is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.AutoNavigationContent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AutoNavigationContent_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + /* TEST CODE */ + Assert.AreEqual(true, appBar.AutoNavigationContent, "Retrieved AutoNavigationContent should be equal to 1."); + + bool autoNavigationContent = false; + appBar.AutoNavigationContent = autoNavigationContent; + Assert.AreEqual(autoNavigationContent, appBar.AutoNavigationContent, "Retrieved AutoNavigationContent should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test Title. Check whether Title is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.Title A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void Title_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + /* TEST CODE */ + string title = "NewTitle"; + appBar.Title = title; + Assert.AreEqual(title, appBar.Title, "Retrieved Title should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test Actions. Check whether Actions is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.Actions A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void Actions_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + /* TEST CODE */ + View[] actions = new View[] { new View(), new View() }; + Assert.IsNotNull(actions, "Should not be null"); + + appBar.Actions = actions; + + int i = 0; + foreach (var action in appBar.Actions) + { + Assert.AreSame(actions[i], action, "Retrieved Actions should be the same with the set value."); + i++; + } + } + + [Test] + [Category("P1")] + [Description("Test NavigationContent. Check whether NavigationContent is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.NavigationContent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void NavigationContent_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + /* TEST CODE */ + View view = new View(); + Assert.IsNotNull(view, "Should not be null"); + + appBar.NavigationContent = view;; + Assert.AreEqual(view, appBar.NavigationContent, "Retrieved NavigationContent should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test TitleContent. Check whether TitleContent is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.TitleContent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TitleContent_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + /* TEST CODE */ + View view = new View(); + Assert.IsNotNull(view, "Should not be null"); + + appBar.TitleContent = view;; + Assert.AreEqual(view, appBar.TitleContent, "Retrieved TitleContent should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test ActionContent. Check whether ActionContent is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.ActionContent A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void ActionContent_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + /* TEST CODE */ + View view = new View(); + Assert.IsNotNull(view, "Should not be null"); + + appBar.ActionContent = view;; + Assert.AreEqual(view, appBar.ActionContent, "Retrieved ActionContent should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test ApplyStyle. Check whether ApplyStyle works or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBar.ApplyStyle M")] + [Property("SPEC_URL", " - ")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void ApplyStyle_CHECK() + { + try + { + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Should not be null"); + + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Should not be null"); + + appBar.ApplyStyle(style); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + public class DefaultAppBarStyle : StyleBase + { + protected override ViewStyle GetViewStyle() + { + return new AppBarStyle(); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAppBarStyle.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAppBarStyle.cs new file mode 100755 index 0000000..489fc5a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSAppBarStyle.cs @@ -0,0 +1,185 @@ +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.AppBarStyle Tests")] + public class AppBarStyleTests + { + private const string TAG = "Components"; + + public AppBarStyleTests() + { + } + + ~AppBarStyleTests() + { + } + + [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 AppBarStyle object. Check whether AppBarStyle is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.AppBarStyle C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBarStyle_INIT() + { + /* TEST CODE */ + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style, "Costruct AppBarStyle Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AppBarStyle constructor using style. Check whether AppBarStyle is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.AppBarStyle C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "AppBarStyle")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBarStyle_INIT_WITH_STYLE() + { + /* PRECONDITION */ + var style1 = new AppBarStyle(); + Assert.IsNotNull(style1, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style1, "Costruct AppBarStyle Fail"); + + /* TEST CODE */ + var style2 = new AppBarStyle(style1); + Assert.IsNotNull(style2, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style2, "Costruct AppBarStyle with style Fail"); + } + + [Test] + [Category("P1")] + [Description("Test BackButton. Check whether BackButton is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.BackButton A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void BackButton_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style, "Construct AppBarStyle Fail"); + + /* TEST CODE */ + var backButton = new ButtonStyle(); + Assert.IsNotNull(backButton, "Should not be null"); + + style.BackButton = backButton; + Assert.AreSame(backButton, style.BackButton, "Retrieved BackButton should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test TitleTextLabel. Check whether TitleTextLabel is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.TitleTextLabel A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void TitleTextLabel_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style, "Construct AppBarStyle Fail"); + + /* TEST CODE */ + var titleTextLabel = new TextLabelStyle(); + Assert.IsNotNull(titleTextLabel, "Should not be null"); + + style.TitleTextLabel = titleTextLabel; + Assert.AreSame(titleTextLabel, style.TitleTextLabel, "Retrieved TitleTextLabel should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test ActionView. Check whether ActionView is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.ActionView A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void ActionView_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style, "Construct AppBarStyle Fail"); + + /* TEST CODE */ + var actionView = new ViewStyle(); + Assert.IsNotNull(actionView, "Should not be null"); + + style.ActionView = actionView; + Assert.AreSame(actionView, style.ActionView, "Retrieved ActionView should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test ActionButton. Check whether ActionButton is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.ActionButton A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void ActionButton_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var style = new AppBarStyle(); + Assert.IsNotNull(style, "Can't create success object AppBarStyle"); + Assert.IsInstanceOf(style, "Construct AppBarStyle Fail"); + + /* TEST CODE */ + var actionButton = new ButtonStyle(); + Assert.IsNotNull(actionButton, "Should not be null"); + + style.ActionButton = actionButton; + Assert.AreSame(actionButton, style.ActionButton, "Retrieved ActionButton should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test CopyFrom. Check whether CopyFrom works or not.")] + [Property("SPEC", "Tizen.NUI.Components.AppBarStyle.CopyFrom M")] + [Property("SPEC_URL", " - ")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void CopyFrom_CHECK() + { + try + { + var style1 = new AppBarStyle(); + Assert.IsNotNull(style1, "Should not be null"); + + var style2 = new AppBarStyle(); + Assert.IsNotNull(style2, "Should not be null"); + + style2.CopyFrom(style1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSContentPage.cs b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSContentPage.cs new file mode 100755 index 0000000..07e611a --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Components.Tests/testcase/TSContentPage.cs @@ -0,0 +1,97 @@ +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.ContentPage Tests")] + public class ContentPageTests + { + private const string TAG = "Components"; + + public ContentPageTests() + { + } + + ~ContentPageTests() + { + } + + [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 ContentPage object. Check whether ContentPage is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.Components.ContentPage.ContentPage C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void ContentPage_INIT() + { + /* TEST CODE */ + var page = new ContentPage(); + Assert.IsNotNull(page, "Can't create success object ContentPage"); + Assert.IsInstanceOf(page, "Costruct ContentPage Fail"); + } + + [Test] + [Category("P1")] + [Description("Test AppBar. Check whether AppBar is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.ContentPage.AppBar A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void AppBar_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var page = new ContentPage(); + Assert.IsNotNull(page, "Can't create success object ContentPage"); + Assert.IsInstanceOf(page, "Costruct ContentPage Fail"); + + /* TEST CODE */ + var appBar = new AppBar(); + Assert.IsNotNull(appBar, "Can't create success object AppBar"); + Assert.IsInstanceOf(appBar, "Construct AppBar Fail"); + + page.AppBar = appBar; + Assert.AreSame(appBar, page.AppBar, "Retrieved AppBar should be the same with the set value."); + } + + [Test] + [Category("P1")] + [Description("Test Content. Check whether Content is readable and writable.")] + [Property("SPEC", "Tizen.NUI.Components.ContentPage.Content A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jaehyun Cho, jae_hyun.cho@samsung.com")] + public void Content_CHECK_SET_GET_VALUE() + { + /* PRECONDITION */ + var page = new ContentPage(); + Assert.IsNotNull(page, "Can't create success object ContentPage"); + Assert.IsInstanceOf(page, "Costruct ContentPage Fail"); + + /* TEST CODE */ + var view = new View(); + Assert.IsNotNull(view, "Can't create success object View"); + Assert.IsInstanceOf(view, "Construct View Fail"); + + page.Content = view; + Assert.AreSame(view, page.Content, "Retrieved Content should be the same with the set value."); + } + } +}