Make TextField and TextEditor clear it's input focus when getting Return/Escape KeyUp event.
Change-Id: I62053850dc198da0f9d6a241aac586b67f1d6d88
Signed-off-by: minho.sun <minho.sun@samsung.com>
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
+ // Press Escape to increase coverage
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up ) );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !editor.HasKeyInputFocus() );
+
END_TEST;
}
DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+ // Press Escape to increase coverage
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Up ) );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( !field.HasKeyInputFocus() );
+
END_TEST;
}
if( Dali::DALI_KEY_ESCAPE == event.keyCode ) // Make a Dali key code for this
{
- ClearKeyInputFocus();
+ // Make sure ClearKeyInputFocus when only key is up
+ if( event.state == KeyEvent::Up )
+ {
+ ClearKeyInputFocus();
+ }
+
return true;
}
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode );
- if( Dali::DALI_KEY_ESCAPE == event.keyCode ||
- "Return" == event.keyPressedName ) // Make a Dali key code for this
+ if( Dali::DALI_KEY_ESCAPE == event.keyCode || "Return" == event.keyPressedName ) // Make a Dali key code for this
{
- ClearKeyInputFocus();
+ // Make sure ClearKeyInputFocus when only key is up
+ if( event.state == KeyEvent::Up )
+ {
+ ClearKeyInputFocus();
+ }
+
return true;
}