+
+
+int utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountScrollingCase(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountScrollingCase ");
+
+ int lineCountBefore =0 ;
+ int lineCountAfter =0 ;
+
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+ //Set very large font-size using point-size
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ //Specify font-family
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ //Specify size
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+ //Set text longer than width of textEditor
+ textEditor.SetProperty( TextEditor::Property::TEXT, "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
+
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ //Failed case is the GetHeightForWidth change LineCount then the scrollor will not arrive to latest line
+ //GetHeightForWidth is a retrieval method which should not modify object
+ lineCountBefore = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ textEditor.GetHeightForWidth(200.f);
+
+ //This is to simulate focus into text editor after calling GetHeightForWidth
+ //Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCountAfter = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+
+ //The LineCount must not be changed when calling GetHeightForWidth.
+ DALI_TEST_EQUALS( lineCountAfter , lineCountBefore, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountLineWrapCharCase(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetHeightForWidthDoesNotChangeLineCountLineWrapCharCase ");
+
+ int lineCountBefore =0 ;
+ int lineCountAfter =0 ;
+
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+ //Set very large font-size using point-size
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ //Specify font-family
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ //Specify size
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 50.f, 100.f ) );
+ //Set text longer than width of textEditor
+ textEditor.SetProperty( TextEditor::Property::TEXT, "qwertyuiopasdfghjklzxcvbnm\n");
+ //Set line wrap mode Character
+ textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
+
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ //Failed case is the GetHeightForWidth change LineCount which make position of cursor invalid in TextEditor
+ //GetHeightForWidth is a retrieval method which should not modify object
+ lineCountBefore = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ textEditor.GetHeightForWidth(200.f);
+
+ //This is to simulate focus into text editor after calling GetHeightForWidth
+ //Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCountAfter = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+
+ //The LineCount must not be changed when calling GetHeightForWidth.
+ DALI_TEST_EQUALS( lineCountAfter , lineCountBefore, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliTextEditorGetHeightForWidthChangeLineCountWhenTextChanged(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetHeightForWidthChangeLineCountWhenTextChanged ");
+
+ int lineCountBefore =0 ;
+ int lineCountAfter =0 ;
+
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+ //Set very large font-size using point-size
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ //Specify font-family
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ //Specify size
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 200.f, 100.f ) );
+ //Set text longer than width of textEditor
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Short text");
+ //Set line wrap mode Character
+ textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
+
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+
+ lineCountBefore = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "This is very loooooooooooooooooooooooooooooooooooong text for test");
+ lineCountAfter = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+
+ // When the text changed, the Line-count should be updated according to new text.
+ // Because the GetHeightForWidth is called in Controller::GetLineCount(float width)
+ DALI_TEST_EQUALS( lineCountBefore ,1, TEST_LOCATION );
+ DALI_TEST_GREATER( lineCountAfter,1, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+
+int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountScrollingCase(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountScrollingCase ");
+
+ int lineCountBefore =0 ;
+ int lineCountAfter =0 ;
+
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+ //Set very large font-size using point-size
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ //Specify font-family
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ //Specify size
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+ //Set text longer than width of textEditor
+ textEditor.SetProperty( TextEditor::Property::TEXT, "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST ");
+
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ //Failed case is the GetNaturalSize change LineCount then the scrollor will not arrive to latest line
+ //GetNaturalSize is a retrieval method which should not modify object
+ lineCountBefore = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ textEditor.GetNaturalSize();
+
+ //This is to simulate focus into text editor after calling GetNaturalSize
+ //Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCountAfter = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+
+ //The LineCount must not be changed when calling GetNaturalSize.
+ DALI_TEST_EQUALS( lineCountAfter , lineCountBefore, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" utcDaliTextEditorGetNaturalSizeDoesNotChangeLineCountLineWrapCharCase ");
+
+ int lineCountBefore =0 ;
+ int lineCountAfter =0 ;
+
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+ //Set very large font-size using point-size
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ //Specify font-family
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ //Specify size
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 50.f, 100.f ) );
+ //Set text longer than width of textEditor
+ textEditor.SetProperty( TextEditor::Property::TEXT, "qwertyuiopasdfghjklzxcvbnm\n");
+ //Set line wrap mode Character
+ textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, "CHARACTER");
+
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+
+ //Failed case is the GetNaturalSize change LineCount which make position of cursor invalid in TextEditor
+ //GetNaturalSize is a retrieval method which should not modify object
+ lineCountBefore = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ textEditor.GetNaturalSize( );
+
+ //This is to simulate focus into text editor after calling GetNaturalSize
+ //Create a tap event to touch the text editor.
+ TestGenerateTap( application, 18.0f, 25.0f );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCountAfter = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+
+ //The LineCount must not be changed when calling GetNaturalSize.
+ DALI_TEST_EQUALS( lineCountAfter , lineCountBefore, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledForLargeFontPointSize ");
+
+ // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
+ const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
+ const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
+
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+
+ //Set size to avoid automatic eliding
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+ //Set very large font-size using point-size
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 1000) ;
+ //Specify font-family
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ //Set text to check if appear or not
+ textEditor.SetProperty( TextEditor::Property::TEXT, "A");
+
+ application.GetScene().Add( textEditor );
+
+ application.SendNotification();
+ application.Render();
+ //Use GetNaturalSize to verify that size of block does not exceed Atlas size
+ Vector3 naturalSize = textEditor.GetNaturalSize();
+
+ DALI_TEST_GREATER( lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION );
+ DALI_TEST_GREATER( lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases ");
+
+ // +2: First one to handle the equal case. Second one to handle odd to even case of GetNaturalSize
+ const uint32_t lessThanWidth = TextAbstraction::FontClient::MAX_TEXT_ATLAS_WIDTH - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
+ const uint32_t lessThanHeight = TextAbstraction::FontClient::MAX_TEXT_ATLAS_HEIGHT - TextAbstraction::FontClient::PADDING_TEXT_ATLAS_BLOCK + 2;
+
+ Vector3 naturalSize; //Use GetNaturalSize to verify that size of block does not exceed Atlas size
+ // Create a text editor
+ TextEditor textEditor = TextEditor::New();
+ //Set size to avoid automatic eliding
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ textEditor.SetProperty( TextEditor::Property::TEXT, "A");
+
+ const int numberOfCases = 6;
+ int arrayCases[numberOfCases] = {323, 326, 330, 600, 1630, 2500};
+
+ for (int index=0; index < numberOfCases; index++)
+ {
+ tet_printf(" UtcDaliTextEditorAtlasLimitationIsEnabledPerformanceCases point-size= %d \n", arrayCases[index]);
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, arrayCases[index]) ;
+ application.GetScene().Add( textEditor );
+ application.SendNotification();
+ application.Render();
+ naturalSize = textEditor.GetNaturalSize();
+ DALI_TEST_GREATER( lessThanWidth, static_cast<uint32_t>(naturalSize.width), TEST_LOCATION );
+ DALI_TEST_GREATER( lessThanHeight, static_cast<uint32_t>(naturalSize.height), TEST_LOCATION );
+
+ }
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorHyphenWrapMode(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorHyphenWrapMode ");
+
+ int lineCount =0;
+ TextEditor textEditor = TextEditor::New();
+
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 150.0f, 300.f ) );
+
+ application.GetScene().Add( textEditor );
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Hi Experimen" );
+ textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, DevelText::LineWrap::HYPHENATION);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::HYPHENATION ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ /*
+ text will be :
+ Hi Exp-
+ erimen
+ */
+ DALI_TEST_EQUALS( lineCount, 2, TEST_LOCATION );
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Hi Experimen" );
+ textEditor.SetProperty(TextEditor::Property::LINE_WRAP_MODE, DevelText::LineWrap::MIXED);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( DevelText::LineWrap::MIXED ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ lineCount = textEditor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ /*
+ text will be :
+ Hi
+ Experi-
+ men
+ */
+ DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextEditorEllipsisPositionProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty ");
+ TextEditor textEditor = TextEditor::New();
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Default is END");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START using integer");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 1);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE using integer");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 2);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END using integer");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 0);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "START");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "MIDDLE");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "END");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "start");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "middle");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "end");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorCopyText(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorCopyText ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ std::string selectedText = "";
+ std::string copiedText = "";
+
+ application.GetScene().Add( textEditor );
+
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Hello world" );
+
+ application.SendNotification();
+ application.Render();
+
+ // Hello is selected
+ DevelTextEditor::SelectText( textEditor, 0, 5 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "Hello", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 5, TEST_LOCATION );
+
+ // Hello is copied
+ copiedText = DevelTextEditor::CopyText( textEditor );
+ DALI_TEST_EQUALS( "Hello", copiedText, TEST_LOCATION );
+
+ // world is selected
+ DevelTextEditor::SelectText( textEditor, 6, 11 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "world", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 6, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 11, TEST_LOCATION );
+
+ // world is copied
+ copiedText = DevelTextEditor::CopyText( textEditor );
+ DALI_TEST_EQUALS( "world", copiedText, TEST_LOCATION );
+
+ // "lo wo" is selected
+ DevelTextEditor::SelectText( textEditor, 3, 8 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "lo wo", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 3, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 8, TEST_LOCATION );
+
+ // "lo wo" is copied
+ copiedText = DevelTextEditor::CopyText( textEditor );
+ DALI_TEST_EQUALS( "lo wo", copiedText, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorCutText(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorCutText ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ std::string selectedText = "";
+
+ application.GetScene().Add( textEditor );
+
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Hello world" );
+
+ application.SendNotification();
+ application.Render();
+
+ // Hello is selected
+ DevelTextEditor::SelectText( textEditor, 0, 5 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "Hello", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 5, TEST_LOCATION );
+
+ // Hello is cut
+ DALI_TEST_EQUALS( "Hello", DevelTextEditor::CutText( textEditor ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( TextEditor::Property::TEXT ).Get<std::string>(), " world", TEST_LOCATION );
+
+ // " w" is selected
+ DevelTextEditor::SelectText( textEditor, 0, 2 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( " w", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 2, TEST_LOCATION );
+
+ // " w" is cut
+ DALI_TEST_EQUALS( " w", DevelTextEditor::CutText( textEditor ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( TextEditor::Property::TEXT ).Get<std::string>(), "orld", TEST_LOCATION );
+
+ // Test Cut from the middle
+
+ // "rl" is selected
+ DevelTextEditor::SelectText( textEditor, 1, 3 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "rl", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 3, TEST_LOCATION );
+
+ // "rl" is cut
+ DALI_TEST_EQUALS( "rl", DevelTextEditor::CutText( textEditor ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( TextEditor::Property::TEXT ).Get<std::string>(), "od", TEST_LOCATION );
+
+ // Test Cut from the end
+
+ // "d" is selected
+ DevelTextEditor::SelectText( textEditor, 1, 2 );
+
+ application.SendNotification();
+ application.Render();
+
+ selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+ DALI_TEST_EQUALS( "d", selectedText, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 2, TEST_LOCATION );
+
+ // "d" is cut
+ DALI_TEST_EQUALS( "d", DevelTextEditor::CutText( textEditor ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( TextEditor::Property::TEXT ).Get<std::string>(), "o", TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorPasteText(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorPasteText ");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ application.GetScene().Add( editor );
+
+ std::string cutText = "";
+ std::string copiedText = "";
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+ editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ editor.SetProperty( Actor::Property::ANCHOR_POINT, 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 on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Select some text in the right of the current cursor position
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Cut the selected text
+ cutText = DevelTextEditor::CutText(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( "wor", cutText, TEST_LOCATION );
+ DALI_TEST_EQUALS( "Hello\nld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+ // Select some text in the left of the current cursor position
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "",DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Copy the selected text
+ copiedText = DevelTextEditor::CopyText(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( "lo\n", copiedText, TEST_LOCATION );
+ DALI_TEST_EQUALS( "Hello\nld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+
+ // Move the cursor to the third line
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Paste the selected text at the current cursor position
+ DevelTextEditor::PasteText(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( "Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+ END_TEST;
+}
+int UtcDaliTextEditorLineSpacing(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorLineSpacing ");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.f ) );
+ application.GetScene().Add( textEditor );
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3" );
+ textEditor.SetProperty( DevelTextEditor::Property::LINE_SPACING, 0 );
+
+ Vector3 sizeBefore = textEditor.GetNaturalSize();
+
+ textEditor.SetProperty( DevelTextEditor::Property::LINE_SPACING, 20 );
+
+ //add 20 for each line 20 * 3
+ DALI_TEST_EQUALS(sizeBefore.height + 60.0f, textEditor.GetNaturalSize().height, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorMinLineSize(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorMinLineSize ");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.f ) );
+ application.GetScene().Add( textEditor );
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Line #1\nLine #2\nLine #3" );
+ textEditor.SetProperty( DevelTextEditor::Property::MIN_LINE_SIZE, 0 );
+
+ Vector3 sizeBefore = textEditor.GetNaturalSize();
+
+ textEditor.SetProperty( DevelTextEditor::Property::MIN_LINE_SIZE, 60 );
+
+ DALI_TEST_NOT_EQUALS( sizeBefore, textEditor.GetNaturalSize(), 0.0f, TEST_LOCATION);
+
+ //60 * 3 lines
+ DALI_TEST_EQUALS(180.0f, textEditor.GetNaturalSize().height, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliTextEditorCursorPositionChangedSignal(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorCursorPositionChangedSignal");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ application.GetScene().Add( editor );
+
+ // connect to the selection changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextEditor::CursorPositionChangedSignal(editor).Connect(&TestCursorPositionChangedCallback);
+ bool cursorPositionChangedSignal = false;
+ editor.ConnectSignal( testTracker, "cursorPositionChanged", CallbackFunctor(&cursorPositionChangedSignal) );
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+ editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ editor.SetKeyInputFocus();
+
+ // Tap on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldCursorPos, 23, TEST_LOCATION);
+
+ gCursorPositionChangedCallbackCalled = false;
+
+ // Move to left.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldCursorPos, 18, TEST_LOCATION);
+
+ gCursorPositionChangedCallbackCalled = false;
+
+ // Insert C
+ application.ProcessEvent( GenerateKey( "c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldCursorPos, 17, TEST_LOCATION);
+
+ gCursorPositionChangedCallbackCalled = false;
+
+ //delete one character
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldCursorPos, 18, TEST_LOCATION);
+
+ gCursorPositionChangedCallbackCalled = false;
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello" );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldCursorPos, 17, TEST_LOCATION);
+
+ gCursorPositionChangedCallbackCalled = false;
+
+ editor.SetProperty( DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gCursorPositionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldCursorPos, 5, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int utcDaliTextEditorSelectionChangedSignal(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorSelectionChangedSignal");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ application.GetScene().Add( editor );
+
+ // connect to the selection changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ DevelTextEditor::SelectionChangedSignal(editor).Connect(&TestSelectionChangedCallback);
+ bool selectionChangedSignal = false;
+ editor.ConnectSignal( testTracker, "selectionChanged", CallbackFunctor(&selectionChangedSignal) );
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+ editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ editor.SetProperty( Actor::Property::ANCHOR_POINT, 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 on the text editor
+ TestGenerateTap( application, 3.0f, 25.0f );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move to second line of the text.
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Select some text in the right of the current cursor position
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
+
+ gSelectionChangedCallbackCalled = false;
+
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(oldSelectionEnd, 7, TEST_LOCATION);
+
+ gSelectionChangedCallbackCalled = false;
+
+ application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(oldSelectionEnd, 8, TEST_LOCATION);
+
+ gSelectionChangedCallbackCalled = false;
+ editor.SetKeyInputFocus();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DevelTextEditor::SelectText( editor ,0, 5 );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
+
+ gSelectionChangedCallbackCalled = false;
+
+ editor.SetProperty( DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(oldSelectionEnd, 5, TEST_LOCATION);
+
+ gSelectionChangedCallbackCalled = false;
+
+ // select all text
+ DevelTextEditor::SelectWholeText(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, oldSelectionEnd, TEST_LOCATION);
+
+ gSelectionChangedCallbackCalled = false;
+
+ // select none
+ DevelTextEditor::SelectNone(editor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(gSelectionChangedCallbackCalled);
+ DALI_TEST_EQUALS(oldSelectionStart, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(oldSelectionEnd, 23, TEST_LOCATION);
+
+ END_TEST;
+}
\ No newline at end of file