From daa41e8911be439768a1558de22270fbb86fa38e Mon Sep 17 00:00:00 2001 From: abdullah Date: Thu, 2 Sep 2021 14:49:53 +0300 Subject: [PATCH] [NUI][ACR-453] Add UTC for SelectionCleared Event Added test to check if SelectionCleared is called in TextEditor & TextField. Change-Id: I833fd9c93283d343ab0c66008892cadf1f69a69e --- .../Tizen.NUI.Tests/testcase/TSTextEditor.cs | 30 +++++++++++++++++++- .../Tizen.NUI.Tests/testcase/TSTextField.cs | 33 ++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextEditor.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextEditor.cs index c3c22f6..f68a0ba 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextEditor.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextEditor.cs @@ -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")] + [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", "-")] diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs index 888d66c..196d6f5 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs @@ -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, "Should be an instance of TextField type."); textField.MatchSystemLanguageDirection = false; - Assert.AreEqual(false, textField.MatchSystemLanguageDirection, "should be same"); - + 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", "-")] -- 2.7.4