From: wenfeng.ge Date: Mon, 17 Sep 2018 06:30:47 +0000 (+0800) Subject: [NUI][ACR-148][Update TCTs for Tizen.NUI] X-Git-Tag: tct5.0_m2~53^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6651a6d163fa59fccd3fcf38d445f987a3d6c21;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI][ACR-148][Update TCTs for Tizen.NUI] Change-Id: I2496c31dd6152ac6a133b7f3354e4d854031ec52 Signed-off-by: wenfeng.ge --- diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs index b7311e8..6456cfa 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs @@ -5,6 +5,7 @@ using Tizen.NUI; using Tizen.NUI.UIComponents; using Tizen.NUI.BaseComponents; using Tizen.NUI.Test; +using System.Threading.Tasks; namespace Tizen.NUI.Tests { @@ -14,6 +15,7 @@ namespace Tizen.NUI.Tests public class BaseHandleTests { private static string TAG = "NUI"; + private static bool _flag = false; [SetUp] public static void Init() @@ -29,6 +31,11 @@ namespace Tizen.NUI.Tests Tizen.Log.Info(TAG, "Destroy() is called!"); } + private void baseHandleEventCallback(object sender, EventArgs e) + { + _flag = true; + } + [Test] [Category("P1")] [Description("dali BaseHandle constructor test")] @@ -347,7 +354,29 @@ namespace Tizen.NUI.Tests Assert.IsTrue(flag, "Should be true!"); } - + [Test] + [Category("P1")] + [Description("PropertySet test, Check whether PropertySet event will be triggered.")] + [Property("SPEC", "Tizen.NUI.BaseHandle.PropertySet E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public async Task PropertySet_EVENT() + { + /* TEST CODE */ + View view = new View(); + view.Size2D = new Size2D(100, 100); + view.Position = new Position(100, 100, 0); + view.BackgroundColor = Color.Red; + _flag = false; + view.PropertySet += baseHandleEventCallback; + Window.Instance.GetDefaultLayer().Add(view); + view.StyleName = "fake"; + await Task.Delay(20); + Assert.IsTrue(_flag, "Should be true!"); + Window.Instance.GetDefaultLayer().Remove(view); + view.PropertySet -= baseHandleEventCallback; + } [Test] [Category("P1")] diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTableView.CellPosition.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTableView.CellPosition.cs index e220a74..ff7c71e 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTableView.CellPosition.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTableView.CellPosition.cs @@ -156,6 +156,58 @@ namespace Tizen.NUI.Tests { [Test] [Category("P1")] + [Description("Test cell position ColumnIndex.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.TableView.CellPosition.ColumnIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void ColumnIndex_GET_VALUE() + { + TableView.CellPosition cell = new TableView.CellPosition(4, 3); + Assert.AreEqual(3, cell.ColumnIndex, "cell position ColumnIndex test fail."); + } + + [Test] + [Category("P1")] + [Description("Test cell position RowIndex.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.TableView.CellPosition.RowIndex A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void RowIndex_GET_VALUE() + { + TableView.CellPosition cell = new TableView.CellPosition(3); + Assert.AreEqual(3, cell.RowIndex, "cell position RowIndex test fail."); + } + + [Test] + [Category("P1")] + [Description("Test cell position ColumnSpan.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.TableView.CellPosition.ColumnSpan A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void ColumnSpan_GET_VALUE() + { + TableView.CellPosition cell = new TableView.CellPosition(4, 4, 4, 3); + Assert.AreEqual(3, cell.ColumnSpan, "cell position ColumnSpan test fail"); + } + + [Test] + [Category("P1")] + [Description("Test cell position RowSpan.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.TableView.CellPosition.RowSpan A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void RowSpan_GET_VALUE() + { + TableView.CellPosition cell = new TableView.CellPosition(4, 4, 3); + Assert.AreEqual(3, cell.RowSpan, "cell position RowSpan test fail"); + } + + [Test] + [Category("P1")] [Description("Test Dispose, try to dispose the CellPosition.")] [Property("SPEC", "Tizen.NUI.BaseComponents.TableView.CellPosition.Dispose M")] [Property("SPEC_URL", "-")] diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildAddedEventArgs.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildAddedEventArgs.cs new file mode 100755 index 0000000..26d9225 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildAddedEventArgs.cs @@ -0,0 +1,62 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.BaseComponents.View.ChildAddedEventArgs Tests")] + public class ChildAddedEventArgsTests + { + private static string TAG = "NUI"; + + [SetUp] + public static void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ChildAddedEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public static void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ChildAddedEventArgs object. Check whether ChildAddedEventArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ChildAddedEventArgs.ChildAddedEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void ChildAddedEventArgs_INIT() + { + /* TEST CODE */ + var childAddedEventArgs = new View.ChildAddedEventArgs(); + Assert.IsNotNull(childAddedEventArgs, "Can't create success object ChildAddedEventArgs"); + Assert.IsInstanceOf(childAddedEventArgs, "Should be an instance of ChildAddedEventArgs type."); + } + + [Test] + [Category("P1")] + [Description("Test Added. Check whether Added is readable and writable.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ChildAddedEventArgs.Added A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void Added_SET_GET_VALUE() + { + /* TEST CODE */ + View.ChildAddedEventArgs childAddedEventArgs = new View.ChildAddedEventArgs(); + View view = new View(); + childAddedEventArgs.Added = view; + Assert.AreEqual(view, childAddedEventArgs.Added, "Added View should be equal to set value"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildRemovedEventArgs.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildRemovedEventArgs.cs new file mode 100755 index 0000000..a35f1e0 --- /dev/null +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildRemovedEventArgs.cs @@ -0,0 +1,62 @@ +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Test; + +namespace Tizen.NUI.Tests +{ + [TestFixture] + [Description("Tizen.NUI.BaseComponents.View.ChildRemovedEventArgs Tests")] + public class ChildRemovedEventArgsTests + { + private static string TAG = "NUI"; + + [SetUp] + public static void Init() + { + Tizen.Log.Info(TAG, "Init() is called!"); + App.MainTitleChangeText("ChildRemovedEventArgsTests"); + App.MainTitleChangeBackgroundColor(null); + } + + [TearDown] + public static void Destroy() + { + Tizen.Log.Info(TAG, "Destroy() is called!"); + } + + [Test] + [Category("P1")] + [Description("Create a ChildRemovedEventArgs object. Check whether ChildRemovedEventArgs is successfully created or not.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ChildRemovedEventArgs.ChildRemovedEventArgs C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void ChildRemovedEventArgs_INIT() + { + /* TEST CODE */ + var childRemovedEventArgs = new View.ChildRemovedEventArgs(); + Assert.IsNotNull(childRemovedEventArgs, "Can't create success object ChildRemovedEventArgs"); + Assert.IsInstanceOf(childRemovedEventArgs, "Should be an instance of ChildRemovedEventArgs type."); + } + + [Test] + [Category("P1")] + [Description("Test Removed. Check whether Removed is readable and writable.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ChildRemovedEventArgs.Removed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public void Removed_SET_GET_VALUE() + { + /* TEST CODE */ + View.ChildRemovedEventArgs childRemovedEventArgs = new View.ChildRemovedEventArgs(); + View view = new View(); + childRemovedEventArgs.Removed = view; + Assert.AreEqual(view, childRemovedEventArgs.Removed, "Removed View should be equal to set value"); + } + + } +} diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs index 911965f..bb32260 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs @@ -708,8 +708,6 @@ namespace Tizen.NUI.Tests Window.Instance.GetDefaultLayer().Remove(parentActor); } - - [Test] [Category("P1")] [Description("Test WorldColor. Check whether WorldColor returns expected value or not.")] @@ -2457,6 +2455,49 @@ namespace Tizen.NUI.Tests Window.Instance.GetDefaultLayer().Remove(view); view.LayoutDirectionChanged -= viewEventCallback; } + + [Test] + [Category("P1")] + [Description("Test ChildAdded. Test whether the ChildAdded event will be triggered when the view has been add to the window.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ChildAdded E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public async Task ChildAdded_CHECK_EVENT() + { + View childActor = new View(); + View parentActor = new View(); + parentActor.ChildAdded += viewEventCallback; + Window.Instance.GetDefaultLayer().Add(childActor); + Window.Instance.GetDefaultLayer().Add(parentActor); + parentActor.Add(childActor); + await Task.Delay(20); + Assert.IsTrue(_flag, "Should be true!"); + Window.Instance.GetDefaultLayer().Remove(childActor); + Window.Instance.GetDefaultLayer().Remove(parentActor); + parentActor.ChildAdded -= viewEventCallback; + } + + [Test] + [Category("P1")] + [Description("Test ChildRemoved. Test whether the ChildRemoved event will be triggered when the view has been add to the window.")] + [Property("SPEC", "Tizen.NUI.BaseComponents.View.ChildRemoved E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] + public async Task ChildRemoved_CHECK_EVENT() + { + View childActor = new View(); + View parentActor = new View(); + parentActor.ChildRemoved += viewEventCallback; + parentActor.Add(childActor); + await Task.Delay(20); + parentActor.Remove(childActor); + await Task.Delay(20); + Assert.IsTrue(_flag, "Should be true!"); + parentActor.ChildRemoved -= viewEventCallback; + } + } }