X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit-internal%2Futc-Dali-TextEditor-internal.cpp;h=b19d653ca32d4a5995e7777b60085a10868bf7a5;hp=9445be6d01de1043c52d03b1b0491700febb59ca;hb=72f6a79a6e1de38a07a8990f6f687418dc92e5bb;hpb=eac3e6ee30183868f1af12addd94e7f2fc467ed7 diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp index 9445be6..b19d653 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -70,3 +71,100 @@ int UtcDaliTextEditorSelectText(void) END_TEST; } + +int UtcDaliTextEditorMarkupUnderline(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextEditorMarkupUnderline "); + + TextEditor textEditor = TextEditor::New(); + + application.GetScene().Add( textEditor ); + + textEditor.SetProperty( TextEditor::Property::TEXT, "ABCEFGH" ); + textEditor.SetProperty( TextEditor ::Property::ENABLE_MARKUP, true ); + + application.SendNotification(); + application.Render(); + + uint32_t expectedNumberOfUnderlinedGlyphs = 5u; + + Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor ); + const Text::Length numberOfUnderlineRuns = textEditorImpl.getController()->GetTextModel()->GetNumberOfUnderlineRuns(); + + DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION ); + + Vector underlineRuns; + underlineRuns.Resize(numberOfUnderlineRuns); + textEditorImpl.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; +} + +int UtcDaliTextEditorFontPointSizeLargerThanAtlas(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextEditorFontPointSizeLargerThanAtlas "); + + // 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(); + + //Check if Glyph is added to AtlasGlyphManger or not + int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount; + DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION ); + + END_TEST; +} + + +int UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase "); + + //Set Map of placeholder: text, font-family and point-size + Property::Map placeholderMapSet; + placeholderMapSet["text"] = "A"; + placeholderMapSet["fontFamily"] = "DejaVu Sans"; + placeholderMapSet["pixelSize"] = 1000.0f; + + // Create a text editor + TextEditor textEditor = TextEditor::New(); + //Set size to avoid automatic eliding + textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025)); + //Set placeholder + textEditor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet) ; + + application.GetScene().Add( textEditor ); + + application.SendNotification(); + application.Render(); + + //Check if Glyph is added to AtlasGlyphManger or not + int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount; + DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION ); + + END_TEST; +} \ No newline at end of file