X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-Text-Controller.cpp;h=e1787c94525b570c0409cf6a8a402b7eb83a6540;hb=ef172eb5a35516cc4512cfb284d93818f563c5c0;hp=d37a1dbcb295ae59ea1ea54c9550665fd9fe5d85;hpb=679dd19ad581013971018b16212ef551b5c6cd31;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index d37a1db..e1787c9 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -257,6 +258,9 @@ int UtcDaliTextControllerImfEvent(void) controller->GetText( text ); DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION ); + // for coverage + inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::UNDERLINE ); + // Send PRE_EDIT event imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "wo", 6, 2 ); controller->OnInputMethodContextEvent( inputMethodContext, imfEvent ); @@ -1002,3 +1006,83 @@ int UtcDaliTextControllerCheckInputFontPointSizeChanged(void) 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]; + for( int i = 0; i < maxLength; i++ ) + { + world[i] = 'a'; + } + + // Set the text + std::string text(world); + controller->SetText( text ); + + // Perform a relayout + const Size size( Dali::Stage::GetCurrent().GetSize() ); + controller->Relayout(size); + + // check text length + controller->GetText( text ); + Length textSize = text.size(); + + DALI_TEST_EQUALS( MAX_TEXT_LENGTH, textSize, TEST_LOCATION ); + + END_TEST; +}