+
+ END_TEST;
+}
+
+int UtcDaliTextControllerCheckInputFontWidthChanged(void)
+{
+ tet_infoline(" UtcDaliTextControllerCheckInputFontWidthChanged");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextLabel(controller);
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+ InputMethodContext inputMethodContext = InputMethodContext::New();
+ // Enables the text input.
+ controller->EnableTextInput( decorator, inputMethodContext );
+
+ // Set the text
+ const std::string text("Hello World!");
+ controller->SetText(text);
+ controller->SetInputFontWidth( TextAbstraction::FontWidth::NORMAL );
+
+ // Get the implementation of the text controller
+ Controller::Impl& mImpl = Controller::Impl::GetImplementation( *controller.Get() );
+
+ // Reset operation
+ mImpl.mOperationsPending = Controller::NO_OPERATION;
+
+ // simulate a key event.
+ controller->KeyEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Dali::KeyEvent::Down ) );
+
+ // change the input font width
+ controller->SetInputFontWidth( TextAbstraction::FontWidth::EXPANDED );
+
+ // Check if relayout is requested or not when event state is INACTIVE.
+ DALI_TEST_EQUALS( EventData::INACTIVE, mImpl.mEventData->mState, TEST_LOCATION );
+ DALI_TEST_EQUALS( Controller::VALIDATE_FONTS, static_cast<Controller::OperationsMask>( mImpl.mOperationsPending & Controller::VALIDATE_FONTS ),
+ TEST_LOCATION );
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout(size);
+
+ tet_result(TET_PASS);
+
+ END_TEST;
+}
+
+int UtcDaliTextControllerCheckInputFontSlantChanged(void)
+{
+ tet_infoline(" UtcDaliTextControllerCheckInputFontSlantChanged");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextLabel(controller);
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+ InputMethodContext inputMethodContext = InputMethodContext::New();
+ // Enables the text input.
+ controller->EnableTextInput( decorator, inputMethodContext );
+
+ // Set the text
+ const std::string text("Hello World!");
+ controller->SetText(text);
+ controller->SetInputFontSlant( TextAbstraction::FontSlant::NORMAL );
+
+ // Get the implementation of the text controller
+ Controller::Impl& mImpl = Controller::Impl::GetImplementation( *controller.Get() );
+
+ // Reset operation
+ mImpl.mOperationsPending = Controller::NO_OPERATION;
+
+ // simulate a key event.
+ controller->KeyEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Dali::KeyEvent::Down ) );
+
+ // change the input font slant
+ controller->SetInputFontSlant( TextAbstraction::FontSlant::ROMAN );
+
+ // Check if relayout is requested or not when event state is INACTIVE.
+ DALI_TEST_EQUALS( EventData::INACTIVE, mImpl.mEventData->mState, TEST_LOCATION );
+ DALI_TEST_EQUALS( Controller::VALIDATE_FONTS, static_cast<Controller::OperationsMask>( mImpl.mOperationsPending & Controller::VALIDATE_FONTS ),
+ TEST_LOCATION );
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout(size);
+
+ tet_result(TET_PASS);
+
+ END_TEST;
+}
+
+int UtcDaliTextControllerCheckInputFontPointSizeChanged(void)
+{
+ tet_infoline(" UtcDaliTextControllerCheckInputFontPointSizeChanged");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextLabel(controller);
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+ InputMethodContext inputMethodContext = InputMethodContext::New();
+ // Enables the text input.
+ controller->EnableTextInput( decorator, inputMethodContext );
+
+ // Set the text
+ const std::string text("Hello World!");
+ controller->SetText(text);
+ controller->SetInputFontPointSize( 1.0f );
+
+ // Get the implementation of the text controller
+ Controller::Impl& mImpl = Controller::Impl::GetImplementation( *controller.Get() );
+
+ // Reset operation
+ mImpl.mOperationsPending = Controller::NO_OPERATION;
+
+ // simulate a key event.
+ controller->KeyEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Dali::KeyEvent::Down ) );
+
+ // change the input font point size
+ controller->SetInputFontPointSize( 1.2f );
+
+ // Check if relayout is requested or not when event state is INACTIVE.
+ DALI_TEST_EQUALS( EventData::INACTIVE, mImpl.mEventData->mState, TEST_LOCATION );
+ DALI_TEST_EQUALS( Controller::VALIDATE_FONTS, static_cast<Controller::OperationsMask>( mImpl.mOperationsPending & Controller::VALIDATE_FONTS ),
+ TEST_LOCATION );
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout(size);
+
+ tet_result(TET_PASS);
+
+ END_TEST;
+}
+
+int UtcDaliTextControllerSelectEvent(void)
+{
+ tet_infoline(" UtcDaliTextControllerSelectEvent");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Configures the text controller similarly to the text-field.
+ ConfigureTextField( controller );
+
+ // Set the text
+ const std::string text("Hello World!");
+ controller->SetText( text );
+
+ // Select the whole text.
+ controller->SelectEvent( 0.f, 0.f, false );
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout(size);
+
+ // Get the implementation of the text controller
+ Controller::Impl& mImpl = Controller::Impl::GetImplementation( *controller.Get() );
+
+ // Check if the whole text is selected or not.
+ std::string retrieved_text;
+ mImpl.RetrieveSelection( retrieved_text, false );
+ DALI_TEST_EQUALS( "Hello", retrieved_text, TEST_LOCATION );
+
+ // Select the whole text.
+ controller->SelectEvent( 0.f, 0.f, true );
+
+ // Perform a relayout
+ controller->Relayout( size );
+
+ mImpl.RetrieveSelection( retrieved_text, false );
+ DALI_TEST_EQUALS( text, retrieved_text, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliTextControllerMaxLengthSetText(void)
+{
+ tet_infoline(" UtcDaliTextControllerMaxLengthSetText");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextLabel( controller );
+
+ const Length MAX_TEXT_LENGTH = 1024u * 32u;
+
+ // make over length world
+ int maxLength = ( 1024u * 32u ) + 10u;
+ char world[maxLength] = { 'a' };
+
+ // Set the text
+ std::string text( world, maxLength );
+ controller->SetText( text );
+
+ // check text length
+ controller->GetText( text );
+ Length textSize = text.size();
+
+ DALI_TEST_EQUALS( MAX_TEXT_LENGTH, textSize, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextControllerRemoveTextChangeEventData(void)
+{
+ tet_infoline(" UtcDaliTextControllerRemoveTextChangeEventData");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextField( controller );
+
+ // Set the text
+ const std::string text( "Hello World!" );
+ controller->SetText( text );
+ controller->SetInputFontPointSize( 1.0f );
+
+ // Get the implementation of the text controller
+ Controller::Impl& mImpl = Controller::Impl::GetImplementation( *controller.Get() );
+
+ DALI_TEST_EQUALS( EventData::INACTIVE, mImpl.mEventData->mState, TEST_LOCATION );
+
+ // Send DELETE_SURROUNDING event
+ InputMethodContext::EventData imfEvent = InputMethodContext::EventData( InputMethodContext::DELETE_SURROUNDING, "", -1, 1 );
+ InputMethodContext inputMethodContext = InputMethodContext::New();
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ // Simulate a key event to delete text
+ controller->KeyEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Dali::KeyEvent::Down ) );
+
+ DALI_TEST_EQUALS( EventData::EDITING, mImpl.mEventData->mState, TEST_LOCATION );
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout( size );
+
+ tet_result(TET_PASS);
+