Clear input focus when Return/Escape key Up
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-TextField.cpp
index 911a06e..1ea11be 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <iostream>
 #include <stdlib.h>
+#include <unistd.h>
+
 #include <dali/public-api/rendering/renderer.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/tap-gesture-event.h>
@@ -25,6 +27,7 @@
 #include <dali/integration-api/events/long-press-gesture-event.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include "toolkit-clipboard.h"
 
 using namespace Dali;
 using namespace Toolkit;
@@ -105,20 +108,19 @@ const float TO_SECONDS = 1.f / TO_MILLISECONDS;
 const float SCROLL_THRESHOLD = 10.f;
 const float SCROLL_SPEED = 300.f;
 
+const unsigned int DEFAULT_FONT_SIZE = 1152u;
+const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
 static bool gTextChangedCallBackCalled;
 static bool gMaxCharactersCallBackCalled;
+static bool gInputStyleChangedCallbackCalled;
+static Dali::Toolkit::TextField::InputStyle::Mask gInputStyleMask;
 
 static void LoadBitmapResource(TestPlatformAbstraction& platform, int width, int height)
 {
-  Integration::ResourceRequest* request = platform.GetRequest();
   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
   Integration::ResourcePointer resource(bitmap);
   bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
-
-  if(request)
-  {
-    platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
-  }
 }
 
 static void LoadMarkerImages(ToolkitTestApplication& app, TextField textField)
@@ -206,6 +208,35 @@ static int Wait(ToolkitTestApplication& application, int duration = 0)
   return time;
 }
 
+Dali::Integration::Point GetPointDownInside( Vector2& pos )
+{
+  Dali::Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( pos );
+  return point;
+}
+
+Dali::Integration::Point GetPointUpInside( Vector2& pos )
+{
+  Dali::Integration::Point point;
+  point.SetState( PointState::UP );
+  point.SetScreenPosition( pos );
+  return point;
+}
+
+struct CallbackFunctor
+{
+  CallbackFunctor(bool* callbackFlag)
+  : mCallbackFlag( callbackFlag )
+  {
+  }
+
+  void operator()()
+  {
+    *mCallbackFlag = true;
+  }
+  bool* mCallbackFlag;
+};
 
 static void TestTextChangedCallback( TextField control )
 {
@@ -221,6 +252,14 @@ static void TestMaxLengthReachedCallback( TextField control )
   gMaxCharactersCallBackCalled = true;
 }
 
+static void TestInputStyleChangedCallback( TextField control, TextField::InputStyle::Mask mask )
+{
+  tet_infoline(" TestInputStyleChangedCallback");
+
+  gInputStyleChangedCallbackCalled = true;
+  gInputStyleMask = mask;
+}
+
 // Generate a TapGestureEvent to send to Core.
 Integration::TapGestureEvent GenerateTap(
     Gesture::State state,
@@ -237,7 +276,6 @@ Integration::TapGestureEvent GenerateTap(
   return tap;
 }
 
-
 Integration::LongPressGestureEvent GenerateLongPress(
     Gesture::State state,
     unsigned int numberOfTouches,
@@ -266,6 +304,34 @@ Integration::KeyEvent GenerateKey( const std::string& keyName,
                                 keyState );
 }
 
+bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
+{
+  if( fontStyleMapGet.Count() == fontStyleMapSet.Count() )
+  {
+    for( unsigned int index = 0u; index < fontStyleMapGet.Count(); ++index )
+    {
+      const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index );
+
+      Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey );
+      if( NULL != valueSet )
+      {
+        if( valueGet.second.Get<std::string>() != valueSet->Get<std::string>() )
+        {
+          tet_printf( "  Value got : [%s], expected : [%s]", valueGet.second.Get<std::string>().c_str(), valueSet->Get<std::string>().c_str() );
+          return false;
+        }
+      }
+      else
+      {
+        tet_printf( "  The key %s doesn't exist.", valueGet.first.stringKey.c_str() );
+        return false;
+      }
+    }
+  }
+
+  return true;
+}
+
 } // namespace
 
 int UtcDaliToolkitTextFieldConstructorP(void)
@@ -456,18 +522,67 @@ int UtcDaliTextFieldSetPropertyP(void)
   // Check font properties.
   field.SetProperty( TextField::Property::FONT_FAMILY, "Setting font family" );
   DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
-  field.SetProperty( TextField::Property::FONT_STYLE, "Setting font style" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("Setting font style"), TEST_LOCATION );
+
+  Property::Map fontStyleMapSet;
+  Property::Map fontStyleMapGet;
+  Property::Value* slantValue = NULL;
+
+  fontStyleMapSet.Insert( "weight", "bold" );
+  fontStyleMapSet.Insert( "width", "condensed" );
+  fontStyleMapSet.Insert( "slant", "italic" );
+  field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
   field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
   DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
 
+  // Reset font style.
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "weight", "normal" );
+  fontStyleMapSet.Insert( "slant", "oblique" );
+  field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "slant", "roman" );
+  field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+
+  // Replace 'roman' for 'normal'.
+  slantValue = fontStyleMapGet.Find( "slant" );
+  if( NULL != slantValue )
+  {
+    if( "normal" == slantValue->Get<std::string>() )
+    {
+      fontStyleMapGet["slant"] = "roman";
+    }
+  }
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+  fontStyleMapSet.Clear();
+
+  field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
   // Check that the MAX_LENGTH property can be correctly set
   const int maxNumberOfCharacters = 20;
   field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters );
   DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::MAX_LENGTH ), maxNumberOfCharacters, TEST_LOCATION );
 
   // Check exceed policy
-  // Set a different exceed policy is not implemented.
+  field.SetProperty( TextField::Property::EXCEED_POLICY, Dali::Toolkit::TextField::EXCEED_POLICY_CLIP );
+  DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::EXCEED_POLICY ), static_cast<int>( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ), TEST_LOCATION );
+  field.SetProperty( TextField::Property::EXCEED_POLICY, Dali::Toolkit::TextField::EXCEED_POLICY_ORIGINAL );
+  DALI_TEST_EQUALS( field.GetProperty<int>( TextField::Property::EXCEED_POLICY ), static_cast<int>( Dali::Toolkit::TextField::EXCEED_POLICY_ORIGINAL ), TEST_LOCATION );
 
   // Check that the Alignment properties can be correctly set
   field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "END" );
@@ -545,22 +660,85 @@ int UtcDaliTextFieldSetPropertyP(void)
   // Check input font properties.
   field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
   DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
-  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "Setting input font style" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "Setting input font style", TEST_LOCATION );
+
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "weight", "bold" );
+  fontStyleMapSet.Insert( "width", "condensed" );
+  fontStyleMapSet.Insert( "slant", "italic" );
+
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
   field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
   DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
 
+  // Reset input font style.
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "weight", "normal" );
+  fontStyleMapSet.Insert( "slant", "oblique" );
+
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "slant", "roman" );
+
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+
+  // Replace 'roman' for 'normal'.
+  slantValue = fontStyleMapGet.Find( "slant" );
+  if( NULL != slantValue )
+  {
+    if( "normal" == slantValue->Get<std::string>() )
+    {
+      fontStyleMapGet["slant"] = "roman";
+    }
+  }
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+  fontStyleMapSet.Clear();
+
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+  Property::Map underlineMapSet;
+  Property::Map underlineMapGet;
+
+  underlineMapSet.Insert( "enable", "true" );
+  underlineMapSet.Insert( "color", "red" );
+  underlineMapSet.Insert( "height", "1" );
+
   // Check the underline property
-  field.SetProperty( TextField::Property::UNDERLINE, "Underline properties" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::UNDERLINE ), std::string("Underline properties"), TEST_LOCATION );
+  field.SetProperty( TextField::Property::UNDERLINE, underlineMapSet );
+
+  underlineMapGet = field.GetProperty<Property::Map>( TextField::Property::UNDERLINE );
+  DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapGet, underlineMapSet ), true, TEST_LOCATION );
 
   // Check the input underline property
   field.SetProperty( TextField::Property::INPUT_UNDERLINE, "Underline input properties" );
   DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
 
   // Check the shadow property
-  field.SetProperty( TextField::Property::SHADOW, "Shadow properties" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::SHADOW ), std::string("Shadow properties"), TEST_LOCATION );
+  Property::Map shadowMapSet;
+  Property::Map shadowMapGet;
+
+  shadowMapSet.Insert( "color", "green" );
+  shadowMapSet.Insert( "offset", "2 2" );
+
+  field.SetProperty( TextField::Property::SHADOW, shadowMapSet );
+
+  shadowMapGet = field.GetProperty<Property::Map>( TextField::Property::SHADOW );
+  DALI_TEST_EQUALS( shadowMapGet.Count(), shadowMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( shadowMapGet, shadowMapSet ), true, TEST_LOCATION );
 
   // Check the input shadow property
   field.SetProperty( TextField::Property::INPUT_SHADOW, "Shadow input properties" );
@@ -625,11 +803,16 @@ int utcDaliTextFieldTextChangedP(void)
 
   Stage::GetCurrent().Add( field );
 
+  // connect to the text changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
   field.TextChangedSignal().Connect(&TestTextChangedCallback);
+  bool textChangedSignal = false;
+  field.ConnectSignal( testTracker, "textChanged",   CallbackFunctor(&textChangedSignal) );
 
   gTextChangedCallBackCalled = false;
   field.SetProperty( TextField::Property::TEXT, "ABC" );
   DALI_TEST_CHECK( gTextChangedCallBackCalled );
+  DALI_TEST_CHECK( textChangedSignal );
 
   application.SendNotification();
 
@@ -652,11 +835,16 @@ int utcDaliTextFieldTextChangedN(void)
 
   Stage::GetCurrent().Add( field );
 
+  // connect to the text changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
   field.TextChangedSignal().Connect(&TestTextChangedCallback);
+  bool textChangedSignal = false;
+  field.ConnectSignal( testTracker, "textChanged",   CallbackFunctor(&textChangedSignal) );
 
   gTextChangedCallBackCalled = false;
   field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "ABC" ); // Setting placeholder, not TEXT
   DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+  DALI_TEST_CHECK( !textChangedSignal );
 
   END_TEST;
 }
@@ -676,13 +864,19 @@ int utcDaliTextFieldMaxCharactersReachedP(void)
 
   field.SetKeyInputFocus();
 
-  gMaxCharactersCallBackCalled = false;
+  // connect to the text changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
   field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
+  bool maxLengthReachedSignal = false;
+  field.ConnectSignal( testTracker, "maxLengthReached",   CallbackFunctor(&maxLengthReachedSignal) );
+
+  gMaxCharactersCallBackCalled = false;
 
   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 );
+  DALI_TEST_CHECK( maxLengthReachedSignal );
 
   END_TEST;
 }
@@ -702,13 +896,451 @@ int utcDaliTextFieldMaxCharactersReachedN(void)
 
   field.SetKeyInputFocus();
 
-  gMaxCharactersCallBackCalled = false;
+  // connect to the text changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
   field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
+  bool maxLengthReachedSignal = false;
+  field.ConnectSignal( testTracker, "maxLengthReached",   CallbackFunctor(&maxLengthReachedSignal) );
+
+  gMaxCharactersCallBackCalled = false;
 
   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 );
+  DALI_TEST_CHECK( !maxLengthReachedSignal );
+
+  END_TEST;
+}
+
+int utcDaliTextFieldInputStyleChanged01(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextFieldInputStyleChanged01");
+
+  // The text-field emits signals when the input style changes. These changes of style are
+  // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+  // can't be emitted during the size negotiation as the callbacks may update the UI.
+  // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
+  // This creates an implementation of the adaptor stub and a queue of idle callbacks.
+  application.CreateAdaptor();
+
+  // Load some fonts.
+
+  char* pathNamePtr = get_current_dir_name();
+  const std::string pathName( pathNamePtr );
+  free( pathNamePtr );
+
+  TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+  fontClient.SetDpi( 93u, 93u );
+
+  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
+  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
+
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+
+  field.SetSize( 300.f, 50.f );
+  field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+  field.SetProperty( TextField::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>" );
+
+  // connect to the text changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
+  field.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
+  bool inputStyleChangedSignal = false;
+  field.ConnectSignal( testTracker, "inputStyleChanged",   CallbackFunctor(&inputStyleChangedSignal) );
+
+  Stage::GetCurrent().Add( field );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::FONT_FAMILY | TextField::InputStyle::POINT_SIZE ), TEST_LOCATION );
+
+    const std::string fontFamily = field.GetProperty( TextField::Property::INPUT_FONT_FAMILY ).Get<std::string>();
+    DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
+
+    const float pointSize = field.GetProperty( TextField::Property::INPUT_POINT_SIZE ).Get<float>();
+    DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+  DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::COLOR ), TEST_LOCATION );
+
+    const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+    DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::COLOR | TextField::InputStyle::FONT_STYLE ), TEST_LOCATION );
+
+    const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+    DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+
+    const Property::Map fontStyleMapGet = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<Property::Map>();
+
+    Property::Map fontStyleMapSet;
+    fontStyleMapSet.Insert( "weight", "bold" );
+
+    DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+    DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+  DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::FONT_STYLE ), TEST_LOCATION );
+
+    const std::string style = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<std::string>();
+    DALI_TEST_CHECK( style.empty() );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+  DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+  END_TEST;
+}
+
+int utcDaliTextFieldInputStyleChanged02(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextFieldInputStyleChanged02");
+
+  // The text-field emits signals when the input style changes. These changes of style are
+  // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+  // can't be emitted during the size negotiation as the callbacks may update the UI.
+  // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
+  // This creates an implementation of the adaptor stub and a queue of idle callbacks.
+  application.CreateAdaptor();
+
+  // Load some fonts.
+
+  char* pathNamePtr = get_current_dir_name();
+  const std::string pathName( pathNamePtr );
+  free( pathNamePtr );
+
+  TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+  fontClient.SetDpi( 93u, 93u );
+
+  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
+  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
+
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+
+
+  field.SetSize( 300.f, 50.f );
+  field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+  field.SetProperty( TextField::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='blue'> l</color><color value='green'>lo</color> <font weight='bold'>world</font> demo</font>" );
+
+  // connect to the text changed signal.
+  ConnectionTracker* testTracker = new ConnectionTracker();
+  field.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
+  bool inputStyleChangedSignal = false;
+  field.ConnectSignal( testTracker, "inputStyleChanged",   CallbackFunctor(&inputStyleChangedSignal) );
+
+  Stage::GetCurrent().Add( field );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+                      static_cast<unsigned int>( TextField::InputStyle::FONT_FAMILY |
+                                                 TextField::InputStyle::POINT_SIZE  |
+                                                 TextField::InputStyle::COLOR ),
+                      TEST_LOCATION );
+
+    const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+    DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
+
+    const std::string fontFamily = field.GetProperty( TextField::Property::INPUT_FONT_FAMILY ).Get<std::string>();
+    DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
+
+    const float pointSize = field.GetProperty( TextField::Property::INPUT_POINT_SIZE ).Get<float>();
+    DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+                      static_cast<unsigned int>( TextField::InputStyle::COLOR ),
+                      TEST_LOCATION );
+
+    const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+    DALI_TEST_EQUALS( color, Color::BLUE, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+  DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+                      static_cast<unsigned int>( TextField::InputStyle::COLOR ),
+                      TEST_LOCATION );
+
+    const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+    DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
+
+  gInputStyleChangedCallbackCalled = false;
+  gInputStyleMask = TextField::InputStyle::NONE;
+  inputStyleChangedSignal = false;
+
+  field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
+
+  Property::Map fontStyleMapSet;
+  fontStyleMapSet.Insert( "weight", "thin" );
+  fontStyleMapSet.Insert( "width", "condensed" );
+  fontStyleMapSet.Insert( "slant", "italic" );
+
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+  field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 20.f );
+
+  field.SetProperty( TextField::Property::INPUT_UNDERLINE, "underline" );
+  field.SetProperty( TextField::Property::INPUT_SHADOW, "shadow" );
+  field.SetProperty( TextField::Property::INPUT_EMBOSS, "emboss" );
+  field.SetProperty( TextField::Property::INPUT_OUTLINE, "outline" );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+  DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+  // Create a tap event to touch the text field.
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Executes the idle callbacks added by the text control on the change of input style.
+  application.RunIdles();
+
+  DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+  if( gInputStyleChangedCallbackCalled )
+  {
+    DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+                      static_cast<unsigned int>( TextField::InputStyle::COLOR |
+                                                 TextField::InputStyle::POINT_SIZE |
+                                                 TextField::InputStyle::FONT_STYLE |
+                                                 TextField::InputStyle::UNDERLINE |
+                                                 TextField::InputStyle::SHADOW |
+                                                 TextField::InputStyle::EMBOSS |
+                                                 TextField::InputStyle::OUTLINE ),
+                      TEST_LOCATION );
+
+    const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+    DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+  }
+  DALI_TEST_CHECK( inputStyleChangedSignal );
 
   END_TEST;
 }
@@ -825,15 +1457,11 @@ int utcDaliTextFieldEvent02(void)
   application.SendNotification();
   application.Render();
 
-  // Check there are the expected number of children ( offscreen root actor, and the offscreen image view
-  DALI_TEST_EQUALS( field.GetChildCount(), 2u, TEST_LOCATION );
-
-  Actor offscreenRoot = field.GetChildAt( 0u );
-  DALI_TEST_CHECK( offscreenRoot.IsLayer() );
-  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
+  // Check there are the expected number of children ( stencil ).
+  DALI_TEST_EQUALS( field.GetChildCount(), 1u, TEST_LOCATION );
 
-  Actor offscreenImage = field.GetChildAt( 1u );
-  DALI_TEST_CHECK( offscreenImage );
+  Actor stencil = field.GetChildAt( 0u );
+  DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
 
   // Create a tap event to touch the text field.
   application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
@@ -843,11 +1471,11 @@ int utcDaliTextFieldEvent02(void)
   application.SendNotification();
   application.Render();
 
-  Actor layer = field.GetChildAt( 2u );
+  Actor layer = field.GetChildAt( 1u );
   DALI_TEST_CHECK( layer.IsLayer() );
 
   DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
-  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
+  DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
 
   // 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 ) );
@@ -859,16 +1487,13 @@ int utcDaliTextFieldEvent02(void)
 
   // 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
+  DALI_TEST_EQUALS( stencil.GetChildCount(), 1u, TEST_LOCATION ); // The renderer
 
   Control cursor = Control::DownCast( layer.GetChildAt( 0u ) );
   DALI_TEST_CHECK( cursor );
 
-  CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
-  DALI_TEST_CHECK( camera );
-
   // The offscreen root actor has a container with all the actors which contain the text renderers.
-  Actor container = offscreenRoot.GetChildAt( 1u );
+  Actor container = stencil.GetChildAt( 0u );
   for( unsigned int index = 0; index < container.GetChildCount(); ++index )
   {
     Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
@@ -942,7 +1567,7 @@ int utcDaliTextFieldEvent02(void)
   DALI_TEST_EQUALS( position2, position6, TEST_LOCATION );// Should be in the same position2.
 
   // Should not be a renderer.
-  DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor only.
+  DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION );
 
   END_TEST;
 }
@@ -989,22 +1614,18 @@ int utcDaliTextFieldEvent03(void)
   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 );
+  // The offscreen root actor should have two actors: the renderer and the highlight actor.
+  Actor stencil = field.GetChildAt( 0u );
 
   // The offscreen root actor has a container with all the actors which contain the text renderers.
-  Actor container = offscreenRoot.GetChildAt( 1u );
+  Actor container = stencil.GetChildAt( 0u );
   for( unsigned int index = 0; index < container.GetChildCount(); ++index )
   {
     Renderer renderer = container.GetChildAt( index ).GetRendererAt( 0u );
     DALI_TEST_CHECK( renderer );
   }
 
-  Renderer highlight = offscreenRoot.GetChildAt( 2u ).GetRendererAt( 0u );
+  Renderer highlight = stencil.GetChildAt( 1u ).GetRendererAt( 0u );
   DALI_TEST_CHECK( highlight );
 
   END_TEST;
@@ -1135,7 +1756,7 @@ int utcDaliTextFieldEvent05(void)
   SendPan(application, Gesture::Finished, pos);
   Wait(application, RENDER_FRAME_INTERVAL);
 
-  Actor offscreenRoot = field.GetChildAt( 1u );
+  Actor stencil = field.GetChildAt( 1u );
   END_TEST;
 }
 
@@ -1236,6 +1857,9 @@ int utcDaliTextFieldEvent08(void)
   ToolkitTestApplication application;
   tet_infoline(" utcDaliTextFieldEvent08");
 
+  Dali::Clipboard clipboard = Clipboard::Get();
+  clipboard.SetItem("testTextFieldEvent");
+
   // Checks Longpress when only place holder text
 
   TextField field = TextField::New();
@@ -1266,13 +1890,35 @@ int utcDaliTextFieldEvent08(void)
   application.SendNotification();
   application.Render();
 
+  Wait(application, 500);
+
+  Stage stage = Stage::GetCurrent();
+  Layer layer = stage.GetRootLayer();
+  Actor actor = layer.FindChildByName("optionPaste");
+
+  if (actor)
+  {
+    Vector3 worldPosition = actor.GetCurrentWorldPosition();
+    Vector2 halfStageSize = stage.GetSize() / 2.0f;
+    Vector2 position(worldPosition.x + halfStageSize.width, worldPosition.y + halfStageSize.height);
+
+    Dali::Integration::TouchEvent event;
+    event = Dali::Integration::TouchEvent();
+    event.AddPoint( GetPointDownInside( position ) );
+    application.ProcessEvent( event );
+
+    event = Dali::Integration::TouchEvent();
+    event.AddPoint( GetPointUpInside( position ) );
+    application.ProcessEvent( event );
+  }
+  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("testTextFieldEvent"), TEST_LOCATION );
   END_TEST;
 }
 
-int utcDaliTextFieldStyleWhilstSelected09(void)
+int utcDaliTextFieldStyleWhilstSelected(void)
 {
   ToolkitTestApplication application;
-  tet_infoline(" utcDaliTextFieldEvent09");
+  tet_infoline(" utcDaliTextFieldStyleWhilstSelected");
 
   // Change font and styles whilst text is selected whilst word selected
 
@@ -1323,11 +1969,25 @@ int utcDaliTextFieldStyleWhilstSelected09(void)
   field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
   DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
 
-  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+  Property::Map fontStyleMapSet;
+  Property::Map fontStyleMapGet;
+
+  fontStyleMapSet.Insert( "weight", "bold" );
+  fontStyleMapSet.Insert( "slant", "italic" );
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
 
-  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"width\":\"expanded\",\"slant\":\"italic\"}" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"width\":\"expanded\",\"slant\":\"italic\"}", TEST_LOCATION );
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "width", "expanded" );
+  fontStyleMapSet.Insert( "slant", "italic" );
+  field.SetProperty( TextField::Property::INPUT_FONT_STYLE, fontStyleMapSet );
+
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::INPUT_FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
 
   field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
   DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
@@ -1335,11 +1995,31 @@ int utcDaliTextFieldStyleWhilstSelected09(void)
   field.SetProperty( TextField::Property::TEXT_COLOR, Color::RED );
   DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::TEXT_COLOR ), Color::RED, TEST_LOCATION );
 
-  field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "weight", "bold" );
+  fontStyleMapSet.Insert( "slant", "italic" );
+
+  field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+  DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
+  DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+
+  fontStyleMapSet.Clear();
+  fontStyleMapSet.Insert( "width", "expanded" );
+
+  field.SetProperty( TextField::Property::FONT_STYLE, fontStyleMapSet );
+
+  fontStyleMapGet = field.GetProperty<Property::Map>( TextField::Property::FONT_STYLE );
+  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();
 
-  field.SetProperty( TextField::Property::FONT_STYLE, "{\"width\":\"expanded\"}" );
-  DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"width\":\"expanded\"}", TEST_LOCATION );
+  DALI_TEST_CHECK( !field.HasKeyInputFocus() );
 
   END_TEST;
 }