[NUI][ACR-148][Update TCTs for Tizen.NUI] 39/189339/3
authorwenfeng.ge <wenfeng.ge@samsung.com>
Mon, 17 Sep 2018 06:30:47 +0000 (14:30 +0800)
committerwenfeng.ge <wenfeng.ge@samsung.com>
Tue, 18 Sep 2018 03:16:31 +0000 (11:16 +0800)
Change-Id: I2496c31dd6152ac6a133b7f3354e4d854031ec52
Signed-off-by: wenfeng.ge <wenfeng.ge@samsung.com>
tct-suite-vs/Tizen.NUI.Tests/testcase/TSBaseHandle.cs
tct-suite-vs/Tizen.NUI.Tests/testcase/TSTableView.CellPosition.cs
tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildAddedEventArgs.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.ChildRemovedEventArgs.cs [new file with mode: 0755]
tct-suite-vs/Tizen.NUI.Tests/testcase/TSView.cs

index b7311e8..6456cfa 100755 (executable)
@@ -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")]
index e220a74..ff7c71e 100755 (executable)
@@ -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 (executable)
index 0000000..26d9225
--- /dev/null
@@ -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<View.ChildAddedEventArgs>(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 (executable)
index 0000000..a35f1e0
--- /dev/null
@@ -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<View.ChildRemovedEventArgs>(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");
+        }
+
+    }
+}
index 911965f..bb32260 100755 (executable)
@@ -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;
+        }
+
     }
 
 }