From 07fcd26f605e8cb3d19e443f003b83ecc812064f Mon Sep 17 00:00:00 2001 From: "guowei.wang" Date: Tue, 11 Aug 2020 17:40:00 +0800 Subject: [PATCH] [NUI][ACR-306]Update TCs related InputMethodContext(). Constructor "InputMethodContext()" has been deprecated, so update related TCs. change files: tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.ActivatedEventArgs.cs tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.EventReceivedEventArgs.cs Change-Id: I0b48c4eee8b0029e4b08b8a5059d99c42b93305c --- ...TSInputMethodContext.ActivatedEventArgs.cs | 6 +- ...putMethodContext.EventReceivedEventArgs.cs | 6 +- .../testcase/TSInputMethodContext.cs | 99 +++++++++++-------- 3 files changed, 64 insertions(+), 47 deletions(-) diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.ActivatedEventArgs.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.ActivatedEventArgs.cs index bb08b24ca..7e9711bde 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.ActivatedEventArgs.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.ActivatedEventArgs.cs @@ -6,7 +6,8 @@ using Tizen.NUI.UIComponents; using System.Runtime.InteropServices; using System.Threading.Tasks; using Tizen.NUI.Test; - +using Tizen.NUI.BaseComponents; + namespace Tizen.NUI.Tests { [TestFixture] @@ -54,7 +55,8 @@ namespace Tizen.NUI.Tests public void InputMethodContext_SET_GET_VALUE() { InputMethodContext.ActivatedEventArgs activatedEventArgs = new InputMethodContext.ActivatedEventArgs(); - activatedEventArgs.InputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + activatedEventArgs.InputMethodContext = _editor.GetInputMethodContext(); InputMethodContext inputMethodContext = activatedEventArgs.InputMethodContext; Assert.NotNull(inputMethodContext, "Should be not null"); Assert.IsInstanceOf(inputMethodContext, "Should be an instance of InputMethodContext"); diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.EventReceivedEventArgs.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.EventReceivedEventArgs.cs index 3f2ce6579..ca4557f2f 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.EventReceivedEventArgs.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.EventReceivedEventArgs.cs @@ -6,7 +6,8 @@ using Tizen.NUI.UIComponents; using System.Runtime.InteropServices; using System.Threading.Tasks; using Tizen.NUI.Test; - +using Tizen.NUI.BaseComponents; + namespace Tizen.NUI.Tests { [TestFixture] @@ -70,7 +71,8 @@ namespace Tizen.NUI.Tests public void InputMethodContext_SET_GET_VALUE() { InputMethodContext.EventReceivedEventArgs eventReceivedEventArgs = new InputMethodContext.EventReceivedEventArgs(); - eventReceivedEventArgs.InputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + eventReceivedEventArgs.InputMethodContext = _editor.GetInputMethodContext(); InputMethodContext manager = eventReceivedEventArgs.InputMethodContext; Assert.NotNull(manager, "Should be not null"); Assert.IsInstanceOf(manager, "Should be an instance of InputMethodContext"); diff --git a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs index 43c234cfd..a8ae4e1d9 100755 --- a/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs +++ b/tct-suite-vs/Tizen.NUI.Tests/testcase/TSInputMethodContext.cs @@ -61,7 +61,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void DestroyContext_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); Assert.IsNotNull(inputMethodContext, "The inputMethodContext object should not be null!"); tlog.Debug(TAG, $"DestroyContext_NO_RETURN_VALUE() checked if inputMethodContext object is null"); @@ -76,21 +77,6 @@ namespace Tizen.NUI.Tests } } - [Test] - [Category("P1")] - [Description("Test constructor. Check whether it works or not.")] - [Property("SPEC", "Tizen.NUI.InputMethodContext.InputMethodContext C")] - [Property("SPEC_URL", " - ")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] - public void InputMethodContext_INIT() - { - var inputMethodContext = new InputMethodContext(); - Assert.NotNull(inputMethodContext, "Should not be null"); - Assert.IsInstanceOf(inputMethodContext, "Should be the instance of InputMethodContext Type"); - tlog.Debug(TAG, $"InputMethodContext_INIT() checked if inputMethodContext object is null"); - } - [Test] [Category("P1")] [Description("Test Activate. Check whether Activate works or not.")] @@ -100,7 +86,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task Activate_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); Assert.IsNotNull(inputMethodContext, "The inputMethodContext object should not be null!"); tlog.Debug(TAG, $"Activate_NO_RETURN_VALUE() checked if inputMethodContext object is null"); @@ -128,7 +115,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void Deactivate_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.Deactivate(); @@ -148,7 +136,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void RestoreAfterFocusLost_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetRestoreAfterFocusLost(true); @@ -171,7 +160,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void SetRestoreAfterFocusLost_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetRestoreAfterFocusLost(true); @@ -194,7 +184,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void Reset_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.Reset(); @@ -214,7 +205,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void NotifyCursorPosition_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.NotifyCursorPosition(); @@ -234,7 +226,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void SetCursorPosition_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); uint cursorPosition = 0; try { @@ -257,7 +250,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void GetCursorPosition_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); inputMethodContext.SetCursorPosition(100); uint pos = inputMethodContext.GetCursorPosition(); Assert.AreEqual(100, pos, "Should be equal to GetCursorPosition"); @@ -272,7 +266,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void SetSurroundingText_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { string example = "Test"; @@ -294,7 +289,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void GetSurroundingText_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); inputMethodContext.SetSurroundingText("Test"); string text = inputMethodContext.GetSurroundingText(); Assert.AreEqual("Test", text, "Should be equal to GetSurroundingText"); @@ -309,7 +305,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void NotifyTextInputMultiLine_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.NotifyTextInputMultiLine(true); @@ -330,7 +327,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void GetTextDirection_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); if (inputMethodContext) { Assert.AreEqual(InputMethodContext.TextDirection.LeftToRight, inputMethodContext.GetTextDirection(), "Should be equal"); @@ -347,7 +345,8 @@ namespace Tizen.NUI.Tests public void TextPrediction_SET_GET_VALUE() { /* TEST CODE */ - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); inputMethodContext.TextPrediction = true; Assert.AreEqual(true, inputMethodContext.TextPrediction, "Should be true but error"); inputMethodContext.TextPrediction = false; @@ -363,7 +362,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task GetInputMethodArea_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); inputMethodContext.Activate(); inputMethodContext.ShowInputPanel(); @@ -387,7 +387,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void SetInputPanelUserData_TEST() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetInputPanelUserData("layouttype = 1 & entrylimit = 255 & action = clearall_for_voice_commit & caller = org.volt.search - all"); @@ -409,7 +410,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void GetInputPanelUserData_TEST() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetInputPanelUserData("layouttype = 1 & entrylimit = 255 & action = clearall_for_voice_commit & caller = org.volt.search - all"); @@ -433,7 +435,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task GetInputPanelState_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); Assert.IsNotNull(inputMethodContext, "InputMethodContext should not be null"); if (inputMethodContext.RestoreAfterFocusLost()) { @@ -454,7 +457,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void SetReturnKeyState_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetReturnKeyState(true); @@ -475,7 +479,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task AutoEnableInputPanel_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { tlog.Debug(TAG, $"AutoEnableInputPanel_NO_RETURN_VALUE: start"); @@ -507,7 +512,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task ShowInputPanel_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.Activate(); @@ -529,7 +535,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void HideInputPanel_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.Deactivate(); @@ -550,7 +557,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public void GetKeyboardType_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); if (inputMethodContext) { Assert.AreEqual(InputMethodContext.KeyboardType.SoftwareKeyboard, inputMethodContext.GetKeyboardType(), "Should be not null"); @@ -605,7 +613,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Seoyeon Kim, seoyeon2.kim@samsung.com")] public void SetMIMEType_TEST() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetMIMEType("text/plain,image/png,image/gif,application/pdf"); @@ -627,7 +636,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Seoyeon Kim, seoyeon2.kim@samsung.com")] public void SetInputPanelPosition_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); try { inputMethodContext.SetInputPanelPosition(100, 100); @@ -647,7 +657,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Seoyeon Kim, seoyeon2.kim@samsung.com")] public void SetInputPanelLanguage_NO_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); InputMethodContext.InputPanelLanguage language = InputMethodContext.InputPanelLanguage.Alphabet; try { @@ -674,7 +685,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Seoyeon Kim, seoyeon2.kim@samsung.com")] public void GetInputPanelLanguage_RETURN_VALUE() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); if (inputMethodContext) { inputMethodContext.SetInputPanelLanguage(InputMethodContext.InputPanelLanguage.Automatic); @@ -691,7 +703,8 @@ namespace Tizen.NUI.Tests [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")] public async Task Activated_EVENT() { - var inputMethodContext = new InputMethodContext(); + var _editor = new TextEditor(); + var inputMethodContext = _editor.GetInputMethodContext(); if (inputMethodContext) { _temp = 0; -- 2.34.1