From: Seoyeon Kim Date: Fri, 28 Aug 2020 01:53:12 +0000 (+0900) Subject: [NUI][Non-ACR][Fix some test case fails] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b6ae3da5bad96fcf19c88fb5de8fd9ae425f3df;p=test%2Ftct%2Fcsharp%2Fapi.git [NUI][Non-ACR][Fix some test case fails] - Some InputMethodContext APIs need to show IME (input panel). - This patch is to fix the defects of the patch, : [NUI][ACR-306]Update TCs related InputMethodContext(). 07fcd26f605e8cb3d19e443f003b83ecc812064f - To add TextEditor instance and get InputMethodContext instance from it, there should show IME to get focus or do activated. Change-Id: Iebb8c716c85a089dd47a27f59c035666902d7c0d Signed-off-by: Seoyeon Kim --- diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs index a8ae4e1d9..7320395a4 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs @@ -342,15 +342,38 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", " - ")] [Property("CRITERIA", "PRW")] [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] - public void TextPrediction_SET_GET_VALUE() + public async Task TextPrediction_SET_GET_VALUE() { /* TEST CODE */ - var _editor = new TextEditor(); - var inputMethodContext = _editor.GetInputMethodContext(); - inputMethodContext.TextPrediction = true; - Assert.AreEqual(true, inputMethodContext.TextPrediction, "Should be true but error"); - inputMethodContext.TextPrediction = false; - Assert.AreEqual(false, inputMethodContext.TextPrediction, "should be false but error"); + TextEditor editor = new TextEditor() + { + Size2D = new Size2D(500, 300), + Position2D = new Position2D(10, 550), + BackgroundColor = Color.Magenta, + Focusable = true, + }; + NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor); + var inputMethodContext = editor.GetInputMethodContext(); + FocusManager.Instance.SetCurrentFocusView(editor); + inputMethodContext.Activate(); + inputMethodContext.ShowInputPanel(); + + await Task.Delay(300); + + if (inputMethodContext) + { + editor.Text = "text"; + inputMethodContext.TextPrediction = true; + Assert.AreEqual(true, inputMethodContext.TextPrediction, "Should be true but error"); + inputMethodContext.TextPrediction = false; + Assert.AreEqual(false, inputMethodContext.TextPrediction, "should be false but error"); + } + inputMethodContext.HideInputPanel(); + await Task.Delay(30); + FocusManager.Instance.ClearFocus(); + editor.Unparent(); + editor.Dispose(); + editor = null; } [Test] @@ -435,9 +458,20 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task GetInputPanelState_RETURN_VALUE() { - var _editor = new TextEditor(); - var inputMethodContext = _editor.GetInputMethodContext(); + TextEditor editor = new TextEditor() + { + Size2D = new Size2D(500, 300), + Position2D = new Position2D(10, 550), + BackgroundColor = Color.Magenta, + Focusable = true, + }; + NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor); + var inputMethodContext = editor.GetInputMethodContext(); Assert.IsNotNull(inputMethodContext, "InputMethodContext should not be null"); + FocusManager.Instance.SetCurrentFocusView(editor); + inputMethodContext.Activate(); + inputMethodContext.ShowInputPanel(); + await Task.Delay(300); if (inputMethodContext.RestoreAfterFocusLost()) { inputMethodContext.SetRestoreAfterFocusLost(false); @@ -446,6 +480,10 @@ namespace Tizen.NUI.Tests inputMethodContext.HideInputPanel(); await Task.Delay(300); Assert.AreEqual(InputMethodContext.State.Hide, inputMethodContext.GetInputPanelState(), "Should be equal"); + FocusManager.Instance.ClearFocus(); + editor.Unparent(); + editor.Dispose(); + editor = null; } [Test] @@ -602,6 +640,12 @@ namespace Tizen.NUI.Tests } } } + inputMethodContext.HideInputPanel(); + await Task.Delay(30); + FocusManager.Instance.ClearFocus(); + _editor.Unparent(); + _editor.Dispose(); + _editor = null; } [Test] @@ -655,10 +699,20 @@ namespace Tizen.NUI.Tests [Property("SPEC_URL", " - ")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Seoyeon Kim, seoyeon2.kim@samsung.com")] - public void SetInputPanelLanguage_NO_RETURN_VALUE() + public async Task SetInputPanelLanguage_NO_RETURN_VALUE() { - var _editor = new TextEditor(); - var inputMethodContext = _editor.GetInputMethodContext(); + TextEditor editor = new TextEditor() + { + Size2D = new Size2D(500, 300), + Position2D = new Position2D(10, 550), + BackgroundColor = Color.Magenta, + Focusable = true, + }; + NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor); + var inputMethodContext = editor.GetInputMethodContext(); + FocusManager.Instance.SetCurrentFocusView(editor); + inputMethodContext.Activate(); + inputMethodContext.ShowInputPanel(); InputMethodContext.InputPanelLanguage language = InputMethodContext.InputPanelLanguage.Alphabet; try { @@ -674,6 +728,12 @@ namespace Tizen.NUI.Tests { Assert.Fail("Caught Exception" + e.ToString()); } + inputMethodContext.HideInputPanel(); + await Task.Delay(30); + FocusManager.Instance.ClearFocus(); + editor.Unparent(); + editor.Dispose(); + editor = null; } [Test] @@ -703,17 +763,33 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task Activated_EVENT() { - var _editor = new TextEditor(); - var inputMethodContext = _editor.GetInputMethodContext(); + TextEditor editor = new TextEditor() + { + Size2D = new Size2D(500, 300), + Position2D = new Position2D(10, 550), + BackgroundColor = Color.Magenta, + Focusable = true, + }; + NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(editor); + var inputMethodContext = editor.GetInputMethodContext(); + FocusManager.Instance.SetCurrentFocusView(editor); + await Task.Delay(500); if (inputMethodContext) { _temp = 0; inputMethodContext.Activated += OnInputMethodContextEvent; inputMethodContext.Activate(); - await Task.Delay(20); + inputMethodContext.ShowInputPanel(); + await Task.Delay(500); Assert.AreEqual(10, _temp, "Should be 10"); inputMethodContext.Activated -= OnInputMethodContextEvent; } + inputMethodContext.HideInputPanel(); + await Task.Delay(30); + FocusManager.Instance.ClearFocus(); + editor.Unparent(); + editor.Dispose(); + editor = null; } [Test]