From b65c786260cc4afb7c1977695c53e88f3380453f Mon Sep 17 00:00:00 2001 From: "guowei.wang" Date: Fri, 25 Jun 2021 11:25:09 +0800 Subject: [PATCH] [NUI] Add Widget(internal & public) TCs. --- .../internal/Widget/TSWidgetApplication.cs | 409 +++++++++ .../testcase/internal/Widget/TSWidgetImpl.cs | 438 ++++++++++ .../testcase/internal/Widget/TSWidgetImplPtr.cs | 79 ++ .../testcase/internal/Widget/TSWidgetViewSignal.cs | 277 ++++++ .../testcase/public/Widget/TSWidget.cs | 158 ++++ .../testcase/public/Widget/TSWidgetView.cs | 970 +++++++++++++++++++++ .../testcase/public/Widget/TSWidgetViewManager.cs | 212 +++++ 7 files changed, 2543 insertions(+) create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetApplication.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImpl.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImplPtr.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetViewSignal.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidget.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetView.cs create mode 100755 test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetViewManager.cs diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetApplication.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetApplication.cs new file mode 100755 index 0000000..f7cc2a0 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetApplication.cs @@ -0,0 +1,409 @@ +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("Internal/Widget/WidgetApplication")] + public class InternalWidgetApplicationTest + { + private const string tag = "NUITEST"; + + internal class MyWidgetApplication : WidgetApplication + { + public MyWidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { } + + public void OnReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) + { + base.ReleaseSwigCPtr(swigCPtr); + } + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication Constructor.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.WidgetApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationConstructor() + { + tlog.Debug(tag, $"WidgetApplicationConstructor START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication Constructor. With WidgetApplication.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.WidgetApplication C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationConstructorWithWidgetApplication() + { + tlog.Debug(tag, $"WidgetApplicationConstructorWithWidgetApplication START"); + + Widget widget = new Widget(); + + WidgetApplication widgetApplication = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(widgetApplication, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(widgetApplication, "Should be an instance of WidgetApplication type."); + + var testingTarget = new WidgetApplication(widgetApplication); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + widget.Dispose(); + widget = null; + + widgetApplication.Dispose(); + widgetApplication = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationConstructorWithWidgetApplication END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication Assign.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.Assign M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationAssign() + { + tlog.Debug(tag, $"WidgetApplicationAssign START"); + + Widget widget = new Widget(); + + WidgetApplication widgetApplication = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(widgetApplication, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(widgetApplication, "Should be an instance of WidgetApplication type."); + + var testingTarget = widgetApplication.Assign(widgetApplication); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + widget.Dispose(); + widget = null; + + widgetApplication.Dispose(); + widgetApplication = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationAssign END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication getCPtr.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.getCPtr M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationgetCPtr() + { + tlog.Debug(tag, $"WidgetApplicationgetCPtr START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + try + { + WidgetApplication.getCPtr(testingTarget); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationgetCPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication ReleaseSwigCPtr.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.ReleaseSwigCPtr M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationReleaseSwigCPtr() + { + tlog.Debug(tag, $"WidgetApplicationReleaseSwigCPtr START"); + + Widget widget = new Widget(); + + var testingTarget = new MyWidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + try + { + testingTarget.OnReleaseSwigCPtr(widget.SwigCPtr); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationReleaseSwigCPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication RegisterWidgetCreatingFunction.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.RegisterWidgetCreatingFunction M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationRegisterWidgetCreatingFunction() + { + tlog.Debug(tag, $"WidgetApplicationRegisterWidgetCreatingFunction START"); + + Widget widget = new Widget(); + + var testingTarget = new MyWidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + global::System.Collections.Generic.Dictionary widgetInfo = new global::System.Collections.Generic.Dictionary(){ + { typeof(Widget), "w1@org.tizen.WidgetApp"} }; + + testingTarget.RegisterWidgetInfo(widgetInfo); + + try + { + testingTarget.RegisterWidgetCreatingFunction(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationRegisterWidgetCreatingFunction END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication AddWidgetInstance.")] + [Property("SPEC", "Tizen.NUI.WidgetApplication.AddWidgetInstance M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationAddWidgetInstance() + { + tlog.Debug(tag, $"WidgetApplicationAddWidgetInstance START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + try + { + testingTarget.AddWidgetInstance(widget); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationAddWidgetInstance END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication RegisterWidgetInfo.")] + [Property("SPEC", "Tizen.Applications.WidgetApplication.RegisterWidgetInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationRegisterWidgetInfo() + { + tlog.Debug(tag, $"WidgetApplicationRegisterWidgetInfo START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + global::System.Collections.Generic.Dictionary widgetInfo = new global::System.Collections.Generic.Dictionary(){ + { typeof(Widget), "w1@org.tizen.WidgetApp"} }; + + try + { + testingTarget.RegisterWidgetInfo(widgetInfo); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationRegisterWidgetInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication AddWidgetInfo.")] + [Property("SPEC", "Tizen.Applications.WidgetApplication.AddWidgetInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationAddWidgetInfo() + { + tlog.Debug(tag, $"WidgetApplicationAddWidgetInfo START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + global::System.Collections.Generic.Dictionary widgetInfo = new global::System.Collections.Generic.Dictionary(){ + { typeof(Widget), "w1@org.tizen.WidgetApp"} }; + testingTarget.RegisterWidgetInfo(widgetInfo); + + try + { + testingTarget.AddWidgetInfo(new global::System.Collections.Generic.Dictionary(){ + { typeof(WidgetApplication), "w2@org.tizen.WidgetApp"} }); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetApplicationAddWidgetInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication WidgetCreateFunction.")] + [Property("SPEC", "Tizen.Applications.WidgetApplication.WidgetCreateFunction M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationWidgetCreateFunction() + { + tlog.Debug(tag, $"WidgetApplicationWidgetCreateFunction START"); + + tlog.Debug(tag, "WidgetApplication.Instance : " + WidgetApplication.Instance); + + try + { + string widgetName = null; + WidgetApplication.WidgetCreateFunction(ref widgetName); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetApplicationWidgetCreateFunction END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetApplication WidgetInfo.")] + [Property("SPEC", "Tizen.Applications.WidgetApplication.WidgetInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetApplicationWidgetInfo() + { + tlog.Debug(tag, $"WidgetApplicationWidgetInfo START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetApplication(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetApplication"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetApplication type."); + + global::System.Collections.Generic.Dictionary widgetInfo = new global::System.Collections.Generic.Dictionary(){ + { typeof(Widget), "w1@org.tizen.WidgetApp"} }; + testingTarget.RegisterWidgetInfo(widgetInfo); + + tlog.Debug(tag, "testingTarget.WidgetInfo : " + testingTarget.WidgetInfo); + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + + tlog.Debug(tag, $"WidgetApplicationWidgetInfo END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImpl.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImpl.cs new file mode 100755 index 0000000..5dcefd1 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImpl.cs @@ -0,0 +1,438 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("Internal/Widget/WidgetImpl")] + public class PublicWidgetImplTest + { + 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("WidgetImpl.WIdgetInstanceOnCreateArgs.ContentInfo.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WIdgetInstanceOnCreateArgs.ContentInfo A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWIdgetInstanceOnCreateArgsContentInfo() + { + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnCreateArgsContentInfo START"); + + var testingTarget = new WidgetImpl.WIdgetInstanceOnCreateArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WIdgetInstanceOnCreateArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WIdgetInstanceOnCreateArgs type."); + + tlog.Debug(tag, "Default testingTarget.ContentInfo is : " + testingTarget.ContentInfo); + + testingTarget.ContentInfo = "WidgetImpl"; + tlog.Debug(tag, "testingTarget.ContentInfo : " + testingTarget.ContentInfo); + + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnCreateArgsContentInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.WIdgetInstanceOnCreateArgs.Window.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WIdgetInstanceOnCreateArgs.Window A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWIdgetInstanceOnCreateArgsWindow() + { + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnCreateArgsWindow START"); + + var testingTarget = new WidgetImpl.WIdgetInstanceOnCreateArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WIdgetInstanceOnCreateArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WIdgetInstanceOnCreateArgs type."); + + tlog.Debug(tag, "Default testingTarget.Window is : " + testingTarget.Window); + + testingTarget.Window = Window.Instance; + tlog.Debug(tag, "testingTarget.Window : " + testingTarget.Window); + + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnCreateArgsWindow END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.WIdgetInstanceOnDestroyArgs.ContentInfo.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WIdgetInstanceOnDestroyArgs.ContentInfo A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWIdgetInstanceOnDestroyArgsContentInfo() + { + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnDestroyArgsContentInfo START"); + + var testingTarget = new WidgetImpl.WIdgetInstanceOnDestroyArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WIdgetInstanceOnDestroyArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WIdgetInstanceOnDestroyArgs type."); + + tlog.Debug(tag, "Default testingTarget.ContentInfo is : " + testingTarget.ContentInfo); + + testingTarget.ContentInfo = "WIdgetInstanceOnDestroyArgs"; + tlog.Debug(tag, "testingTarget.ContentInfo : " + testingTarget.ContentInfo); + + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnDestroyArgsContentInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.WIdgetInstanceOnDestroyArgs.TerminateType.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WIdgetInstanceOnDestroyArgs.TerminateType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWIdgetInstanceOnDestroyArgsTerminateType() + { + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnDestroyArgsTerminateType START"); + + var testingTarget = new WidgetImpl.WIdgetInstanceOnDestroyArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WIdgetInstanceOnDestroyArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WIdgetInstanceOnDestroyArgs type."); + + tlog.Debug(tag, "Default testingTarget.TerminateType is : " + testingTarget.TerminateType); + + testingTarget.TerminateType = Widget.TerminationType.Permanent; + tlog.Debug(tag, "testingTarget.TerminateType : " + testingTarget.TerminateType); + + testingTarget.TerminateType = Widget.TerminationType.Temporary; + tlog.Debug(tag, "testingTarget.TerminateType : " + testingTarget.TerminateType); + + tlog.Debug(tag, $"WidgetImplWIdgetInstanceOnDestroyArgsTerminateType END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.WidgetInstanceOnResizeArgs.Window.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WidgetInstanceOnResizeArgs.Window A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWidgetInstanceOnResizeArgsWindow() + { + tlog.Debug(tag, $"WidgetImplWidgetInstanceOnResizeArgsWindow START"); + + var testingTarget = new WidgetImpl.WidgetInstanceOnResizeArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetInstanceOnResizeArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetInstanceOnResizeArgs type."); + + tlog.Debug(tag, "Default testingTarget.Window is : " + testingTarget.Window); + + testingTarget.Window = Window.Instance; + tlog.Debug(tag, "testingTarget.Window : " + testingTarget.Window); + + tlog.Debug(tag, $"WidgetImplWidgetInstanceOnResizeArgsWindow END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.WidgetInstanceOnUpdateArgs.ContentInfo.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WidgetInstanceOnUpdateArgs.ContentInfo A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWidgetInstanceOnUpdateArgsContentInfo() + { + tlog.Debug(tag, $"WidgetImplWidgetInstanceOnUpdateArgsContentInfo START"); + + var testingTarget = new WidgetImpl.WidgetInstanceOnUpdateArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetInstanceOnUpdateArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetInstanceOnUpdateArgs type."); + + tlog.Debug(tag, "Default testingTarget.ContentInfo is : " + testingTarget.ContentInfo); + + testingTarget.ContentInfo = "WidgetInstanceOnUpdateArgs"; + tlog.Debug(tag, "testingTarget.ContentInfo : " + testingTarget.ContentInfo); + + tlog.Debug(tag, $"WidgetImplWidgetInstanceOnUpdateArgsContentInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.WidgetInstanceOnUpdateArgs.Force.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.WidgetInstanceOnUpdateArgs.Force A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplWidgetInstanceOnUpdateArgsForce() + { + tlog.Debug(tag, $"WidgetImplWidgetInstanceOnUpdateArgsForce START"); + + var testingTarget = new WidgetImpl.WidgetInstanceOnUpdateArgs(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetInstanceOnUpdateArgs"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetInstanceOnUpdateArgs type."); + + tlog.Debug(tag, "Default testingTarget.Force is : " + testingTarget.Force); + + testingTarget.Force = 0; + tlog.Debug(tag, "testingTarget.Force : " + testingTarget.Force); + + tlog.Debug(tag, $"WidgetImplWidgetInstanceOnUpdateArgsForce END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.SetImpl.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.SetImpl M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplSetImpl() + { + tlog.Debug(tag, $"WidgetImplSetImpl START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + Widget widget = new Widget(); + + try + { + testingTarget.SetImpl(new SWIGTYPE_p_Dali__Widget__Impl(widget.GetIntPtr())); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + widget.Dispose(); + widget = null; + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplSetImpl END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnCreate.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnCreate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnCreate() + { + tlog.Debug(tag, $"WidgetImplOnCreate START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnCreate("WidgetImplOnCreate", Window.Instance); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnCreate END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnTerminate. Type is Permanent.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnTerminate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnTerminatePermanent() + { + tlog.Debug(tag, $"WidgetImplOnTerminatePermanent START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnTerminate("WidgetImplOnTerminate", Widget.TerminationType.Permanent); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnTerminatePermanent END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnTerminate. Type is Temporary.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnTerminate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnTerminateTemporary() + { + tlog.Debug(tag, $"WidgetImplOnTerminateTemporary START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnTerminate("WidgetImplOnTerminate", Widget.TerminationType.Temporary); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnTerminateTemporary END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnPause.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnPause M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnPause() + { + tlog.Debug(tag, $"WidgetImplOnPause START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnPause(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnPause END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnResume.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnResume M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnResume() + { + tlog.Debug(tag, $"WidgetImplOnResume START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnResume(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnResume END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnResize.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnResize M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnResize() + { + tlog.Debug(tag, $"WidgetImplOnResize START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnResize(Window.Instance); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnResize END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImpl.OnUpdate.")] + [Property("SPEC", "Tizen.NUI.WidgetImpl.OnUpdate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplOnUpdate() + { + tlog.Debug(tag, $"WidgetImplOnUpdate START"); + + var testingTarget = new WidgetImpl(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImpl"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImpl type."); + + try + { + testingTarget.OnUpdate("WidgetImplOnUpdate", 0); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + testingTarget = null; + tlog.Debug(tag, $"WidgetImplOnUpdate END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImplPtr.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImplPtr.cs new file mode 100755 index 0000000..d2965b4 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetImplPtr.cs @@ -0,0 +1,79 @@ +using global::System; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Tizen.NUI.Components; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.Devel.Tests +{ + using tlog = Tizen.Log; + + [TestFixture] + [Description("Internal/Widget/WidgetImplPtr")] + public class InternalWidgetImplPtrTest + { + private const string tag = "NUITEST"; + + internal class MyWidgetImplPtr : WidgetImplPtr + { + public MyWidgetImplPtr() : base() + { } + } + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("WidgetImplPtr Constructor.")] + [Property("SPEC", "Tizen.NUI.WidgetImplPtr.WidgetImplPtr C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplPtrConstructorWithIntPtr() + { + tlog.Debug(tag, $"WidgetImplPtrConstructorWithIntPtr START"); + + Widget widget = new Widget(); + + var testingTarget = new WidgetImplPtr(widget.GetIntPtr()); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImplPtr"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImplPtr type."); + + widget.Dispose(); + widget = null; + tlog.Debug(tag, $"WidgetImplPtrConstructorWithIntPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetImplPtr Constructor.")] + [Property("SPEC", "Tizen.NUI.WidgetImplPtr.WidgetImplPtr C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetImplPtrConstructor() + { + tlog.Debug(tag, $"WidgetImplPtrConstructor START"); + + Widget widget = new Widget(); + + var testingTarget = new MyWidgetImplPtr(); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetImplPtr"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetImplPtr type."); + + widget.Dispose(); + widget = null; + tlog.Debug(tag, $"WidgetImplPtrConstructor END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetViewSignal.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetViewSignal.cs new file mode 100755 index 0000000..3d53c2f --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Widget/TSWidgetViewSignal.cs @@ -0,0 +1,277 @@ +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("internal/Widget/WidgetViewSignal")] + public class WidgetViewSignalTests + { + private const string tag = "NUITEST"; + private delegate void SignalCallback(); + + private static void MyDelegate() + { + Log.Fatal("TCT", "[TestCase][AddIdle][NUIApplication] Pass"); + } + + [SetUp] + public void Init() + { + Tizen.Log.Info(tag, "Init() is called!"); + } + + [TearDown] + public void Destroy() + { + Tizen.Log.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewSignal constructor.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.WidgetViewSignal C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalConstructor() + { + tlog.Debug(tag, $"WidgetViewSignalConstructor START"); + + var testingTarget = new WidgetViewSignal() ; + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewSignal Dispose.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR MCST")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalDispose() + { + tlog.Debug(tag, $"WidgetViewSignalDispose START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + try + { + testingTarget.Dispose(); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalDispose END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewSignal Empty.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Empty M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalEmpty() + { + tlog.Debug(tag, $"WidgetViewSignalEmpty START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + Assert.IsTrue(testingTarget.Empty(), "Should be true here!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalEmpty END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewSignal GetConnectionCount.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.GetConnectionCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalGetConnectionCount() + { + tlog.Debug(tag, $"WidgetViewSignalGetConnectionCount START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + Assert.AreEqual(0, testingTarget.GetConnectionCount(), "Should be zero here!"); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalGetConnectionCount END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewSignal Connect.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Connect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalConnect() + { + tlog.Debug(tag, $"WidgetViewSignalConnect START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + try + { + SignalCallback signalCallback = new SignalCallback(MyDelegate); + testingTarget.Connect(signalCallback); + Assert.AreEqual(1, testingTarget.GetConnectionCount(), "Should be one here!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalConnect END (OK)"); + } + + [Test] + [Category("P2")] + [Description("WidgetViewSignal Connect. With null.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Connect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalConnectWithNull() + { + tlog.Debug(tag, $"WidgetViewSignalConnectWithNull START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + try + { + testingTarget.Connect(null); + Assert.Fail("Should throw the ArgumentNullException!"); + } + catch (ArgumentNullException e) + { + Assert.True(true); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalConnectWithNull END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewSignal Disconnect")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Disconnect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalDisconnect() + { + tlog.Debug(tag, $"WidgetViewSignalDisconnect START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + SignalCallback signalCallback = new SignalCallback(MyDelegate); + + try + { + testingTarget.Connect(signalCallback); + Assert.AreEqual(1, testingTarget.GetConnectionCount(), "Should be one here!"); + + testingTarget.Disconnect(signalCallback); + Assert.AreEqual(0, testingTarget.GetConnectionCount(), "Should be zero here!"); + } + catch (Exception e) + { + Assert.Fail("Caught Exception" + e.ToString()); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalDisconnect END (OK)"); + } + + [Test] + [Category("P2")] + [Description("WidgetViewSignal Disconnect. With null.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Disconnect M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalDisconnectWithNull() + { + tlog.Debug(tag, $"WidgetViewSignalDisconnect START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + try + { + testingTarget.Disconnect(null); + Assert.Fail("Should throw the ArgumentNullException!"); + } + catch (ArgumentNullException e) + { + Assert.True(true); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalDisconnect END (OK)"); + } + + [Test] + [Category("P2")] + [Description("WidgetViewSignal Emit. With null.")] + [Property("SPEC", "Tizen.NUI.WidgetViewSignal.Emit M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewSignalEmitWithNull() + { + tlog.Debug(tag, $"WidgetViewSignalEmitWithNull START"); + + var testingTarget = new WidgetViewSignal(); + Assert.IsNotNull(testingTarget, "Should be not null!"); + Assert.IsInstanceOf(testingTarget, "Should be an Instance of WidgetViewSignal!"); + + try + { + testingTarget.Emit(null); + Assert.Fail("Should throw the ArgumentNullException!"); + } + catch (ArgumentNullException e) + { + Assert.True(true); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewSignalEmitWithNull END (OK)"); + } + } + +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidget.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidget.cs new file mode 100755 index 0000000..ca9af2b --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidget.cs @@ -0,0 +1,158 @@ +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/Widget/Widget")] + public class PublicWidgetTest + { + private const string tag = "NUITEST"; + private Widget widget = null; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + + widget = new Widget(); + tlog.Debug(tag, "widget.Id : " + widget.Id); + } + + [TearDown] + public void Destroy() + { + widget.Dispose(); + widget = null; + + tlog.Info(tag, "Destroy() is called!"); + } + + internal class MyWidget : Widget + { + public MyWidget() : base() + { } + + public void MyOnCreate(string contentInfo, Window window) + { + window.BackgroundColor = Color.White; + TextLabel textLabel = new TextLabel("Widget Works"); + + window.GetDefaultLayer().Add(textLabel); + base.OnCreate(contentInfo, window); + } + + public void MyOnTerminate(string contentInfo, Widget.TerminationType type) + { + base.OnTerminate(contentInfo, type); + } + + public void MyOnPause() + { + base.OnPause(); + } + + public void MyOnResume() + { + base.OnResume(); + } + + public void MyOnResize(Window window) + { + base.OnResize(window); + } + + public void MyOnUpdate(string contentInfo, int force) + { + base.OnUpdate(contentInfo, force); + } + } + + [Test] + [Category("P1")] + [Description("Widget Constructor. With IntPtr.")] + [Property("SPEC", "Tizen.NUI.Widget.Widget C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetConstructorWithIntPtr() + { + tlog.Debug(tag, $"WidgetConstructorWithIntPtr START"); + + var testingTarget = new Widget(widget.GetIntPtr(), true); + Assert.IsNotNull(testingTarget, "Can't create success object Widget"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Widget type."); + + tlog.Debug(tag, $"WidgetConstructorWithIntPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Widget SetContentInfo.")] + [Property("SPEC", "Tizen.NUI.Widget.Assign M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetSetContentInfo() + { + tlog.Debug(tag, $"WidgetSetContentInfo START"); + + try + { + widget.SetContentInfo("PublicWidgetTest"); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetSetContentInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Widget getCPtr.")] + [Property("SPEC", "Tizen.NUI.Widget.getCPtr M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetGetCPtr() + { + tlog.Debug(tag, $"WidgetGetCPtr START"); + + var testingTarget = new Widget(widget.GetIntPtr(), true); + Assert.IsNotNull(testingTarget, "Can't create success object Widget"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of Widget type."); + + var result = Widget.getCPtr(testingTarget); + Assert.IsNotNull(result); + + tlog.Debug(tag, $"WidgetGetCPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("Widget Assign.")] + [Property("SPEC", "Tizen.NUI.Widget.Assign M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetAssign() + { + tlog.Debug(tag, $"WidgetAssign START"); + + var result = widget.Assign(Activator.CreateInstance(typeof(Widget)) as Widget); + Assert.IsNotNull(result, "Can't create success object Widget"); + Assert.IsInstanceOf(result, "Should be an instance of Widget type."); + + tlog.Debug(tag, $"WidgetAssign END (OK)"); + } + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetView.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetView.cs new file mode 100755 index 0000000..071a76d --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetView.cs @@ -0,0 +1,970 @@ +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/Widget/WidgetView")] + public class PublicWidgetViewTest + { + private const string tag = "NUITEST"; + private ImageView imageView = null; + private WidgetView widgetView = null; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + + imageView = new ImageView(); + widgetView = new WidgetView(imageView.SwigCPtr.Handle, false); + tlog.Debug(tag, " widgetView.Id : " + widgetView.Id.ToString()); + } + + [TearDown] + public void Destroy() + { + imageView?.Dispose(); + imageView = null; + + widgetView?.Dispose(); + widgetView = null; + + tlog.Info(tag, "Destroy() is called!"); + } + + //[Test] + //[Category("P1")] + //[Description("WidgetView Constructor.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetView C")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "CONSTR")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewConstructor() + //{ + // tlog.Debug(tag, $"WidgetViewConstructor START"); + + // try + // { + // var testingTarget = new WidgetView(widget.Id.ToString(), "WidgetView", 100, 200, 50.0f); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // testingTarget.Dispose(); + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // tlog.Debug(tag, $"WidgetViewConstructor END (OK)"); + //} + + [Test] + [Category("P1")] + [Description("WidgetView Constructor. With WidgetView")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetView C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewConstructorWithWidgetView() + { + tlog.Debug(tag, $"WidgetViewConstructorWithWidgetView START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewConstructorWithWidgetView END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetAddedSignal.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetAddedSignal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetAddedSignal() + { + tlog.Debug(tag, $"WidgetViewWidgetAddedSignal START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.WidgetAddedSignal(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetAddedSignal END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetDeletedSignal.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetDeletedSignal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetDeletedSignal() + { + tlog.Debug(tag, $"WidgetViewWidgetDeletedSignal START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.WidgetDeletedSignal(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetDeletedSignal END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetCreationAbortedSignal.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetCreationAbortedSignal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetCreationAbortedSignal() + { + tlog.Debug(tag, $"WidgetViewWidgetCreationAbortedSignal START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.WidgetCreationAbortedSignal(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetCreationAbortedSignal END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetContentUpdatedSignal.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetContentUpdatedSignal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetContentUpdatedSignal() + { + tlog.Debug(tag, $"WidgetViewWidgetContentUpdatedSignal START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.WidgetContentUpdatedSignal(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetContentUpdatedSignal END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetUpdatePeriodChangedSignal.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetUpdatePeriodChangedSignal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetUpdatePeriodChangedSignal() + { + tlog.Debug(tag, $"WidgetViewWidgetUpdatePeriodChangedSignal START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.WidgetUpdatePeriodChangedSignal(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetUpdatePeriodChangedSignal END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetFaultedSignal.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetFaultedSignal M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetFaultedSignal() + { + tlog.Debug(tag, $"WidgetViewWidgetFaultedSignal START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.WidgetFaultedSignal(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetFaultedSignal END (OK)"); + } + + //[Test] + //[Category("P1")] + //[Description("WidgetView WidgetAdded.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetAdded A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewWidgetAdded() + //{ + // tlog.Debug(tag, $"WidgetViewWidgetAdded START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // testingTarget.WidgetAdded += MyOnWidgetAdded; + // testingTarget.WidgetAdded -= MyOnWidgetAdded; + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewWidgetAdded END (OK)"); + //} + + //[Test] + //[Category("P1")] + //[Description("WidgetView WidgetContentUpdated.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetContentUpdated A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewWidgetContentUpdated() + //{ + // tlog.Debug(tag, $"WidgetViewWidgetContentUpdated START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // testingTarget.WidgetContentUpdated += MyOnWidgetContentUpdated; + // testingTarget.WidgetContentUpdated -= MyOnWidgetContentUpdated; + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewWidgetContentUpdated END (OK)"); + //} + + //[Test] + //[Category("P1")] + //[Description("WidgetView WidgetDeleted.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetDeleted A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewWidgetDeleted() + //{ + // tlog.Debug(tag, $"WidgetViewWidgetDeleted START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // testingTarget.WidgetDeleted += MyOnWidgetDeleted; + // testingTarget.WidgetDeleted -= MyOnWidgetDeleted; + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewWidgetDeleted END (OK)"); + //} + + //[Test] + //[Category("P1")] + //[Description("WidgetView WidgetCreationAborted.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetCreationAborted A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewWidgetCreationAborted() + //{ + // tlog.Debug(tag, $"WidgetViewWidgetCreationAborted START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // testingTarget.WidgetCreationAborted += MyOnWidgetCreationAborted; + // testingTarget.WidgetCreationAborted -= MyOnWidgetCreationAborted; + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewWidgetCreationAborted END (OK)"); + //} + + //[Test] + //[Category("P1")] + //[Description("WidgetView WidgetUpdatePeriodChanged.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetUpdatePeriodChanged A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewWidgetUpdatePeriodChanged() + //{ + // tlog.Debug(tag, $"WidgetViewWidgetUpdatePeriodChanged START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // testingTarget.WidgetUpdatePeriodChanged += MyOnWidgetUpdatePeriodChanged; + // testingTarget.WidgetUpdatePeriodChanged -= MyOnWidgetUpdatePeriodChanged; + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewWidgetUpdatePeriodChanged END (OK)"); + //} + + //[Test] + //[Category("P1")] + //[Description("WidgetView WidgetFaulted.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.WidgetFaulted A")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "PRW")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewWidgetFaulted() + //{ + // tlog.Debug(tag, $"WidgetViewWidgetFaulted START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // testingTarget.WidgetFaulted += MyOnWidgetFaulted; + // testingTarget.WidgetFaulted -= MyOnWidgetFaulted; + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewWidgetFaulted END (OK)"); + //} + + private void MyOnWidgetAdded(object sender, EventArgs e) { } + //private void MyOnWidgetContentUpdated(object sender, EventArgs e) { } + //private void MyOnWidgetDeleted(object sender, EventArgs e) { } + //private void MyOnWidgetCreationAborted(object sender, EventArgs e) { } + //private void MyOnWidgetUpdatePeriodChanged(object sender, EventArgs e) { } + //private void MyOnWidgetFaulted(object sender, EventArgs e) { } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetID.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetID A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetID() + { + tlog.Debug(tag, $"WidgetViewWidgetID START"); + + try + { + tlog.Debug(tag, "widgetView.WidgetID : " + widgetView.WidgetID); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewWidgetID END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView InstanceID.")] + [Property("SPEC", "Tizen.NUI.WidgetView.InstanceID A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewInstanceID() + { + tlog.Debug(tag, $"WidgetViewInstanceID START"); + + try + { + tlog.Debug(tag, "widgetView.InstanceID : " + widgetView.InstanceID); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewInstanceID END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView ContentInfo.")] + [Property("SPEC", "Tizen.NUI.WidgetView.ContentInfo A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewContentInfo() + { + tlog.Debug(tag, $"WidgetViewContentInfo START"); + + try + { + tlog.Debug(tag, "widgetView.ContentInfo : " + widgetView.ContentInfo); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewContentInfo END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView Title.")] + [Property("SPEC", "Tizen.NUI.WidgetView.Title A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewTitle() + { + tlog.Debug(tag, $"WidgetViewTitle START"); + + try + { + tlog.Debug(tag, "widgetView.Title : " + widgetView.Title); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewTitle END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView UpdatePeriod.")] + [Property("SPEC", "Tizen.NUI.WidgetView.Title A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewUpdatePeriod() + { + tlog.Debug(tag, $"WidgetViewUpdatePeriod START"); + + try + { + tlog.Debug(tag, "widgetView.UpdatePeriod : " + widgetView.UpdatePeriod); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewUpdatePeriod END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView Preview.")] + [Property("SPEC", "Tizen.NUI.WidgetView.Preview A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewPreview() + { + tlog.Debug(tag, $"WidgetViewPreview START"); + + try + { + tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.Preview); + + widgetView.Preview = true; + tlog.Debug(tag, "widgetView.Preview : " + widgetView.Preview); + + widgetView.Preview = false; + tlog.Debug(tag, "widgetView.Preview : " + widgetView.Preview); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewPreview END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView LoadingText.")] + [Property("SPEC", "Tizen.NUI.WidgetView.LoadingText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewLoadingText() + { + tlog.Debug(tag, $"WidgetViewLoadingText START"); + + try + { + tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.LoadingText); + + widgetView.LoadingText = true; + tlog.Debug(tag, "widgetView.LoadingText : " + widgetView.LoadingText); + + widgetView.LoadingText = false; + tlog.Debug(tag, "widgetView.LoadingText : " + widgetView.LoadingText); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewLoadingText END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView WidgetStateFaulted.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetStateFaulted A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetStateFaulted() + { + tlog.Debug(tag, $"WidgetViewWidgetStateFaulted START"); + + try + { + tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.WidgetStateFaulted); + + widgetView.WidgetStateFaulted = true; + tlog.Debug(tag, "widgetView.WidgetStateFaulted : " + widgetView.WidgetStateFaulted); + + widgetView.WidgetStateFaulted = false; + tlog.Debug(tag, "widgetView.WidgetStateFaulted : " + widgetView.WidgetStateFaulted); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewWidgetStateFaulted END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView PermanentDelete.")] + [Property("SPEC", "Tizen.NUI.WidgetView.PermanentDelete A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetPermanentDelete() + { + tlog.Debug(tag, $"WidgetViewWidgetPermanentDelete START"); + + try + { + tlog.Debug(tag, "Default widgetView.Preview is : " + widgetView.PermanentDelete); + + widgetView.PermanentDelete = true; + tlog.Debug(tag, "widgetView.PermanentDelete : " + widgetView.PermanentDelete); + + widgetView.PermanentDelete = false; + tlog.Debug(tag, "widgetView.PermanentDelete : " + widgetView.PermanentDelete); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewWidgetPermanentDelete END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView RetryText.")] + [Property("SPEC", "Tizen.NUI.WidgetView.RetryText A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewRetryText() + { + tlog.Debug(tag, $"WidgetViewRetryText START"); + + try + { + using (PropertyMap map = new PropertyMap()) + { + map.Insert(WidgetView.Property.RetryText, new PropertyValue(1)); + + widgetView.RetryText = map; + + var result = widgetView.RetryText; + Assert.IsInstanceOf(result, "Should be an instance of PropertyMap type."); + } + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewRetryText END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView Effect.")] + [Property("SPEC", "Tizen.NUI.WidgetView.Effect A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewEffect() + { + tlog.Debug(tag, $"WidgetViewEffect START"); + + try + { + using (PropertyMap map = new PropertyMap()) + { + map.Insert(WidgetView.Property.EFFECT, new PropertyValue(1)); + + widgetView.Effect = map; + + var result = widgetView.Effect; + Assert.IsInstanceOf(result, "Should be an instance of PropertyMap type."); + } + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewEffect END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView PauseWidget.")] + [Property("SPEC", "Tizen.NUI.WidgetView.PauseWidget M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetPauseWidget() + { + tlog.Debug(tag, $"WidgetViewWidgetPauseWidget START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.PauseWidget(); + testingTarget.ResumeWidget(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewWidgetPauseWidget END (OK)"); + } + + //[Test] + //[Category("P1")] + //[Description("WidgetView CancelTouchEvent.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.CancelTouchEvent M")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "MR")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewCancelTouchEvent() + //{ + // tlog.Debug(tag, $"WidgetViewCancelTouchEvent START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // tlog.Debug(tag, "testingTarget.CancelTouchEvent() : " + testingTarget.CancelTouchEvent()); + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewCancelTouchEvent END (OK)"); + //} + + [Test] + [Category("P1")] + [Description("WidgetView ActivateFaultedWidget.")] + [Property("SPEC", "Tizen.NUI.WidgetView.ActivateFaultedWidget M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewActivateFaultedWidget() + { + tlog.Debug(tag, $"WidgetViewActivateFaultedWidget START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.ActivateFaultedWidget(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewActivateFaultedWidget END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView TerminateWidget.")] + [Property("SPEC", "Tizen.NUI.WidgetView.TerminateWidget M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewTerminateWidget() + { + tlog.Debug(tag, $"WidgetViewTerminateWidget START"); + + var testingTarget = new WidgetView(widgetView); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + try + { + testingTarget.TerminateWidget(); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewTerminateWidget END (OK)"); + } + + //[Test] + //[Category("P1")] + //[Description("WidgetView DownCast.")] + //[Property("SPEC", "Tizen.NUI.WidgetView.DownCast M")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "MR")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewDownCast() + //{ + // tlog.Debug(tag, $"WidgetViewDownCast START"); + + // var testingTarget = new WidgetView(widgetView); + // Assert.IsNotNull(testingTarget, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetView type."); + + // try + // { + // WidgetView.DownCast(testingTarget); + // } + // catch (Exception e) + // { + // tlog.Debug(tag, e.Message.ToString()); + // Assert.Fail("Caught Exception: Failed!"); + // } + + // testingTarget.Dispose(); + // tlog.Debug(tag, $"WidgetViewDownCast END (OK)"); + //} + + [Test] + [Category("P1")] + [Description("WidgetView GetWidgetViewFromPtr.")] + [Property("SPEC", "Tizen.NUI.WidgetView.GetWidgetViewFromPtr M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewGetWidgetViewFromPtr() + { + tlog.Debug(tag, $"WidgetViewGetWidgetViewFromPtr START"); + + try + { + WidgetView.GetWidgetViewFromPtr(widgetView.SwigCPtr.Handle); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewGetWidgetViewFromPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView Assign.")] + [Property("SPEC", "Tizen.NUI.WidgetView.Assign M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewAssign() + { + tlog.Debug(tag, $"WidgetViewAssign START"); + + try + { + widgetView.Assign(widgetView); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewAssign END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetView.WidgetViewEventArgs.WidgetView.")] + [Property("SPEC", "Tizen.NUI.WidgetView.WidgetViewEventArgs.WidgetView M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewWidgetViewEventArgsWidgetView() + { + tlog.Debug(tag, $"WidgetViewWidgetViewEventArgsWidgetView START"); + + var testingTarget = new WidgetView.WidgetViewEventArgs(); + tlog.Debug(tag, "Default testingTarget.WidgetView is : " + testingTarget.WidgetView); + + testingTarget.WidgetView = widgetView; + tlog.Debug(tag, "testingTarget.WidgetView is : " + testingTarget.WidgetView); + + tlog.Debug(tag, $"WidgetViewWidgetViewEventArgsWidgetView END (OK)"); + } + + + } +} diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetViewManager.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetViewManager.cs new file mode 100755 index 0000000..6eb76f2 --- /dev/null +++ b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Widget/TSWidgetViewManager.cs @@ -0,0 +1,212 @@ +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/Widget/WidgetViewManager")] + public class PublicWidgetViewManagerTest + { + private const string tag = "NUITEST"; + private Widget widget = null; + + [SetUp] + public void Init() + { + tlog.Info(tag, "Init() is called!"); + + widget = new Widget(); + tlog.Debug(tag, "widget.Id : " + widget.Id); + } + + [TearDown] + public void Destroy() + { + widget.Dispose(); + widget = null; + + tlog.Info(tag, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewManager constructor.")] + [Property("SPEC", "Tizen.NUI.WidgetViewManager.WidgetViewManager C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewManagerConstructor() + { + tlog.Debug(tag, $"WidgetViewManagerConstructor START"); + + var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetViewManager type."); + + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewManagerConstructor END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewManager constructor. With WidgetViewManager.")] + [Property("SPEC", "Tizen.NUI.WidgetViewManager.WidgetViewManager C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewManagerConstructorWithWidgetViewManager() + { + tlog.Debug(tag, $"WidgetViewManagerConstructorWithWidgetViewManager START"); + + WidgetViewManager manager = new WidgetViewManager(widget.GetIntPtr(), false); + Assert.IsNotNull(manager, "Can't create success object WidgetViewManager"); + Assert.IsInstanceOf(manager, "Should be an instance of WidgetViewManager type."); + + var testingTarget = new WidgetViewManager(manager); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetViewManager type."); + + manager.Dispose(); + testingTarget.Dispose(); + tlog.Debug(tag, $"WidgetViewManagerConstructorWithWidgetViewManager END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewManager Instance.")] + [Property("SPEC", "Tizen.NUI.WidgetViewManager.Instance A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewManagerInstance() + { + tlog.Debug(tag, $"WidgetViewManagerInstance START"); + + try + { + tlog.Debug(tag, "WidgetViewManager.Instance : " + WidgetViewManager.Instance); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewManagerInstance END (OK)"); + } + + //[Test] + //[Category("P1")] + //[Description("WidgetViewManager AddWidget.")] + //[Property("SPEC", "Tizen.NUI.WidgetViewManager.AddWidget M")] + //[Property("SPEC_URL", "-")] + //[Property("CRITERIA", "MR")] + //[Property("AUTHOR", "guowei.wang@samsung.com")] + //public void WidgetViewManagerAddWidget() + //{ + // tlog.Debug(tag, $"WidgetViewManagerAddWidget START"); + + // var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false); + + // var result = testingTarget.AddWidget(widget.Id.ToString(), "WidgetView", 100, 200, 50.0f); + // Assert.IsNotNull(result, "Can't create success object WidgetView"); + // Assert.IsInstanceOf(result, "Should be an instance of WidgetView type."); + + // testingTarget.Dispose(); + + // tlog.Debug(tag, $"WidgetViewManagerAddWidget END (OK)"); + //} + + [Test] + [Category("P1")] + [Description("WidgetViewManager getCPtr.")] + [Property("SPEC", "Tizen.NUI.WidgetViewManager.getCPtr A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewManagergetCPtr() + { + tlog.Debug(tag, $"WidgetViewManagergetCPtr START"); + + var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetViewManager type."); + + try + { + + WidgetViewManager.getCPtr(testingTarget); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewManagergetCPtr END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewManager DownCast.")] + [Property("SPEC", "Tizen.NUI.WidgetViewManager.DownCast A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewManagerDownCast() + { + tlog.Debug(tag, $"WidgetViewManagerDownCast START"); + + var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetViewManager type."); + + try + { + + WidgetViewManager.DownCast(testingTarget); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewManagerDownCast END (OK)"); + } + + [Test] + [Category("P1")] + [Description("WidgetViewManager Assign.")] + [Property("SPEC", "Tizen.NUI.WidgetViewManager.Assign A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "guowei.wang@samsung.com")] + public void WidgetViewManagerAssign() + { + tlog.Debug(tag, $"WidgetViewManagerAssign START"); + + var testingTarget = new WidgetViewManager(widget.GetIntPtr(), false); + Assert.IsNotNull(testingTarget, "Can't create success object WidgetViewManager"); + Assert.IsInstanceOf(testingTarget, "Should be an instance of WidgetViewManager type."); + + try + { + WidgetViewManager.Instance.Assign(testingTarget); + } + catch (Exception e) + { + tlog.Debug(tag, e.Message.ToString()); + Assert.Fail("Caught Exception: Failed!"); + } + + tlog.Debug(tag, $"WidgetViewManagerAssign END (OK)"); + } + } +} -- 2.7.4