Merge "Sanitize code inside Alignment, remove duplication and unnecessary functor...
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 23 Jun 2015 15:49:57 +0000 (08:49 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 23 Jun 2015 15:49:57 +0000 (08:49 -0700)
19 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/internal/text/bidirectional-support.cpp
dali-toolkit/internal/text/bidirectional-support.h
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/multi-language-support-impl.h
dali-toolkit/internal/text/multi-language-support.cpp
dali-toolkit/internal/text/multi-language-support.h
dali-toolkit/internal/text/segmentation.cpp
dali-toolkit/internal/text/segmentation.h
dali-toolkit/internal/text/shaper.cpp
dali-toolkit/internal/text/shaper.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index c3b14ab..9324e48 100644 (file)
@@ -10,6 +10,7 @@ SET(TC_SOURCES
  utc-Dali-PushButton.cpp
  utc-Dali-Text-CharacterSetConversion.cpp
  utc-Dali-Text-Segmentation.cpp
+ utc-Dali-Text-MultiLanguage.cpp
 )
 
 # Append list of test harness files (Won't get parsed for test cases)
diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp
new file mode 100644 (file)
index 0000000..4b89f25
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali-toolkit/internal/text/character-set-conversion.h>
+#include <dali-toolkit/internal/text/segmentation.h>
+#include <dali-toolkit/internal/text/multi-language-support.h>
+#include <dali-toolkit/internal/text/logical-model-impl.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+// Tests the following functions with different scripts.
+// Constructor, destructor and MultilanguageSupport::Get()
+// void MultilanguageSupport::SetScripts( const Vector<Character>& text, const Vector<LineBreakInfo>& lineBreakInfo, Vector<ScriptRun>& scripts );
+// void MultilanguageSupport::ValidateFonts( const Vector<Character>& text, const Vector<ScriptRun>& scripts, Vector<FontRun>& fonts );
+
+//////////////////////////////////////////////////////////
+
+namespace
+{
+
+struct ScriptsData
+{
+  std::string description;      ///< Description of the experiment.
+  std::string text;             ///< Input text.
+  Vector<ScriptRun> scriptRuns; ///< Expected script runs.
+};
+
+struct ValidateFontsData
+{
+  std::string description;  ///< Description of the experiment.
+  std::string text;         ///< Input text.
+};
+
+//////////////////////////////////////////////////////////
+
+bool ScriptsTest( const ScriptsData& data )
+{
+  MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
+
+  // 1) Convert to utf32
+  Vector<Character> utf32;
+  utf32.Resize( data.text.size() );
+
+  const uint32_t numberOfCharacters = Utf8ToUtf32( reinterpret_cast<const uint8_t* const>( data.text.c_str() ),
+                                                   data.text.size(),
+                                                   &utf32[0u] );
+  utf32.Resize( numberOfCharacters );
+
+  // 2) Set the line break info.
+  Vector<LineBreakInfo> lineBreakInfo;
+  lineBreakInfo.Resize( numberOfCharacters );
+
+  SetLineBreakInfo( utf32, lineBreakInfo );
+
+  // 3) Set the script info.
+  Vector<ScriptRun> scripts;
+  multilanguageSupport.SetScripts( utf32,
+                                   lineBreakInfo,
+                                   scripts );
+
+  // 4) Compare the results.
+
+  if( scripts.Count() != data.scriptRuns.Count() )
+  {
+    tet_infoline("ScriptsTest: different number of scripts.");
+    return false;
+  }
+
+  for( unsigned int index = 0u; index < scripts.Count(); ++index )
+  {
+    const ScriptRun& scriptRun1 = scripts[index];
+    const ScriptRun& scriptRun2 = data.scriptRuns[index];
+
+    if( scriptRun1.characterRun.characterIndex != scriptRun2.characterRun.characterIndex )
+    {
+      tet_infoline("ScriptsTest: different character index.");
+      return false;
+    }
+
+    if( scriptRun1.characterRun.numberOfCharacters != scriptRun2.characterRun.numberOfCharacters )
+    {
+      tet_infoline("ScriptsTest: different number of characters.");
+      return false;
+    }
+
+    if( scriptRun1.script != scriptRun2.script )
+    {
+      tet_infoline("ScriptsTest: different script.");
+      return false;
+    }
+  }
+
+  return true;
+}
+
+bool ValidateFontTest( const ValidateFontsData& data )
+{
+  MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
+
+  // 1) Convert to utf32
+  Vector<Character> utf32;
+  utf32.Resize( data.text.size() );
+
+  const uint32_t numberOfCharacters = Utf8ToUtf32( reinterpret_cast<const uint8_t* const>( data.text.c_str() ),
+                                                   data.text.size(),
+                                                   &utf32[0u] );
+  utf32.Resize( numberOfCharacters );
+
+  // 2) Set the line break info.
+  Vector<LineBreakInfo> lineBreakInfo;
+  lineBreakInfo.Resize( numberOfCharacters );
+
+  SetLineBreakInfo( utf32, lineBreakInfo );
+
+  // 3) Set the script info.
+  Vector<ScriptRun> scripts;
+  multilanguageSupport.SetScripts( utf32,
+                                   lineBreakInfo,
+                                   scripts );
+
+  Vector<FontRun> fonts;
+  // 4) Validate the fonts
+  multilanguageSupport.ValidateFonts( utf32,
+                                      scripts,
+                                      fonts );
+
+  return true;
+}
+
+} // namespace
+
+int UtcDaliTextMultiLanguageConstructor(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextMultiLanguageConstructor");
+
+  MultilanguageSupport multilanguageSupport;
+  DALI_TEST_CHECK( !multilanguageSupport );
+
+  MultilanguageSupport multilanguageSupport1 = MultilanguageSupport::Get();
+  DALI_TEST_CHECK( multilanguageSupport1 );
+
+  // To increase coverage.
+  MultilanguageSupport multilanguageSupport2 = MultilanguageSupport::Get();
+  DALI_TEST_CHECK( multilanguageSupport2 );
+
+  DALI_TEST_CHECK( multilanguageSupport1 == multilanguageSupport2 );
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
+
+int UtcDaliTextMultiLanguageSetScripts(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextMultiLanguageSetScripts" );
+
+  // Void text.
+  Vector<ScriptRun> scriptRuns00;
+
+  // Hello world.
+  Vector<ScriptRun> scriptRuns01;
+  ScriptRun scriptRun0100 =
+  {
+    0u,
+    11u,
+    TextAbstraction::LATIN
+  };
+  scriptRuns01.PushBack( scriptRun0100 );
+
+  const ScriptsData data[] =
+  {
+    {
+      "void text",
+      "",
+      scriptRuns00,
+    },
+    {
+      "Easy latin script",
+      "Hello world",
+      scriptRuns01,
+    },
+  };
+  const unsigned int numberOfTests = 2u;
+
+  for( unsigned int index = 0u; index < numberOfTests; ++index )
+  {
+    if( !ScriptsTest( data[index] ) )
+    {
+      tet_result(TET_FAIL);
+    }
+  }
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
+
+int UtcDaliTextMultiLanguageValidateFonts01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextMultiLanguageValidateFonts");
+
+  const ValidateFontsData data[] =
+  {
+    {
+      "void text",
+      "",
+    },
+    {
+      "Easy latin script",
+      "Hello world",
+    },
+  };
+  const unsigned int numberOfTests = 2u;
+
+  for( unsigned int index = 0u; index < numberOfTests; ++index )
+  {
+    if( !ValidateFontTest( data[index] ) )
+    {
+      tet_result(TET_FAIL);
+    }
+  }
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
index 3b98639..2d8a983 100644 (file)
@@ -18,6 +18,8 @@
 #include <iostream>
 #include <stdlib.h>
 #include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/tap-gesture-event.h>
+#include <dali/devel-api/actors/mesh-actor.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/styling/style-manager.h>
@@ -99,6 +101,38 @@ static void TestMaxLengthReachedCallback( TextField control )
   gMaxCharactersCallBackCalled = true;
 }
 
+// Generate a TapGestureEvent to send to Core.
+Integration::TapGestureEvent GenerateTap(
+    Gesture::State state,
+    unsigned int numberOfTaps,
+    unsigned int numberOfTouches,
+    Vector2 point)
+{
+  Integration::TapGestureEvent tap( state );
+
+  tap.numberOfTaps = numberOfTaps;
+  tap.numberOfTouches = numberOfTouches;
+  tap.point = point;
+
+  return tap;
+}
+
+// Generate a KeyEvent to send to Core.
+Integration::KeyEvent GenerateKey( const std::string& keyName,
+                                   const std::string& keyString,
+                                   int keyCode,
+                                   int keyModifier,
+                                   unsigned long timeStamp,
+                                   const Integration::KeyEvent::State& keyState )
+{
+  return Integration::KeyEvent( keyName,
+                                keyString,
+                                keyCode,
+                                keyModifier,
+                                timeStamp,
+                                keyState );
+}
+
 } // namespace
 
 int UtcDaliToolkitTextFieldConstructorP(void)
@@ -363,6 +397,10 @@ int utcDaliTextFieldBasicRenderP(void)
 
   field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
 
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  Stage::GetCurrent().Add( field );
+
   try
   {
     // Render some text with the basic backend
@@ -388,6 +426,11 @@ int utcDaliTextFieldAtlasRenderP(void)
   DALI_TEST_CHECK( field );
 
   field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  Stage::GetCurrent().Add( field );
+
   try
   {
     // Render some text with the shared atlas backend
@@ -422,16 +465,8 @@ int utcDaliTextFieldTextChangedP(void)
 
   field.SetKeyInputFocus();
 
-  Dali::Integration::KeyEvent keyevent;
-  keyevent.keyName = "D";
-  keyevent.keyString = "D";
-  keyevent.keyCode = 0;
-  keyevent.keyModifier = 0;
-  keyevent.time = 0;
-  keyevent.state = Integration::KeyEvent::Down;
-
   gTextChangedCallBackCalled = false;
-  application.ProcessEvent( keyevent );
+  application.ProcessEvent( GenerateKey( "D", "D", 0, 0, 0, Integration::KeyEvent::Down ) );
   DALI_TEST_CHECK( gTextChangedCallBackCalled );
 
   END_TEST;
@@ -474,17 +509,8 @@ int utcDaliTextFieldMaxCharactersReachedP(void)
   gMaxCharactersCallBackCalled = false;
   field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
 
-  Dali::Integration::KeyEvent keyevent;
-  keyevent.keyName = "a";
-  keyevent.keyString = "a";
-  keyevent.keyCode = 0;
-  keyevent.keyModifier = 0;
-  keyevent.time = 0;
-  keyevent.state = Integration::KeyEvent::Down;
-
-  application.ProcessEvent( keyevent );
-
-  application.ProcessEvent( keyevent );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
 
   DALI_TEST_CHECK( gMaxCharactersCallBackCalled );
 
@@ -509,18 +535,294 @@ int utcDaliTextFieldMaxCharactersReachedN(void)
   gMaxCharactersCallBackCalled = false;
   field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
 
-  Dali::Integration::KeyEvent keyevent;
-  keyevent.keyName = "a";
-  keyevent.keyString = "a";
-  keyevent.keyCode = 0;
-  keyevent.keyModifier = 0;
-  keyevent.time = 0;
-  keyevent.state = Integration::KeyEvent::Down;
-
-  application.ProcessEvent( keyevent );
-  application.ProcessEvent( keyevent );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
 
   DALI_TEST_CHECK( !gMaxCharactersCallBackCalled );
 
   END_TEST;
 }
+
+int utcDaliTextFieldEvent01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextFieldEvent01");
+
+  // Creates a tap event. After creating a tap event the text field should
+  // have the focus and add text with key events should be possible.
+
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  Stage::GetCurrent().Add( field );
+
+  field.SetSize( 300.f, 50.f );
+  field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Add a key event but as the text field has not the focus it should do nothing.
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string(""), TEST_LOCATION );
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Now the text field has the focus, so it can handle the key events.
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::TEXT ), std::string("aa"), TEST_LOCATION );
+
+  // Create a second text field and send key events to it.
+  TextField field2 = TextField::New();
+
+  field2.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field2.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  field2.SetSize( 100.f, 100.f );
+  field2.SetPosition( 100.f, 100.f );
+
+  Stage::GetCurrent().Add( field2 );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Create a tap event on the second text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 125.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // The second text field has the focus. It should handle the key events.
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Check the text has been added to the second text field.
+  DALI_TEST_EQUALS( field2.GetProperty<std::string>( TextField::Property::TEXT ), std::string("aa"), TEST_LOCATION );
+
+  END_TEST;
+}
+
+int utcDaliTextFieldEvent02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextFieldEvent02");
+
+  // Checks if the right number of actors are created.
+
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  Stage::GetCurrent().Add( field );
+
+  field.SetSize( 300.f, 50.f );
+  field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Check there are the expected number of children ( active layer, offscreen root actor, and the offscreen image actor
+  DALI_TEST_EQUALS( field.GetChildCount(), 3u, TEST_LOCATION );
+
+  Actor layer = field.GetChildAt( 0u );
+  DALI_TEST_CHECK( layer.IsLayer() );
+
+  Actor offscreenRoot = field.GetChildAt( 1u );
+  DALI_TEST_CHECK( offscreenRoot.IsLayer() );
+  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
+
+  Actor offscreenImage = field.GetChildAt( 2u );
+  ImageActor imageActor = ImageActor::DownCast( offscreenImage );
+  DALI_TEST_CHECK( imageActor );
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
+  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
+
+  // Now the text field has the focus, so it can handle the key events.
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Checks the cursor and the renderer have been created.
+  DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
+  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 2u, TEST_LOCATION ); // The camera actor and the renderer
+
+  ImageActor cursor = ImageActor::DownCast( layer.GetChildAt( 0u ) );
+  DALI_TEST_CHECK( cursor );
+
+  CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
+  DALI_TEST_CHECK( camera );
+
+  RenderableActor renderer = RenderableActor::DownCast( offscreenRoot.GetChildAt( 1u ) );
+  DALI_TEST_CHECK( renderer );
+
+  // Move the cursor and check the position changes.
+  Vector3 position1 = cursor.GetCurrentPosition();
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Vector3 position2 = cursor.GetCurrentPosition();
+
+  DALI_TEST_CHECK( position2.x < position1.x );
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Vector3 position3 = cursor.GetCurrentPosition();
+
+  DALI_TEST_EQUALS( position1, position3, TEST_LOCATION ); // Should be in the same position1.
+
+  // Send some taps and check the cursor positions.
+
+  // Try to tap at the beginning.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Cursor position should be the same than position1.
+  Vector3 position4 = cursor.GetCurrentPosition();
+
+  DALI_TEST_EQUALS( position2, position4, TEST_LOCATION ); // Should be in the same position2.
+
+  // Try to tap at the end.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 13.f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 13.0f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Cursor position should be the same than position1.
+  Vector3 position5 = cursor.GetCurrentPosition();
+
+  DALI_TEST_EQUALS( position1, position5, TEST_LOCATION ); // Should be in the same position1.
+
+  // Remove some text.
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Cursor position should be the same than position2.
+  Vector3 position6 = cursor.GetCurrentPosition();
+
+  DALI_TEST_EQUALS( Vector3( 0.f, position2.y, position2.z ), position6, TEST_LOCATION ); // TODO Should be in the same position2.
+
+  // Should not be renderer.
+  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor only.
+
+  END_TEST;
+}
+
+int utcDaliTextFieldEvent03(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextFieldEvent03");
+
+  // Checks if the highlight actor is created.
+
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+  Stage::GetCurrent().Add( field );
+
+  field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
+  field.SetSize( 30.f, 50.f );
+  field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Tap first to get the focus.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Double tap to select a word.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // The offscreen root actor should have three actors: the camera, a renderer and the highlight actor.
+  Actor offscreenRoot = field.GetChildAt( 1u );
+  DALI_TEST_CHECK( offscreenRoot.IsLayer() );
+
+  CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
+  DALI_TEST_CHECK( camera );
+
+  RenderableActor renderer = RenderableActor::DownCast( offscreenRoot.GetChildAt( 1u ) );
+  DALI_TEST_CHECK( renderer );
+
+  MeshActor highlight = MeshActor::DownCast( offscreenRoot.GetChildAt( 2u ) );
+  DALI_TEST_CHECK( highlight );
+
+  END_TEST;
+}
index d3a3b60..dd5d091 100644 (file)
@@ -236,6 +236,9 @@ int UtcDaliToolkitTextlabelBasicRenderP(void)
   TextLabel label = TextLabel::New("Test Text");
   DALI_TEST_CHECK( label );
 
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
   Stage::GetCurrent().Add( label );
 
   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "BEGIN" );
@@ -262,6 +265,11 @@ int UtcDaliToolkitTextlabelAtlasRenderP(void)
   TextLabel label = TextLabel::New("Test Text");
   DALI_TEST_CHECK( label );
 
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  Stage::GetCurrent().Add( label );
+
   // Turn on all the effects
   label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
@@ -297,7 +305,8 @@ int UtcDaliToolkitTextLabelLanguagesP(void)
                              "բարեւ աշխարհը, მსოფლიოში, 안녕하세요, 你好世界, ひらがな, カタカナ, "
                              "ওহে বিশ্ব, မင်္ဂလာပါကမ္ဘာလောက, हैलो वर्ल्ड, હેલો વર્લ્ડ, ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ, ಹಲೋ ವರ್ಲ್ಡ್, "
                              "ഹലോ വേൾഡ്, ଓଡ଼ିଆ, හෙලෝ වර්ල්ඩ්, ஹலோ உலகம், హలో వరల్డ్, "
-                             "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក." );
+                             "ສະບາຍດີໂລກ, สวัสดีโลก, ជំរាបសួរពិភពលោក, "
+                             "\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84." ); // these characters on the last line are emojis.
 
   label.SetProperty( TextLabel::Property::TEXT, scripts );
   DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::TEXT ), scripts, TEST_LOCATION );
index 135f71b..cf9ec63 100644 (file)
@@ -162,13 +162,6 @@ void SetBidirectionalInfo( const Vector<Character>& text,
   }
 }
 
-void ReplaceBidirectionalInfo( LogicalModel& model,
-                               CharacterIndex characterIndex,
-                               Length numberOfCharactersToRemove,
-                               Length numberOfCharactersToInsert )
-{
-}
-
 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
                    Vector<LineRun>& lineRuns,
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns )
@@ -234,14 +227,6 @@ void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInf
   }
 }
 
-void ReorderLines( LogicalModel& logicalModel,
-                   const VisualModel& visualModel,
-                   CharacterIndex characterIndex,
-                   Length numberOfCharactersToRemove,
-                   Length numberOfCharactersToInsert )
-{
-}
-
 bool GetMirroredText( const Vector<Character>& text,
                       Vector<Character>& mirroredText )
 {
index f51e5e7..2f3b251 100644 (file)
@@ -53,25 +53,6 @@ void SetBidirectionalInfo( const Vector<Character>& text,
                            Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
 
 /**
- * Replaces the bidirectional info from the logical model.
- *
- * @pre The @p model needs to have a text set.
- * @pre The @p model needs to have the line break info set.
- *
- * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
- * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
- *
- * @param[in,out] model The text's logical model.
- * @param[in] characterIndex Index to the first character.
- * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
- * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
- */
-void ReplaceBidirectionalInfo( LogicalModel& model,
-                               CharacterIndex characterIndex,
-                               Length numberOfCharactersToRemove,
-                               Length numberOfCharactersToInsert );
-
-/**
  * Sets the visual to logical map tables.
  *
  * Any map tables previously set are removed.
@@ -90,28 +71,6 @@ void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInf
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns );
 
 /**
- * Replaces the visual to logical and logical to visual map tables.
- *
- * @pre The @p logicalModel needs to have a text set.
- * @pre The @p logicalModel needs to have the line break info set.
- * @pre The @p visualModel needs to have the laid-out lines info set.
- *
- * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
- * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
- *
- * @param[in,out] logicalModel The text's logical model.
- * @param[in] visualModel The text's visual model.
- * @param[in] characterIndex Index to the first character.
- * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
- * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
- */
-void ReorderLines( LogicalModel& logicalModel,
-                   const VisualModel& visualModel,
-                   CharacterIndex characterIndex,
-                   Length numberOfCharactersToRemove,
-                   Length numberOfCharactersToInsert );
-
-/**
  * @brief Replaces any character which could be mirrored.
  *
  * @param[in] text The text.
index 7934b6f..02de592 100644 (file)
@@ -82,8 +82,8 @@ const char* DEFAULT_SELECTION_HANDLE_TWO_PRESSED( DALI_IMAGE_DIR "text-input-sel
 
 const int DEFAULT_POPUP_OFFSET( -100.0f ); // Vertical offset of Popup from cursor or handles position.
 
-const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.5f, 2.0f, 1.0f );
-const Dali::Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.5f, 1.5f, 1.0f );
+const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.25f, 1.5f, 1.0f );
+const Dali::Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.25f, 1.5f, 1.0f );
 
 const Dali::Vector4 LIGHT_BLUE( (0xb2 / 255.0f), (0xeb / 255.0f), (0xf2 / 255.0f), 0.5f ); // The text highlight color.
 
@@ -650,8 +650,9 @@ struct Decorator::Impl : public ConnectionTracker
       primary.grabArea.SetName("SelectionHandleOneGrabArea");
 #endif
       primary.grabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+      primary.grabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
+      primary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
       primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
-      primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
       mTapDetector.Attach( primary.grabArea );
       mPanGestureDetector.Attach( primary.grabArea );
@@ -686,8 +687,9 @@ struct Decorator::Impl : public ConnectionTracker
       secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
 #endif
       secondary.grabArea.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+      secondary.grabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
+      secondary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
       secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
-      secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
       mTapDetector.Attach( secondary.grabArea );
       mPanGestureDetector.Attach( secondary.grabArea );
index f137b4d..3fa8f6f 100644 (file)
@@ -345,13 +345,6 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
   scripts.PushBack( currentScriptRun );
 }
 
-void MultilanguageSupport::ReplaceScripts( LogicalModel& model,
-                                           CharacterIndex characterIndex,
-                                           Length numberOfCharactersToRemove,
-                                           Length numberOfCharactersToInsert )
-{
-}
-
 void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
                                           const Vector<ScriptRun>& scripts,
                                           Vector<FontRun>& fonts )
@@ -593,13 +586,6 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--MultilanguageSupport::ValidateFonts\n" );
 }
 
-void MultilanguageSupport::ValidateFonts( LogicalModel& model,
-                                          CharacterIndex characterIndex,
-                                          Length numberOfCharactersToRemove,
-                                          Length numberOfCharactersToInsert )
-{
-}
-
 } // namespace Internal
 
 } // namespace Text
index 0f7e177..ee91aae 100644 (file)
@@ -98,27 +98,12 @@ public:
                    Vector<ScriptRun>& scripts );
 
   /**
-   * @copydoc Dali::MultilanguageSupport::ReplaceScripts()
-   */
-  void ReplaceScripts( LogicalModel& model,
-                       CharacterIndex characterIndex,
-                       Length numberOfCharactersToRemove,
-                       Length numberOfCharactersToInsert );
-
-  /**
    * @copydoc Dali::MultilanguageSupport::ValidateFonts( const Vector<Character>& text, const Vector<ScriptRun>& scripts, Vector<FontRun>& fonts )
    */
   void ValidateFonts( const Vector<Character>& text,
                       const Vector<ScriptRun>& scripts,
                       Vector<FontRun>& fonts );
 
-  /**
-   * @copydoc Dali::MultilanguageSupport::ValidateFonts( LogicalModel& model, CharacterIndex characterIndex, Length numberOfCharactersToRemove, Length numberOfCharactersToInsert )
-   */
-  void ValidateFonts( LogicalModel& model,
-                      CharacterIndex characterIndex,
-                      Length numberOfCharactersToRemove,
-                      Length numberOfCharactersToInsert );
 private:
   Vector<FontId>                  mDefaultFontPerScriptCache; ///< Caches the default font for a script.
   Vector<ValidateFontsPerScript*> mValidFontsPerScriptCache;  ///< Caches valid fonts for a script.
index 4416dba..8c28dd5 100644 (file)
@@ -57,17 +57,6 @@ void MultilanguageSupport::SetScripts( const Vector<Character>& text,
                                          scripts );
 }
 
-void MultilanguageSupport::ReplaceScripts( LogicalModel& model,
-                                           CharacterIndex characterIndex,
-                                           Length numberOfCharactersToRemove,
-                                           Length numberOfCharactersToInsert )
-{
-  GetImplementation( *this ).ReplaceScripts( model,
-                                             characterIndex,
-                                             numberOfCharactersToRemove,
-                                             numberOfCharactersToInsert );
-}
-
 void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
                                           const Vector<ScriptRun>& scripts,
                                           Vector<FontRun>& fonts )
@@ -77,17 +66,6 @@ void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
                                             fonts );
 }
 
-void MultilanguageSupport::ValidateFonts( LogicalModel& model,
-                                          CharacterIndex characterIndex,
-                                          Length numberOfCharactersToRemove,
-                                          Length numberOfCharactersToInsert )
-{
-  GetImplementation( *this ).ValidateFonts( model,
-                                            characterIndex,
-                                            numberOfCharactersToRemove,
-                                            numberOfCharactersToInsert );
-}
-
 } // namespace Text
 
 } // namespace Toolkit
index b70f672..a22676c 100644 (file)
@@ -99,24 +99,6 @@ public:
                    Vector<ScriptRun>& scripts );
 
   /**
-   * Replaces the scrips of the given range of characters.
-   *
-   * @pre The @p model needs to have a text set.
-   *
-   * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
-   * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
-   *
-   * @param[in,out] model The text's logical model.
-   * @param[in] characterIndex Index to the first character.
-   * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
-   * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
-   */
-  void ReplaceScripts( LogicalModel& model,
-                       CharacterIndex characterIndex,
-                       Length numberOfCharactersToRemove,
-                       Length numberOfCharactersToInsert );
-
-  /**
    * @brief Validates the character's font of the whole text.
    *
    * It may update fonts set by application developers.
@@ -136,28 +118,6 @@ public:
   void ValidateFonts( const Vector<Character>& text,
                       const Vector<ScriptRun>& scripts,
                       Vector<FontRun>& fonts );
-
-  /**
-   * Validates the character's font of the given range of characters.
-   *
-   * It may update fonts set by the mark-up processor.
-   * It sets default fonts based on the script to those characters without a font set.
-   *
-   * @pre The @p model needs to have a text set.
-   * @pre The @p model needs to have the scripts set.
-   *
-   * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
-   * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
-   *
-   * @param[in,out] model The text's logical model.
-   * @param[in] characterIndex Index to the first character.
-   * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
-   * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
-   */
-  void ValidateFonts( LogicalModel& model,
-                      CharacterIndex characterIndex,
-                      Length numberOfCharactersToRemove,
-                      Length numberOfCharactersToInsert );
 };
 
 } // namespace Text
index 3889793..466991b 100644 (file)
@@ -84,13 +84,6 @@ void SetLineBreakInfo( const Vector<Character>& text,
 #endif
 }
 
-void ReplaceLineBreakInfo( LogicalModel& model,
-                           CharacterIndex characterIndex,
-                           Length numberOfCharactersToRemove,
-                           Length numberOfCharactersToInsert )
-{
-}
-
 void SetWordBreakInfo( const Vector<Character>& text,
                        Vector<WordBreakInfo>& wordBreakInfo )
 {
@@ -126,13 +119,6 @@ void SetWordBreakInfo( const Vector<Character>& text,
 #endif
 }
 
-void ReplaceWordBreakInfo( LogicalModel& model,
-                           CharacterIndex characterIndex,
-                           Length numberOfCharactersToRemove,
-                           Length numberOfCharactersToInsert )
-{
-}
-
 } // namespace Text
 
 } // namespace Toolkit
index 949b1c9..4bbe5d5 100644 (file)
@@ -51,24 +51,6 @@ void SetLineBreakInfo( const Vector<Character>& text,
                        Vector<LineBreakInfo>& lineBreakInfo );
 
 /**
- * Replaces line break info.
- *
- * @pre The @p model needs to have a text set.
- *
- * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
- * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
- *
- * @param[in,out] model The text's logical model.
- * @param[in] characterIndex Index to the first character.
- * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
- * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
- */
-void ReplaceLineBreakInfo( LogicalModel& model,
-                           CharacterIndex characterIndex,
-                           Length numberOfCharactersToRemove,
-                           Length numberOfCharactersToInsert );
-
-/**
  * Sets word break info.
  *
  * - 0 is a WORD_BREAK.    Text can be broken into a new word.
@@ -80,24 +62,6 @@ void ReplaceLineBreakInfo( LogicalModel& model,
 void SetWordBreakInfo( const Vector<Character>& text,
                        Vector<WordBreakInfo>& wordBreakInfo );
 
-/**
- * Replaces word break info.
- *
- * @pre The @p model needs to have a text set.
- *
- * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
- * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
- *
- * @param[in,out] model The text's logical model.
- * @param[in] characterIndex Index to the first character.
- * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
- * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
- */
-void ReplaceWordBreakInfo( LogicalModel& model,
-                           CharacterIndex characterIndex,
-                           Length numberOfCharactersToRemove,
-                           Length numberOfCharactersToInsert );
-
 } // namespace Text
 
 } // namespace Toolkit
index c236d28..9ca8e9f 100644 (file)
@@ -225,14 +225,6 @@ void ShapeText( const Vector<Character>& text,
   glyphToCharacterMap.Resize( totalNumberOfGlyphs );
 }
 
-void ShapeText( const LogicalModel& logicalModel,
-                VisualModel& visualModel,
-                CharacterIndex characterIndex,
-                Length numberOfCharactersToRemove,
-                Length numberOfCharactersToInsert )
-{
-}
-
 } // namespace Text
 
 } // namespace Toolkit
index d423cc5..f07cf49 100644 (file)
@@ -56,29 +56,6 @@ void ShapeText( const Vector<Character>& text,
                 Vector<CharacterIndex>& glyphToCharacterMap,
                 Vector<Length>& charactersPerGlyph );
 
-/**
- * Replaces the shape info of the given range of characters.
- *
- * @pre The @p model needs to have a text set.
- * @pre The @p model needs to have the scripts set.
- * @pre The @p model needs to have the fonts set.
- * @pre The @p model needs to have the bidirectional info set.
- *
- * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
- * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
- *
- * @param[in] logicalModel The text's logical model.
- * @param[in,out] visualModel The text's logical model.
- * @param[in] characterIndex Index to the first character.
- * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
- * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
- */
-void ShapeText( const LogicalModel& logicalModel,
-                VisualModel& visualModel,
-                CharacterIndex characterIndex,
-                Length numberOfCharactersToRemove,
-                Length numberOfCharactersToInsert );
-
 } // namespace Text
 
 } // namespace Toolkit
index cef33eb..f05ffda 100644 (file)
@@ -799,9 +799,12 @@ void Controller::Impl::SendSelectionToClipboard( bool deleteAfterSending )
   ChangeState( EventData::EDITING );
 }
 
-void Controller::Impl::PasteTextFromClipboard()
+void Controller::Impl::GetTextFromClipboard( unsigned int itemIndex, std::string& retreivedString )
 {
-  // Not supported
+  if ( mClipboard )
+  {
+    retreivedString =  mClipboard.GetItem( itemIndex );
+  }
 }
 
 void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart, CharacterIndex selectionEnd )
index dc5d3a6..8e84d3c 100644 (file)
@@ -345,7 +345,7 @@ struct Controller::Impl
 
   void SendSelectionToClipboard( bool deleteAfterSending );
 
-  void PasteTextFromClipboard();
+  void GetTextFromClipboard( unsigned int itemIndex, std::string& retreivedString );
 
   void RepositionSelectionHandles( CharacterIndex selectionStart, CharacterIndex selectionEnd );
   void RepositionSelectionHandles( float visualX, float visualY );
index 55ece1c..886327f 100644 (file)
@@ -1227,7 +1227,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "UTF8 size %d, UTF32 size %d\n", text.size(), utf32Characters.Count() );
   }
 
-  if( 0u != utf32Characters.Count() )
+  if( 0u != utf32Characters.Count() ) // Check if Utf8ToUtf32 conversion succeeded
   {
     // Handle the IMF (predicitive text) state changes
     if( mImpl->mEventData )
@@ -1490,7 +1490,11 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt
     }
     case Toolkit::TextSelectionPopup::PASTE:
     {
-      mImpl->PasteTextFromClipboard();
+      std::string stringToPaste("");
+      mImpl->GetTextFromClipboard( 0, stringToPaste ); // Paste latest item from system clipboard
+      InsertText( stringToPaste, Text::Controller::CLIPBOARD );
+      mImpl->ChangeState( EventData::EDITING );
+      mImpl->RequestRelayout();
       break;
     }
     case Toolkit::TextSelectionPopup::SELECT:
index 69c210d..f1e1d28 100644 (file)
@@ -103,7 +103,8 @@ public:
   enum InsertType
   {
     COMMIT,
-    PRE_EDIT
+    PRE_EDIT,
+    CLIPBOARD
   };
 
   /**