namespace Tizen.NUI.Tests
{
+ using tlog = Tizen.Log;
+
[TestFixture]
[Description("Tizen.NUI.InputMethodContext Tests")]
public class InputMethodContextTests
[TearDown]
public void Destroy()
{
- Tizen.Log.Info(TAG, "Destroy() is called!");
+ tlog.Debug(TAG, "Destroy() is called!");
}
public void OnInputMethodContextEvent(object sender, EventArgs e)
public void OnInputMethodContextEvent1(object sender, EventArgs e)
{
- Tizen.Log.Fatal("NUI", $"TP#3 LanguageChanged_EVENT() OnInputMethodContextEvent1() TimeStamp={DateTime.Now.ToString("hh:mm:ss.fff")}");
+ tlog.Debug(TAG, $"LanguageChanged_EVENT() OnInputMethodContextEvent1() TimeStamp={DateTime.Now.ToString("hh:mm:ss.fff")}");
_temp = 10;
}
{
_temp = 10;
InputMethodContext.CallbackData callbackData = new InputMethodContext.CallbackData(true, 0, e.EventData.PredictiveString, false);
- Tizen.Log.Fatal("NUI", "Inputmethod Manager return callbackData!!!");
+ tlog.Debug(TAG, "Inputmethod Manager return callbackData!!!");
return callbackData;
}
[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!");
+ var inputMethodContext = new InputMethodContext();
+ Assert.IsNotNull(inputMethodContext, "The inputMethodContext object should not be null!");
+
+ tlog.Debug(TAG, $"DestroyContext_NO_RETURN_VALUE() checked if inputMethodContext object is null");
try
{
inputMethodContext.DestroyContext();
+ tlog.Debug(TAG, $"DestroyContext_NO_RETURN_VALUE() inputMethodContext.DestroyContext() called");
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
var inputMethodContext = new InputMethodContext();
Assert.NotNull(inputMethodContext, "Should not be null");
Assert.IsInstanceOf<InputMethodContext>(inputMethodContext, "Should be the instance of InputMethodContext Type");
- inputMethodContext.Dispose();
+ tlog.Debug(TAG, $"InputMethodContext_INIT() checked if inputMethodContext object is null");
}
[Test]
[Property("SPEC_URL", " - ")]
[Property("CRITERIA", "MR")]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
- public void Activate_NO_RETURN_VALUE()
+ public async Task Activate_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
+
+ Assert.IsNotNull(inputMethodContext, "The inputMethodContext object should not be null!");
+ tlog.Debug(TAG, $"Activate_NO_RETURN_VALUE() checked if inputMethodContext object is null");
+
try
{
inputMethodContext.Activate();
+ tlog.Debug(TAG, $"Activate_NO_RETURN_VALUE() inputMethodContext.Activate() called!");
+
+ await Task.Delay(500);
+ tlog.Debug(TAG, $"Activate_NO_RETURN_VALUE() 500ms delay added");
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void Deactivate_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.Deactivate();
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void RestoreAfterFocusLost_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.SetRestoreAfterFocusLost(true);
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void SetRestoreAfterFocusLost_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.SetRestoreAfterFocusLost(true);
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void Reset_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.Reset();
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void NotifyCursorPosition_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.NotifyCursorPosition();
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void SetCursorPosition_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
uint cursorPosition = 0;
try
{
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void GetCursorPosition_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
inputMethodContext.SetCursorPosition(100);
uint pos = inputMethodContext.GetCursorPosition();
Assert.AreEqual(100, pos, "Should be equal to GetCursorPosition");
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void SetSurroundingText_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
string example = "Test";
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void GetSurroundingText_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
inputMethodContext.SetSurroundingText("Test");
string text = inputMethodContext.GetSurroundingText();
Assert.AreEqual("Test", text, "Should be equal to GetSurroundingText");
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void NotifyTextInputMultiLine_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.NotifyTextInputMultiLine(true);
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void GetTextDirection_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
if (inputMethodContext)
{
Assert.AreEqual(InputMethodContext.TextDirection.LeftToRight, inputMethodContext.GetTextDirection(), "Should be equal");
}
-
- inputMethodContext.Dispose();
}
[Test]
public void TextPrediction_SET_GET_VALUE()
{
/* TEST CODE */
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
inputMethodContext.TextPrediction = true;
Assert.AreEqual(true, inputMethodContext.TextPrediction, "Should be true but error");
inputMethodContext.TextPrediction = false;
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public async Task GetInputMethodArea_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
inputMethodContext.Activate();
inputMethodContext.ShowInputPanel();
await Task.Delay(300);
- Tizen.Log.Debug("NUI", "GetInputMethodArea_RETURN_VALUE! Add 300ms delay!");
+ tlog.Debug(TAG, "GetInputMethodArea_RETURN_VALUE! Add 300ms delay!");
if (inputMethodContext)
{
Assert.GreaterOrEqual(rect.X, 0, "Should be greater than 0!");
Assert.GreaterOrEqual(rect.Y, 0, "Should be greater than 0!");
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void SetInputPanelUserData_TEST()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var 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());
+ tlog.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]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void GetInputPanelUserData_TEST()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var 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());
+ tlog.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]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public async Task GetInputPanelState_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
Assert.IsNotNull(inputMethodContext, "InputMethodContext should not be null");
if (inputMethodContext.RestoreAfterFocusLost())
{
inputMethodContext.HideInputPanel();
await Task.Delay(300);
Assert.AreEqual(InputMethodContext.State.Hide, inputMethodContext.GetInputPanelState(), "Should be equal");
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void SetReturnKeyState_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.SetReturnKeyState(true);
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("SPEC_URL", " - ")]
[Property("CRITERIA", "MR")]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
- public void AutoEnableInputPanel_NO_RETURN_VALUE()
+ public async Task AutoEnableInputPanel_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
+ tlog.Debug(TAG, $"AutoEnableInputPanel_NO_RETURN_VALUE: start");
+
inputMethodContext.AutoEnableInputPanel(true);
+ tlog.Debug(TAG, $"AutoEnableInputPanel_NO_RETURN_VALUE: inputMethodContext.AutoEnableInputPanel(true) called");
+
+ await Task.Delay(500);
+ tlog.Debug(TAG, $"AutoEnableInputPanel_NO_RETURN_VALUE: add delay 500ms");
+
inputMethodContext.AutoEnableInputPanel(false);
+ tlog.Debug(TAG, $"AutoEnableInputPanel_NO_RETURN_VALUE: inputMethodContext.AutoEnableInputPanel(false) called");
+
+ await Task.Delay(500);
+ tlog.Debug(TAG, $"AutoEnableInputPanel_NO_RETURN_VALUE: add delay 500ms");
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("SPEC_URL", " - ")]
[Property("CRITERIA", "MR")]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
- public void ShowInputPanel_NO_RETURN_VALUE()
+ public async Task ShowInputPanel_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.Activate();
inputMethodContext.ShowInputPanel();
+ await Task.Delay(500);
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void HideInputPanel_NO_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
try
{
inputMethodContext.Deactivate();
{
Assert.Fail("Caught Exception" + e.ToString());
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public void GetKeyboardType_RETURN_VALUE()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
if (inputMethodContext)
{
Assert.AreEqual(InputMethodContext.KeyboardType.SoftwareKeyboard, inputMethodContext.GetKeyboardType(), "Should be not null");
}
-
- inputMethodContext.Dispose();
}
[Test]
Focusable = true,
};
- InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ var inputMethodContext = _editor.GetInputMethodContext();
Assert.IsNotNull(inputMethodContext, "InputMethodContext should not be null after using GetInputMethodContext");
inputMethodContext.Activate();
await Task.Delay(500);
if (inputMethodContext)
{
- if(inputMethodContext.GetInputPanelLocale() != null)\r
- {\r
- if (inputMethodContext.GetInputPanelLocale() != "")\r
- {\r
- Assert.IsTrue(inputMethodContext.GetInputPanelLocale().Contains("en_US"), "Default value is not en_US");\r
- }\r
- else\r
- {\r
- Assert.Pass("InputPanelLocale of InputMethod is not set in this profile");\r
- }\r
+ if(inputMethodContext.GetInputPanelLocale() != null)
+ {
+ if (inputMethodContext.GetInputPanelLocale() != "")
+ {
+ Assert.IsTrue(inputMethodContext.GetInputPanelLocale().Contains("en_US"), "Default value is not en_US");
+ }
+ else
+ {
+ Assert.Pass("InputPanelLocale of InputMethod is not set in this profile");
+ }
}
}
-
- inputMethodContext.Dispose();
}
[Test]
[Property("AUTHOR", "Wenfeng Ge, wenfeng.ge@samsung.com")]
public async Task Activated_EVENT()
{
- InputMethodContext inputMethodContext = new InputMethodContext();
+ var inputMethodContext = new InputMethodContext();
if (inputMethodContext)
{
_temp = 0;
Assert.AreEqual(10, _temp, "Should be 10");
inputMethodContext.Activated -= OnInputMethodContextEvent;
}
-
- inputMethodContext.Dispose();
}
[Test]
Focusable = true,
};
Window.Instance.GetDefaultLayer().Add(_editor);
- InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ var inputMethodContext = _editor.GetInputMethodContext();
if (inputMethodContext)
{
_temp = 0;
Focusable = true,
};
Window.Instance.GetDefaultLayer().Add(_editor);
- InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ var inputMethodContext = _editor.GetInputMethodContext();
if (inputMethodContext)
{
_temp = 0;
inputMethodContext.ShowInputPanel();
await Task.Delay(200);
- Tizen.Log.Debug("NUI", "StatusChanged_EVENT Add 200ms delay");
+ tlog.Debug(TAG, "StatusChanged_EVENT Add 200ms delay");
Assert.AreEqual(10, _temp, "Should be 10");
inputMethodContext.StatusChanged -= OnInputMethodContextEvent;
Focusable = true,
};
Window.Instance.GetDefaultLayer().Add(_editor);
- InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ var inputMethodContext = _editor.GetInputMethodContext();
if (inputMethodContext)
{
_temp = 0;
Focusable = true,
};
Window.Instance.GetDefaultLayer().Add(_editor);
- InputMethodContext inputMethodContext = _editor.GetInputMethodContext();
+ var inputMethodContext = _editor.GetInputMethodContext();
if (inputMethodContext)
- {\r
- if (inputMethodContext.GetInputPanelLocale() != null)\r
- {\r
- if (inputMethodContext.GetInputPanelLocale() == "")\r
- {\r
- Assert.Pass("InputPanelLocale of InputMethod is not set in this profile");\r
- }\r
- else\r
- {\r
- _temp = 0;\r
- inputMethodContext.LanguageChanged += OnInputMethodContextEvent1;\r
- inputMethodContext.Deactivate();\r
- inputMethodContext.HideInputPanel();\r
- await Task.Delay(500);\r
- Tizen.Log.Debug("NUI", $"TP#1 LanguageChanged_EVENT() HideInputPanel() TimeStamp={DateTime.Now.ToString("hh:mm:ss.fff")}");\r
- inputMethodContext.Activate();\r
- inputMethodContext.ShowInputPanel();\r
- await Task.Delay(500);\r
- Tizen.Log.Debug("NUI", $"TP#2 LanguageChanged_EVENT() ShowInputPanel() TimeStamp={DateTime.Now.ToString("hh:mm:ss.fff")}");\r
-\r
- Assert.AreEqual(10, _temp, "Should be 10");\r
- inputMethodContext.LanguageChanged -= OnInputMethodContextEvent1;\r
- }\r
+ {
+ if (inputMethodContext.GetInputPanelLocale() != null)
+ {
+ if (inputMethodContext.GetInputPanelLocale() == "")
+ {
+ Assert.Pass("InputPanelLocale of InputMethod is not set in this profile");
+ }
+ else
+ {
+ _temp = 0;
+ inputMethodContext.LanguageChanged += OnInputMethodContextEvent1;
+ inputMethodContext.Deactivate();
+ inputMethodContext.HideInputPanel();
+ await Task.Delay(500);
+ tlog.Debug(TAG, $"LanguageChanged_EVENT() HideInputPanel() TimeStamp={DateTime.Now.ToString("hh:mm:ss.fff")}");
+ inputMethodContext.Activate();
+ inputMethodContext.ShowInputPanel();
+ await Task.Delay(500);
+ tlog.Debug(TAG, $"LanguageChanged_EVENT() ShowInputPanel() TimeStamp={DateTime.Now.ToString("hh:mm:ss.fff")}");
+
+ Assert.AreEqual(10, _temp, "Should be 10");
+ inputMethodContext.LanguageChanged -= OnInputMethodContextEvent1;
+ }
}
}
-
Window.Instance.GetDefaultLayer().Remove(_editor);
}
-
}
}