X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-TextField-internal.cpp;h=1d899d9de4545d119f3d80bd9bad2930c1bdbd43;hb=ac501f02feab8e2fb7e613f936d3d5a511603001;hp=a098f73b551650b441d39ad60a56014139aa909d;hpb=946461ac1b49e996d9155c95130ec5aa1b08f77d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git
diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp
index a098f73..1d899d9 100755
--- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp
+++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp
@@ -112,3 +112,82 @@ int UtcDaliTextFieldMultipleBackgroundText(void)
END_TEST;
}
+
+int UtcDaliTextFieldSelectText(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliTextFieldSelectText" );
+
+ // Create a text field
+ TextField textField = TextField::New();
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 400.f, 60.f ) );
+ textField.SetProperty( TextField::Property::TEXT, "Hello World" );
+
+ // Add the text field to the stage
+ application.GetScene().Add( textField );
+
+ application.SendNotification();
+ application.Render();
+
+ Toolkit::Internal::TextField& textFieldImpl = GetImpl( textField );
+
+ application.SendNotification();
+ application.Render();
+
+ // Highlight the whole text
+ textFieldImpl.SelectWholeText();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( textFieldImpl.GetSelectedText() == "Hello World" );
+
+ // Select None
+ textFieldImpl.SelectNone();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( textFieldImpl.GetSelectedText() == "" );
+
+ END_TEST;
+}
+
+int UtcDaliTextFieldMarkupUnderline(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextFieldMarkupUnderline ");
+
+ TextField textField = TextField::New();
+
+ application.GetScene().Add( textField );
+
+ textField.SetProperty( TextField::Property::TEXT, "ABCEFGH" );
+ textField.SetProperty( TextField ::Property::ENABLE_MARKUP, true );
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
+
+ Toolkit::Internal::TextField& textFieldImpl = GetImpl( textField );
+ const Text::Length numberOfUnderlineRuns = textFieldImpl.getController()->GetTextModel()->GetNumberOfUnderlineRuns();
+
+ DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION );
+
+ Vector underlineRuns;
+ underlineRuns.Resize(numberOfUnderlineRuns);
+ textFieldImpl.getController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
+
+ //ABC are underlined
+ DALI_TEST_EQUALS( underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS( underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS( underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
+
+ //GH are underlined
+ DALI_TEST_EQUALS( underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS( underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
+
+ END_TEST;
+
+}
\ No newline at end of file