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