int UtcDaliTextInputExceedMaxCharacters(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing Max characters is obeyed when inputting key events ");

  TextInput textInput = TextInput::New();  // create empty TextInput

  Stage::GetCurrent().Add(textInput);
  textInput.SetMaxCharacterLength(4);
  textInput.SetInitialText("");
  textInput.SetEditable(true);

  application.SendNotification();
  application.Render();

  Integration::KeyEvent eventA("a", "a", 0, 0, 0, Integration::KeyEvent::Down );
  Integration::KeyEvent eventB("b", "b", 0, 0, 0, Integration::KeyEvent::Down );

  application.ProcessEvent(eventA);
  application.ProcessEvent(eventB);
  application.ProcessEvent(eventA);
  application.ProcessEvent(eventB);

  application.ProcessEvent(eventA);
  application.ProcessEvent(eventB);

  tet_printf( "Get text result : %s\n", textInput.GetText().c_str());

  DALI_TEST_EQUALS("abab",textInput.GetText(), TEST_LOCATION); // Get text which should be only 4 characters
  END_TEST;
}
int UtcDaliTextInputSetAndGetPlaceholderText(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing Setting of PlaceholderText");

  const std::string initialString = "initial text";
  const std::string placeholderString = "placeholder";

  TextInput textInput = TextInput::New();  // create empty TextInput

  tet_infoline("Testing TextInput is empty at creation ");

  DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION);

  tet_infoline("Set placeholder text");

  textInput.SetPlaceholderText( placeholderString );

  tet_infoline("Testing TextInput contains placeholder text");

  DALI_TEST_EQUALS( placeholderString , textInput.GetPlaceholderText(), TEST_LOCATION);

  tet_infoline("Set initial text which should replace placeholder text");

  textInput.SetInitialText( initialString );

  tet_infoline("Testing TextInput contains initial text when placeholder text set");

  DALI_TEST_EQUALS( initialString,textInput.GetText(), TEST_LOCATION);
  END_TEST;
}
int UtcDaliTextInputSetMaxCharacterLength(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing Setting of max characters");

  const int maxChars = 4;
  const char* testChar  = "v";

  TextInput textInput = TextInput::New();  // create empty TextInput
  Stage::GetCurrent().Add(textInput);
  application.SendNotification();
  application.Render();

  textInput.SetMaxCharacterLength(maxChars);

  Integration::KeyEvent event(testChar, testChar, 0, 0, 0, Integration::KeyEvent::Down );

  std::string testString = "";

  tet_infoline("Starting editmode");
  textInput.SetEditable( true );

  tet_infoline("Sending Key Events");
  // Send max number of characters
  for (int i=0; i < maxChars; i++)
    {
      application.ProcessEvent(event);
      testString.append(testChar);
    }

  tet_printf( "Get text result : %s\n", textInput.GetText().c_str());

  DALI_TEST_EQUALS(testString, textInput.GetText(), TEST_LOCATION);

  tet_infoline("Sending Key Event which exceeds max characters");

  application.ProcessEvent(event); // try to append additional character

  DALI_TEST_EQUALS(testString,textInput.GetText(), TEST_LOCATION);

  tet_infoline("Increase max characters limit");

  textInput.SetMaxCharacterLength(maxChars+1); // increment max characters by 1

  tet_infoline("Send character again which should now fit");
  application.ProcessEvent(event); // append additional character
  testString.append(testChar);

  DALI_TEST_EQUALS(testString,textInput.GetText(), TEST_LOCATION);
  END_TEST;
}
int UtcDaliTextInputGetMarkupText(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing retrieval of Markup text after style set");

  const std::string markup = "<i>Text with italic style</i>" ;
  const std::string teststring = "Text with italic style";

  TextInput textInput = TextInput::New();

  tet_infoline("Set initial text");

  textInput.SetInitialText( teststring );

  tet_infoline("Check initial text");
  DALI_TEST_EQUALS( teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be empty

  TextStyle style;
  style.SetItalics( true );

  tet_infoline("Apply style to TextInput");
  textInput.ApplyStyleToAll( style );

  tet_infoline("Retreive Markup Text");
  const std::string retreivedMarkupString = textInput.GetMarkupText();

  tet_infoline("Test Retreived text and Markup text match");
  DALI_TEST_EQUALS( retreivedMarkupString , retreivedMarkupString, TEST_LOCATION);
  END_TEST;
}
// Positive test case for a method
int UtcDaliTextInputGetText(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing GetText");

  const std::string teststring = "test";

  TextInput textInput = TextInput::New();  // create empty TextInput

  DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION); // Get text which should be empty

  textInput.SetInitialText(teststring);

  DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION); // Get text which should be test string

  END_TEST;
}
// Positive test case for a method
int UtcDaliTextInputSetInitialText(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing Setting of Initial Text");

  const std::string teststring = "test";

  TextInput textInput = TextInput::New();  // create empty TextInput

  tet_infoline("Testing TextInput is empty at creation ");

  DALI_TEST_EQUALS("",textInput.GetText(), TEST_LOCATION);

  tet_infoline("Set text to TextInput");

  textInput.SetInitialText(teststring);

  tet_infoline("Test TextInput contains set text");

  DALI_TEST_EQUALS(teststring,textInput.GetText(), TEST_LOCATION);
  END_TEST;
}