Merge "Don't count '\r' in text-field" into devel/master
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 17 Jan 2018 08:30:10 +0000 (08:30 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 17 Jan 2018 08:30:10 +0000 (08:30 +0000)
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp

index a8f2c9d..3e369f6 100644 (file)
@@ -120,6 +120,7 @@ const float SCROLL_SPEED = 300.f;
 const unsigned int DEFAULT_FONT_SIZE = 1152u;
 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
 
+const int KEY_RETURN_CODE = 36;
 const int KEY_A_CODE = 38;
 const int KEY_D_CODE = 40;
 
@@ -1156,6 +1157,11 @@ int utcDaliTextFieldMaxCharactersReachedN(void)
   DALI_TEST_CHECK( !gMaxCharactersCallBackCalled );
   DALI_TEST_CHECK( !maxLengthReachedSignal );
 
+  application.ProcessEvent( GenerateKey( "Return", "\r", KEY_RETURN_CODE, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  DALI_TEST_CHECK( !gMaxCharactersCallBackCalled );
+  DALI_TEST_CHECK( !maxLengthReachedSignal );
+
   END_TEST;
 }
 
index 737d507..d79fd7b 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <cstring>
 #include <dali/public-api/adaptor-framework/key.h>
+#include <dali/devel-api/adaptor-framework/key-devel.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/devel-api/object/property-helper-devel.h>
@@ -1572,6 +1573,11 @@ bool TextField::OnKeyEvent( const KeyEvent& event )
 
     return true;
   }
+  else if( Dali::DevelKey::DALI_KEY_RETURN == event.keyCode )
+  {
+    // Do nothing when enter is comming.
+    return false;
+  }
 
   return mController->KeyEvent( event );
 }