Merge "DALi Version 1.2.40" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 19 May 2017 12:45:17 +0000 (12:45 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 19 May 2017 12:45:17 +0000 (12:45 +0000)
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp
dali-toolkit/internal/text/text-controller.cpp

index c0a7076..8d73622 100644 (file)
@@ -194,6 +194,18 @@ int UtcDaliTextControllerImfEvent(void)
   controller->GetText( text );
   DALI_TEST_CHECK( text.empty() );
 
+  imfEvent = ImfManager::ImfEventData( ImfManager::COMMIT, "Hello ", 0, 6 );
+  controller->OnImfEvent( imfManager, imfEvent );
+  controller->GetNaturalSize();
+
+  // Check 'Delete All' key which means the input panel send a big range
+  imfEvent = ImfManager::ImfEventData( ImfManager::DELETESURROUNDING, "", -100, 100 );
+  controller->OnImfEvent( imfManager, imfEvent );
+  controller->GetNaturalSize();
+
+  controller->GetText( text );
+  DALI_TEST_EQUALS( "", text, TEST_LOCATION );
+
   // Send COMMIT event.
   imfEvent = ImfManager::ImfEventData( ImfManager::COMMIT, "Hello ", 0, 6 );
   controller->OnImfEvent( imfManager, imfEvent );
index 7545481..d02f9aa 100644 (file)
@@ -2681,12 +2681,12 @@ bool Controller::RemoveText( int cursorOffset,
     Vector<Character>& currentText = mImpl->mModel->mLogicalModel->mText;
     CharacterIndex& oldCursorIndex = mImpl->mEventData->mPrimaryCursorPosition;
 
-    CharacterIndex cursorIndex = oldCursorIndex;
+    CharacterIndex cursorIndex = 0;
 
     // Validate the cursor position & number of characters
-    if( static_cast< CharacterIndex >( std::abs( cursorOffset ) ) <= cursorIndex )
+    if( ( static_cast< int >( mImpl->mEventData->mPrimaryCursorPosition ) + cursorOffset ) >= 0 )
     {
-      cursorIndex = oldCursorIndex + cursorOffset;
+      cursorIndex = mImpl->mEventData->mPrimaryCursorPosition + cursorOffset;
     }
 
     if( ( cursorIndex + numberOfCharacters ) > currentText.Count() )