+}
+
+int UtcDaliTextEditorControlBackgroundColor(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorControlBackgroundColor\n");
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+
+ Vector4 backgroundColor;
+
+ editor.SetProperty(TextEditor::Property::TEXT, "Background Color");
+ application.GetScene().Add(editor);
+ application.SendNotification();
+ application.Render();
+
+ Toolkit::Internal::TextEditor& editorImpl = GetImpl(editor);
+ ControllerPtr controller = editorImpl.GetTextController();
+ Controller::Impl& controllerImpl = Controller::Impl::GetImplementation(*controller.Get());
+
+ // Default color is transparent
+ controllerImpl.mEditableControlInterface->GetControlBackgroundColor(backgroundColor);
+ DALI_TEST_EQUALS(backgroundColor, Color::TRANSPARENT, TEST_LOCATION);
+
+ // Set background color to red
+ editor.SetBackgroundColor(Color::RED);
+ application.SendNotification();
+ application.Render();
+
+ // Should be red
+ controllerImpl.mEditableControlInterface->GetControlBackgroundColor(backgroundColor);
+ DALI_TEST_EQUALS(backgroundColor, Color::RED, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorTextPositionWithMinLineAndBigFont(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorTextPositionWithMinLine ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, "<span font-size='45'>H</span>\ni");
+ textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50);
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+ application.GetScene().Add(textEditor);
+
+ application.SendNotification();
+ application.Render();
+
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ Text::ViewInterface& view = textEditorImpl.GetTextController()->GetView();
+
+ Length numberOfGlyphs = view.GetNumberOfGlyphs();
+
+ DALI_TEST_EQUALS(numberOfGlyphs, 3u, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+ Vector<GlyphInfo> glyphs;
+ glyphs.Resize(numberOfGlyphs);
+
+ Vector<Vector2> positions;
+ positions.Resize(numberOfGlyphs);
+
+ float alignmentOffset = 0u;
+ numberOfGlyphs = view.GetGlyphs(glyphs.Begin(),
+ positions.Begin(),
+ alignmentOffset,
+ 0u,
+ numberOfGlyphs);
+
+ DALI_TEST_EQUALS(positions[2].y, 165.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorMarkupStrikethrough(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorMarkupStrikethrough ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ application.GetScene().Add(textEditor);
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, "<s>ABC</s>EF<s color='red'>GH</s>");
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t expectedNumberOfStrikethroughGlyphs = 2u;
+
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ const Text::Length numberOfStrikethroughRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
+
+ DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughGlyphs, TEST_LOCATION);
+
+ Vector<StrikethroughGlyphRun> strikethroughRuns;
+ strikethroughRuns.Resize(numberOfStrikethroughRuns);
+ textEditorImpl.GetTextController()->GetTextModel()->GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns);
+
+ //ABC have strikethrough
+ DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.glyphIndex, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.numberOfGlyphs, 3u, TEST_LOCATION);
+ DALI_TEST_CHECK(!strikethroughRuns[0u].isColorSet);
+
+ //GH have strikethrough
+ DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.glyphIndex, 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.numberOfGlyphs, 2u, TEST_LOCATION);
+ DALI_TEST_CHECK(strikethroughRuns[1u].isColorSet);
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorMarkupStrikethroughNoEndTag(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorMarkupStrikethroughNoEndTag ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ application.GetScene().Add(textEditor);
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, "<s>ABC");
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t expectedNumberOfStrikethroughGlyphs = 0u;
+
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ Text::Length numberOfStrikethroughRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
+
+ DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughGlyphs, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorMarkupParagraphTag(void)
+
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTag ");
+
+ TextEditor textEditor = TextEditor::New();
+ application.GetScene().Add(textEditor);
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, "text one <p>Paragraph two</p> text three <p>Paragraph four</p> text five");
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t expectedNumberOfBoundedParagraphRuns = 2u;
+
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ const Text::Length numberOfBoundedParagraphRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfBoundedParagraphRuns();
+ DALI_TEST_EQUALS(numberOfBoundedParagraphRuns, expectedNumberOfBoundedParagraphRuns, TEST_LOCATION);
+
+ const Vector<BoundedParagraphRun>& boundedParagraphRuns = textEditorImpl.GetTextController()->GetTextModel()->GetBoundedParagraphRuns();
+
+ //<p>Paragraph two</p>
+ DALI_TEST_EQUALS(boundedParagraphRuns[0u].characterRun.characterIndex, 10u, TEST_LOCATION);
+ DALI_TEST_EQUALS(boundedParagraphRuns[0u].characterRun.numberOfCharacters, 14u, TEST_LOCATION);
+
+ //<p>Paragraph four</p>
+ DALI_TEST_EQUALS(boundedParagraphRuns[1u].characterRun.characterIndex, 37u, TEST_LOCATION);
+ DALI_TEST_EQUALS(boundedParagraphRuns[1u].characterRun.numberOfCharacters, 15u, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTextEditorMarkupParagraphTagAlignAttribute(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute ");
+
+ // Apply alignment for each type on property level on three paragraphs and in-between text.
+ // Apply align in markup on the three paragraphs (each one a type).
+ // Using the same text to gain similar results from both the property level and the markup.
+ // Compare line alignment between the property level and the markup.
+
+ std::string textAlignOnPropertyLevel = "text outside<p>Paragraph end</p>text outside<p>Paragraph center</p>text outside<p>Paragraph begin</p><p>Paragraph property alignment</p>";
+ std::string textAlignInMarkup = "text outside<p align='end'>Paragraph end</p>text outside<p align='center'>Paragraph center</p>text outside<p align='begin' >Paragraph begin</p><p>Paragraph property alignment</p>";
+
+ //Set size to avoid automatic eliding
+ Vector2 controllerSize = Vector2(1025, 1025);
+
+ TextEditor textEditorBeginAlign = TextEditor::New();
+ TextEditor textEditorCenterAlign = TextEditor::New();
+ TextEditor textEditorEndAlign = TextEditor::New();
+ TextEditor textEditorMultiAlign = TextEditor::New();
+
+ application.GetScene().Add(textEditorBeginAlign);
+ application.GetScene().Add(textEditorCenterAlign);
+ application.GetScene().Add(textEditorEndAlign);
+ application.GetScene().Add(textEditorMultiAlign);
+
+ textEditorBeginAlign.SetProperty(TextEditor::Property::TEXT, textAlignOnPropertyLevel);
+ textEditorBeginAlign.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+ textEditorBeginAlign.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ textEditorBeginAlign.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::BEGIN);
+ textEditorBeginAlign.SetProperty(Actor::Property::SIZE, controllerSize);
+
+ textEditorCenterAlign.SetProperty(TextEditor::Property::TEXT, textAlignOnPropertyLevel);
+ textEditorCenterAlign.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+ textEditorCenterAlign.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ textEditorCenterAlign.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::CENTER);
+ textEditorCenterAlign.SetProperty(Actor::Property::SIZE, controllerSize);
+
+ textEditorEndAlign.SetProperty(TextEditor::Property::TEXT, textAlignOnPropertyLevel);
+ textEditorEndAlign.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+ textEditorEndAlign.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ textEditorEndAlign.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::END);
+ textEditorEndAlign.SetProperty(Actor::Property::SIZE, controllerSize);
+
+ textEditorMultiAlign.SetProperty(TextEditor::Property::TEXT, textAlignInMarkup);
+ textEditorMultiAlign.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+ textEditorMultiAlign.SetProperty(DevelTextEditor::Property::ELLIPSIS, false);
+ textEditorMultiAlign.SetProperty(TextEditor::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::CENTER);
+ textEditorMultiAlign.SetProperty(Actor::Property::SIZE, controllerSize);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t expectedNumberOfBoundedParagraphRuns = 4u;
+ uint32_t expectedNumberOfLines = 7u;
+
+ Toolkit::Internal::TextEditor& textEditorMultiAlignImpl = GetImpl(textEditorMultiAlign);
+ Toolkit::Internal::TextEditor& textEditorBeginAlignImpl = GetImpl(textEditorBeginAlign);
+ Toolkit::Internal::TextEditor& textEditorCenterAlignImpl = GetImpl(textEditorCenterAlign);
+ Toolkit::Internal::TextEditor& textEditorEndAlignImpl = GetImpl(textEditorEndAlign);
+
+ const Text::Length numberOfBoundedParagraphRuns = textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetNumberOfBoundedParagraphRuns();
+ DALI_TEST_EQUALS(numberOfBoundedParagraphRuns, expectedNumberOfBoundedParagraphRuns, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
+ DALI_TEST_CHECK(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines());
+
+ DALI_TEST_EQUALS(textEditorBeginAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
+ DALI_TEST_CHECK(textEditorBeginAlignImpl.GetTextController()->GetTextModel()->GetLines());
+
+ DALI_TEST_EQUALS(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
+ DALI_TEST_CHECK(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetLines());
+
+ DALI_TEST_EQUALS(textEditorEndAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
+ DALI_TEST_CHECK(textEditorEndAlignImpl.GetTextController()->GetTextModel()->GetLines());
+
+ const uint32_t LINE_INDEX_ALIGN_END = 1u;
+ const uint32_t LINE_INDEX_ALIGN_CENTER = 3u;
+ const uint32_t LINE_INDEX_ALIGN_BEGIN = 5u;
+ const uint32_t LINE_INDEX_OUTSIDE_1 = 0u;
+ const uint32_t LINE_INDEX_OUTSIDE_2 = 2u;
+ const uint32_t LINE_INDEX_OUTSIDE_3 = 4u;
+ const uint32_t LINE_INDEX_PARAGRAPH = 6u;
+
+ //<p align='end'>Paragraph end</p>
+ const LineRun& lineEndFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_END);
+ const LineRun& lineEndFromEndAlign = *(textEditorEndAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_END);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - <p align='end'>Paragraph end</p>");
+ DALI_TEST_EQUALS(lineEndFromMultiAlign.alignmentOffset, lineEndFromEndAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineEndFromMultiAlign.width, lineEndFromEndAlign.width, TEST_LOCATION);
+
+ //<p align='center'>Paragraph center</p>
+ const LineRun& lineCenterFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_CENTER);
+ const LineRun& lineEndFromCenterAlign = *(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_CENTER);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - <p align='center'>Paragraph center</p>");
+ DALI_TEST_EQUALS(lineCenterFromMultiAlign.alignmentOffset, lineEndFromCenterAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineCenterFromMultiAlign.width, lineEndFromCenterAlign.width, TEST_LOCATION);
+
+ //<p align='begin' >Paragraph begin</p>
+ const LineRun& lineBeginFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_BEGIN);
+ const LineRun& lineEndFromBeginAlign = *(textEditorBeginAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_BEGIN);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - <p align='begin' >Paragraph begin</p>");
+ DALI_TEST_EQUALS(lineBeginFromMultiAlign.alignmentOffset, lineEndFromBeginAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineBeginFromMultiAlign.width, lineEndFromBeginAlign.width, TEST_LOCATION);
+
+ //text outside
+ const LineRun& lineOutsideOneFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_1);
+ const LineRun& lineOutsideOneFromCenterAlign = *(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_1);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - text outside one");
+ DALI_TEST_EQUALS(lineOutsideOneFromMultiAlign.alignmentOffset, lineOutsideOneFromCenterAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineOutsideOneFromMultiAlign.width, lineOutsideOneFromCenterAlign.width, TEST_LOCATION);
+
+ const LineRun& lineOutsideTwoFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_2);
+ const LineRun& lineOutsideTwoFromCenterAlign = *(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_2);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - text outside two");
+ DALI_TEST_EQUALS(lineOutsideTwoFromMultiAlign.alignmentOffset, lineOutsideTwoFromCenterAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineOutsideTwoFromMultiAlign.width, lineOutsideTwoFromCenterAlign.width, TEST_LOCATION);
+
+ const LineRun& lineOutsideThreeFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_3);
+ const LineRun& lineOutsideThreeFromCenterAlign = *(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_3);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - text outside three");
+ DALI_TEST_EQUALS(lineOutsideThreeFromMultiAlign.alignmentOffset, lineOutsideThreeFromCenterAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineOutsideThreeFromMultiAlign.width, lineOutsideThreeFromCenterAlign.width, TEST_LOCATION);
+
+ const LineRun& lineParagraphFromMultiAlign = *(textEditorMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_PARAGRAPH);
+ const LineRun& lineParagraphFromCenterAlign = *(textEditorCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_PARAGRAPH);
+ tet_infoline(" UtcDaliTextEditorMarkupParagraphTagAlignAttribute - <p>Paragraph property alignment</p>");
+ DALI_TEST_EQUALS(lineParagraphFromMultiAlign.alignmentOffset, lineParagraphFromCenterAlign.alignmentOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(lineParagraphFromMultiAlign.width, lineParagraphFromCenterAlign.width, TEST_LOCATION);
+
+ END_TEST;
+}