Ensured that the cursor remains active even when the keyboard is invisible but the control still has focus.
Change-Id: Ie4a57646f866eecc7c0082615155dd6cc0ad889c
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
END_TEST;
}
+int utcDaliTextEditorFocusWithInputMethodContext(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorFocusWithInputMethodContext");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+
+ application.GetScene().Add(editor);
+ editor.SetProperty(DevelTextEditor::Property::ENABLE_EDITING, true);
+ application.SendNotification();
+ application.Render();
+
+ // get InputMethodContext
+ InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext(editor);
+ DALI_TEST_CHECK(inputMethodContext);
+
+ // connect StatusChangedSignal
+ editor.SetKeyInputFocus();
+
+ // keyboard shown
+ inputMethodContext.StatusChangedSignal().Emit(true);
+ application.SendNotification();
+ application.Render();
+
+ // keyboard hidden
+ inputMethodContext.StatusChangedSignal().Emit(false);
+ application.SendNotification();
+ application.Render();
+
+ // set focus and keyboard shown
+ editor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ KeyboardFocusManager::Get().SetCurrentFocusActor(editor);
+
+ inputMethodContext.StatusChangedSignal().Emit(true);
+ application.SendNotification();
+ application.Render();
+
+ // keyboard hidden, focus should remain
+ inputMethodContext.StatusChangedSignal().Emit(false);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(editor, KeyboardFocusManager::Get().GetCurrentFocusActor(), TEST_LOCATION);
+
+ END_TEST;
+}
+
int utcDaliTextEditorInputStyleChanged01(void)
{
// The text-editor emits signals when the input style changes. These changes of style are
END_TEST;
}
+int utcDaliTextFieldFocusWithInputMethodContext(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldFocusWithInputMethodContext");
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+ field.SetProperty(DevelTextField::Property::ENABLE_EDITING, true);
+ application.SendNotification();
+ application.Render();
+
+ // get InputMethodContext
+ InputMethodContext inputMethodContext = DevelTextField::GetInputMethodContext(field);
+ DALI_TEST_CHECK(inputMethodContext);
+
+ // connect StatusChangedSignal
+ field.SetKeyInputFocus();
+
+ // keyboard shown
+ inputMethodContext.StatusChangedSignal().Emit(true);
+ application.SendNotification();
+ application.Render();
+
+ // keyboard hidden
+ inputMethodContext.StatusChangedSignal().Emit(false);
+ application.SendNotification();
+ application.Render();
+
+ // set focus and keyboard shown
+ field.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ KeyboardFocusManager::Get().SetCurrentFocusActor(field);
+
+ inputMethodContext.StatusChangedSignal().Emit(true);
+ application.SendNotification();
+ application.Render();
+
+ // keyboard hidden, focus should remain
+ inputMethodContext.StatusChangedSignal().Emit(false);
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(field, KeyboardFocusManager::Get().GetCurrentFocusActor(), TEST_LOCATION);
+
+ END_TEST;
+}
+
// Negative test for the textChanged signal.
int utcDaliTextFieldTextChangedN(void)
{
{
DALI_LOG_INFO(gTextEditorLogFilter, Debug::Verbose, "TextEditor::KeyboardStatusChanged %p keyboardShown %d\n", mController.Get(), keyboardShown);
+ bool isFocused = false;
+
+ Dali::Toolkit::KeyboardFocusManager keyboardFocusManager = Dali::Toolkit::KeyboardFocusManager::Get();
+ if(keyboardFocusManager)
+ {
+ isFocused = keyboardFocusManager.GetCurrentFocusActor() == Self();
+ }
+
// Just hide the grab handle when keyboard is hidden.
if(!keyboardShown)
{
- mController->KeyboardFocusLostEvent();
+ if(!isFocused)
+ {
+ mController->KeyboardFocusLostEvent();
+ }
}
else
{
{
DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField::KeyboardStatusChanged %p keyboardShown %d\n", mController.Get(), keyboardShown);
+ bool isFocused = false;
+
+ Dali::Toolkit::KeyboardFocusManager keyboardFocusManager = Dali::Toolkit::KeyboardFocusManager::Get();
+ if(keyboardFocusManager)
+ {
+ isFocused = keyboardFocusManager.GetCurrentFocusActor() == Self();
+ }
+
// Just hide the grab handle when keyboard is hidden.
if(!keyboardShown)
{
- mController->KeyboardFocusLostEvent();
+ if(!isFocused)
+ {
+ mController->KeyboardFocusLostEvent();
+ }
}
else
{