From 0ad79b2ac77a6705a0229bbcea52bfb36a6db77a Mon Sep 17 00:00:00 2001 From: abdullah Date: Wed, 1 Sep 2021 16:54:38 +0300 Subject: [PATCH] [NUI][ACR-451] Add SelectionChanged Event Added test to check if SelectionChanged is called in TextEditor & TextField. Change-Id: I9a340f0ac23eaee1d35493ddfa70058ce03aa5a8 --- .../Tizen.NUI.Tests/testcase/TSTextEditor.cs | 28 ++++++++++++++++++- .../Tizen.NUI.Tests/testcase/TSTextField.cs | 31 ++++++++++++++++++++-- 2 files changed, 56 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..bcd805e 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() @@ -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", "-")] diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSTextField.cs index 888d66c..696275d 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,8 +1200,8 @@ 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"); } @@ -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", "-")] -- 2.7.4