6c073026b7bc221d9f7fb2d6fc71ae4dadd353db
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-TextLabel-internal.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <stdlib.h>
19 #include <iostream>
20
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
23
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>
29
30 using namespace Dali;
31 using namespace Toolkit;
32 using namespace Text;
33
34 int UtcDaliTextLabelMarkupUnderline(void)
35 {
36   ToolkitTestApplication application;
37   tet_infoline(" UtcDaliTextLabelMarkupUnderline ");
38
39   TextLabel textLabel = TextLabel::New();
40
41   application.GetScene().Add(textLabel);
42
43   textLabel.SetProperty(TextLabel::Property::TEXT, "<u>ABC</u>EF<u>GH</u>");
44   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
45
46   application.SendNotification();
47   application.Render();
48
49   uint32_t expectedNumberOfUnderlineRuns = 2u;
50
51   Toolkit::Internal::TextLabel& textLabelImpl         = GetImpl(textLabel);
52   const Text::Length            numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
53
54   DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlineRuns, TEST_LOCATION);
55
56   Vector<UnderlinedGlyphRun> underlineRuns;
57   underlineRuns.Resize(numberOfUnderlineRuns);
58   textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
59
60   //ABC are underlined
61   DALI_TEST_EQUALS(underlineRuns[0u].glyphRun.glyphIndex, 0u, TEST_LOCATION);
62   DALI_TEST_EQUALS(underlineRuns[0u].glyphRun.numberOfGlyphs, 3u, TEST_LOCATION);
63
64   //GH are underlined
65   DALI_TEST_EQUALS(underlineRuns[1u].glyphRun.glyphIndex, 5u, TEST_LOCATION);
66   DALI_TEST_EQUALS(underlineRuns[1u].glyphRun.numberOfGlyphs, 2u, TEST_LOCATION);
67
68   END_TEST;
69 }
70
71 int UtcDaliTextLabelMarkupUnderlineAttributes(void)
72 {
73   ToolkitTestApplication application;
74   tet_infoline(" UtcDaliTextLabelMarkupUnderlineAttributes ");
75
76   TextLabel textLabel = TextLabel::New();
77
78   application.GetScene().Add(textLabel);
79
80   std::string testText =
81     "start<u>ABC1</u>then"
82     "<u type='solid'>ABC2</u>then"
83     "<u type='dashed'>ABC3</u>then"
84     "<u type='double'>ABC4</u>then"
85     "<u color='green'>ABC5</u>then"
86     "<u height='5.0f'>ABC6</u>then"
87     "<u type='dashed' dash-gap='3.0f'>ABC7</u>then"
88     "<u type='dashed' dash-width='4.0f'>ABC8</u>then"
89     "<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>ABC9</u>end"
90
91     ;
92
93   textLabel.SetProperty(TextLabel::Property::TEXT, testText);
94   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
95
96   application.SendNotification();
97   application.Render();
98
99   const uint32_t expectedNumberOfUnderlineRuns = 9u;
100
101   Toolkit::Internal::TextLabel& textLabelImpl         = GetImpl(textLabel);
102   const Text::Length            numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
103
104   DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlineRuns, TEST_LOCATION);
105
106   Vector<UnderlinedGlyphRun> underlineRuns;
107   underlineRuns.Resize(numberOfUnderlineRuns);
108   textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
109
110   struct DataOfCase
111   {
112     std::string              title;
113     GlyphIndex               glyphIndex;
114     Length                   numberOfGlyphs;
115     UnderlineStyleProperties properties;
116   };
117   DataOfCase data[] =
118     {
119       //<u>ABC1</u>
120       {"<u>ABC1</u>",
121        5u,
122        4u,
123        {
124          Text::Underline::SOLID,
125          Color::BLACK,
126          0u,
127          1u,
128          2u,
129          false,
130          false,
131          false,
132          false,
133          false,
134        }},
135
136       //<u type='solid'>ABC2</u>
137       {"<u type='solid'>ABC2</u>",
138        13u,
139        4u,
140        {
141          Text::Underline::SOLID,
142          Color::BLACK,
143          0u,
144          1u,
145          2u,
146          true,
147          false,
148          false,
149          false,
150          false,
151        }},
152
153       //<u type='dashed'>ABC3</u>
154       {"<u type='dashed'>ABC3</u>",
155        21u,
156        4u,
157        {
158          Text::Underline::DASHED,
159          Color::BLACK,
160          0u,
161          1u,
162          2u,
163          true,
164          false,
165          false,
166          false,
167          false,
168        }},
169
170       //<u type='double'>ABC4</u>
171       {"<u type='double'>ABC4</u>",
172        29u,
173        4u,
174        {
175          Text::Underline::DOUBLE,
176          Color::BLACK,
177          0u,
178          1u,
179          2u,
180          true,
181          false,
182          false,
183          false,
184          false,
185        }},
186
187       //<u color='green'>ABC5</u>
188       {"<u color='green'>ABC5</u>",
189        37u,
190        4u,
191        {
192          Text::Underline::SOLID,
193          Color::GREEN,
194          0u,
195          1u,
196          2u,
197          false,
198          true,
199          false,
200          false,
201          false,
202        }},
203
204       //<u height='5.0f'>ABC6</u>
205       {"<u height='5.0f'>ABC6</u>",
206        45u,
207        4u,
208        {
209          Text::Underline::SOLID,
210          Color::BLACK,
211          5u,
212          1u,
213          2u,
214          false,
215          false,
216          true,
217          false,
218          false,
219        }},
220
221       //<u type='dashed' dash-gap='3.0f'>ABC7</u>
222       {"<u type='dashed' dash-gap='3.0f'>ABC7</u>",
223        53u,
224        4u,
225        {
226          Text::Underline::DASHED,
227          Color::BLACK,
228          0u,
229          3u,
230          2u,
231          true,
232          false,
233          false,
234          true,
235          false,
236        }},
237
238       //<u type='dashed' dash-width='4.0f'>ABC8</u>
239       {"<u type='dashed' dash-width='4.0f'>ABC8</u>",
240        61u,
241        4u,
242        {
243          Text::Underline::DASHED,
244          Color::BLACK,
245          0u,
246          1u,
247          4u,
248          true,
249          false,
250          false,
251          false,
252          true,
253        }},
254
255       //<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>
256       {"<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>",
257        69u,
258        4u,
259        {
260          Text::Underline::DASHED,
261          Color::BLUE,
262          4u,
263          2u,
264          3u,
265          true,
266          true,
267          true,
268          true,
269          true,
270        }},
271
272     };
273
274   for(uint32_t i = 0; i < expectedNumberOfUnderlineRuns; i++)
275   {
276     tet_infoline(data[i].title.c_str());
277     DALI_TEST_EQUALS(underlineRuns[i].glyphRun.glyphIndex, data[i].glyphIndex, TEST_LOCATION);
278     DALI_TEST_EQUALS(underlineRuns[i].glyphRun.numberOfGlyphs, data[i].numberOfGlyphs, TEST_LOCATION);
279     DALI_TEST_CHECK(data[i].properties == underlineRuns[i].properties);
280   }
281
282   END_TEST;
283 }
284
285 int UtcDaliTextLabelMarkupSpanUnderline(void)
286 {
287   ToolkitTestApplication application;
288   tet_infoline(" UtcDaliTextLabelMarkupSpanUnderline ");
289
290   TextLabel textLabel = TextLabel::New();
291
292   application.GetScene().Add(textLabel);
293
294   std::string testText =
295     "start<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ABC1</span>then"
296     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>then"
297     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>then"
298     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>then"
299     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>then"
300     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>then"
301     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>then"
302     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>then"
303     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>end";
304
305   textLabel.SetProperty(TextLabel::Property::TEXT, testText);
306   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
307
308   application.SendNotification();
309   application.Render();
310
311   const uint32_t expectedNumberOfUnderlineRuns = 8u;
312
313   Toolkit::Internal::TextLabel& textLabelImpl         = GetImpl(textLabel);
314   const Text::Length            numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
315
316   DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlineRuns, TEST_LOCATION);
317
318   Vector<UnderlinedGlyphRun> underlineRuns;
319   underlineRuns.Resize(numberOfUnderlineRuns);
320   textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
321
322   struct DataOfCase
323   {
324     std::string              title;
325     GlyphIndex               glyphIndex;
326     Length                   numberOfGlyphs;
327     UnderlineStyleProperties properties;
328   };
329   DataOfCase data[] =
330     {
331       //<u type='solid'>ABC2</u>
332       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='solid'>ABC2</span>",
333        13u,
334        4u,
335        {
336          Text::Underline::SOLID,
337          Color::BLACK,
338          0u,
339          1u,
340          2u,
341          true,
342          false,
343          false,
344          false,
345          false,
346        }},
347
348       //<u type='dashed'>ABC3</u>
349       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed'>ABC3</span>",
350        21u,
351        4u,
352        {
353          Text::Underline::DASHED,
354          Color::BLACK,
355          0u,
356          1u,
357          2u,
358          true,
359          false,
360          false,
361          false,
362          false,
363        }},
364
365       //<u type='double'>ABC4</u>
366       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='double'>ABC4</span>",
367        29u,
368        4u,
369        {
370          Text::Underline::DOUBLE,
371          Color::BLACK,
372          0u,
373          1u,
374          2u,
375          true,
376          false,
377          false,
378          false,
379          false,
380        }},
381
382       //<u color='green'>ABC5</u>
383       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='green'>ABC5</span>",
384        37u,
385        4u,
386        {
387          Text::Underline::SOLID,
388          Color::GREEN,
389          0u,
390          1u,
391          2u,
392          false,
393          true,
394          false,
395          false,
396          false,
397        }},
398
399       //<u height='5.0f'>ABC6</u>
400       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-height='5.0f'>ABC6</span>",
401        45u,
402        4u,
403        {
404          Text::Underline::SOLID,
405          Color::BLACK,
406          5u,
407          1u,
408          2u,
409          false,
410          false,
411          true,
412          false,
413          false,
414        }},
415
416       //<u type='dashed' dash-gap='3.0f'>ABC7</u>
417       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-gap='3.0f'>ABC7</span>",
418        53u,
419        4u,
420        {
421          Text::Underline::DASHED,
422          Color::BLACK,
423          0u,
424          3u,
425          2u,
426          true,
427          false,
428          false,
429          true,
430          false,
431        }},
432
433       //<u type='dashed' dash-width='4.0f'>ABC8</u>
434       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-type='dashed' u-dash-width='4.0f'>ABC8</span>",
435        61u,
436        4u,
437        {
438          Text::Underline::DASHED,
439          Color::BLACK,
440          0u,
441          1u,
442          4u,
443          true,
444          false,
445          false,
446          false,
447          true,
448        }},
449
450       //<u color='blue' type='dashed' height='4.0f' dash-gap='2.0f' dash-width='3.0f'>
451       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' u-color='blue' u-type='dashed' u-height='4.0f' u-dash-gap='2.0f' u-dash-width='3.0f'>ABC9</span>",
452        69u,
453        4u,
454        {
455          Text::Underline::DASHED,
456          Color::BLUE,
457          4u,
458          2u,
459          3u,
460          true,
461          true,
462          true,
463          true,
464          true,
465        }},
466
467     };
468
469   for(uint32_t i = 0; i < expectedNumberOfUnderlineRuns; i++)
470   {
471     tet_infoline(data[i].title.c_str());
472     DALI_TEST_EQUALS(underlineRuns[i].glyphRun.glyphIndex, data[i].glyphIndex, TEST_LOCATION);
473     DALI_TEST_EQUALS(underlineRuns[i].glyphRun.numberOfGlyphs, data[i].numberOfGlyphs, TEST_LOCATION);
474     DALI_TEST_CHECK(data[i].properties == underlineRuns[i].properties);
475   }
476
477   END_TEST;
478 }
479
480 int UtcDaliTextLabelMarkupNestedUnderlineTags(void)
481 {
482   ToolkitTestApplication application;
483   tet_infoline(" UtcDaliTextLabelMarkupNestedUnderlineTags ");
484
485   TextLabel textLabel = TextLabel::New();
486
487   application.GetScene().Add(textLabel);
488
489   std::string testText = "start<u height='5.0f' color='green' >AB<u color='blue' >XYZ</u>CDE</u>end";
490
491   textLabel.SetProperty(TextLabel::Property::TEXT, testText);
492   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
493
494   application.SendNotification();
495   application.Render();
496
497   const uint32_t expectedNumberOfUnderlineRuns = 2u;
498
499   Toolkit::Internal::TextLabel& textLabelImpl         = GetImpl(textLabel);
500   const Text::Length            numberOfUnderlineRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
501
502   DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlineRuns, TEST_LOCATION);
503
504   Vector<UnderlinedGlyphRun> underlineRuns;
505   underlineRuns.Resize(numberOfUnderlineRuns);
506   textLabelImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
507
508   struct DataOfCase
509   {
510     std::string              title;
511     GlyphIndex               glyphIndex;
512     Length                   numberOfGlyphs;
513     UnderlineStyleProperties properties;
514   };
515   DataOfCase data[] =
516     {
517       //Outter
518       {"<u height='5.0f' color='green' >AB<u color='blue' >XYZ</u>CDE</u>",
519        5u,
520        8u,
521        {
522          Text::Underline::SOLID,
523          Color::GREEN,
524          5u,
525          1u,
526          2u,
527          false,
528          true,
529          true,
530          false,
531          false,
532        }},
533
534       //Inner
535       {"<u color='blue' >XYZ</u>",
536        7u,
537        3u,
538        {
539          Text::Underline::SOLID,
540          Color::BLUE,
541          5u,
542          1u,
543          2u,
544          false,
545          true,
546          true,
547          false,
548          false,
549        }},
550
551     };
552
553   for(uint32_t i = 0; i < expectedNumberOfUnderlineRuns; i++)
554   {
555     tet_infoline(data[i].title.c_str());
556     DALI_TEST_EQUALS(underlineRuns[i].glyphRun.glyphIndex, data[i].glyphIndex, TEST_LOCATION);
557     DALI_TEST_EQUALS(underlineRuns[i].glyphRun.numberOfGlyphs, data[i].numberOfGlyphs, TEST_LOCATION);
558     DALI_TEST_CHECK(data[i].properties == underlineRuns[i].properties);
559   }
560
561   END_TEST;
562 }
563
564 int UtcDaliTextLabelMarkupStrikethroughAttributes(void)
565 {
566   ToolkitTestApplication application;
567   tet_infoline(" UtcDaliTextLabelMarkupStrikethroughAttributes ");
568
569   TextLabel textLabel = TextLabel::New();
570
571   application.GetScene().Add(textLabel);
572
573   std::string testText =
574     "start<s>ABC1</s>then"
575     "<s color='green'>ABC2</s>then"
576     "<s height='5.0f'>ABC3</s>then"
577     "<s color='blue' height='4.0f' >ABC4</s>end";
578
579   textLabel.SetProperty(TextLabel::Property::TEXT, testText);
580   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
581
582   application.SendNotification();
583   application.Render();
584
585   const uint32_t expectedNumberOfStrikethroughRuns = 4u;
586
587   Toolkit::Internal::TextLabel& textLabelImpl             = GetImpl(textLabel);
588   const Text::Length            numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
589
590   DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughRuns, TEST_LOCATION);
591
592   Vector<StrikethroughGlyphRun> strikethroughRuns;
593   strikethroughRuns.Resize(numberOfStrikethroughRuns);
594   textLabelImpl.GetTextController()->GetTextModel()->GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns);
595
596   struct DataOfCase
597   {
598     std::string                  title;
599     GlyphIndex                   glyphIndex;
600     Length                       numberOfGlyphs;
601     StrikethroughStyleProperties properties;
602   };
603   DataOfCase data[] =
604     {
605
606       {"<s>ABC1</s>",
607        5u,
608        4u,
609        {Color::BLACK,
610         0.0f,
611         false,
612         false}},
613
614       {"<s color='green'>ABC2</s>",
615        13u,
616        4u,
617        {Color::GREEN,
618         0.0f,
619         true,
620         false}},
621
622       {"<s height='5.0f'>ABC3</s>",
623        21u,
624        4u,
625        {Color::BLACK,
626         5.0f,
627         false,
628         true}},
629
630       {"<s color='blue' height='4.0f' >ABC4</s>",
631        29u,
632        4u,
633        {Color::BLUE,
634         4.0f,
635         true,
636         true}},
637
638     };
639
640   for(uint32_t i = 0; i < expectedNumberOfStrikethroughRuns; i++)
641   {
642     tet_infoline(data[i].title.c_str());
643     DALI_TEST_EQUALS(strikethroughRuns[i].glyphRun.glyphIndex, data[i].glyphIndex, TEST_LOCATION);
644     DALI_TEST_EQUALS(strikethroughRuns[i].glyphRun.numberOfGlyphs, data[i].numberOfGlyphs, TEST_LOCATION);
645     DALI_TEST_CHECK(data[i].properties == strikethroughRuns[i].properties);
646   }
647
648   END_TEST;
649 }
650
651 int UtcDaliTextLabelMarkupSpanStrikethrough(void)
652 {
653   ToolkitTestApplication application;
654   tet_infoline(" UtcDaliTextLabelMarkupSpanStrikethrough ");
655
656   TextLabel textLabel = TextLabel::New();
657
658   application.GetScene().Add(textLabel);
659
660   std::string testText =
661     "start<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ABC1</span>then"
662     "<span s-color='blue'>ABC2</span>then"
663     "<span s-height='2.0f'>ABC3</span>then"
664     "<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' s-color='green' s-height='5.0f'>ABC4</span>end";
665
666   textLabel.SetProperty(TextLabel::Property::TEXT, testText);
667   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
668
669   application.SendNotification();
670   application.Render();
671
672   const uint32_t expectedNumberOfStrikethroughRuns = 3u;
673
674   Toolkit::Internal::TextLabel& textLabelImpl             = GetImpl(textLabel);
675   const Text::Length            numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
676
677   DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughRuns, TEST_LOCATION);
678
679   Vector<StrikethroughGlyphRun> strikethroughRuns;
680   strikethroughRuns.Resize(numberOfStrikethroughRuns);
681   textLabelImpl.GetTextController()->GetTextModel()->GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns);
682
683   struct DataOfCase
684   {
685     std::string                  title;
686     GlyphIndex                   glyphIndex;
687     Length                       numberOfGlyphs;
688     StrikethroughStyleProperties properties;
689   };
690   DataOfCase data[] =
691     {
692
693       {"<span s-color='blue'>ABC2</span>then",
694        13u,
695        4u,
696        {Color::BLUE,
697         0.0f,
698         true,
699         false}},
700
701       {"<span s-height='2.0f'>ABC3</span>then",
702        21u,
703        4u,
704        {Color::BLACK,
705         2.0f,
706         false,
707         true}},
708
709       {"<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red' s-color='green' s-height='5.0f'>ABC4</span>",
710        29u,
711        4u,
712        {Color::GREEN,
713         5.0f,
714         true,
715         true}},
716
717     };
718
719   for(uint32_t i = 0; i < expectedNumberOfStrikethroughRuns; i++)
720   {
721     tet_infoline(data[i].title.c_str());
722     DALI_TEST_EQUALS(strikethroughRuns[i].glyphRun.glyphIndex, data[i].glyphIndex, TEST_LOCATION);
723     DALI_TEST_EQUALS(strikethroughRuns[i].glyphRun.numberOfGlyphs, data[i].numberOfGlyphs, TEST_LOCATION);
724     DALI_TEST_CHECK(data[i].properties == strikethroughRuns[i].properties);
725   }
726
727   END_TEST;
728 }
729
730 int UtcDaliTextLabelBackgroundTag(void)
731 {
732   ToolkitTestApplication application;
733   tet_infoline("UtcDaliTextLabelBackgroundTag\n");
734
735   TextLabel label = TextLabel::New();
736   DALI_TEST_CHECK(label);
737
738   label.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
739   label.SetProperty(TextLabel::Property::TEXT, "H<background color='red'>e</background> Worl<background color='yellow'>d</background>");
740   application.GetScene().Add(label);
741   application.SendNotification();
742   application.Render();
743
744   Toolkit::Internal::TextLabel& labelImpl                    = GetImpl(label);
745   const ColorIndex* const       backgroundColorIndicesBuffer = labelImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
746
747   DALI_TEST_CHECK(backgroundColorIndicesBuffer);
748
749   //default color
750   DALI_TEST_EQUALS(backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
751
752   //red color
753   DALI_TEST_EQUALS(backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
754
755   //yellow color
756   DALI_TEST_EQUALS(backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
757
758   END_TEST;
759 }
760
761 int UtcDaliTextLabelSpanBackgroundTag(void)
762 {
763   ToolkitTestApplication application;
764   tet_infoline("UtcDaliTextLabelSpanBackgroundTag\n");
765
766   TextLabel label = TextLabel::New();
767   DALI_TEST_CHECK(label);
768
769   label.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
770   label.SetProperty(TextLabel::Property::TEXT, "H<span background-color='red'>e</span> Worl<span background-color='yellow'>d</span>");
771   application.GetScene().Add(label);
772   application.SendNotification();
773   application.Render();
774
775   Toolkit::Internal::TextLabel& labelImpl                    = GetImpl(label);
776   const ColorIndex* const       backgroundColorIndicesBuffer = labelImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
777
778   DALI_TEST_CHECK(backgroundColorIndicesBuffer);
779
780   //default color
781   DALI_TEST_EQUALS(backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
782
783   //red color
784   DALI_TEST_EQUALS(backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
785
786   //yellow color
787   DALI_TEST_EQUALS(backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
788
789   END_TEST;
790 }
791
792 int UtcDaliToolkitTextlabelEllipsisInternalAPIs(void)
793 {
794   ToolkitTestApplication application;
795   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs ");
796   TextLabel textLabel = TextLabel::New();
797
798   Toolkit::Internal::TextLabel& textLabelImpl = GetImpl(textLabel);
799   const ModelInterface* const   textModel     = textLabelImpl.GetTextController()->GetTextModel();
800
801   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - ELLIPSIS Disabled");
802   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS, false);
803   DALI_TEST_EQUALS(textLabel.GetProperty<bool>(DevelTextLabel::Property::ELLIPSIS), false, TEST_LOCATION);
804   DALI_TEST_CHECK(!(textModel->IsTextElideEnabled()));
805
806   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - ELLIPSIS Enabled");
807   textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS, true);
808   DALI_TEST_EQUALS(textLabel.GetProperty<bool>(DevelTextLabel::Property::ELLIPSIS), true, TEST_LOCATION);
809   DALI_TEST_CHECK(textModel->IsTextElideEnabled());
810
811   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs Default");
812   DALI_TEST_EQUALS(textModel->GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
813
814   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs Default");
815   DALI_TEST_EQUALS(textModel->GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
816
817   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs Default");
818   DALI_TEST_EQUALS(textModel->GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
819
820   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs Default");
821   DALI_TEST_EQUALS(textModel->GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
822
823   // Tests the rendering controller has been created.
824   TypesetterPtr typesetter = Typesetter::New(textModel);
825   DALI_TEST_CHECK(typesetter);
826
827   // Tests the view model has been created.
828   ViewModel* model = typesetter->GetViewModel();
829
830   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - IsTextElideEnabled ViewModel");
831   DALI_TEST_CHECK(model->IsTextElideEnabled());
832
833   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs ViewModel");
834   DALI_TEST_EQUALS(model->GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
835
836   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs ViewModel");
837   DALI_TEST_EQUALS(model->GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
838
839   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs ViewModel");
840   DALI_TEST_EQUALS(model->GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
841
842   tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs ViewModel");
843   DALI_TEST_EQUALS(model->GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION);
844
845   END_TEST;
846 }
847 int UtcDaliTextLabelTextWithSpan(void)
848 {
849   ToolkitTestApplication application;
850   tet_infoline("UtcDaliTextLabelTextWithSpan\n");
851
852   TextLabel label = TextLabel::New();
853   DALI_TEST_CHECK(label);
854
855   label.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
856   label.SetProperty(TextLabel::Property::TEXT, "Hello Span");
857   application.GetScene().Add(label);
858
859   application.SendNotification();
860   application.Render();
861
862   Vector3 originalSize = label.GetNaturalSize();
863   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");
864
865   application.SendNotification();
866   application.Render();
867
868   Vector3 spanSize = label.GetNaturalSize();
869
870   DALI_TEST_GREATER(spanSize.width, originalSize.width, TEST_LOCATION);
871
872   Toolkit::Internal::TextLabel& labelImpl           = GetImpl(label);
873   const ColorIndex* const       colorIndicesBuffer1 = labelImpl.GetTextController()->GetTextModel()->GetColorIndices();
874
875   DALI_TEST_CHECK(colorIndicesBuffer1);
876
877   //default color
878   DALI_TEST_EQUALS(colorIndicesBuffer1[0], 0u, TEST_LOCATION);
879
880   //span color
881   DALI_TEST_EQUALS(colorIndicesBuffer1[1], 1u, TEST_LOCATION);
882
883   //default color
884   DALI_TEST_EQUALS(colorIndicesBuffer1[6], 0u, TEST_LOCATION);
885
886   label.SetProperty(TextLabel::Property::TEXT, "<span font-size='45'>H</span>ello <span text-color='red'>S</span>pan");
887
888   application.SendNotification();
889   application.Render();
890
891   const ColorIndex* const colorIndicesBuffer2 = labelImpl.GetTextController()->GetTextModel()->GetColorIndices();
892
893   DALI_TEST_CHECK(colorIndicesBuffer2);
894
895   //default color
896   DALI_TEST_EQUALS(colorIndicesBuffer2[0], 0u, TEST_LOCATION);
897
898   //default color
899   DALI_TEST_EQUALS(colorIndicesBuffer2[1], 0u, TEST_LOCATION);
900
901   //span color
902   DALI_TEST_EQUALS(colorIndicesBuffer2[6], 1u, TEST_LOCATION);
903
904   //default color
905   DALI_TEST_EQUALS(colorIndicesBuffer2[7], 0u, TEST_LOCATION);
906
907   END_TEST;
908 }
909
910 int UtcDaliTextLabelMarkupStrikethrough(void)
911 {
912   ToolkitTestApplication application;
913   tet_infoline(" UtcDaliTextLabelMarkupStrikethrough ");
914
915   TextLabel textLabel = TextLabel::New();
916
917   application.GetScene().Add(textLabel);
918
919   textLabel.SetProperty(TextLabel::Property::TEXT, "<s color='red'>ABC</s>EF<s color='green'>GH</s>");
920   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
921
922   application.SendNotification();
923   application.Render();
924
925   uint32_t expectedNumberOfStrikethroughGlyphs = 2u;
926
927   Toolkit::Internal::TextLabel& textLabelImpl             = GetImpl(textLabel);
928   const Text::Length            numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
929
930   DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughGlyphs, TEST_LOCATION);
931
932   Vector<StrikethroughGlyphRun> strikethroughRuns;
933   strikethroughRuns.Resize(numberOfStrikethroughRuns);
934   textLabelImpl.GetTextController()->GetTextModel()->GetStrikethroughRuns(strikethroughRuns.Begin(), 0u, numberOfStrikethroughRuns);
935
936   //ABC have strikethrough
937   DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.glyphIndex, 0u, TEST_LOCATION);
938   DALI_TEST_EQUALS(strikethroughRuns[0u].glyphRun.numberOfGlyphs, 3u, TEST_LOCATION);
939   DALI_TEST_CHECK(strikethroughRuns[0u].properties.colorDefined);
940   DALI_TEST_EQUALS(strikethroughRuns[0u].properties.color.r, 1u, TEST_LOCATION);
941   DALI_TEST_EQUALS(strikethroughRuns[0u].properties.color.g, 0u, TEST_LOCATION);
942   DALI_TEST_EQUALS(strikethroughRuns[0u].properties.color.b, 0u, TEST_LOCATION);
943
944   //GH have strikethrough
945   DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.glyphIndex, 5u, TEST_LOCATION);
946   DALI_TEST_EQUALS(strikethroughRuns[1u].glyphRun.numberOfGlyphs, 2u, TEST_LOCATION);
947   DALI_TEST_CHECK(strikethroughRuns[1u].properties.colorDefined);
948   DALI_TEST_EQUALS(strikethroughRuns[1u].properties.color.r, 0u, TEST_LOCATION);
949   DALI_TEST_EQUALS(strikethroughRuns[1u].properties.color.g, 1u, TEST_LOCATION);
950   DALI_TEST_EQUALS(strikethroughRuns[1u].properties.color.b, 0u, TEST_LOCATION);
951
952   END_TEST;
953 }
954
955 int UtcDaliTextLabelMarkupStrikethroughNoEndTag(void)
956 {
957   ToolkitTestApplication application;
958   tet_infoline(" UtcDaliTextLabelMarkupStrikethroughNoEndTag ");
959
960   TextLabel textLabel = TextLabel::New();
961
962   application.GetScene().Add(textLabel);
963
964   textLabel.SetProperty(TextLabel::Property::TEXT, "<s>ABC");
965   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
966
967   application.SendNotification();
968   application.Render();
969
970   uint32_t expectedNumberOfStrikethroughGlyphs = 0u;
971
972   Toolkit::Internal::TextLabel& textLabelImpl             = GetImpl(textLabel);
973   Text::Length                  numberOfStrikethroughRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfStrikethroughRuns();
974
975   DALI_TEST_EQUALS(numberOfStrikethroughRuns, expectedNumberOfStrikethroughGlyphs, TEST_LOCATION);
976
977   END_TEST;
978 }
979
980 int UtcDaliTextLabelMarkupParagraphTag(void)
981
982 {
983   ToolkitTestApplication application;
984
985   tet_infoline(" UtcDaliTextLabelMarkupParagraphTag ");
986   TextLabel textLabel = TextLabel::New();
987
988   application.GetScene().Add(textLabel);
989
990   textLabel.SetProperty(TextLabel::Property::TEXT, "text one <p>Paragraph two</p> text three <p>Paragraph four</p> text five");
991   textLabel.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
992   textLabel.SetProperty(TextLabel::Property::MULTI_LINE, true);
993
994   application.SendNotification();
995   application.Render();
996
997   uint32_t expectedNumberOfBoundedParagraphRuns = 2u;
998
999   Toolkit::Internal::TextLabel& textLabelImpl                = GetImpl(textLabel);
1000   const Text::Length            numberOfBoundedParagraphRuns = textLabelImpl.GetTextController()->GetTextModel()->GetNumberOfBoundedParagraphRuns();
1001   DALI_TEST_EQUALS(numberOfBoundedParagraphRuns, expectedNumberOfBoundedParagraphRuns, TEST_LOCATION);
1002
1003   const Vector<BoundedParagraphRun>& boundedParagraphRuns = textLabelImpl.GetTextController()->GetTextModel()->GetBoundedParagraphRuns();
1004
1005   //<p>Paragraph two</p>
1006   DALI_TEST_EQUALS(boundedParagraphRuns[0u].characterRun.characterIndex, 10u, TEST_LOCATION);
1007   DALI_TEST_EQUALS(boundedParagraphRuns[0u].characterRun.numberOfCharacters, 14u, TEST_LOCATION);
1008
1009   //<p>Paragraph four</p>
1010   DALI_TEST_EQUALS(boundedParagraphRuns[1u].characterRun.characterIndex, 37u, TEST_LOCATION);
1011   DALI_TEST_EQUALS(boundedParagraphRuns[1u].characterRun.numberOfCharacters, 15u, TEST_LOCATION);
1012
1013   END_TEST;
1014 }
1015
1016 int UtcDaliTextLabelMarkupParagraphTagAlignAttribute(void)
1017 {
1018   ToolkitTestApplication application;
1019   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute ");
1020
1021   // Apply alignment for each type on property level on three paragraphs and in-between text.
1022   // Apply align in markup on the three paragraphs (each one a type).
1023   // Using the same text to gain similar results from both the property level and the markup.
1024   // Compare line alignment between the property level and the markup.
1025
1026   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>";
1027   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>";
1028
1029   //Set size to avoid automatic eliding
1030   Vector2 controllerSize = Vector2(1025, 1025);
1031
1032   TextLabel textLabelBeginAlign  = TextLabel::New();
1033   TextLabel textLabelCenterAlign = TextLabel::New();
1034   TextLabel textLabelEndAlign    = TextLabel::New();
1035   TextLabel textLabelMultiAlign  = TextLabel::New();
1036
1037   application.GetScene().Add(textLabelBeginAlign);
1038   application.GetScene().Add(textLabelCenterAlign);
1039   application.GetScene().Add(textLabelEndAlign);
1040   application.GetScene().Add(textLabelMultiAlign);
1041
1042   textLabelBeginAlign.SetProperty(TextLabel::Property::TEXT, textAlignOnPropertyLevel);
1043   textLabelBeginAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
1044   textLabelBeginAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
1045   textLabelBeginAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
1046   textLabelBeginAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::BEGIN);
1047   textLabelBeginAlign.SetProperty(Actor::Property::SIZE, controllerSize);
1048
1049   textLabelCenterAlign.SetProperty(TextLabel::Property::TEXT, textAlignOnPropertyLevel);
1050   textLabelCenterAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
1051   textLabelCenterAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
1052   textLabelCenterAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
1053   textLabelCenterAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::CENTER);
1054   textLabelCenterAlign.SetProperty(Actor::Property::SIZE, controllerSize);
1055
1056   textLabelEndAlign.SetProperty(TextLabel::Property::TEXT, textAlignOnPropertyLevel);
1057   textLabelEndAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
1058   textLabelEndAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
1059   textLabelEndAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
1060   textLabelEndAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::END);
1061   textLabelEndAlign.SetProperty(Actor::Property::SIZE, controllerSize);
1062
1063   textLabelMultiAlign.SetProperty(TextLabel::Property::TEXT, textAlignInMarkup);
1064   textLabelMultiAlign.SetProperty(TextLabel ::Property::ENABLE_MARKUP, true);
1065   textLabelMultiAlign.SetProperty(TextLabel::Property::MULTI_LINE, true);
1066   textLabelMultiAlign.SetProperty(TextLabel::Property::ELLIPSIS, false);
1067   textLabelMultiAlign.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, Dali::Toolkit::Text::HorizontalAlignment::CENTER);
1068   textLabelMultiAlign.SetProperty(Actor::Property::SIZE, controllerSize);
1069
1070   application.SendNotification();
1071   application.Render();
1072
1073   uint32_t expectedNumberOfBoundedParagraphRuns = 4u;
1074   uint32_t expectedNumberOfLines                = 7u;
1075
1076   Toolkit::Internal::TextLabel& textLabelMultiAlignImpl  = GetImpl(textLabelMultiAlign);
1077   Toolkit::Internal::TextLabel& textLabelBeginAlignImpl  = GetImpl(textLabelBeginAlign);
1078   Toolkit::Internal::TextLabel& textLabelCenterAlignImpl = GetImpl(textLabelCenterAlign);
1079   Toolkit::Internal::TextLabel& textLabelEndAlignImpl    = GetImpl(textLabelEndAlign);
1080
1081   const Text::Length numberOfBoundedParagraphRuns = textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetNumberOfBoundedParagraphRuns();
1082   DALI_TEST_EQUALS(numberOfBoundedParagraphRuns, expectedNumberOfBoundedParagraphRuns, TEST_LOCATION);
1083
1084   DALI_TEST_EQUALS(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
1085   DALI_TEST_CHECK(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines());
1086
1087   DALI_TEST_EQUALS(textLabelBeginAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
1088   DALI_TEST_CHECK(textLabelBeginAlignImpl.GetTextController()->GetTextModel()->GetLines());
1089
1090   DALI_TEST_EQUALS(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
1091   DALI_TEST_CHECK(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines());
1092
1093   DALI_TEST_EQUALS(textLabelEndAlignImpl.GetTextController()->GetTextModel()->GetNumberOfLines(), expectedNumberOfLines, TEST_LOCATION);
1094   DALI_TEST_CHECK(textLabelEndAlignImpl.GetTextController()->GetTextModel()->GetLines());
1095
1096   const uint32_t LINE_INDEX_ALIGN_END    = 1u;
1097   const uint32_t LINE_INDEX_ALIGN_CENTER = 3u;
1098   const uint32_t LINE_INDEX_ALIGN_BEGIN  = 5u;
1099   const uint32_t LINE_INDEX_OUTSIDE_1    = 0u;
1100   const uint32_t LINE_INDEX_OUTSIDE_2    = 2u;
1101   const uint32_t LINE_INDEX_OUTSIDE_3    = 4u;
1102   const uint32_t LINE_INDEX_PARAGRAPH    = 6u;
1103
1104   //<p align='end'>Paragraph end</p>
1105   const LineRun& lineEndFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_END);
1106   const LineRun& lineEndFromEndAlign   = *(textLabelEndAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_END);
1107   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p align='end'>Paragraph end</p>");
1108   DALI_TEST_EQUALS(lineEndFromMultiAlign.alignmentOffset, lineEndFromEndAlign.alignmentOffset, TEST_LOCATION);
1109   DALI_TEST_EQUALS(lineEndFromMultiAlign.width, lineEndFromEndAlign.width, TEST_LOCATION);
1110
1111   //<p align='center'>Paragraph center</p>
1112   const LineRun& lineCenterFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_CENTER);
1113   const LineRun& lineEndFromCenterAlign   = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_CENTER);
1114   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p align='center'>Paragraph center</p>");
1115   DALI_TEST_EQUALS(lineCenterFromMultiAlign.alignmentOffset, lineEndFromCenterAlign.alignmentOffset, TEST_LOCATION);
1116   DALI_TEST_EQUALS(lineCenterFromMultiAlign.width, lineEndFromCenterAlign.width, TEST_LOCATION);
1117
1118   //<p align='begin' >Paragraph begin</p>
1119   const LineRun& lineBeginFromMultiAlign = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_BEGIN);
1120   const LineRun& lineEndFromBeginAlign   = *(textLabelBeginAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_ALIGN_BEGIN);
1121   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p align='begin' >Paragraph begin</p>");
1122   DALI_TEST_EQUALS(lineBeginFromMultiAlign.alignmentOffset, lineEndFromBeginAlign.alignmentOffset, TEST_LOCATION);
1123   DALI_TEST_EQUALS(lineBeginFromMultiAlign.width, lineEndFromBeginAlign.width, TEST_LOCATION);
1124
1125   //text outside
1126   const LineRun& lineOutsideOneFromMultiAlign  = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_1);
1127   const LineRun& lineOutsideOneFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_1);
1128   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - text outside one");
1129   DALI_TEST_EQUALS(lineOutsideOneFromMultiAlign.alignmentOffset, lineOutsideOneFromCenterAlign.alignmentOffset, TEST_LOCATION);
1130   DALI_TEST_EQUALS(lineOutsideOneFromMultiAlign.width, lineOutsideOneFromCenterAlign.width, TEST_LOCATION);
1131
1132   const LineRun& lineOutsideTwoFromMultiAlign  = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_2);
1133   const LineRun& lineOutsideTwoFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_2);
1134   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - text outside two");
1135   DALI_TEST_EQUALS(lineOutsideTwoFromMultiAlign.alignmentOffset, lineOutsideTwoFromCenterAlign.alignmentOffset, TEST_LOCATION);
1136   DALI_TEST_EQUALS(lineOutsideTwoFromMultiAlign.width, lineOutsideTwoFromCenterAlign.width, TEST_LOCATION);
1137
1138   const LineRun& lineOutsideThreeFromMultiAlign  = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_3);
1139   const LineRun& lineOutsideThreeFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_OUTSIDE_3);
1140   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - text outside three");
1141   DALI_TEST_EQUALS(lineOutsideThreeFromMultiAlign.alignmentOffset, lineOutsideThreeFromCenterAlign.alignmentOffset, TEST_LOCATION);
1142   DALI_TEST_EQUALS(lineOutsideThreeFromMultiAlign.width, lineOutsideThreeFromCenterAlign.width, TEST_LOCATION);
1143
1144   const LineRun& lineParagraphFromMultiAlign  = *(textLabelMultiAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_PARAGRAPH);
1145   const LineRun& lineParagraphFromCenterAlign = *(textLabelCenterAlignImpl.GetTextController()->GetTextModel()->GetLines() + LINE_INDEX_PARAGRAPH);
1146   tet_infoline(" UtcDaliTextLabelMarkupParagraphTagAlignAttribute - <p>Paragraph property alignment</p>");
1147   DALI_TEST_EQUALS(lineParagraphFromMultiAlign.alignmentOffset, lineParagraphFromCenterAlign.alignmentOffset, TEST_LOCATION);
1148   DALI_TEST_EQUALS(lineParagraphFromMultiAlign.width, lineParagraphFromCenterAlign.width, TEST_LOCATION);
1149
1150   END_TEST;
1151 }