[NUI][ACR-451] Add SelectionChanged Event 86/263386/5
authorabdullah <abdullahhasan10@gmail.com>
Wed, 1 Sep 2021 13:54:38 +0000 (16:54 +0300)
committerabdullah <abdullahhasan10@gmail.com>
Thu, 23 Sep 2021 10:32:21 +0000 (13:32 +0300)
Added test to check if SelectionChanged is called in TextEditor & TextField.

Change-Id: I9a340f0ac23eaee1d35493ddfa70058ce03aa5a8

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

index c3c22f6..bcd805e 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()
@@ -1188,6 +1188,32 @@ namespace Tizen.NUI.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Test SelectionChanged.Check whether SelectionChanged defined in the spec is callable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.SelectionChanged E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Abdullah Ghujeh, a.ghujeh@samsung.com")]
+        public async Task SelectionChanged_CHECK_EVENT()
+        {
+            var textEditor = new TextEditor();
+            textEditor.Text = "123456789";
+            Window.Instance.GetDefaultLayer().Add(textEditor);
+            bool flag = false;
+            EventHandler handler = (obj, e) =>
+            {
+                flag = true;
+            };
+
+            textEditor.SelectionChanged += handler;
+            textEditor.SelectWholeText();
+            await Task.Delay(500);
+
+            Assert.IsTrue(flag, "SelectionChanged is not be called");
+            textEditor.SelectionChanged -= handler;
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Test FontSizeScale. Check the default FontSizeScale and whether FontSizeScale is readable and writable.")]
         [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.FontSizeScale A")]
         [Property("SPEC_URL", "-")]
index 888d66c..696275d 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,8 +1200,8 @@ 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");
         }
@@ -1229,6 +1230,32 @@ namespace Tizen.NUI.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Test SelectionChanged.Check whether SelectionChanged defined in the spec is callable.")]
+        [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.SelectionChanged E")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "EVL")]
+        [Property("AUTHOR", "Abdullah Ghujeh, a.ghujeh@samsung.com")]
+        public async Task SelectionChanged_CHECK_EVENT()
+        {
+            var textField = new TextField();
+            textField.Text = "123456789";
+            Window.Instance.GetDefaultLayer().Add(textField);
+            bool flag = false;
+            EventHandler handler = (obj, e) =>
+            {
+                flag = true;
+            };
+
+            textField.SelectionChanged += handler;
+            textField.SelectWholeText();
+            await Task.Delay(500);
+
+            Assert.IsTrue(flag, "SelectionChanged is not be called");
+            textField.SelectionChanged -= handler;
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Test FontSizeScale. Check the default FontSizeScale whether FontSizeScale is readable and writable.")]
         [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.FontSizeScale A")]
         [Property("SPEC_URL", "-")]