[NUI][ACR-453] Add UTC for SelectionCleared Event 46/263446/6
authorabdullah <abdullahhasan10@gmail.com>
Thu, 2 Sep 2021 11:49:53 +0000 (14:49 +0300)
committerabdullah <abdullahhasan10@gmail.com>
Thu, 23 Sep 2021 10:40:26 +0000 (13:40 +0300)
Added test to check if SelectionCleared is called in TextEditor & TextField.

Change-Id: I833fd9c93283d343ab0c66008892cadf1f69a69e

tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextEditor.cs
tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs

index c3c22f6..f68a0ba 100755 (executable)
@@ -1113,7 +1113,7 @@ namespace Tizen.NUI.Tests
         [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.ScrollStateChanged E")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "EVL")]
-        [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]\r
+        [Property("AUTHOR", "Xianbing Teng, xb.teng@samsung.com")]
         public async Task ScrollStateChanged_CHECK_EVENT()
         {
             var textEditor = new TextEditor()
@@ -1166,6 +1166,34 @@ namespace Tizen.NUI.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Test SelectionCleared.Check whether SelectionCleared defined in the spec is callable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.SelectionCleared E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Abdullah Ghujeh, a.ghujeh@samsung.com")]
+        public async Task SelectionCleared_CHECK_EVENT()
+        {
+            var textEditor = new TextEditor();
+            textEditor.Text = "123456789";
+            Window.Instance.GetDefaultLayer().Add(textEditor);
+            bool flag = false;
+            EventHandler handler = (obj, e) =>
+            {
+                flag = true;
+            };
+
+            textEditor.SelectionCleared += handler;
+            textEditor.SelectWholeText();
+            await Task.Delay(500);
+            textEditor.SelectNone();
+            await Task.Delay(500);
+
+            Assert.IsTrue(flag, "SelectionCleared is not be called");
+            textEditor.SelectionCleared -= handler;
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Test MatchSystemLanguageDirection. Check whether MatchSystemLanguageDirection is working correctly or not.")]
         [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.MatchSystemLanguageDirection A")]
         [Property("SPEC_URL", "-")]
index 888d66c..196d6f5 100755 (executable)
@@ -3,6 +3,7 @@ using NUnit.Framework.TUnit;
 using System;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
+using System.Threading.Tasks;
 using Tizen.NUI.Test;
 
 namespace Tizen.NUI.Tests
@@ -1199,14 +1200,42 @@ namespace Tizen.NUI.Tests
             Assert.IsInstanceOf<TextField>(textField, "Should be an instance of TextField type.");
 
             textField.MatchSystemLanguageDirection = false;
-            Assert.AreEqual(false, textField.MatchSystemLanguageDirection, "should be same");\r
-\r
+            Assert.AreEqual(false, textField.MatchSystemLanguageDirection, "should be same");
+
             textField.MatchSystemLanguageDirection = true;
             Assert.AreEqual(true, textField.MatchSystemLanguageDirection, "should be same");
         }
 
         [Test]
         [Category("P1")]
+        [Description("Test SelectionCleared.Check whether SelectionCleared defined in the spec is callable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.SelectionCleared E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Abdullah Ghujeh, a.ghujeh@samsung.com")]
+        public async Task SelectionCleared_CHECK_EVENT()
+        {
+            var textField = new TextField();
+            textField.Text = "123456789";
+            Window.Instance.GetDefaultLayer().Add(textField);
+            bool flag = false;
+            EventHandler handler = (obj, e) =>
+            {
+                flag = true;
+            };
+
+            textField.SelectionCleared += handler;
+            textField.SelectWholeText();
+            await Task.Delay(500);
+            textField.SelectNone();
+            await Task.Delay(500);
+
+            Assert.IsTrue(flag, "SelectionCleared is not be called");
+            textField.SelectionCleared -= handler;
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Test MatchSystemLanguageDirection. Check whether MatchSystemLanguageDirection is working correctly or not.")]
         [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.MatchSystemLanguageDirection A")]
         [Property("SPEC_URL", "-")]