--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext test")]
+ public class InputMethodContextTests
+ {
+ private static ManualTestNUI _testPage;
+ private static WearableManualTestNUI _wearTestPage;
+ private static Window _window;
+ private static PushButton _button;
+ private static float _PointSize = 5.0f;
+ private static TextLabel _label;
+ private static TextEditor _textEditor;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
+ _window = Window.Instance;
+ if (Window.Instance.Size.Width > 1000)
+ {
+ _PointSize = 20.0f;
+ }
+ if (ManualTest.IsWearable())
+ {
+ _PointSize = 2.0f;
+ _label = ManualTest.CreateLabel("This case is unsuitable for wearable, please press PASS button to continue!");
+ _wearTestPage = WearableManualTestNUI.GetInstance();
+ }
+ else
+ {
+ _testPage = ManualTestNUI.GetInstance();
+ }
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ private PropertyMap CreateTextMap(float pointSize, string text)
+ {
+ PropertyMap map = new PropertyMap();
+ map.Insert("visualType", new PropertyValue("TEXT"));
+ map.Insert("pointSize", new PropertyValue(pointSize));
+ map.Insert("text", new PropertyValue(text));
+ return map;
+ }
+
+ private void CreateView(string information)
+ {
+ _button = new PushButton();
+ _button.Label = CreateTextMap(_PointSize, information);
+
+ _testPage.ExecuteTC(_button);
+ }
+
+ public void OnInputMethodContextEvent(object sender, EventArgs e)
+ {
+ Tizen.Log.Fatal("NUI", "InputMethodContext event !!!!!");
+ ManualTest.Confirm();
+ _window.Remove(_textEditor);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Handle event KeyboardTypeChanged.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.KeyboardTypeChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ [Step(1, "Connect the hardware keyboard to the TV")]
+ [Step(2, "Click run button to run TC")]
+ [Step(3, "Click key on SoftwareKeyboard which shown after clicking run button, input something (not necessary).")]
+ [Step(4, "Press Key(A-Z) on HardwareKeyboard, TC will pass")]
+ [Postcondition(1, "NA")]
+ public async Task KeyboardTypeChanged_CB()
+ {
+ if (ManualTest.IsWearable())
+ {
+ _wearTestPage.ExecuteTC(_label);
+ await ManualTest.WaitForConfirm();
+ _wearTestPage.ClearTestCase(_label);
+ }
+ else
+ {
+ CreateView("Press Key-Down");
+ _textEditor = new TextEditor()
+ {
+ Size2D = new Size2D(500, 300),
+ Position2D = new Position2D(610, 150),
+ BackgroundColor = Color.Magenta,
+ Focusable = true,
+ };
+ _window.Add(_textEditor);
+ FocusManager.Instance.SetCurrentFocusView(_textEditor);
+
+ InputMethodContext inputMethodContext = _textEditor.GetInputMethodContext();
+ inputMethodContext.KeyboardTypeChanged += OnInputMethodContextEvent;
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ // Waits for user confirmation.
+ await ManualTest.WaitForConfirm();
+ inputMethodContext.KeyboardTypeChanged -= OnInputMethodContextEvent;
+ _testPage.ClearTestCase(_button);
+ }
+ }
+ }
+}
+
+
+
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.ActivatedEventArgs Tests")]
+ public class InputMethodContextActivatedEventArgsTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("InputMethodContext.ActivatedEventArgsTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a ActivatedEventArgs object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.ActivatedEventArgs.ActivatedEventArgs C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void ActivatedEventArgs_INIT()
+ {
+ var activatedEventArgs = new InputMethodContext.ActivatedEventArgs();
+ Assert.NotNull(activatedEventArgs, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.ActivatedEventArgs>(activatedEventArgs, "Should be an instance of InputMethodContext.ActivatedEventArgs");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InputMethodContext. Check whether InputMethodContext is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.ActivatedEventArgs.InputMethodContext A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void InputMethodContext_SET_GET_VALUE()
+ {
+ InputMethodContext.ActivatedEventArgs activatedEventArgs = new InputMethodContext.ActivatedEventArgs();
+ activatedEventArgs.InputMethodContext = new InputMethodContext();
+ InputMethodContext inputMethodContext = activatedEventArgs.InputMethodContext;
+ Assert.NotNull(inputMethodContext, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext>(inputMethodContext, "Should be an instance of InputMethodContext");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.CallbackData Tests")]
+ public class InputMethodContextCallbackDataTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("InputMethodContext.CallbackDataTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a CallbackData object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.CallbackData C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void CallbackData_INIT()
+ {
+ var callbackData = new InputMethodContext.CallbackData();
+ Assert.NotNull(callbackData, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.CallbackData>(callbackData, "Should be an instance of InputMethodContext.CallbackData");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a CallbackData object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.CallbackData C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "bool, int, string, bool")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void CallbackData_INIT_WITH_BOOL_INT_STRING_BOOL()
+ {
+ var callbackData = new InputMethodContext.CallbackData(false, 0, "", false);
+ Assert.NotNull(callbackData, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.CallbackData>(callbackData, "Should be an instance of InputMethodContext.CallbackData");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Create a CallbackData object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.CallbackData C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "bool, int, string, bool")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void CallbackData_INIT_WITH_BOOL_INT_STRING_BOOL_NEGATIVE()
+ {
+ Assert.Throws<ArgumentNullException>(() => new InputMethodContext.CallbackData(false, 0, null, false));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test CurrentText. Check whether CurrentText is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.CurrentText A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void CurrentText_SET_GET_VALUE()
+ {
+ InputMethodContext.CallbackData callbackData = new InputMethodContext.CallbackData();
+ string example = "Test current text";
+ callbackData.CurrentText = example;
+ Assert.AreEqual(example, callbackData.CurrentText, "Should be equal!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test CursorPosition. Check whether CursorPosition is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.CursorPosition A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void CursorPosition_SET_GET_VALUE()
+ {
+ InputMethodContext.CallbackData callbackData = new InputMethodContext.CallbackData();
+ callbackData.CursorPosition = 0;
+ Assert.AreEqual(0, callbackData.CursorPosition, "Should be equal!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Update. Check whether Update is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.Update A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void Update_SET_GET_VALUE()
+ {
+ InputMethodContext.CallbackData callbackData = new InputMethodContext.CallbackData();
+ callbackData.Update = false;
+ Assert.IsFalse(callbackData.Update, "Should be false here!");
+ callbackData.Update = true;
+ Assert.IsTrue(callbackData.Update, "Should be true here!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PreeditResetRequired. Check whether PreeditResetRequired is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.CallbackData.PreeditResetRequired A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void PreeditResetRequired_SET_GET_VALUE()
+ {
+ InputMethodContext.CallbackData callbackData = new InputMethodContext.CallbackData();
+ callbackData.PreeditResetRequired = false;
+ Assert.IsFalse(callbackData.PreeditResetRequired, "Should be false here!");
+ callbackData.PreeditResetRequired = true;
+ Assert.IsTrue(callbackData.PreeditResetRequired, "Should be true here!");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.EventData Tests")]
+ public class InputMethodContextEventDataTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("InputMethodContext.EventDataTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a EventData object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.EventData C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void EventData_INIT()
+ {
+ var eventData = new InputMethodContext.EventData();
+ Assert.NotNull(eventData, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.EventData>(eventData, "Should be an instance of InputMethodContext.EventData");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a EventData object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.EventData C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "InputMethodContext.EventType, string, int, int")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void EventData_INIT_WITH_EVENTTYPE_STRING_INT_INT()
+ {
+ var eventData = new InputMethodContext.EventData(InputMethodContext.EventType.DeleteSurrounding, "", 0, 0);
+ Assert.NotNull(eventData, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.EventData>(eventData, "Should be an instance of InputMethodContext.EventData");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Create a EventData object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.EventData C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "InputMethodContext.EventType, string, int, int")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void EventData_INIT_WITH_EVENTTYPE_STRING_INT_INT_NEGATIVE()
+ {
+ Assert.Throws<ArgumentNullException>(() => new InputMethodContext.EventData(InputMethodContext.EventType.DeleteSurrounding, null, 0, 0));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test CursorOffset. Check whether CursorOffset is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.CursorOffset A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void CursorOffset_SET_GET_VALUE()
+ {
+ InputMethodContext.EventData eventData = new InputMethodContext.EventData();
+ eventData.CursorOffset = 0;
+ Assert.AreEqual(0, eventData.CursorOffset, "Should be equal!");
+ eventData.CursorOffset = 9;
+ Assert.AreEqual(9, eventData.CursorOffset, "Should be equal!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test EventName. Check whether EventName is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.EventName A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void EventName_SET_GET_VALUE()
+ {
+ InputMethodContext.EventData eventData = new InputMethodContext.EventData();
+ eventData.EventName = InputMethodContext.EventType.DeleteSurrounding;
+ Assert.AreEqual(InputMethodContext.EventType.DeleteSurrounding, eventData.EventName, "Should be equal!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test NumberOfChars. Check whether NumberOfChars is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.NumberOfChars A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void NumberOfChars_SET_GET_VALUE()
+ {
+ InputMethodContext.EventData eventData = new InputMethodContext.EventData();
+ eventData.NumberOfChars = 5;
+ Assert.AreEqual(5, eventData.NumberOfChars, "Should be equal here!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PredictiveString. Check whether PredictiveString is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventData.PredictiveString A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void PredictiveString_SET_GET_VALUE()
+ {
+ InputMethodContext.EventData eventData = new InputMethodContext.EventData();
+ eventData.PredictiveString = "string";
+ Assert.AreEqual("string", eventData.PredictiveString, "Should be equal here!");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.EventReceivedEventArgs Tests")]
+ public class InputMethodContextEventReceivedEventArgsTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("EventReceivedEventArgsTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a eventReceivedEventArgs object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventReceivedEventArgs.EventReceivedEventArgs C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void EventReceivedEventArgs_INIT()
+ {
+ var eventReceivedEventArgs = new InputMethodContext.EventReceivedEventArgs();
+ Assert.NotNull(eventReceivedEventArgs, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.EventReceivedEventArgs>(eventReceivedEventArgs, "Should be an instance of InputMethodContext.EventReceivedEventArgs");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test EventData. Check whether EventData is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventReceivedEventArgs.EventData A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void EventData_SET_GET_VALUE()
+ {
+ InputMethodContext.EventReceivedEventArgs eventReceivedEventArgs = new InputMethodContext.EventReceivedEventArgs();
+ eventReceivedEventArgs.EventData = new InputMethodContext.EventData();
+ InputMethodContext.EventData eventData = eventReceivedEventArgs.EventData; ;
+ Assert.NotNull(eventData, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.EventData>(eventData, "Should be an instance of InputMethodContext.EventData");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InputMethodContext.Check whether InputMethodContext is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventReceivedEventArgs.InputMethodContext A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void InputMethodContext_SET_GET_VALUE()
+ {
+ InputMethodContext.EventReceivedEventArgs eventReceivedEventArgs = new InputMethodContext.EventReceivedEventArgs();
+ eventReceivedEventArgs.InputMethodContext = new InputMethodContext();
+ InputMethodContext manager = eventReceivedEventArgs.InputMethodContext;
+ Assert.NotNull(manager, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext>(manager, "Should be an instance of InputMethodContext");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.KeyboardTypeChangedEventArgs Tests")]
+ public class InputMethodContextKeyboardTypeChangedEventArgsTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("InputMethodContext.KeyboardTypeChangedEventArgsTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a KeyboardTypeChangedEventArgs object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.KeyboardTypeChangedEventArgs.KeyboardTypeChangedEventArgs C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void KeyboardTypeChangedEventArgs_INIT()
+ {
+ var keyboardTypeChangedEventArgs = new InputMethodContext.KeyboardTypeChangedEventArgs();
+ Assert.NotNull(keyboardTypeChangedEventArgs, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.KeyboardTypeChangedEventArgs>(keyboardTypeChangedEventArgs, "Should be an instance of InputMethodContext.KeyboardTypeChangedEventArgs");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test KeyboardType.Check whether KeyboardType is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.KeyboardTypeChangedEventArgs.KeyboardType A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void KeyboardType_SET_GET_VALUE()
+ {
+ InputMethodContext.KeyboardTypeChangedEventArgs keyboardTypeChangedEventArgs = new InputMethodContext.KeyboardTypeChangedEventArgs();
+ keyboardTypeChangedEventArgs.KeyboardType = InputMethodContext.KeyboardType.SoftwareKeyboard;
+ Assert.AreEqual(InputMethodContext.KeyboardType.SoftwareKeyboard, keyboardTypeChangedEventArgs.KeyboardType, "Should be equal!");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.LanguageChangedEventArgs Tests")]
+ public class InputMethodContextLanguageChangedEventArgsTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("InputMethodContext.LanguageChangedEventArgsTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a LanguageChangedEventArgs object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.LanguageChangedEventArgs.LanguageChangedEventArgs C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void LanguageChangedEventArgs_INIT()
+ {
+ var languageChangedEventArgs = new InputMethodContext.LanguageChangedEventArgs();
+ Assert.NotNull(languageChangedEventArgs, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.LanguageChangedEventArgs>(languageChangedEventArgs, "Should be an instance of InputMethodContext.LanguageChangedEventArgs");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test LanguageChanged.Check whether LanguageChanged is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.LanguageChangedEventArgs.LanguageChanged A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void LanguageChanged_SET_GET_VALUE()
+ {
+ var languageChangedEventArgs = new InputMethodContext.LanguageChangedEventArgs();
+ languageChangedEventArgs.LanguageChanged = 0;
+ Assert.AreEqual(0, languageChangedEventArgs.LanguageChanged, "Should be equal!");
+ languageChangedEventArgs.LanguageChanged = 9;
+ Assert.AreEqual(9, languageChangedEventArgs.LanguageChanged, "Should be equal!");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.ResizedEventArgs Tests")]
+ public class InputMethodContextResizedEventArgsTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("InputMethodContext.ResizedEventArgsTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a event ResizedEventArgs object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.ResizedEventArgs.ResizedEventArgs C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void ResizedEventArgs_INIT()
+ {
+ var resizedEventArgs = new InputMethodContext.ResizedEventArgs();
+ Assert.NotNull(resizedEventArgs, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.ResizedEventArgs>(resizedEventArgs, "Should be an instance of InputMethodContext.ResizedEventArgs");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Resized.Check whether Resized is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.ResizedEventArgs.Resized A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void Resized_SET_GET_VALUE()
+ {
+ var resizedEventArgs = new InputMethodContext.ResizedEventArgs();
+ resizedEventArgs.Resized = 0;
+ Assert.AreEqual(0, resizedEventArgs.Resized, "Should be equal!");
+ resizedEventArgs.Resized = 9;
+ Assert.AreEqual(9, resizedEventArgs.Resized, "Should be equal!");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using Tizen.NUI;
+using Tizen.NUI.UIComponents;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using Tizen.NUI.Test;
+
+namespace Tizen.NUI.Tests
+{
+ [TestFixture]
+ [Description("Tizen.NUI.InputMethodContext.StatusChangedEventArgs Tests")]
+ public class InputMethodContextStatusChangedEventArgsTests
+ {
+ private static string TAG = "NUI";
+ private static string _image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
+
+ [SetUp]
+ public void Init()
+ {
+ Tizen.Log.Info(TAG, "Init() is called!");
+ App.MainTitleChangeText("StatusChangedEventArgsTests");
+ App.MainTitleChangeBackgroundColor(null);
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ Tizen.Log.Info(TAG, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a StatusChangedEventArgs object. Check whether object is successfully created or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.StatusChangedEventArgs.StatusChangedEventArgs C")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void StatusChangedEventArgs_INIT()
+ {
+ var statusChangedEventArgs = new InputMethodContext.StatusChangedEventArgs();
+ Assert.NotNull(statusChangedEventArgs, "Should be not null");
+ Assert.IsInstanceOf<InputMethodContext.StatusChangedEventArgs>(statusChangedEventArgs, "Should be an instance of InputMethodContext.StatusChangedEventArgs");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InputMethodContext.Check whether StatusChanged is readable and writable.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.StatusChangedEventArgs.StatusChanged A")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void StatusChanged_SET_GET_VALUE()
+ {
+ InputMethodContext.StatusChangedEventArgs statusChangedEventArgs = new InputMethodContext.StatusChangedEventArgs();
+ statusChangedEventArgs.StatusChanged = false;
+ Assert.IsFalse(statusChangedEventArgs.StatusChanged, "Should be false");
+ statusChangedEventArgs.StatusChanged = true;
+ Assert.IsTrue(statusChangedEventArgs.StatusChanged, "Should be true");
+ }
+ }
+}
\ No newline at end of file
public class InputMethodContextTests
{
private static string TAG = "NUI";
+ private static TextEditor _editor;
+ private static int _temp;
[SetUp]
- public static void Init()
+ public void Init()
{
Tizen.Log.Info(TAG, "Init() is called!");
App.MainTitleChangeText("InputMethodContextTests");
}
[TearDown]
- public static void Destroy()
+ public void Destroy()
{
Tizen.Log.Info(TAG, "Destroy() is called!");
}
+ public void OnInputMethodContextEvent(object sender, EventArgs e)
+ {
+ _temp = 10;
+ }
+
+ public InputMethodContext.CallbackData OnEventReceived(object sender, InputMethodContext.EventReceivedEventArgs e)
+ {
+ _temp = 10;
+ InputMethodContext.CallbackData callbackData = new InputMethodContext.CallbackData(true, 0, e.EventData.PredictiveString, false);
+ Tizen.Log.Fatal("NUI", "Inputmethod Manager return callbackData!!!");
+ return callbackData;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Get. Check whether DestroyContext works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.DestroyContext M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void DestroyContext_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ Assert.IsNotNull(inputMethodContext, "The object should not be null!");
+ try
+ {
+ inputMethodContext.DestroyContext();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [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>(inputMethodContext, "Should be the instance of InputMethodContext Type");
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Activate. Check whether Activate works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.Activate M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void Activate_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.Activate();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Deactivate. Check whether Deactivate works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.Deactivate M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void Deactivate_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.Deactivate();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test RestoreAfterFocusLost. Check whether RestoreAfterFocusLost works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.RestoreAfterFocusLost M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void RestoreAfterFocusLost_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.SetRestoreAfterFocusLost(true);
+ Assert.IsTrue(inputMethodContext.RestoreAfterFocusLost(), "Should be true");
+ inputMethodContext.SetRestoreAfterFocusLost(false);
+ Assert.IsFalse(inputMethodContext.RestoreAfterFocusLost(), "Should be false");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetRestoreAfterFocusLost. Check whether SetRestoreAfterFocusLost works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.SetRestoreAfterFocusLost M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void SetRestoreAfterFocusLost_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.SetRestoreAfterFocusLost(true);
+ Assert.IsTrue(inputMethodContext.RestoreAfterFocusLost(), "Should be true");
+ inputMethodContext.SetRestoreAfterFocusLost(false);
+ Assert.IsFalse(inputMethodContext.RestoreAfterFocusLost(), "Should be false");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Reset. Check whether Reset works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.Reset M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void Reset_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.Reset();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test NotifyCursorPosition. Check whether NotifyCursorPosition works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.NotifyCursorPosition M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void NotifyCursorPosition_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.NotifyCursorPosition();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetCursorPosition. Check whether SetCursorPosition works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.SetCursorPosition M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void SetCursorPosition_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ uint cursorPosition = 0;
+ try
+ {
+ inputMethodContext.SetCursorPosition(100);
+ cursorPosition = inputMethodContext.GetCursorPosition();
+ Assert.AreEqual(100, cursorPosition, "Should be equal to SetCursorPosition");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetCursorPosition. Check whether GetCursorPosition works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetCursorPosition M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetCursorPosition_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ inputMethodContext.SetCursorPosition(100);
+ uint pos = inputMethodContext.GetCursorPosition();
+ Assert.AreEqual(100, pos, "Should be equal to GetCursorPosition");
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetSurroundingText. Check whether SetSurroundingText works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.SetSurroundingText M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void SetSurroundingText_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ string example = "Test";
+ inputMethodContext.SetSurroundingText(example);
+ Assert.AreEqual(example, inputMethodContext.GetSurroundingText(), "Should be equal to SetSurroundingText");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetSurroundingText. Check whether GetSurroundingText works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetSurroundingText M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetSurroundingText_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ inputMethodContext.SetSurroundingText("Test");
+ string text = inputMethodContext.GetSurroundingText();
+ Assert.AreEqual("Test", text, "Should be equal to GetSurroundingText");
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test NotifyTextInputMultiLine. Check whether NotifyTextInputMultiLine works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.NotifyTextInputMultiLine M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void NotifyTextInputMultiLine_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.NotifyTextInputMultiLine(true);
+ inputMethodContext.NotifyTextInputMultiLine(false);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetTextDirection. Check whether GetTextDirection works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetTextDirection M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetTextDirection_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ if (inputMethodContext)
+ {
+ Assert.AreEqual(InputMethodContext.TextDirection.LeftToRight, inputMethodContext.GetTextDirection(), "Should be equal");
+ }
+
+ inputMethodContext.Dispose();
+ }
+
[Test]
[Category("P1")]
[Description("Test TextPrediction. Check whether TextPrediction is readable and writable.")]
Assert.AreEqual(false, inputMethodContext.TextPrediction, "should be false but error");
}
+ [Test]
+ [Category("P1")]
+ [Description("Test GetInputMethodArea. Check whether GetInputMethodArea works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetInputMethodArea M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetInputMethodArea_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ if (inputMethodContext)
+ {
+ Rectangle rect = inputMethodContext.GetInputMethodArea();
+ Assert.GreaterOrEqual(rect.X, 0, "Should be greater than 0!");
+ Assert.GreaterOrEqual(rect.Y, 0, "Should be greater than 0!");
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetInputPanelUserData. Check whether SetInputPanelUserData works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.SetInputPanelUserData M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void SetInputPanelUserData_TEST()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.SetInputPanelUserData("layouttype = 1 & entrylimit = 255 & action = clearall_for_voice_commit & caller = org.volt.search - all");
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetInputPanelUserData. Check whether GetInputPanelUserData works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetInputPanelUserData M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetInputPanelUserData_TEST()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.SetInputPanelUserData("layouttype = 1 & entrylimit = 255 & action = clearall_for_voice_commit & caller = org.volt.search - all");
+ string data = "";
+ inputMethodContext.GetInputPanelUserData(out data);
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error(TAG, "Caught Exception" + e.ToString());
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetInputPanelState. Check whether GetInputPanelState works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetInputPanelState M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task GetInputPanelState_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ Assert.IsNotNull(inputMethodContext, "InputMethodContext should not be null");
+ if (inputMethodContext.RestoreAfterFocusLost())
+ {
+ inputMethodContext.SetRestoreAfterFocusLost(false);
+ }
+
+ inputMethodContext.HideInputPanel();
+ await Task.Delay(300);
+ Assert.AreEqual(InputMethodContext.State.Hide, inputMethodContext.GetInputPanelState(), "Should be equal");
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test SetReturnKeyState. Check whether SetReturnKeyState works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.SetReturnKeyState M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void SetReturnKeyState_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.SetReturnKeyState(true);
+ inputMethodContext.SetReturnKeyState(false);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test AutoEnableInputPanel. Check whether AutoEnableInputPanel works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.AutoEnableInputPanel M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void AutoEnableInputPanel_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.AutoEnableInputPanel(true);
+ inputMethodContext.AutoEnableInputPanel(false);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ShowInputPanel. Check whether ShowInputPanel works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.ShowInputPanel M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void ShowInputPanel_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test HideInputPanel. Check whether HideInputPanel works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.HideInputPanel M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void HideInputPanel_NO_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ try
+ {
+ inputMethodContext.Deactivate();
+ inputMethodContext.HideInputPanel();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetKeyboardType. Check whether GetKeyboardType works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetKeyboardType M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetKeyboardType_RETURN_VALUE()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ if (inputMethodContext)
+ {
+ Assert.AreEqual(InputMethodContext.KeyboardType.SoftwareKeyboard, inputMethodContext.GetKeyboardType(), "Should be not null");
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test GetInputPanelLocale. Check whether GetInputPanelLocale works or not.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.GetInputPanelLocale M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task GetInputPanelLocale_RETURN_VALUE()
+ {
+ _editor = new TextEditor()
+ {
+ Size2D = new Size2D(500, 300),
+ Position2D = new Position2D(10, 550),
+ BackgroundColor = Color.Magenta,
+ Focusable = true,
+ };
+
+ InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ await Task.Delay(20);
+ if (inputMethodContext)
+ {
+ Assert.AreEqual("en_US", inputMethodContext.GetInputPanelLocale(), "Should be equal");
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Activated event is triggered.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.Activated E")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task Activated_EVENT()
+ {
+ InputMethodContext inputMethodContext = new InputMethodContext();
+ if (inputMethodContext)
+ {
+ _temp = 0;
+ inputMethodContext.Activated += OnInputMethodContextEvent;
+ inputMethodContext.Activate();
+ await Task.Delay(20);
+ Assert.AreEqual(10, _temp, "Should be 10");
+ inputMethodContext.Activated -= OnInputMethodContextEvent;
+ }
+
+ inputMethodContext.Dispose();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether EventReceived event is triggered.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.EventReceived E")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task EventReceived_EVENT()
+ {
+ _editor = new TextEditor()
+ {
+ Size2D = new Size2D(500, 300),
+ Position2D = new Position2D(10, 550),
+ BackgroundColor = Color.Magenta,
+ Focusable = true,
+ };
+ Window.Instance.GetDefaultLayer().Add(_editor);
+ InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ if (inputMethodContext)
+ {
+ _temp = 0;
+ inputMethodContext.EventReceived += OnEventReceived;
+ inputMethodContext.Deactivate();
+ inputMethodContext.HideInputPanel();
+ await Task.Delay(20);
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ await Task.Delay(20);
+ Assert.AreEqual(10, _temp, "Should be 10");
+ inputMethodContext.EventReceived -= OnEventReceived;
+ }
+
+ Window.Instance.GetDefaultLayer().Remove(_editor);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether StatusChanged event is triggered.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.StatusChanged E")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task StatusChanged_EVENT()
+ {
+ _editor = new TextEditor()
+ {
+ Size2D = new Size2D(500, 300),
+ Position2D = new Position2D(10, 550),
+ BackgroundColor = Color.Magenta,
+ Focusable = true,
+ };
+ Window.Instance.GetDefaultLayer().Add(_editor);
+ InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ if (inputMethodContext)
+ {
+ _temp = 0;
+ inputMethodContext.StatusChanged += OnInputMethodContextEvent;
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ await Task.Delay(70);
+ inputMethodContext.Deactivate();
+ inputMethodContext.HideInputPanel();
+ await Task.Delay(70);
+ Assert.AreEqual(10, _temp, "Should be 10");
+ inputMethodContext.StatusChanged -= OnInputMethodContextEvent;
+ }
+
+ Window.Instance.GetDefaultLayer().Remove(_editor);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether Resized event is triggered.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.Resized E")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task Resized_EVENT()
+ {
+ _editor = new TextEditor()
+ {
+ Size2D = new Size2D(500, 300),
+ Position2D = new Position2D(10, 550),
+ BackgroundColor = Color.Magenta,
+ Focusable = true,
+ };
+ Window.Instance.GetDefaultLayer().Add(_editor);
+ InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ if (inputMethodContext)
+ {
+ _temp = 0;
+ inputMethodContext.Resized += OnInputMethodContextEvent;
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ await Task.Delay(60);
+ inputMethodContext.Deactivate();
+ inputMethodContext.HideInputPanel();
+ await Task.Delay(60);
+
+ Assert.AreEqual(10, _temp, "Should be 10");
+ inputMethodContext.Resized -= OnInputMethodContextEvent;
+ }
+
+ Window.Instance.GetDefaultLayer().Remove(_editor);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether LanguageChanged event is triggered.")]
+ [Property("SPEC", "Tizen.NUI.InputMethodContext.LanguageChanged E")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public async Task LanguageChanged_EVENT()
+ {
+ _editor = new TextEditor()
+ {
+ Size2D = new Size2D(500, 300),
+ Position2D = new Position2D(10, 550),
+ BackgroundColor = Color.Magenta,
+ Focusable = true,
+ };
+ Window.Instance.GetDefaultLayer().Add(_editor);
+ InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ if (inputMethodContext)
+ {
+ _temp = 0;
+ inputMethodContext.LanguageChanged += OnInputMethodContextEvent;
+ inputMethodContext.Deactivate();
+ inputMethodContext.HideInputPanel();
+ await Task.Delay(20);
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ await Task.Delay(20);
+ Assert.AreEqual(10, _temp, "Should be 10");
+ inputMethodContext.LanguageChanged -= OnInputMethodContextEvent;
+ }
+
+ Window.Instance.GetDefaultLayer().Remove(_editor);
+ }
+
}
}
private static string image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
[SetUp]
- public static void Init()
+ public void Init()
{
Tizen.Log.Info(TAG, "Init() is called!");
App.MainTitleChangeText("TextEditorTests");
}
[TearDown]
- public static void Destroy()
+ public void Destroy()
{
Tizen.Log.Info(TAG, "Destroy() is called!");
}
[Test]
[Category("P1")]
+ [Description("Test GetInputMethodContext. Check whether GetInputMethodContext works or not.")]
+ [Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.GetInputMethodContext M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetInputMethodContext_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ TextEditor textEditor = new TextEditor();
+ var inputMethodContext = textEditor.GetInputMethodContext();
+ Assert.IsInstanceOf<InputMethodContext>(inputMethodContext, "Should be the instance of InputMethodContext Type");
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Test GrabHandleImage. Check whether GrabHandleImage is readable and writable.")]
[Property("SPEC", "Tizen.NUI.BaseComponents.TextEditor.GrabHandleImage A")]
[Property("SPEC_URL", "-")]
private static string image_path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Tizen.NUI.Tests.png";
[SetUp]
- public static void Init()
+ public void Init()
{
Tizen.Log.Info(TAG, "Init() is called!");
App.MainTitleChangeText("TextFieldTests");
}
[TearDown]
- public static void Destroy()
+ public void Destroy()
{
Tizen.Log.Info(TAG, "Destroy() is called!");
}
[Test]
[Category("P1")]
+ [Description("Test GetInputMethodContext. Check whether GetInputMethodContext works or not.")]
+ [Property("SPEC", "Tizen.NUI.BaseComponents.TextField.GetInputMethodContext M")]
+ [Property("SPEC_URL", " - ")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
+ public void GetInputMethodContext_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ TextField textField = new TextField();
+ var inputMethodContext = textField.GetInputMethodContext();
+ Assert.IsInstanceOf<InputMethodContext>(inputMethodContext, "Should be the instance of InputMethodContext Type");
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Test GrabHandleImage. Check whether GrabHandleImage is readable and writable.")]
[Property("SPEC", "Tizen.NUI.BaseComponents.TextField.GrabHandleImage A")]
[Property("SPEC_URL", "-")]