2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
25 #include <dali-toolkit/internal/text/rendering/text-typesetter.h>
26 #include <dali-toolkit/internal/text/rendering/view-model.h>
27 #include <dali-toolkit/internal/text/text-controller-impl.h>
28 #include <dali-toolkit/internal/text/text-controller.h>
31 using namespace Toolkit;
34 int UtcDaliTextLabelMarkupUnderline(void)
36 ToolkitTestApplication application;
37 tet_infoline(" UtcDaliTextLabelMarkupUnderline ");
39 TextLabel textLabel = TextLabel::New();
41 application.GetScene().Add(textLabel);
43 textLabel.SetProperty(TextLabel::Property::TEXT, "<u>ABC</u>EF<u>GH</u>");
44 textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
46 application.SendNotification();
49 uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
51 Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
52 const Text::Length numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
54 DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
56 Vector<UnderlinedGlyphRun> underlineRuns;
57 underlineRuns.Resize(numberOfUnderlineRuns);
58 textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
61 DALI_TEST_EQUALS(underlineRuns[0u].glyphRun.glyphIndex, 0u, TEST_LOCATION);
62 DALI_TEST_EQUALS(underlineRuns[1u].glyphRun.glyphIndex, 1u, TEST_LOCATION);
63 DALI_TEST_EQUALS(underlineRuns[2u].glyphRun.glyphIndex, 2u, TEST_LOCATION);
66 DALI_TEST_EQUALS(underlineRuns[3u].glyphRun.glyphIndex, 5u, TEST_LOCATION);
67 DALI_TEST_EQUALS(underlineRuns[4u].glyphRun.glyphIndex, 6u, TEST_LOCATION);
72 int UtcDaliTextLabelMarkupUnderlineAttributes(void)
74 ToolkitTestApplication application;
75 tet_infoline(" UtcDaliTextLabelMarkupUnderlineAttributes ");
77 TextLabel textLabel = TextLabel::New();
79 application.GetScene().Add(textLabel);
81 std::string testText =
82 "start<u>ABC1</u>then"
83 "<u type='solid'>ABC2</u>then"
84 "<u type='dashed'>ABC3</u>then"
85 "<u type='double'>ABC4</u>then"
86 "<u color='green'>ABC5</u>then"
87 "<u height='5.0f'>ABC6</u>then"
88 "<u type='dashed' dash-gap='3.0f'>ABC7</u>then"
89 "<u type='dashed' dash-width='4.0f'>ABC8</u>then"
90 "<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>ABC9</u>end"
94 textLabel.SetProperty(TextLabel::Property::TEXT, testText);
95 textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
97 application.SendNotification();
100 const uint32_t NUMBER_OF_CASES = 9u;
101 uint32_t expectedNumberOfUnderlinedGlyphs = 36u;
103 Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
104 const Text::Length numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
106 DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
108 Vector<UnderlinedGlyphRun> underlineRuns;
109 underlineRuns.Resize(numberOfUnderlineRuns);
110 textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
117 GlyphIndex startGlyphIndex;
118 GlyphIndex endGlyphIndex;
119 UnderlineStyleProperties properties;
130 Text::Underline::SOLID,
142 //<u type='solid'>ABC2</u>
143 {"<u type='solid'>ABC2</u>",
149 Text::Underline::SOLID,
161 //<u type='dashed'>ABC3</u>
162 {"<u type='dashed'>ABC3</u>",
168 Text::Underline::DASHED,
180 //<u type='double'>ABC4</u>
181 {"<u type='double'>ABC4</u>",
187 Text::Underline::DOUBLE,
199 //<u color='green'>ABC5</u>
200 {"<u color='green'>ABC5</u>",
206 Text::Underline::SOLID,
218 //<u height='5.0f'>ABC6</u>
219 {"<u height='5.0f'>ABC6</u>",
225 Text::Underline::SOLID,
237 //<u type='dashed' dash-gap='3.0f'>ABC7</u>
238 {"<u type='dashed' dash-gap='3.0f'>ABC7</u>",
244 Text::Underline::DASHED,
256 //<u type='dashed' dash-width='4.0f'>ABC8</u>
257 {"<u type='dashed' dash-width='4.0f'>ABC8</u>",
263 Text::Underline::DASHED,
275 //<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>
276 {"<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>",
282 Text::Underline::DASHED,
296 for(uint32_t i = 0; i < NUMBER_OF_CASES; i++)
298 tet_infoline(data[i].title.c_str());
299 DALI_TEST_EQUALS(underlineRuns[data[i].startIndex].glyphRun.glyphIndex, data[i].startGlyphIndex, TEST_LOCATION);
300 DALI_TEST_EQUALS(underlineRuns[data[i].endIndex].glyphRun.glyphIndex, data[i].endGlyphIndex, TEST_LOCATION);
302 DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].startIndex].properties);
303 DALI_TEST_CHECK(data[i].properties == underlineRuns[data[i].endIndex].properties);
309 int UtcDaliTextLabelBackgroundTag(void)
311 ToolkitTestApplication application;
312 tet_infoline("UtcDaliTextLabelBackgroundTag\n");
314 TextLabel label = TextLabel::New();
315 DALI_TEST_CHECK(label);
317 label.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
318 label.SetProperty(TextLabel::Property::TEXT, "H<background color='red'>e</background> Worl<background color='yellow'>d</background>");
319 application.GetScene().Add(label);
320 application.SendNotification();
321 application.Render();
323 Toolkit::Internal::TextLabel& labelImpl = GetImpl(label);
324 const ColorIndex* const backgroundColorIndicesBuffer = labelImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
326 DALI_TEST_CHECK(backgroundColorIndicesBuffer);
329 DALI_TEST_EQUALS(backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
332 DALI_TEST_EQUALS(backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
335 DALI_TEST_EQUALS(backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
340 int UtcDaliToolkitTextlabelEllipsisInternalAPIs(void)
342 ToolkitTestApplication application;
343 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs ");
344 TextLabel textLabel = TextLabel::New();
346 Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
347 const ModelInterface* const textModel = textLabelImpl.GetTextController()->GetTextModel();
349 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - ELLIPSIS Disabled");
350 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS, false);
351 DALI_TEST_EQUALS(textLabel.GetProperty<bool>(DevelTextLabel::Property::ELLIPSIS), false, TEST_LOCATION);
352 DALI_TEST_CHECK(!(textModel->IsTextElideEnabled()));
354 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - ELLIPSIS Enabled");
355 textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS, true);
356 DALI_TEST_EQUALS(textLabel.GetProperty<bool>(DevelTextLabel::Property::ELLIPSIS), true, TEST_LOCATION);
357 DALI_TEST_CHECK(textModel->IsTextElideEnabled());
359 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs Default");
360 DALI_TEST_EQUALS(textModel->GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
362 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs Default");
363 DALI_TEST_EQUALS(textModel->GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
365 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs Default");
366 DALI_TEST_EQUALS(textModel->GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
368 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs Default");
369 DALI_TEST_EQUALS(textModel->GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
371 // Tests the rendering controller has been created.
372 TypesetterPtr typesetter = Typesetter::New(textModel);
373 DALI_TEST_CHECK(typesetter);
375 // Tests the view model has been created.
376 ViewModel* model = typesetter->GetViewModel();
378 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - IsTextElideEnabled ViewModel");
379 DALI_TEST_CHECK(model->IsTextElideEnabled());
381 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs ViewModel");
382 DALI_TEST_EQUALS(model->GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
384 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs ViewModel");
385 DALI_TEST_EQUALS(model->GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
387 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs ViewModel");
388 DALI_TEST_EQUALS(model->GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
390 tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs ViewModel");
391 DALI_TEST_EQUALS(model->GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
395 int UtcDaliTextLabelTextWithSpan(void)
397 ToolkitTestApplication application;
398 tet_infoline("UtcDaliTextLabelTextWithSpan\n");
400 TextLabel label = TextLabel::New();
401 DALI_TEST_CHECK(label);
403 label.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
404 label.SetProperty(TextLabel::Property::TEXT, "Hello Span");
405 application.GetScene().Add(label);
407 application.SendNotification();
408 application.Render();
410 Vector3 originalSize = label.GetNaturalSize();
411 label.SetProperty(TextLabel::Property::TEXT, "H<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ello</span> Span");
413 application.SendNotification();
414 application.Render();
416 Vector3 spanSize = label.GetNaturalSize();
418 DALI_TEST_GREATER(spanSize.width, originalSize.width, TEST_LOCATION);
420 Toolkit::Internal::TextLabel& labelImpl = GetImpl(label);
421 const ColorIndex* const colorIndicesBuffer1 = labelImpl.GetTextController()->GetTextModel()->GetColorIndices();
423 DALI_TEST_CHECK(colorIndicesBuffer1);
426 DALI_TEST_EQUALS(colorIndicesBuffer1[0], 0u, TEST_LOCATION);
429 DALI_TEST_EQUALS(colorIndicesBuffer1[1], 1u, TEST_LOCATION);
432 DALI_TEST_EQUALS(colorIndicesBuffer1[6], 0u, TEST_LOCATION);
434 label.SetProperty(TextLabel::Property::TEXT, "<span font-size='45'>H</span>ello <span text-color='red'>S</span>pan");
436 application.SendNotification();
437 application.Render();
439 const ColorIndex* const colorIndicesBuffer2 = labelImpl.GetTextController()->GetTextModel()->GetColorIndices();
441 DALI_TEST_CHECK(colorIndicesBuffer2);
444 DALI_TEST_EQUALS(colorIndicesBuffer2[0], 0u, TEST_LOCATION);
447 DALI_TEST_EQUALS(colorIndicesBuffer2[1], 0u, TEST_LOCATION);
450 DALI_TEST_EQUALS(colorIndicesBuffer2[6], 1u, TEST_LOCATION);
453 DALI_TEST_EQUALS(colorIndicesBuffer2[7], 0u, TEST_LOCATION);
458 int UtcDaliTextLabelMarkupStrikethrough(void)
460 ToolkitTestApplication application;
461 tet_infoline(" UtcDaliTextLabelMarkupStrikethrough ");
463 TextLabel textLabel = TextLabel::New();
465 application.GetScene().Add(textLabel);
467 textLabel.SetProperty(TextLabel::Property::TEXT, "<s color='red'>ABC</s>EF<s color='green'>GH</s>");
468 textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
470 application.SendNotification();
471 application.Render();
473 uint32_t expectedNumberOfStrikethroughGlyphs = 2u;
475 Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
476 const Text::Length numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
478 DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughGlyphs, TEST_LOCATION);
480 Vector<StrikethroughGlyphRun> strikethroughRuns;
481 strikethroughRuns.Resize(numberOfStrikethroughRuns);
482 textLabelImpl.GetTextController()->GetTextModel()->GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns);
484 //ABC have strikethrough
485 DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.glyphIndex, 0u, TEST_LOCATION);
486 DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.numberOfGlyphs, 3u, TEST_LOCATION);
487 DALI_TEST_CHECK(strikethroughRuns[0u].isColorSet);
488 DALI_TEST_EQUALS(strikethroughRuns[0u].color.r, 1u, TEST_LOCATION);
489 DALI_TEST_EQUALS(strikethroughRuns[0u].color.g, 0u, TEST_LOCATION);
490 DALI_TEST_EQUALS(strikethroughRuns[0u].color.b, 0u, TEST_LOCATION);
492 //GH have strikethrough
493 DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.glyphIndex, 5u, TEST_LOCATION);
494 DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.numberOfGlyphs, 2u, TEST_LOCATION);
495 DALI_TEST_CHECK(strikethroughRuns[1u].isColorSet);
496 DALI_TEST_EQUALS(strikethroughRuns[1u].color.r, 0u, TEST_LOCATION);
497 DALI_TEST_EQUALS(strikethroughRuns[1u].color.g, 1u, TEST_LOCATION);
498 DALI_TEST_EQUALS(strikethroughRuns[1u].color.b, 0u, TEST_LOCATION);
503 int UtcDaliTextLabelMarkupStrikethroughNoEndTag(void)
505 ToolkitTestApplication application;
506 tet_infoline(" UtcDaliTextLabelMarkupStrikethroughNoEndTag ");
508 TextLabel textLabel = TextLabel::New();
510 application.GetScene().Add(textLabel);
512 textLabel.SetProperty(TextLabel::Property::TEXT, "<s>ABC");
513 textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
515 application.SendNotification();
516 application.Render();
518 uint32_t expectedNumberOfStrikethroughGlyphs = 0u;
520 Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
521 Text::Length numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
523 DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughGlyphs, TEST_LOCATION);
528 int UtcDaliTextLabelMarkupParagraphTag(void)
531 ToolkitTestApplication application;
533 tet_infoline(" UtcDaliTextLabelMarkupParagraphTag ");
534 TextLabel textLabel = TextLabel::New();
536 application.GetScene().Add(textLabel);
538 textLabel.SetProperty(TextLabel::Property::TEXT, "text one <p>Paragraph two</p> text three <p>Paragraph four</p> text five");
539 textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
540 textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
542 application.SendNotification();
543 application.Render();
545 uint32_t expectedNumberOfBoundedParagraphRuns = 2u;
547 Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
548 const Text::Length numberOfBoundedParagraphRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfBoundedParagraphRuns();
549 DALI_TEST_EQUALS(numberOfBoundedParagraphRuns, expectedNumberOfBoundedParagraphRuns, TEST_LOCATION);
551 const Vector<BoundedParagraphRun>& boundedParagraphRuns = textLabelImpl.GetTextController()->GetTextModel()->GetBoundedParagraphRuns();
553 //<p>Paragraph two</p>
554 DALI_TEST_EQUALS(boundedParagraphRuns[0u].characterRun.characterIndex, 10u, TEST_LOCATION);
555 DALI_TEST_EQUALS(boundedParagraphRuns[0u].characterRun.numberOfCharacters, 14u, TEST_LOCATION);
557 //<p>Paragraph four</p>
558 DALI_TEST_EQUALS(boundedParagraphRuns[1u].characterRun.characterIndex, 37u, TEST_LOCATION);
559 DALI_TEST_EQUALS(boundedParagraphRuns[1u].characterRun.numberOfCharacters, 15u, TEST_LOCATION);
564 int UtcDaliTextLabelMarkupParagraphTagAlignAttribute(void)
566 ToolkitTestApplication application;
567 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute ");
569 // Apply alignment for each type on property level on three paragraphs and in-between text.
570 // Apply align in markup on the three paragraphs (each one a type).
571 // Using the same text to gain similar results from both the property level and the markup.
572 // Compare line alignment between the property level and the markup.
574 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>";
575 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>";
577 //Set size to avoid automatic eliding
578 Vector2 controllerSize = Vector2(1025, 1025);
580 TextLabel textLabelBeginAlign = TextLabel::New();
581 TextLabel textLabelCenterAlign = TextLabel::New();
582 TextLabel textLabelEndAlign = TextLabel::New();
583 TextLabel textLabelMultiAlign = TextLabel::New();
585 application.GetScene().Add(textLabelBeginAlign);
586 application.GetScene().Add(textLabelCenterAlign);
587 application.GetScene().Add(textLabelEndAlign);
588 application.GetScene().Add(textLabelMultiAlign);
590 textLabelBeginAlign.SetProperty(TextLabel::Property::TEXT, textAlignOnPropertyLevel);
591 textLabelBeginAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
592 textLabelBeginAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
593 textLabelBeginAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
594 textLabelBeginAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::BEGIN);
595 textLabelBeginAlign.SetProperty(Actor::Property::SIZE, controllerSize);
597 textLabelCenterAlign.SetProperty(TextLabel::Property::TEXT, textAlignOnPropertyLevel);
598 textLabelCenterAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
599 textLabelCenterAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
600 textLabelCenterAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
601 textLabelCenterAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::CENTER);
602 textLabelCenterAlign.SetProperty(Actor::Property::SIZE, controllerSize);
604 textLabelEndAlign.SetProperty(TextLabel::Property::TEXT, textAlignOnPropertyLevel);
605 textLabelEndAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
606 textLabelEndAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
607 textLabelEndAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
608 textLabelEndAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::END);
609 textLabelEndAlign.SetProperty(Actor::Property::SIZE, controllerSize);
611 textLabelMultiAlign.SetProperty(TextLabel::Property::TEXT, textAlignInMarkup);
612 textLabelMultiAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
613 textLabelMultiAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
614 textLabelMultiAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
615 textLabelMultiAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::CENTER);
616 textLabelMultiAlign.SetProperty(Actor::Property::SIZE, controllerSize);
618 application.SendNotification();
619 application.Render();
621 uint32_t expectedNumberOfBoundedParagraphRuns = 4u;
622 uint32_t expectedNumberOfLines = 7u;
624 Toolkit::Internal::TextLabel& textLabelMultiAlignImpl = GetImpl(textLabelMultiAlign);
625 Toolkit::Internal::TextLabel& textLabelBeginAlignImpl = GetImpl(textLabelBeginAlign);
626 Toolkit::Internal::TextLabel& textLabelCenterAlignImpl = GetImpl(textLabelCenterAlign);
627 Toolkit::Internal::TextLabel& textLabelEndAlignImpl = GetImpl(textLabelEndAlign);
629 const Text::Length numberOfBoundedParagraphRuns = textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetNumberOfBoundedParagraphRuns();
630 DALI_TEST_EQUALS(numberOfBoundedParagraphRuns, expectedNumberOfBoundedParagraphRuns, TEST_LOCATION);
632 DALI_TEST_EQUALS(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
633 DALI_TEST_CHECK(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines());
635 DALI_TEST_EQUALS(textLabelBeginAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
636 DALI_TEST_CHECK(textLabelBeginAlignImpl.GetTextController()->GetTextModel()->GetLines());
638 DALI_TEST_EQUALS(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
639 DALI_TEST_CHECK(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines());
641 DALI_TEST_EQUALS(textLabelEndAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
642 DALI_TEST_CHECK(textLabelEndAlignImpl.GetTextController()->GetTextModel()->GetLines());
644 const uint32_t LINE_INDEX_ALIGN_END = 1u;
645 const uint32_t LINE_INDEX_ALIGN_CENTER = 3u;
646 const uint32_t LINE_INDEX_ALIGN_BEGIN = 5u;
647 const uint32_t LINE_INDEX_OUTSIDE_1 = 0u;
648 const uint32_t LINE_INDEX_OUTSIDE_2 = 2u;
649 const uint32_t LINE_INDEX_OUTSIDE_3 = 4u;
650 const uint32_t LINE_INDEX_PARAGRAPH = 6u;
652 //<p align='end'>Paragraph end</p>
653 const LineRun& lineEndFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_END);
654 const LineRun& lineEndFromEndAlign = *(textLabelEndAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_END);
655 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p align='end'>Paragraph end</p>");
656 DALI_TEST_EQUALS(lineEndFromMultiAlign.alignmentOffset, lineEndFromEndAlign.alignmentOffset, TEST_LOCATION);
657 DALI_TEST_EQUALS(lineEndFromMultiAlign.width, lineEndFromEndAlign.width, TEST_LOCATION);
659 //<p align='center'>Paragraph center</p>
660 const LineRun& lineCenterFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_CENTER);
661 const LineRun& lineEndFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_CENTER);
662 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p align='center'>Paragraph center</p>");
663 DALI_TEST_EQUALS(lineCenterFromMultiAlign.alignmentOffset, lineEndFromCenterAlign.alignmentOffset, TEST_LOCATION);
664 DALI_TEST_EQUALS(lineCenterFromMultiAlign.width, lineEndFromCenterAlign.width, TEST_LOCATION);
666 //<p align='begin' >Paragraph begin</p>
667 const LineRun& lineBeginFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_BEGIN);
668 const LineRun& lineEndFromBeginAlign = *(textLabelBeginAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_BEGIN);
669 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p align='begin' >Paragraph begin</p>");
670 DALI_TEST_EQUALS(lineBeginFromMultiAlign.alignmentOffset, lineEndFromBeginAlign.alignmentOffset, TEST_LOCATION);
671 DALI_TEST_EQUALS(lineBeginFromMultiAlign.width, lineEndFromBeginAlign.width, TEST_LOCATION);
674 const LineRun& lineOutsideOneFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_1);
675 const LineRun& lineOutsideOneFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_1);
676 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - text outside one");
677 DALI_TEST_EQUALS(lineOutsideOneFromMultiAlign.alignmentOffset, lineOutsideOneFromCenterAlign.alignmentOffset, TEST_LOCATION);
678 DALI_TEST_EQUALS(lineOutsideOneFromMultiAlign.width, lineOutsideOneFromCenterAlign.width, TEST_LOCATION);
680 const LineRun& lineOutsideTwoFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_2);
681 const LineRun& lineOutsideTwoFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_2);
682 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - text outside two");
683 DALI_TEST_EQUALS(lineOutsideTwoFromMultiAlign.alignmentOffset, lineOutsideTwoFromCenterAlign.alignmentOffset, TEST_LOCATION);
684 DALI_TEST_EQUALS(lineOutsideTwoFromMultiAlign.width, lineOutsideTwoFromCenterAlign.width, TEST_LOCATION);
686 const LineRun& lineOutsideThreeFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_3);
687 const LineRun& lineOutsideThreeFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_3);
688 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - text outside three");
689 DALI_TEST_EQUALS(lineOutsideThreeFromMultiAlign.alignmentOffset, lineOutsideThreeFromCenterAlign.alignmentOffset, TEST_LOCATION);
690 DALI_TEST_EQUALS(lineOutsideThreeFromMultiAlign.width, lineOutsideThreeFromCenterAlign.width, TEST_LOCATION);
692 const LineRun& lineParagraphFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_PARAGRAPH);
693 const LineRun& lineParagraphFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_PARAGRAPH);
694 tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p>Paragraph property alignment</p>");
695 DALI_TEST_EQUALS(lineParagraphFromMultiAlign.alignmentOffset, lineParagraphFromCenterAlign.alignmentOffset, TEST_LOCATION);
696 DALI_TEST_EQUALS(lineParagraphFromMultiAlign.width, lineParagraphFromCenterAlign.width, TEST_LOCATION);