From 460adfd6b5c554655670661c6ca04779c55226f9 Mon Sep 17 00:00:00 2001 From: SukhyungKang Date: Tue, 25 Apr 2023 07:43:59 +0900 Subject: [PATCH] [Applications][TCSACR-529][Add testcases to set and get window position] Change-Id: I974ff43f0c3a661aaf46ac9466369179c0161554 Signed-off-by: SukhyungKang --- .../testcase/TSAppControl.cs | 124 ++++++++++++++++----- .../testcase/TSWindowPosition.cs | 96 ++++++++++++++++ 2 files changed, 193 insertions(+), 27 deletions(-) create mode 100755 tct-suite-vs/Tizen.Applications.Tests/testcase/TSWindowPosition.cs diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs index ebe3125..e390f1c 100755 --- a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSAppControl.cs @@ -3,8 +3,8 @@ using NUnit.Framework.TUnit; using System.Collections.Generic; using System.Threading.Tasks; using System; -using Tizen.Applications.Exceptions; - +using Tizen.Applications.Exceptions; + namespace Tizen.Applications.Tests { @@ -228,14 +228,14 @@ namespace Tizen.Applications.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] - public void ComponentId_PROPERTY_SET_GET() - { - var componentId = "org.example.frame-component"; - - /* TEST CODE */ - _appControl.ComponentId = componentId; - Assert.IsInstanceOf(_appControl.ComponentId); - Assert.AreEqual(componentId, _appControl.ComponentId, "Property \"ComponentId\": the setting value should be equal to the getting value."); + public void ComponentId_PROPERTY_SET_GET() + { + var componentId = "org.example.frame-component"; + + /* TEST CODE */ + _appControl.ComponentId = componentId; + Assert.IsInstanceOf(_appControl.ComponentId); + Assert.AreEqual(componentId, _appControl.ComponentId, "Property \"ComponentId\": the setting value should be equal to the getting value."); } [Test] @@ -468,25 +468,25 @@ namespace Tizen.Applications.Tests [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")] [Property("COVPARAM", "Tizen.Applications.AppControl")] public void SendLaunchRequest_CHECK_APP_NOT_FOUND_EXCEPTION() - { - + { + /* PRECONDITION * Privilege: http://tizen.org/privilege/appmanager.launch - * */ - - /* TEST CODE */ + * */ + + /* TEST CODE */ var appControl = new AppControl(); appControl.Operation = AppControlOperations.Default; appControl.ApplicationId = _unknownAppId; - try - { - AppControl.SendLaunchRequest(appControl); - Assert.Fail("AppNotFoundException should be occurred"); + try + { + AppControl.SendLaunchRequest(appControl); + Assert.Fail("AppNotFoundException should be occurred"); } catch (AppNotFoundException) - { - Assert.Pass("AppNotFoundException occurs"); + { + Assert.Pass("AppNotFoundException occurs"); } } @@ -500,14 +500,84 @@ namespace Tizen.Applications.Tests [Property("COVPARAM", "Tizen.Applications.AppControl")] public void SendLaunchRequest_CHECK_ARGUNMENT_NULL_EXCEPTION() { - try - { - AppControl.SendLaunchRequest(null); - Assert.Fail("ArgumentNullException should be occurred"); + try + { + AppControl.SendLaunchRequest(null); + Assert.Fail("ArgumentNullException should be occurred"); + } + catch (ArgumentNullException) + { + Assert.Pass("ArgumentNullException occurs"); + } + } + + + [Test] + [Category("P1")] + [Description("Test : Sets window position - WindowPostion should be set properly")] + [Property("SPEC", "Tizen.Applications.AppControl.SetWindowPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + [Property("COVPARAM", "Tizen.Applications.WindowPosition")] + public void SetWindowPosition_WINDOWPOSITION_PARAM() + { + var windowPostion = new WindowPosition(10, 20, 300, 400); + + try + { + _appControl.SetWindowPosition(windowPostion); + } + catch + { + Assert.Fail("Exception should not be occurred"); + } + } + + [Test] + [Category("P2")] + [Description("Test : Sets window position - ArgumentNullException should be occured")] + [Property("SPEC", "Tizen.Applications.AppControl.SetWindowPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void SetWindowPosition_CHECK_ARGUNMENT_NULL_EXCEPTION() + { + try { + _appControl.SetWindowPosition(null); + Assert.Fail("ArgumentNullException should be occurred"); } catch (ArgumentNullException) - { - Assert.Pass("ArgumentNullException occurs"); + { + Assert.Pass("ArgumentNullException occurs"); + } + } + + [Test] + [Category("P1")] + [Description("Test : Gets window position - WindowPostion should be retruned properly")] + [Property("SPEC", "Tizen.Applications.AppControl.GetWindowPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void GetWindowPosition_RETURN_WINDOWPOSITION() + { + var windowPostion = new WindowPosition(10, 20, 300, 400); + + try { + _appControl.SetWindowPosition(windowPostion); + + var _winPos = _appControl.GetWindowPosition(); + + Assert.IsInstanceOf(_winPos, "Return value should be the instance of WindowPosition"); + Assert.AreEqual(_winPos.PositionX, windowPostion.PositionX, "Window Position X should be equal"); + Assert.AreEqual(_winPos.PositionY, windowPostion.PositionY, "Window Position Y should be equal"); + Assert.AreEqual(_winPos.Width, windowPostion.Width, "Window Width should be equal"); + Assert.AreEqual(_winPos.Height, windowPostion.Height, "Window Hight should be equal"); + } + catch + { + Assert.Fail("Exception should not be occurred"); } } } diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSWindowPosition.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSWindowPosition.cs new file mode 100755 index 0000000..df71ee1 --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSWindowPosition.cs @@ -0,0 +1,96 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; + +namespace Tizen.Applications.Tests +{ + [TestFixture] + [Description("Tizen.Applications.WindowPosition Tests")] + class WindowPositionTests + { + private WindowPosition _windowPosition; + + [SetUp] + public void Init() + { + _windowPosition = new WindowPosition(10, 20, 300, 400); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test : WindowPosition Constructor")] + [Property("SPEC", "Tizen.Applications.WindowPosition.WindowPosition C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void WindowPosition_INIT() + { + var windowPosition = new WindowPosition(10, 20, 300, 400); + + Assert.IsNotNull(windowPosition, "Object should not be null after initializing"); + Assert.IsInstanceOf(windowPosition, "Object should be the instance of WindowPosition"); + Assert.AreEqual(windowPosition.PositionX, 10, "Position X should be set properly"); + Assert.AreEqual(windowPosition.PositionY, 20, "Position Y should be set properly"); + Assert.AreEqual(windowPosition.Width, 300, "Width should be set properly"); + Assert.AreEqual(windowPosition.Height, 400, "Height should be set properly"); + } + + [Test] + [Category("P1")] + [Description("Test : WindowPosition Properties - sets and gets PositionX properly")] + [Property("SPEC", "Tizen.Applications.WindowPosition.PositionX A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void PositionX_PROPERTY_SET_GET() + { + _windowPosition.PositionX = 50; + Assert.AreEqual(_windowPosition.PositionX, 50, "Propety \"PositionX\": the set value and the get value should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test : WindowPosition Properties - sets and gets PositionY properly")] + [Property("SPEC", "Tizen.Applications.WindowPosition.PositionY A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void PositionY_PROPERTY_SET_GET() + { + _windowPosition.PositionY = 60; + Assert.AreEqual(_windowPosition.PositionY, 60, "Propety \"PositionY\": the set value and the get value should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test : WindowPosition Properties - sets and gets Width properly")] + [Property("SPEC", "Tizen.Applications.WindowPosition.Width A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void Width_PROPERTY_SET_GET() + { + _windowPosition.Width = 500; + Assert.AreEqual(_windowPosition.Width, 500, "Propety \"Width\": the set value and the get value should be equal"); + } + + [Test] + [Category("P1")] + [Description("Test : WindowPosition Properties - sets and gets Height properly")] + [Property("SPEC", "Tizen.Applications.WindowPosition.Height A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")] + public void Height_PROPERTY_SET_GET() + { + _windowPosition.Height = 600; + Assert.AreEqual(_windowPosition.Height, 600, "Propety \"Height\": the set value and the get value should be equal"); + } + } +} -- 2.7.4