From dbc670fdacdf18a7957d59335b536c09a26354cd Mon Sep 17 00:00:00 2001 From: "guowei.wang" Date: Wed, 9 Jun 2021 14:04:57 +0800 Subject: [PATCH] Add ViewProperty and EXaml(public) TCs. --- .../testcase/public/EXaml/TSEXamlExtensions.cs | 183 ++++++++++++ .../public/ViewProperty/TSBackgroundExtraData.cs | 107 +++++++ .../testcase/public/ViewProperty/TSImageShadow.cs | 317 +++++++++++++++++++++ .../testcase/public/ViewProperty/TSShadow.cs | 271 ++++++++++++++++++ .../testcase/public/ViewProperty/TSShadowBase.cs | 69 +++++ .../testcase/public/ViewProperty/TSTextShadow.cs | 250 ++++++++++++++++ 6 files changed, 1197 insertions(+) create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/EXaml/TSEXamlExtensions.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSBackgroundExtraData.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSImageShadow.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadow.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadowBase.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSTextShadow.cs diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/EXaml/TSEXamlExtensions.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/EXaml/TSEXamlExtensions.cs new file mode 100755 index 0000000..32c789e --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/EXaml/TSEXamlExtensions.cs @@ -0,0 +1,183 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/EXaml/EXamlExtensions")] + public class PublicEXamlExtensionsTest + { + private const string tag = "NUITEST"; + private string path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "index.xml"; + private string eXamlString = ""; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("EXamlExtensions LoadFromEXamlPath.")] + [Property("SPEC", "Tizen.NUI.EXamlExtensions.LoadFromEXamlPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void EXamlExtensionsLoadFromEXamlPath() + { + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath START"); + + using (View view = new View()) + { + try + { + var testingTarget = Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXamlPath(view, path); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + } + + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath END (OK)"); + } + + [Test] + [Category("P2")] + [Description("EXamlExtensions LoadFromEXamlPath. Path is null.")] + [Property("SPEC", "Tizen.NUI.EXamlExtensions.LoadFromEXamlPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void EXamlExtensionsLoadFromEXamlPathWithNullPath() + { + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPathWithNullPath START"); + + using (View view = new View()) + { + string str = null; + try + { + Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXamlPath(view, str); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPathWithNullPath END (OK)"); + Assert.Pass("Caught Exception: Passed!"); + } + } + } + + [Test] + [Category("P1")] + [Description("EXamlExtensions LoadFromEXamlPath. With callingType")] + [Property("SPEC", "Tizen.NUI.EXamlExtensions.LoadFromEXamlPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void EXamlExtensionsLoadFromEXamlPathWithType() + { + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPathWithType START"); + + using (View view = new View()) + { + try + { + var testingTarget = Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXamlPath(view, GetType()); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + } + + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPathWithType END (OK)"); + } + + [Test] + [Category("P2")] + [Description("EXamlExtensions LoadFromEXamlPath. Type is null.")] + [Property("SPEC", "Tizen.NUI.EXamlExtensions.LoadFromEXamlPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void EXamlExtensionsLoadFromEXamlPathWithNullType() + { + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPathWithNullType START"); + + using (View view = new View()) + { + Type type = null; + var testingTarget = Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXamlPath(view, type); + } + + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPathWithNullType END (OK)"); + } + + [Test] + [Category("P1")] + [Description("EXamlExtensions LoadFromEXaml.")] + [Property("SPEC", "Tizen.NUI.EXamlExtensions.LoadFromEXaml M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void EXamlExtensionsLoadFromEXaml() + { + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXaml START"); + + using (View view = new View()) + { + try + { + var testingTarget = Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXaml(view, eXamlString); + Assert.IsNotNull(testingTarget, "Can't create success object View"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of View type."); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + } + + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXaml END (OK)"); + } + + [Test] + [Category("P2")] + [Description("EXamlExtensions LoadFromEXaml. String is null.")] + [Property("SPEC", "Tizen.NUI.ControlState.Create M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void EXamlExtensionsLoadFromEXamlWithNullString() + { + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlWithNullString START"); + + using (View view = new View()) + { + var testingTarget = Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXaml(view, null); + Assert.IsNotNull(testingTarget, "Can't create success object View"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of View type."); + } + + tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlWithNullString END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSBackgroundExtraData.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSBackgroundExtraData.cs new file mode 100755 index 0000000..5ad656b --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSBackgroundExtraData.cs @@ -0,0 +1,107 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/Utility/BackgroundExtraData")] + public class PublicBackgroundExtraDataTest + { + private const string tag = "NUITEST"; + + internal class MyBackgroundExtraData : BackgroundExtraData + { + public MyBackgroundExtraData() : base() + { } + + public void OnDispose(bool disposing) + { + base.Dispose(disposing); + } + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("BackgroundExtraData constructor. With BackgroundExtraData")] + [Property("SPEC", "Tizen.NUI.BackgroundExtraData.BackgroundExtraData C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void BackgroundExtraDataConstructor() + { + tlog.Debug(tag, $"BackgroundExtraDataConstructor START"); + + View view = new View(); + view.backgroundExtraData = new BackgroundExtraData() + { + BackgroundImageBorder = new Rectangle(5, 5, 5, 5), + CornerRadius = new Vector4(1.0f, 2.0f, 3.0f, 4.0f), + CornerRadiusPolicy = VisualTransformPolicyType.Relative, + BorderlineWidth = 0.3f, + BorderlineColor = Color.Red, + BorderlineOffset = 1.5f + }; + + var testingTarget = new BackgroundExtraData(view.backgroundExtraData); + Assert.AreEqual(0.3f, testingTarget.BorderlineWidth, "Should be equal!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"BackgroundExtraDataConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("BackgroundExtraData Dispose.")] + [Property("SPEC", "Tizen.NUI.BackgroundExtraData.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void BackgroundExtraDataDispose() + { + tlog.Debug(tag, $"BackgroundExtraDataDispose START"); + + var testingTarget = new MyBackgroundExtraData(); + + try + { + testingTarget.OnDispose(true); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + /** Instance is disposed */ + try + { + testingTarget.OnDispose(true); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"BackgroundExtraDataDispose END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSImageShadow.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSImageShadow.cs new file mode 100755 index 0000000..edc2ccf --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSImageShadow.cs @@ -0,0 +1,317 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/ViewProperty/ImageShadow.cs")] + public class PublicImageShadowTest + { + private const string tag = "NUITEST"; + private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + + internal class MyImageShadow : ImageShadow + { + public MyImageShadow() : base() + { } + + public void OnGetPropertyMap() + { + base.GetPropertyMap(); + } + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow constructor.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.ImageShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowConstructor() + { + tlog.Debug(tag, $"ImageShadowConstructor START"); + + var testingTarget = new ImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + tlog.Debug(tag, $"ImageShadowConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow constructor.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.ImageShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowConstructorWith3Parameters() + { + tlog.Debug(tag, $"ImageShadowConstructorWith3Parameters START"); + + var testingTarget = new ImageShadow(url, new Vector2(20, 30), new Vector2(30, 40)); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + tlog.Debug(tag, $"ImageShadowConstructorWith3Parameters END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow constructor. With Border.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.ImageShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowConstructorWithBorder() + { + tlog.Debug(tag, $"ImageShadowConstructorWithBorder START"); + + var testingTarget = new ImageShadow(url, new Rectangle(5, 5, 5, 5), new Vector2(20, 30), new Vector2(30, 40)); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + tlog.Debug(tag, $"ImageShadowConstructorWithBorder END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow constructor. With ImageShadow.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.ImageShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowConstructorWithImageShadow() + { + tlog.Debug(tag, $"ImageShadowConstructorWithImageShadow START"); + + var shadow = new ImageShadow(url, new Rectangle(5, 5, 5, 5), new Vector2(20, 30), new Vector2(30, 40)); + Assert.IsNotNull(shadow, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(shadow, "Should be an instance of ImageShadow type."); + + var testingTarget = new ImageShadow(shadow); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + tlog.Debug(tag, $"ImageShadowConstructorWithImageShadow END (OK)"); + } + + [Test] + [Category("P2")] + [Description("ImageShadow constructor. With null ImageShadow.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.ImageShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowConstructorWithNullImageShadow() + { + tlog.Debug(tag, $"ImageShadowConstructorWithNullImageShadow START"); + + ImageShadow shadow = null; + + try + { + var testingTarget = new ImageShadow(shadow); + } + catch (ArgumentNullException) + { + tlog.Debug(tag, $"ImageShadowConstructorWithNullImageShadow END (OK)"); + Assert.Pass("Caught ArgumentNullException: Passed!"); + } + } + + [Test] + [Category("P2")] + [Description("ImageShadow constructor. By PropertyMap.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.ImageShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowConstructorWithByPropertyMap() + { + tlog.Debug(tag, $"ImageShadowConstructorWithByPropertyMap START"); + + using (PropertyMap map = new PropertyMap()) + { + var testingTarget = new ImageShadow(map); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + tlog.Debug(tag, $"ImageShadowConstructorWithByPropertyMap END (OK)"); + } + } + + [Test] + [Category("P1")] + [Description("ImageShadow Equals.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.Equals M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowEquals() + { + tlog.Debug(tag, $"ImageShadowEquals START"); + + var testingTarget = new ImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + var result = testingTarget.Equals(new ImageShadow()); + Assert.IsTrue(result); + + testingTarget.Url = url; + result = testingTarget.Equals(new ImageShadow()); + Assert.IsFalse(result); + + tlog.Debug(tag, $"ImageShadowEquals END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow GetHashCode.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.GetHashCode M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowGetHashCode() + { + tlog.Debug(tag, $"ImageShadowGetHashCode START"); + + var testingTarget = new ImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + testingTarget.Border = new Rectangle(5, 5, 5, 5); + testingTarget.Url = url; + + var result = testingTarget.GetHashCode(); + Assert.IsNotNull(result); + + tlog.Debug(tag, $"ImageShadowGetHashCode END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow Clone.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowClone() + { + tlog.Debug(tag, $"ImageShadowClone START"); + + var testingTarget = new ImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + var result = testingTarget.Clone(); + Assert.IsNotNull(result, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(result, "Should be an instance of ImageShadow type."); + + tlog.Debug(tag, $"ImageShadowClone END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow IsEmpty.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.IsEmpty M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowIsEmpty() + { + tlog.Debug(tag, $"ImageShadowIsEmpty START"); + + var testingTarget = new ImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + var result = testingTarget.IsEmpty(); + Assert.IsTrue(result); + + tlog.Debug(tag, $"ImageShadowIsEmpty END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow GetPropertyMap.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.GetPropertyMap M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowGetPropertyMap() + { + tlog.Debug(tag, $"ImageShadowGetPropertyMap START"); + + var testingTarget = new MyImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + testingTarget.Border = new Rectangle(5, 5, 5, 5); + testingTarget.Url = url; + + try + { + testingTarget.OnGetPropertyMap(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"ImageShadowGetPropertyMap END (OK)"); + } + + [Test] + [Category("P1")] + [Description("ImageShadow GetPropertyMap. Border is null.")] + [Property("SPEC", "Tizen.NUI.ImageShadow.GetPropertyMap M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ImageShadowGetPropertyMapWithNullBorder() + { + tlog.Debug(tag, $"ImageShadowGetPropertyMapWithNullBorder START"); + + var testingTarget = new MyImageShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object ImageShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of ImageShadow type."); + + testingTarget.Url = url; + + try + { + testingTarget.OnGetPropertyMap(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"ImageShadowGetPropertyMapWithNullBorder END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadow.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadow.cs new file mode 100755 index 0000000..ebf2742 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadow.cs @@ -0,0 +1,271 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/ViewProperty/Shadow.cs")] + public class PublicShadowTest + { + private const string tag = "NUITEST"; + + internal class MyShadow : Shadow + { + public MyShadow() : base() + { } + + public void OnGetPropertyMap() + { + base.GetPropertyMap(); + } + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Shadow constructor.")] + [Property("SPEC", "Tizen.NUI.Shadow.Shadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowConstructor() + { + tlog.Debug(tag, $"ShadowConstructor START"); + + var testingTarget = new Shadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + tlog.Debug(tag, $"ShadowConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow constructor. With custom value.")] + [Property("SPEC", "Tizen.NUI.Shadow.Shadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowConstructorWithCustomValue() + { + tlog.Debug(tag, $"ShadowConstructorWithCustomValue START"); + + var testingTarget = new Shadow(1.5f, Color.CadetBlue, null, null); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + tlog.Debug(tag, $"ShadowConstructorWithCustomValue END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow constructor. Copy other.")] + [Property("SPEC", "Tizen.NUI.Shadow.Shadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowConstructorCopyOther() + { + tlog.Debug(tag, $"ShadowConstructorCopyOther START"); + + var testingTarget = new Shadow(new Shadow()); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + tlog.Debug(tag, $"ShadowConstructorCopyOther END (OK)"); + } + + [Test] + [Category("P2")] + [Description("Shadow constructor. Copy null.")] + [Property("SPEC", "Tizen.NUI.Shadow.Shadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowConstructorCopyNull() + { + tlog.Debug(tag, $"ShadowConstructorCopyNull START"); + + Shadow shadow = null; + + try + { + var testingTarget = new Shadow(shadow); + } + catch (ArgumentNullException e) + { + tlog.Debug(tag, $"ShadowConstructorCopyNull END (OK)"); + tlog.Debug(tag, e.Message.ToString()); + Assert.Pass("Caught ArgumentNullException: Passed!"); + } + } + + [Test] + [Category("P1")] + [Description("Shadow constructor. From PropertyMap.")] + [Property("SPEC", "Tizen.NUI.Shadow.Shadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowConstructorFromPropertyMap() + { + tlog.Debug(tag, $"ShadowConstructorFromPropertyMap START"); + + using (PropertyMap map = new PropertyMap()) + { + map.Insert(Visual.Property.Transform, new PropertyValue(Interop.Visual.TransformGet())); + map.Insert(ColorVisualProperty.MixColor, new PropertyValue(Color.Cyan)); + map.Insert(ColorVisualProperty.BlurRadius, new PropertyValue(0.3f)); + + var testingTarget = new Shadow(map); + Assert.AreEqual(0.3f, testingTarget.BlurRadius); + } + tlog.Debug(tag, $"ShadowConstructorFromPropertyMap END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow Equals.")] + [Property("SPEC", "Tizen.NUI.Shadow.Equals M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowEquals() + { + tlog.Debug(tag, $"ShadowEquals START"); + + var testingTarget = new Shadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + var result = testingTarget.Equals(new Shadow()); + Assert.IsTrue(result); + + testingTarget.Offset = new Vector2(0.8f, 1.3f); + result = testingTarget.Equals(new Shadow()); + Assert.IsFalse(result); + Assert.IsTrue(testingTarget != new Shadow()); + + tlog.Debug(tag, $"ShadowEquals END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow GetHashCode.")] + [Property("SPEC", "Tizen.NUI.Shadow.GetHashCode M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowGetHashCode() + { + tlog.Debug(tag, $"ShadowGetHashCode START"); + + var testingTarget = new Shadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + testingTarget.Color = Color.Cyan; + testingTarget.BlurRadius = 0.3f; + + var result = testingTarget.GetHashCode(); + Assert.IsNotNull(result); + + tlog.Debug(tag, $"ShadowGetHashCode END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow Clone.")] + [Property("SPEC", "Tizen.NUI.Shadow.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowClone() + { + tlog.Debug(tag, $"ShadowClone START"); + + var testingTarget = new Shadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + var result = testingTarget.Clone(); + Assert.IsNotNull(result, "Can't create success object Shadow"); + Assert.IsInstanceOf(result, "Should be an instance of Shadow type."); + + tlog.Debug(tag, $"ShadowClone END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow IsEmpty.")] + [Property("SPEC", "Tizen.NUI.Shadow.IsEmpty M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowIsEmpty() + { + tlog.Debug(tag, $"ShadowIsEmpty START"); + + var testingTarget = new Shadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + var result = testingTarget.IsEmpty(); + Assert.IsFalse(result); + + tlog.Debug(tag, $"ShadowIsEmpty END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Shadow GetPropertyMap.")] + [Property("SPEC", "Tizen.NUI.Shadow.GetPropertyMap M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowGetPropertyMap() + { + tlog.Debug(tag, $"ShadowGetPropertyMap START"); + + var testingTarget = new MyShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + testingTarget.Offset = new Vector2(0.8f, 0.5f); + testingTarget.Extents = new Vector2(1.2f, 1.3f); + + testingTarget.Color = Color.Cyan; + testingTarget.BlurRadius = 0.3f; + + try + { + testingTarget.OnGetPropertyMap(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"ShadowGetPropertyMap END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadowBase.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadowBase.cs new file mode 100755 index 0000000..cc31528 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSShadowBase.cs @@ -0,0 +1,69 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/ViewProperty/ShadowBase.cs")] + public class PublicShadowBaseTest + { + private const string tag = "NUITEST"; + + internal class MyShadow : Shadow + { + public MyShadow() : base() + { } + + public void OnGetPropertyMap() + { + base.GetPropertyMap(); + } + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("ShadowBase ToPropertyValue.")] + [Property("SPEC", "Tizen.NUI.ShadowBase.ToPropertyValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void ShadowBaseToPropertyValue() + { + tlog.Debug(tag, $"ShadowBaseToPropertyValue START"); + + var testingTarget = new MyShadow(); + Assert.IsNotNull(testingTarget, "Can't create success object Shadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Shadow type."); + + using (View view = new View()) + { + view.CornerRadius = new Vector4(0.1f, 0.9f, 0.7f, 0.0f); + + var result = testingTarget.ToPropertyValue(view); + Assert.IsNotNull(result, "Can't create success object PropertyValue"); + Assert.IsInstanceOf(result, "Should be an instance of PropertyValue type."); + } + + tlog.Debug(tag, $"ShadowBaseToPropertyValue END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSTextShadow.cs b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSTextShadow.cs new file mode 100755 index 0000000..8119fff --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.TCT/testcase/public/ViewProperty/TSTextShadow.cs @@ -0,0 +1,250 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("public/ViewProperty/TextShadow.cs")] + public class PublicTextShadowTest + { + private const string tag = "NUITEST"; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("TextShadow constructor.")] + [Property("SPEC", "Tizen.NUI.TextShadow.TextShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowConstructor() + { + tlog.Debug(tag, $"TextShadowConstructor START"); + + using (Vector2 vector = new Vector2(1.5f, 3.0f)) + { + var testingTarget = new TextShadow(Color.Cyan, vector, 0.3f); + Assert.IsNotNull(testingTarget, "Can't create success object TextShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of TextShadow type."); + + testingTarget.Dispose(); + } + + tlog.Debug(tag, $"TextShadowConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("TextShadow constructor. With TextShadow.")] + [Property("SPEC", "Tizen.NUI.TextShadow.TextShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowConstructorWithTextShadow() + { + tlog.Debug(tag, $"TextShadowConstructorWithTextShadow START"); + + using (Vector2 vector = new Vector2(1.5f, 3.0f)) + { + using (TextShadow shadow = new TextShadow(Color.Cyan, vector, 0.3f)) + { + try + { + var testingTarget = new TextShadow(shadow); + testingTarget.Dispose(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + } + } + + tlog.Debug(tag, $"TextShadowConstructorWithTextShadow END (OK)"); + } + + [Test] + [Category("P1")] + [Description("TextShadow constructor. With PropertyMap.")] + [Property("SPEC", "Tizen.NUI.TextShadow.TextShadow C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowConstructorWithPropertyMap() + { + tlog.Debug(tag, $"TextShadowConstructorWithPropertyMap START"); + + TextLabel textLabel = new TextLabel() + { + Text = "TextShadowConstructor", + Color = Color.Green, + PointSize = 15.0f, + }; + PropertyMap temp = new PropertyMap(); + Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp); + + var testingTarget = new TextShadow(temp); + Assert.IsNotNull(testingTarget, "Can't create success object TextShadow"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of TextShadow type."); + + textLabel.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"TextShadowConstructorWithPropertyMap END (OK)"); + } + + [Test] + [Category("P1")] + [Description("TextShadow Clone.")] + [Property("SPEC", "Tizen.NUI.TextShadow.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowClone() + { + tlog.Debug(tag, $"TextShadowClone START"); + + using (Vector2 vector = new Vector2(1.5f, 3.0f)) + { + using (TextShadow textShadow = new TextShadow(Color.Cyan, vector, 0.3f)) + { + try + { + textShadow.Clone(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + } + } + + tlog.Debug(tag, $"TextShadowClone END (OK)"); + } + + [Test] + [Category("P1")] + [Description("TextShadow Clone. With TextShadow.")] + [Property("SPEC", "Tizen.NUI.TextShadow.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowCloneWithTextShadow() + { + tlog.Debug(tag, $"TextShadowCloneWithTextShadow START"); + + TextLabel textLabel = new TextLabel() + { + Text = "TextShadowConstructor", + Color = Color.Green, + PointSize = 15.0f, + }; + PropertyMap temp = new PropertyMap(); + Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp); + + try + { + TextShadow.Clone(new TextShadow(temp)); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + textLabel.Dispose(); + tlog.Debug(tag, $"TextShadowCloneWithTextShadow END (OK)"); + } + + [Test] + [Category("P1")] + [Description("TextShadow Clone. With null TextShadow.")] + [Property("SPEC", "Tizen.NUI.TextShadow.Clone M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowCloneWithNullTextShadow() + { + tlog.Debug(tag, $"TextShadowCloneWithNullTextShadow START"); + + TextShadow textShadow = null; + var testingTarget = TextShadow.Clone(textShadow); + Assert.IsNull(testingTarget); + + tlog.Debug(tag, $"TextShadowCloneWithNullTextShadow END (OK)"); + } + + [Test] + [Category("P1")] + [Description("TextShadow ToPropertyValue.")] + [Property("SPEC", "Tizen.NUI.TextShadow.ToPropertyValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowToPropertyValue() + { + tlog.Debug(tag, $"TextShadowToPropertyValue START"); + + TextLabel textLabel = new TextLabel() + { + Text = "TextShadowConstructor", + Color = Color.Green, + PointSize = 15.0f, + }; + PropertyMap temp = new PropertyMap(); + Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp); + + using (TextShadow textShadow = new TextShadow(temp)) + { + + var testingTarget = TextShadow.ToPropertyValue(textShadow); + Assert.IsNotNull(testingTarget, "Can't create success object PropertyValue"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of PropertyValue type."); + + testingTarget.Dispose(); + } + + textLabel.Dispose(); + tlog.Debug(tag, $"TextShadowToPropertyValue END (OK)"); + } + + [Test] + [Category("P2")] + [Description("TextShadow ToPropertyValue. Instance is null.")] + [Property("SPEC", "Tizen.NUI.TextShadow.ToPropertyValue M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void TextShadowToPropertyValueWithNullInstance() + { + tlog.Debug(tag, $"TextShadowToPropertyValueWithNullInstance START"); + + var testingTarget = TextShadow.ToPropertyValue(null); + Assert.IsNotNull(testingTarget, "Can't create success object PropertyValue"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of PropertyValue type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"TextShadowToPropertyValueWithNullInstance END (OK)"); + } + } +} -- 2.7.4