From f3e32b4cfe97826cc01e624be05b00b46bde8872 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Thu, 26 Aug 2021 18:56:18 +0900 Subject: [PATCH] [TCSACR-446[NUI] Add VectorGraphics testcase [new class] ColorStop.cs DrawableGroup.cs Gradient.cs LinearGradient.cs PathCommands.cs Picture.cs RadialGradient.cs [new api] CanvasView.cs public CanvasView() public Size2D ViewBox { get; set; } public void RemoveDrawable(Drawable drawable) public void RemoveAllDrawables() Drawable.cs public Vector4 BoundingBox { get; } public void ClipPath(Drawable clip) public void Mask(Drawable mask, MaskType type) Shape.cs public Gradient FillGradient { get; set; } public Gradient StrokeGradient { get; set; } public void AddPath(PathCommands pathCommands) Change-Id: I94aabe77b9f9b55b49b87a1579d7f508a033b5b8 --- .../testcase/TSVectorGraphics.CanvasView.cs | 122 +++++++++++- .../testcase/TSVectorGraphics.ColorStop.cs | 107 +++++++++++ .../testcase/TSVectorGraphics.Drawable.cs | 189 ++++++++++++++++++ .../testcase/TSVectorGraphics.DrawableGroup.cs | 149 ++++++++++++++ .../testcase/TSVectorGraphics.Gradient.cs | 129 +++++++++++++ .../testcase/TSVectorGraphics.LinearGradient.cs | 96 +++++++++ .../testcase/TSVectorGraphics.PathCommands.cs | 214 +++++++++++++++++++++ .../testcase/TSVectorGraphics.Picture.cs | 173 +++++++++++++++++ .../testcase/TSVectorGraphics.RadialGradient.cs | 96 +++++++++ .../testcase/TSVectorGraphics.Shape.cs | 138 ++++++++++++- 10 files changed, 1400 insertions(+), 13 deletions(-) create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.ColorStop.cs create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.DrawableGroup.cs create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Gradient.cs create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.LinearGradient.cs create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.PathCommands.cs create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Picture.cs create mode 100644 tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.RadialGradient.cs diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.CanvasView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.CanvasView.cs index 7038c80..6348c80 100644 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.CanvasView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.CanvasView.cs @@ -29,7 +29,7 @@ namespace Tizen.NUI.Tests [Test] [Category("P1")] - [Description("CanvasView constructor test")] + [Description("Create a CanvasView object. Check whether object is successfully created or not.")] [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.CanvasView C")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "CONSTR")] @@ -37,7 +37,24 @@ namespace Tizen.NUI.Tests public void CanvasView_INIT() { /* TEST CODE */ - var canvasView = new CanvasView(new Size2D(100, 100)); + var canvasView = new CanvasView(); + Assert.IsNotNull(canvasView, "Can't create success object CanvasView"); + Assert.IsInstanceOf(canvasView, "Should return CanvasView instance."); + } + + [Test] + [Category("P1")] + [Description("CanvasView constructor test without argument")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.CanvasView C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "Tizen.NUI.Size2D")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void CanvasView_INIT_WITH_ARGUMENTS() + { + /* TEST CODE */ + var viewbox = new Size2D(100, 100); + var canvasView = new CanvasView(viewbox); Assert.IsNotNull(canvasView, "Can't create success object CanvasView"); Assert.IsInstanceOf(canvasView, "Should return CanvasView instance."); } @@ -54,7 +71,7 @@ namespace Tizen.NUI.Tests /* TEST CODE */ try { - CanvasView canvasView = new CanvasView(null); + var canvasView = new CanvasView(null); Assert.IsNotNull(canvasView, "Can't create success object CanvasView"); Assert.IsInstanceOf(canvasView, "Should return CanvasView instance."); } @@ -66,6 +83,37 @@ namespace Tizen.NUI.Tests [Test] [Category("P1")] + [Description("Test ViewBox property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.ViewBox A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ViewBox_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var viewbox = new Size2D(100, 100); + var canvasView = new CanvasView(viewbox); + Assert.AreEqual(canvasView.ViewBox, viewbox, "Retrieved viewbox default should be equal to init value of CanvasView."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Opacity property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.ViewBox A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ViewBox_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + var viewbox = new Size2D(100, 100); + var canvasView = new CanvasView(); + canvasView.ViewBox = viewbox; + Assert.AreEqual(canvasView.ViewBox, viewbox, "Retrieved viewbox should be equal to set value"); + } + + [Test] + [Category("P1")] [Description("Test AddDrawable. Check whether AddDrawable is working.")] [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.AddDrawable M")] [Property("SPEC_URL", "-")] @@ -106,5 +154,73 @@ namespace Tizen.NUI.Tests Assert.Pass("ArgumentNullException : Passed"); } } + + [Test] + [Category("P1")] + [Description("Test RemoveDrawable. Check whether RemoveDrawable is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.RemoveDrawable M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RemoveDrawable_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + CanvasView canvasView = new CanvasView(new Size2D(100, 100)); + Shape shape = new Shape(); + canvasView.AddDrawable(shape); + canvasView.RemoveDrawable(shape); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Verify RemoveDrawable with null argument.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.RemoveDrawable M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RemoveDrawable_NULL_ARGUMENTS() + { + /* TEST CODE */ + CanvasView canvasView = new CanvasView(new Size2D(100, 100)); + try + { + canvasView.RemoveDrawable(null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test RemoveAllDrawables. Check whether RemoveAllDrawables is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.CanvasView.RemoveAllDrawables M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RemoveAllDrawables_TEST() + { + /* TEST CODE */ + try + { + CanvasView canvasView = new CanvasView(new Size2D(100, 100)); + Shape shape = new Shape(); + canvasView.AddDrawable(shape); + canvasView.RemoveAllDrawables(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } } } diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.ColorStop.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.ColorStop.cs new file mode 100644 index 0000000..da32e26 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.ColorStop.cs @@ -0,0 +1,107 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.ColorStop Tests")] + public class ColorStopTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.ColorStopTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ColorStop object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.ColorStop.ColorStop C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "float, Tizen.NUI.Color")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ColorStop_INIT() + { + /* TEST CODE */ + var colorStop = new ColorStop(0.0f, new Color(1.0f, 1.0f, 1.0f, 1.0f)); + Assert.IsNotNull(colorStop, "Can't create success object ColorStop"); + Assert.IsInstanceOf(colorStop, "Should return ColorStop instance."); + } + + [Test] + [Category("P1")] + [Description("Test Offset property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.ColorStop.Offset A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Offset_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var colorStop = new ColorStop(0.0f, new Color(1.0f, 1.0f, 1.0f, 1.0f)); + Assert.AreEqual(colorStop.Offset, 0.0f, "Retrieved Offset default should be equal to init value of ColorStop."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Offset property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.ColorStop.Offset A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Offset_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + var offset = 0.0f; + var colorStop = new ColorStop(1.0f, new Color(1.0f, 1.0f, 1.0f, 1.0f)); + colorStop.Offset = offset; + Assert.AreEqual(colorStop.Offset, offset, "Retrieved Offset should be equal to set value."); + } + + [Test] + [Category("P1")] + [Description("Test Color property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.ColorStop.Color A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Color_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var color = new Color(0.0f, 0.0f, 0.0f, 0.0f); + var colorStop = new ColorStop(0.0f, color); + Assert.AreEqual(colorStop.Color, color, "Retrieved Color default should be equal to init value of ColorStop."); + } + + [Test] + [Category("P1")] + [Description("Test setting of Color property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.ColorStop.Color A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Color_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + var color = new Color(0.0f, 0.0f, 0.0f, 0.0f); + var colorStop = new ColorStop(0.0f, new Color(1.0f, 1.0f, 1.0f, 1.0f)); + colorStop.Color = color; + Assert.AreEqual(colorStop.Color, color, "Retrieved Offset should be equal to set value."); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Drawable.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Drawable.cs index 560f3ba..a4564ba 100644 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Drawable.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Drawable.cs @@ -168,5 +168,194 @@ namespace Tizen.NUI.Tests Assert.Pass("ArgumentNullException : Passed"); } } + + [Test] + [Category("P1")] + [Description("Test ClipPath. Check whether ClipPath is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.ClipPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ClipPath_TEST() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + try + { + var drawable = new Shape(); + var clip = new Shape(); + drawable.ClipPath(clip); + } + catch(Exception e) + { + Assert.Fail("This testcase shouldn't throw exception"); + } + } + + [Test] + [Category("P2")] + [Description("Test ClipPath. Check whether ClipPath is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.ClipPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ClipPath_CHECK_INVALID_ARGUMENTS() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + var drawable = new Shape(); + var drawableGroup = new DrawableGroup(); + var clip = new Shape(); + drawableGroup.AddDrawable(clip); + try + { + //clip Drawable is already used. + drawable.ClipPath(clip); + + Assert.Fail("Should argument exception"); + } + catch (Exception e) + { + Assert.Pass("Exception : Passed / " + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Test ClipPath. Check whether ClipPath is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.ClipPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ClipPath_CHECK_NULL_ARGUMENTS() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + var drawable = new Shape(); + try + { + drawable.ClipPath(null); + Assert.Fail("Should null argument exception"); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test Mask. Check whether Mask is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.Mask M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Mask_TEST() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + try + { + var drawable = new Shape(); + var clip = new Shape(); + drawable.Mask(clip, MaskType.Alpha); + } + catch(Exception e) + { + Assert.Fail("This testcase shouldn't throw exception"); + } + } + + [Test] + [Category("P2")] + [Description("Test Mask. Check whether Mask is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.Mask M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Mask_CHECK_INVALID_ARGUMENTS() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + var drawable = new Shape(); + try + { + var drawableGroup = new DrawableGroup(); + var clip = new Shape(); + + drawableGroup.AddDrawable(clip); + + //clip Drawable is already used. + drawable.Mask(clip, MaskType.Alpha); + + Assert.Fail("Should argument exception"); + } + catch (Exception e) + { + Assert.Pass("Exception : Passed / " + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Test Mask. Check whether Mask is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.Mask M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Mask_CHECK_NULL_ARGUMENTS() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + var drawable = new Shape(); + try + { + drawable.Mask(null, MaskType.Alpha); + Assert.Fail("Should null argument exception"); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test BoundingBox property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.BoundingBox A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void BoundingBox_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + var drawable = new Shape() + { + FillColor = new Color(1.0f, 0.0f, 0.0f, 1.0f) + }; + var rect = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + Assert.AreEqual(drawable.BoundingBox, rect, "Retrieved BoundingBox default should be equal to 0"); + } + + [Test] + [Category("P1")] + [Description("Test getting of BoundingBox property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Drawable.BoundingBox A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void BoundingBox_CHECK_GET_VALUE() + { + /* TEST CODE */ + //Drawable classes cannot be created directly. You can test the Drawable method through a Shape or other class that inherits Drawable. + var drawable = new Shape() + { + FillColor = new Color(1.0f, 0.0f, 0.0f, 1.0f) + }; + drawable.AddRect(0.0f, 0.0f, 100.0f, 100.0f, 0.0f, 0.0f); + var rect = new Vector4(0.0f, 0.0f, 100.0f, 100.0f); + Assert.AreEqual(drawable.BoundingBox, rect, "Retrieved BoundingBox should be equal to set shape's boundary size"); + } } } diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.DrawableGroup.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.DrawableGroup.cs new file mode 100644 index 0000000..ae8c1ef --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.DrawableGroup.cs @@ -0,0 +1,149 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup Tests")] + public class DrawableGroupTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.DrawableGroupTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a DrawableGroup object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup.DrawableGroup C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void DrawableGroup_INIT() + { + /* TEST CODE */ + var drawableGroup = new DrawableGroup(); + Assert.IsNotNull(drawableGroup, "Can't create success object DrawableGroup"); + Assert.IsInstanceOf(drawableGroup, "Should return DrawableGroup instance."); + } + + [Test] + [Category("P1")] + [Description("Test AddDrawable. Check whether AddDrawable is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup.AddDrawable M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void AddDrawable_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + DrawableGroup drawableGroup = new DrawableGroup(); + drawableGroup.AddDrawable(new Shape()); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Verify AddDrawable with null argument.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup.AddDrawable M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void AddDrawable_NULL_ARGUMENTS() + { + /* TEST CODE */ + DrawableGroup drawableGroup = new DrawableGroup(); + try + { + drawableGroup.AddDrawable(null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test RemoveDrawable. Check whether RemoveDrawable is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup.RemoveDrawable M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RemoveDrawable_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + DrawableGroup drawableGroup = new DrawableGroup(); + Shape shape = new Shape(); + drawableGroup.AddDrawable(shape); + drawableGroup.RemoveDrawable(shape); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Verify RemoveDrawable with null argument.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup.RemoveDrawable M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RemoveDrawable_NULL_ARGUMENTS() + { + /* TEST CODE */ + DrawableGroup drawableGroup = new DrawableGroup(); + try + { + drawableGroup.RemoveDrawable(null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test RemoveAllDrawables. Check whether RemoveAllDrawables is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.DrawableGroup.RemoveAllDrawables M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RemoveAllDrawables_TEST() + { + /* TEST CODE */ + DrawableGroup drawableGroup = new DrawableGroup(); + Shape shape = new Shape(); + drawableGroup.AddDrawable(shape); + Assert.True(drawableGroup.RemoveAllDrawables(), "RemoveAllDrawables should return true"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Gradient.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Gradient.cs new file mode 100644 index 0000000..bdc3d60 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Gradient.cs @@ -0,0 +1,129 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; +using System.Collections.Generic; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.Gradient Tests")] + public class GradientTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.GradientTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Test Spread property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Gradient.Spread A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Spread_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + //Gradient classes cannot be created directly. You can test the Gradient method through a LinearGradient or other class that inherits Gradient. + var gradient = new LinearGradient(); + Assert.AreEqual(gradient.Spread, SpreadType.Pad, "Retrieved Spread default should be equal to Pad"); + } + + [Test] + [Category("P1")] + [Description("Test setting of Spread property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Gradient.Spread A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Spread_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + //Gradient classes cannot be created directly. You can test the Gradient method through a LinearGradient or other class that inherits Gradient. + var gradient = new LinearGradient(); + gradient.Spread = SpreadType.Reflect; + Assert.AreEqual(gradient.Spread, SpreadType.Reflect, "Retrieved Spread should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test ColorStops property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Gradient.ColorStops A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ColorStops_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + //Gradient classes cannot be created directly. You can test the Gradient method through a LinearGradient or other class that inherits Gradient. + var gradient = new LinearGradient(); + Assert.AreEqual(gradient.ColorStops.Count, 0, "Retrieved ColorStops default should be equal to null"); + } + + [Test] + [Category("P1")] + [Description("Test setting of ColorStops property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Gradient.ColorStops A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ColorStops_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + //Gradient classes cannot be created directly. You can test the Gradient method through a LinearGradient or other class that inherits Gradient. + var colorStops = new List() + { + new ColorStop(0.0f, new Color(1.0f,0.0f,0.0f,1.0f)), + new ColorStop(0.5f, new Color(0.0f,1.0f,0.0f,1.0f)), + new ColorStop(1.0f, new Color(0.0f,0.0f,1.0f,1.0f)) + }; + var gradient = new LinearGradient(); + gradient.ColorStops = colorStops.AsReadOnly(); + + for(int i = 0; i < gradient.ColorStops.Count; i++) + { + Assert.AreEqual(gradient.ColorStops[i].Offset, colorStops[i].Offset, "Retrieved ColorStops should be equal to set value"); + Assert.AreEqual(gradient.ColorStops[i].Color.R, colorStops[i].Color.R, "Retrieved ColorStops should be equal to set value"); + Assert.AreEqual(gradient.ColorStops[i].Color.G, colorStops[i].Color.G, "Retrieved ColorStops should be equal to set value"); + Assert.AreEqual(gradient.ColorStops[i].Color.B, colorStops[i].Color.B, "Retrieved ColorStops should be equal to set value"); + Assert.AreEqual(gradient.ColorStops[i].Color.A, colorStops[i].Color.A, "Retrieved ColorStops should be equal to set value"); + } + } + + [Test] + [Category("P2")] + [Description("Test setting of ColorStops property with null value")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Gradient.ColorStops A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void ColorStops_CHECK_NULL_VALUE() + { + /* TEST CODE */ + //Gradient classes cannot be created directly. You can test the Gradient method through a LinearGradient or other class that inherits Gradient. + var gradient = new LinearGradient(); + try + { + gradient.ColorStops = null; + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.LinearGradient.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.LinearGradient.cs new file mode 100644 index 0000000..a6d23e3 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.LinearGradient.cs @@ -0,0 +1,96 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.LinearGradient Tests")] + public class LinearGradientTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.LinearGradientTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a LinearGradient object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.LinearGradient.LinearGradient C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void LinearGradient_INIT() + { + /* TEST CODE */ + var linearGradient = new LinearGradient(); + Assert.IsNotNull(linearGradient, "Can't create success object LinearGradient"); + Assert.IsInstanceOf(linearGradient, "Should return LinearGradient instance."); + } + + [Test] + [Category("P1")] + [Description("Test SetBounds. Check whether SetBounds is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.LinearGradient.SetBounds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void SetBounds_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + var linearGradient = new LinearGradient(); + linearGradient.SetBounds(new Position2D(0, 0), new Position2D(1, 1)); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetBounds. Check whether GetBounds is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.LinearGradient.GetBounds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void GetBounds_CHECK_GET_ARGUMENTS() + { + /* TEST CODE */ + var linearGradient = new LinearGradient(); + try + { + var firstPoint = new Position2D(0, 0); + var secondPoint = new Position2D(1, 1); + linearGradient.SetBounds(firstPoint, secondPoint); + + var _firstPoint = new Position2D(); + var _secondPoint = new Position2D(); + linearGradient.GetBounds(ref _firstPoint, ref _secondPoint); + + Assert.AreEqual(firstPoint, _firstPoint, "Retrieved GetBounds should be equal to set value."); + Assert.AreEqual(secondPoint, _secondPoint, "Retrieved GetBounds should be equal to set value."); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.PathCommands.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.PathCommands.cs new file mode 100644 index 0000000..60e54fe --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.PathCommands.cs @@ -0,0 +1,214 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.PathCommands Tests")] + public class PathCommandsTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.PathCommandsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a PathCommands object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.PathCommands C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("COVPARAM", "System.Collections.Generic.System.Collections.Generic.IEnumerable, System.Collections.Generic.System.Collections.Generic.IEnumerable")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void PathCommands_INIT() + { + /* TEST CODE */ + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, new float[] { 0.0f, 0.0f }); + Assert.IsNotNull(pathCommands, "Can't create success object PathCommands"); + Assert.IsInstanceOf(pathCommands, "Should return PathCommands instance."); + } + + [Test] + [Category("P2")] + [Description("PathCommands constructor test with null commands argument")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.PathCommands C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTN")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void PathCommands_INITCommands_ARGUMENT_NULL_EXCEPTION() + { + /* TEST CODE */ + try + { + var pathCommands = new PathCommands(null, new float[] { 0.0f, 0.0f }); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P2")] + [Description("PathCommands constructor test with null points argument")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.PathCommands C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTN")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void PathCommands_INIT_Points_ARGUMENT_NULL_EXCEPTION() + { + /* TEST CODE */ + try + { + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test Commands property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.Commands A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Commands_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var commands = new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }; + var pathCommands = new PathCommands(commands, new float[] { 0.0f, 0.0f }); + int i = 0; + foreach (PathCommandType command in pathCommands.Commands) + { + Assert.AreEqual(command, commands[i], "Retrieved Commands default should be equal to init value of PathCommands."); + i++; + } + } + + [Test] + [Category("P1")] + [Description("Test setting of Commands property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.Commands A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Commands_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + var commands = new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.Close }; + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, new float[] { 0.0f, 0.0f }); + pathCommands.Commands = commands; + int i = 0; + foreach (PathCommandType command in pathCommands.Commands) + { + Assert.AreEqual(command, commands[i], "Retrieved Commands default should be equal to init value of PathCommands."); + i++; + } + } + + [Test] + [Category("P2")] + [Description("Test null setting of Commands property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.Commands A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Commands_CHECK_SET_NULL_VALUE() + { + /* TEST CODE */ + try + { + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, new float[] { 0.0f, 0.0f }); + pathCommands.Commands = null; + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test Points property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.Points A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Points_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var points = new float[] { 0.0f, 0.0f }; + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, points); + int i = 0; + foreach (float point in pathCommands.Points) + { + Assert.AreEqual(point, points[i], "Retrieved Commands default should be equal to init value of PathCommands."); + i++; + } + } + + [Test] + [Category("P1")] + [Description("Test setting of Points property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.Points A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Points_CHECK_SET_GET_VALUE() + { + /* TEST CODE */ + var points = new float[] { 0.0f, 0.0f }; + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, new float[] { 1.0f, 1.0f }); + pathCommands.Points = points; + int i = 0; + foreach (float point in pathCommands.Points) + { + Assert.AreEqual(point, points[i], "Retrieved Commands default should be equal to init value of PathCommands."); + i++; + } + } + + [Test] + [Category("P2")] + [Description("Test null setting of Points property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.PathCommands.Points A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Points_CHECK_SET_NULL_VALUE() + { + /* TEST CODE */ + try + { + var pathCommands = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, new float[] { 0.0f, 0.0f }); + pathCommands.Points = null; + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Picture.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Picture.cs new file mode 100644 index 0000000..03bdafc --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Picture.cs @@ -0,0 +1,173 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.Picture Tests")] + public class PictureTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.PictureTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a Picture object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.Picture C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Picture_INIT() + { + /* TEST CODE */ + var picture = new Picture(); + Assert.IsNotNull(picture, "Can't create success object Picture"); + Assert.IsInstanceOf(picture, "Should return Picture instance."); + } + + [Test] + [Category("P1")] + [Description("Test Load. Check whether Load is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.Load M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Load_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "star-mod.png"; + var picture = new Picture(); + picture.Load(url); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Verify Load with null argument.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.Load M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Load_NULL_ARGUMENTS() + { + /* TEST CODE */ + var picture = new Picture(); + try + { + picture.Load(null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P2")] + [Description("Verify Load fail with invalid path")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.Load M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void Load_FAIL_EXCEPTION() + { + /* TEST CODE */ + var picture = new Picture(); + try + { + string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "invalid_path.png"; + picture.Load(url); + Assert.Fail("Should exception "); + } + catch (Exception e) + { + Assert.Pass("Exception : Passed [" + e.ToString() + "]"); + } + } + + [Test] + [Category("P1")] + [Description("Test SetSize. Check whether SetSize is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.SetSize M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void SetSize_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + var picture = new Picture(); + picture.SetSize(new Size2D(100, 100)); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Verify SetSize with null argument.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.SetSize M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void SetSize_NULL_ARGUMENTS() + { + /* TEST CODE */ + var picture = new Picture(); + try + { + picture.SetSize(null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } + + [Test] + [Category("P1")] + [Description("Test GetSize. Check whether GetSize is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Picture.GetSize M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void GetSize_TEST() + { + /* TEST CODE */ + string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "star-mod.png"; // 40 x 40 + var picture = new Picture(); + picture.Load(url); + var ret = picture.GetSize(); + Assert.AreEqual(ret.Width, 40, "Retrieved GetSize return value should be equal to set value"); + Assert.AreEqual(ret.Height, 40, "Retrieved GetSize return value should be equal to set value"); + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.RadialGradient.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.RadialGradient.cs new file mode 100644 index 0000000..c7203d3 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.RadialGradient.cs @@ -0,0 +1,96 @@ +using NUnit.Framework; +using System; +using System.Threading.Tasks; +using Tizen.NUI.Test; +using Tizen.NUI.BaseComponents.VectorGraphics; + +namespace Tizen.NUI.Tests +{ + + [TestFixture] + [Description("Tizen.NUI.BaseComponents.VectorGraphics.RadialGradient Tests")] + public class RadialGradientTests + { + private string TAG = "NUI"; + + [SetUp] + public void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("VectorGraphics.RadialGradientTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a RadialGradient object. Check whether object is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.RadialGradient.RadialGradient C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void RadialGradient_INIT() + { + /* TEST CODE */ + var radialGradient = new RadialGradient(); + Assert.IsNotNull(radialGradient, "Can't create success object RadialGradient"); + Assert.IsInstanceOf(radialGradient, "Should return RadialGradient instance."); + } + + [Test] + [Category("P1")] + [Description("Test SetBounds. Check whether SetBounds is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.RadialGradient.SetBounds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void SetBounds_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + var radialGradient = new RadialGradient(); + radialGradient.SetBounds(new Position2D(0, 0), 1); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test GetBounds. Check whether GetBounds is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.RadialGradient.GetBounds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void GetBounds_CHECK_GET_ARGUMENTS() + { + /* TEST CODE */ + var radialGradient = new RadialGradient(); + try + { + var centerPoint = new Position2D(0, 0); + var radius = 1.0f; + radialGradient.SetBounds(centerPoint, radius); + + var _centerPoint = new Position2D(); + var _radius = 0.0f; + radialGradient.GetBounds(ref _centerPoint, ref _radius); + + Assert.AreEqual(centerPoint, _centerPoint, "Retrieved GetBounds should be equal to set value."); + Assert.AreEqual(radius, _radius, "Retrieved GetBounds should be equal to set value."); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Shape.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Shape.cs index 16ff731..2adc494 100644 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Shape.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSVectorGraphics.Shape.cs @@ -29,7 +29,7 @@ namespace Tizen.NUI.Tests [Test] [Category("P1")] - [Description("Shape constructor test")] + [Description("Create a Shape object. Check whether object is successfully created or not.")] [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.Shape C")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "CONSTR")] @@ -89,7 +89,7 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var shape = new Shape(); - Assert.AreEqual(Shape.FillRuleType.Winding, shape.FillRule, "Retrieved fill rule type should be equal to Winding"); + Assert.AreEqual(FillRuleType.Winding, shape.FillRule, "Retrieved fill rule type should be equal to Winding"); } [Test] @@ -103,8 +103,8 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var shape = new Shape(); - shape.FillRule = Shape.FillRuleType.EvenOdd; - Assert.AreEqual(Shape.FillRuleType.EvenOdd, shape.FillRule, "Retrieved fill rule type should be equal to set value"); + shape.FillRule = FillRuleType.EvenOdd; + Assert.AreEqual(FillRuleType.EvenOdd, shape.FillRule, "Retrieved fill rule type should be equal to set value"); } [Test] @@ -183,7 +183,7 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var shape = new Shape(); - Assert.AreEqual(Shape.StrokeCapType.Square, shape.StrokeCap, "Retrieved stroke cap type should be equal to Square"); + Assert.AreEqual(StrokeCapType.Square, shape.StrokeCap, "Retrieved stroke cap type should be equal to Square"); } [Test] @@ -197,8 +197,8 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var shape = new Shape(); - shape.StrokeCap = Shape.StrokeCapType.Round; - Assert.AreEqual(Shape.StrokeCapType.Round, shape.StrokeCap, "Retrieved stroke cap type should be equal to set value"); + shape.StrokeCap = StrokeCapType.Round; + Assert.AreEqual(StrokeCapType.Round, shape.StrokeCap, "Retrieved stroke cap type should be equal to set value"); } [Test] @@ -212,7 +212,7 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var shape = new Shape(); - Assert.AreEqual(Shape.StrokeJoinType.Bevel, shape.StrokeJoin, "Retrieved stroke join type should be equal to Bevel"); + Assert.AreEqual(StrokeJoinType.Bevel, shape.StrokeJoin, "Retrieved stroke join type should be equal to Bevel"); } [Test] @@ -226,8 +226,8 @@ namespace Tizen.NUI.Tests { /* TEST CODE */ var shape = new Shape(); - shape.StrokeJoin = Shape.StrokeJoinType.Round; - Assert.AreEqual(Shape.StrokeJoinType.Round, shape.StrokeJoin, "Retrieved stroke join type should be equal to set value"); + shape.StrokeJoin = StrokeJoinType.Round; + Assert.AreEqual(StrokeJoinType.Round, shape.StrokeJoin, "Retrieved stroke join type should be equal to set value"); } [Test] @@ -403,5 +403,123 @@ namespace Tizen.NUI.Tests var ret = shape.ResetPath(); Assert.True(ret, "ResetPath should true"); } + + [Test] + [Category("P1")] + [Description("Test FillGradient property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.FillGradient A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void FillGradient_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var shape = new Shape(); + Assert.AreEqual(shape.FillGradient.ColorStops.Count, 0, "Retrieved FillGradient default value should be empty"); + } + + [Test] + [Category("P1")] + [Description("Test setting of FillGradient property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.FillGradient A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void FillGradient_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + var color1 = new Color(1.0f,0.0f,1.0f,1.0f); + var color2 = new Color(0.0f,1.0f,1.0f,1.0f); + var colorStop1 = new ColorStop(0.0f, color1); + var colorStop2 = new ColorStop(1.0f, color2); + var colorStops = new List() { colorStop1, colorStop2 }; + var linearGradient = new LinearGradient() { ColorStops = colorStops.AsReadOnly() }; + + var shape = new Shape(); + shape.FillGradient = linearGradient; + Assert.AreEqual(shape.FillGradient.ColorStops.Count, colorStops.Count, "Retrieved FillGradient value should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test StrokeGradient property's default value.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.StrokeGradient A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void StrokeGradient_CHECK_DEFAULT_VALUE() + { + /* TEST CODE */ + var shape = new Shape(); + Assert.AreEqual(shape.StrokeGradient.ColorStops.Count, 0, "Retrieved StrokeGradient default value should be empty"); + } + + [Test] + [Category("P1")] + [Description("Test setting of StrokeGradient property.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.StrokeGradient A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void StrokeGradient_CHECK_RETURN_VALUE() + { + /* TEST CODE */ + var color1 = new Color(1.0f,0.0f,1.0f,1.0f); + var color2 = new Color(0.0f,1.0f,1.0f,1.0f); + var colorStop1 = new ColorStop(0.0f, color1); + var colorStop2 = new ColorStop(1.0f, color2); + var colorStops = new List() { colorStop1, colorStop2 }; + var linearGradient = new LinearGradient() { ColorStops = colorStops.AsReadOnly() }; + + var shape = new Shape(); + shape.StrokeGradient = linearGradient; + Assert.AreEqual(shape.StrokeGradient.ColorStops.Count, colorStops.Count, "Retrieved StrokeGradient value should be equal to set value"); + } + + [Test] + [Category("P1")] + [Description("Test AddPath Check whether AddPath is working.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.AddPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void AddPath_CHECK_SET_ARGUMENTS() + { + /* TEST CODE */ + try + { + var shape = new Shape(); + var pathCommand = new PathCommands(new PathCommandType[] { PathCommandType.MoveTo, PathCommandType.LineTo, PathCommandType.Close }, + new float[] { 0.0f, -160.0f }); + shape.AddPath(pathCommand); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Verify AddPath with null argument.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.VectorGraphics.Shape.AddPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Junsu Choi, jsuya.choi@samsung.com")] + public void AddPath_NULL_ARGUMENTS() + { + /* TEST CODE */ + DrawableGroup drawableGroup = new DrawableGroup(); + try + { + var shape = new Shape(); + shape.AddPath(null); + Assert.Fail("Should argument null exception "); + } + catch (ArgumentNullException e) + { + Assert.Pass("ArgumentNullException : Passed"); + } + } } } -- 2.7.4