Text - UTC fixes after removing non latin characters from the LATIN script in adaptor.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-Text-MultiLanguage.cpp
1 /*
2  * Copyright (c) 2015 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 <iostream>
19 #include <stdlib.h>
20 #include <unistd.h>
21
22 #include <dali/devel-api/text-abstraction/font-client.h>
23 #include <dali-toolkit/internal/text/character-set-conversion.h>
24 #include <dali-toolkit/internal/text/logical-model-impl.h>
25 #include <dali-toolkit/internal/text/multi-language-helper-functions.h>
26 #include <dali-toolkit/internal/text/multi-language-support.h>
27 #include <dali-toolkit/internal/text/segmentation.h>
28 #include <dali-toolkit/internal/text/text-run-container.h>
29 #include <dali-toolkit-test-suite-utils.h>
30 #include <dali-toolkit/dali-toolkit.h>
31
32 using namespace Dali;
33 using namespace Toolkit;
34 using namespace Text;
35
36 // Tests the following functions with different scripts.
37 //
38 // void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
39 //                             Vector<FontId>& fontIds,
40 //                             Vector<bool>& isDefaultFont,
41 //                             const TextAbstraction::FontDescription& defaultFontDescription,
42 //                             TextAbstraction::PointSize26Dot6 defaultPointSize,
43 //                             CharacterIndex startIndex,
44 //                             Length numberOfCharacters );
45 //
46 // Script GetScript( Length index,
47 //                   Vector<ScriptRun>::ConstIterator& scriptRunIt,
48 //                   const Vector<ScriptRun>::ConstIterator& scriptRunEndIt );
49 //
50 // Constructor, destructor and MultilanguageSupport::Get()
51 //
52 // void MultilanguageSupport::SetScripts( const Vector<Character>& text,
53 //                                        CharacterIndex startIndex,
54 //                                        Length numberOfCharacters,
55 //                                        Vector<ScriptRun>& scripts );
56 //
57 // void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
58 //                                           const Vector<ScriptRun>& scripts,
59 //                                           const Vector<FontDescriptionRun>& fontDescriptions,
60 //                                           FontId defaultFontId,
61 //                                           CharacterIndex startIndex,
62 //                                           Length numberOfCharacters,
63 //                                           Vector<FontRun>& fonts );
64
65 //////////////////////////////////////////////////////////
66
67 namespace
68 {
69
70 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
71 const unsigned int EMOJI_FONT_SIZE = 3968u;
72 const unsigned int NON_DEFAULT_FONT_SIZE = 40u;
73
74 struct MergeFontDescriptionsData
75 {
76   std::string description;                                 ///< Description of the experiment.
77   Vector<FontDescriptionRun> fontDescriptionRuns;          ///< The font description runs.
78   TextAbstraction::FontDescription defaultFontDescription; ///< The default font description.
79   TextAbstraction::PointSize26Dot6 defaultPointSize;       ///< The default point size.
80   unsigned int startIndex;                                 ///< The start index.
81   unsigned int numberOfCharacters;                         ///< The number of characters.
82   Vector<FontId> expectedFontIds;                          ///< The expected font ids.
83   Vector<bool> expectedIsDefault;                          ///< The expected font ids.
84 };
85
86 struct ScriptsData
87 {
88   std::string description;         ///< Description of the experiment.
89   std::string text;                ///< Input text.
90   unsigned int index;              ///< The index of the first character to update the script.
91   unsigned int numberOfCharacters; ///< The numbers of characters to update the script.
92   Vector<ScriptRun> scriptRuns;    ///< Expected script runs.
93 };
94
95 struct ValidateFontsData
96 {
97   std::string                description;         ///< Description of the experiment.
98   std::string                text;                ///< Input text.
99   std::string                defaultFont;         ///< The default font.
100   unsigned int               defaultFontSize;     ///< The default font size.
101   unsigned int               index;               ///< The index of the first character to update the script.
102   unsigned int               numberOfCharacters;  ///< The numbers of characters to update the script.
103   Vector<FontDescriptionRun> fontDescriptionRuns; ///< The font description runs.
104   Vector<FontRun>            fontRuns;            ///< The expected font runs.
105 };
106
107 //////////////////////////////////////////////////////////
108
109 bool MergeFontDescriptionsTest( const MergeFontDescriptionsData& data )
110 {
111   Vector<FontId> fontIds;
112   fontIds.Resize( data.startIndex + data.numberOfCharacters, 0u );
113   Vector<bool> isDefaultFont;
114   isDefaultFont.Resize( data.startIndex + data.numberOfCharacters, true );
115
116   MergeFontDescriptions( data.fontDescriptionRuns,
117                          fontIds,
118                          isDefaultFont,
119                          data.defaultFontDescription,
120                          data.defaultPointSize,
121                          data.startIndex,
122                          data.numberOfCharacters );
123
124   if( fontIds.Count() != data.expectedFontIds.Count() )
125   {
126     std::cout << data.description << " Different number of font ids : " << fontIds.Count() << ", expected : " << data.expectedFontIds.Count() << std::endl;
127     return false;
128   }
129
130   for( unsigned int index = 0u; index < fontIds.Count(); ++index )
131   {
132     if( fontIds[index] != data.expectedFontIds[index] )
133     {
134       std::cout << data.description << " Different font id at index : " << index << ", font id : " << fontIds[index] << ", expected : " << data.expectedFontIds[index] << std::endl;
135       std::cout << "           font ids : ";
136       for( unsigned int i=0;i<fontIds.Count();++i)
137       {
138         std::cout << fontIds[i] << " ";
139       }
140       std::cout << std::endl;
141       std::cout << "  expected font ids : ";
142       for( unsigned int i=0;i<data.expectedFontIds.Count();++i)
143       {
144         std::cout << data.expectedFontIds[i] << " ";
145       }
146       std::cout << std::endl;
147       return false;
148     }
149
150     if( isDefaultFont[index] != data.expectedIsDefault[index] )
151     {
152       std::cout << data.description << " Different 'is font default' at index : " << index << ", is font default : " << isDefaultFont[index] << ", expected : " << data.expectedIsDefault[index] << std::endl;
153       return false;
154     }
155   }
156
157   return true;
158 }
159
160 bool ScriptsTest( const ScriptsData& data )
161 {
162   MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
163
164   // 1) Convert to utf32
165   Vector<Character> utf32;
166   utf32.Resize( data.text.size() );
167
168   const uint32_t numberOfCharacters = Utf8ToUtf32( reinterpret_cast<const uint8_t* const>( data.text.c_str() ),
169                                                    data.text.size(),
170                                                    &utf32[0u] );
171   utf32.Resize( numberOfCharacters );
172
173   // 2) Set the script info.
174   Vector<ScriptRun> scripts;
175   multilanguageSupport.SetScripts( utf32,
176                                    0u,
177                                    numberOfCharacters,
178                                    scripts );
179
180   if( ( 0u != data.index ) ||
181       ( numberOfCharacters != data.numberOfCharacters ) )
182   {
183     // 3) Clear the scripts.
184     ClearCharacterRuns( data.index,
185                         data.index + data.numberOfCharacters - 1u,
186                         scripts );
187
188     multilanguageSupport.SetScripts( utf32,
189                                      data.index,
190                                      data.numberOfCharacters,
191                                      scripts );
192   }
193
194   // 4) Compare the results.
195
196   tet_printf( "Testing %s\n", data.description.c_str() );
197   if( scripts.Count() != data.scriptRuns.Count() )
198   {
199     tet_printf("ScriptsTest FAIL: different number of scripts. %d, should be %d\n", scripts.Count(), data.scriptRuns.Count() );
200     for( Vector<ScriptRun>::ConstIterator it = scripts.Begin(); it != scripts.End(); ++it)
201     {
202       const ScriptRun& run = *it;
203
204       std::cout << "  index : " << run.characterRun.characterIndex << ", num chars : " << run.characterRun.numberOfCharacters << ", script : [" << TextAbstraction::ScriptName[run.script] << "]" << std::endl;
205     }
206     return false;
207   }
208
209   for( unsigned int index = 0u; index < scripts.Count(); ++index )
210   {
211     const ScriptRun& scriptRun1 = scripts[index];
212     const ScriptRun& scriptRun2 = data.scriptRuns[index];
213
214     if( scriptRun1.characterRun.characterIndex != scriptRun2.characterRun.characterIndex )
215     {
216       tet_printf("ScriptsTest FAIL: different character index. %d, should be %d\n", scriptRun1.characterRun.characterIndex, scriptRun2.characterRun.characterIndex );
217       return false;
218     }
219
220     if( scriptRun1.characterRun.numberOfCharacters != scriptRun2.characterRun.numberOfCharacters )
221     {
222       tet_printf("ScriptsTest FAIL: different number of characters. %d, should be %d\n", scriptRun1.characterRun.numberOfCharacters, scriptRun2.characterRun.numberOfCharacters );
223       return false;
224     }
225
226     if( scriptRun1.script != scriptRun2.script )
227     {
228       tet_printf("ScriptsTest FAIL: different script. %s, should be %s\n", TextAbstraction::ScriptName[scriptRun1.script], TextAbstraction::ScriptName[scriptRun2.script] );
229       return false;
230     }
231   }
232
233   return true;
234 }
235
236 bool ValidateFontTest( const ValidateFontsData& data )
237 {
238   MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
239   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
240
241   // 1) Convert to utf32
242   Vector<Character> utf32;
243   utf32.Resize( data.text.size() );
244
245   const uint32_t numberOfCharacters = Utf8ToUtf32( reinterpret_cast<const uint8_t* const>( data.text.c_str() ),
246                                                    data.text.size(),
247                                                    &utf32[0u] );
248   utf32.Resize( numberOfCharacters );
249
250   // 2) Set the script info.
251   Vector<ScriptRun> scripts;
252   multilanguageSupport.SetScripts( utf32,
253                                    0u,
254                                    numberOfCharacters,
255                                    scripts );
256
257   char* pathNamePtr = get_current_dir_name();
258   const std::string pathName( pathNamePtr );
259   free( pathNamePtr );
260
261   // Get the default font id.
262   const FontId defaultFontId = fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + data.defaultFont,
263                                                      data.defaultFontSize );
264
265   Vector<FontRun> fontRuns;
266
267   // 3) Validate the fonts.
268   multilanguageSupport.ValidateFonts( utf32,
269                                       scripts,
270                                       data.fontDescriptionRuns,
271                                       defaultFontId,
272                                       0u,
273                                       numberOfCharacters,
274                                       fontRuns );
275
276   if( ( 0u != data.index ) ||
277       ( numberOfCharacters != data.numberOfCharacters ) )
278   {
279     // 4) Clear the fonts.
280     ClearCharacterRuns( data.index,
281                         data.index + data.numberOfCharacters - 1u,
282                         fontRuns );
283
284     multilanguageSupport.ValidateFonts( utf32,
285                                         scripts,
286                                         data.fontDescriptionRuns,
287                                         defaultFontId,
288                                         data.index,
289                                         data.numberOfCharacters,
290                                         fontRuns );
291   }
292
293   // 5) Compare the results.
294   if( data.fontRuns.Count() != fontRuns.Count() )
295   {
296     std::cout << "  Different number of font runs : " << fontRuns.Count() << ", expected : " << data.fontRuns.Count() << std::endl;
297     return false;
298   }
299
300
301   for( unsigned int index = 0; index < data.fontRuns.Count(); ++index )
302   {
303     const FontRun& run = fontRuns[index];
304     const FontRun& expectedRun = data.fontRuns[index];
305
306     if( run.characterRun.characterIndex != expectedRun.characterRun.characterIndex )
307     {
308       std::cout << "  character run : " << index << ", index : " << run.characterRun.characterIndex << ", expected : " << expectedRun.characterRun.characterIndex << std::endl;
309       return false;
310     }
311     if( run.characterRun.numberOfCharacters != expectedRun.characterRun.numberOfCharacters )
312     {
313       std::cout << "  character run : " << index << ", num chars : " << run.characterRun.numberOfCharacters << ", expected : " << expectedRun.characterRun.numberOfCharacters << std::endl;
314       return false;
315     }
316     if( run.fontId != expectedRun.fontId )
317     {
318       std::cout << "  character run : " << index << ", font : " << run.fontId << ", expected : " << expectedRun.fontId << std::endl;
319       return false;
320     }
321   }
322
323   return true;
324 }
325
326 } // namespace
327
328 int UtcDaliTextGetScript(void)
329 {
330   ToolkitTestApplication application;
331   tet_infoline(" UtcDaliTextGetScript");
332
333   Script script = TextAbstraction::LATIN;
334
335   // Text with no scripts.
336   Vector<ScriptRun> scriptRuns;
337   Vector<ScriptRun>::ConstIterator scriptRunIt = scriptRuns.Begin();
338   script = GetScript( 0u,
339                       scriptRunIt,
340                       scriptRuns.End() );
341
342   DALI_TEST_CHECK( TextAbstraction::UNKNOWN == script );
343
344   const unsigned int numberOfCharacters = 7u;
345   // Add scripts.
346   ScriptRun scriptRun01 =
347   {
348     {
349       0u,
350       2u,
351     },
352     TextAbstraction::LATIN
353   };
354   ScriptRun scriptRun02 =
355   {
356     {
357       2u,
358       2u,
359     },
360     TextAbstraction::HEBREW
361   };
362   ScriptRun scriptRun03 =
363   {
364     {
365       4u,
366       2u,
367     },
368     TextAbstraction::ARABIC
369   };
370   scriptRuns.PushBack( scriptRun01 );
371   scriptRuns.PushBack( scriptRun02 );
372   scriptRuns.PushBack( scriptRun03 );
373
374   // Expected results
375   TextAbstraction::Script expectedScripts[]=
376   {
377     TextAbstraction::LATIN,
378     TextAbstraction::LATIN,
379     TextAbstraction::HEBREW,
380     TextAbstraction::HEBREW,
381     TextAbstraction::ARABIC,
382     TextAbstraction::ARABIC,
383     TextAbstraction::UNKNOWN
384   };
385
386   scriptRunIt = scriptRuns.Begin();
387   for( unsigned int index = 0u; index < numberOfCharacters; ++index )
388   {
389     script = GetScript( index,
390                         scriptRunIt,
391                         scriptRuns.End() );
392
393     DALI_TEST_CHECK( expectedScripts[index] == script );
394   }
395   DALI_TEST_CHECK( scriptRunIt == scriptRuns.End() );
396
397   tet_result(TET_PASS);
398   END_TEST;
399 }
400
401 int UtcDaliTextMergeFontDescriptions(void)
402 {
403   ToolkitTestApplication application;
404   tet_infoline(" UtcDaliTextMergeFontDescriptions");
405
406   // Load some fonts.
407
408   char* pathNamePtr = get_current_dir_name();
409   const std::string pathName( pathNamePtr );
410   free( pathNamePtr );
411
412   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
413   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSans.ttf" );
414   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf" );
415   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", NON_DEFAULT_FONT_SIZE );
416   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf" );
417   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Italic.ttf" );
418
419   // To test the font width as GetFontId() with the font file path can't cache the width property.
420   TextAbstraction::FontDescription widthDescription;
421   widthDescription.path = "";
422   widthDescription.family = "DejaVu Serif";
423   widthDescription.weight = TextAbstraction::FontWeight::NORMAL;
424   widthDescription.width = TextAbstraction::FontWidth::EXPANDED;
425   widthDescription.slant = TextAbstraction::FontSlant::NORMAL;
426   fontClient.GetFontId( widthDescription );
427
428   // Test.
429
430   TextAbstraction::FontDescription defaultFontDescription01;
431   Vector<FontDescriptionRun> fontDescriptionRuns01;
432   Vector<FontId> expectedFontIds01;
433   Vector<bool> expectedIsFontDefault01;
434
435   TextAbstraction::FontDescription defaultFontDescription02;
436   Vector<FontDescriptionRun> fontDescriptionRuns02;
437   Vector<FontId> expectedFontIds02;
438   expectedFontIds02.PushBack( 0u );
439   expectedFontIds02.PushBack( 0u );
440   Vector<bool> expectedIsFontDefault02;
441   expectedIsFontDefault02.PushBack( true );
442   expectedIsFontDefault02.PushBack( true );
443
444   TextAbstraction::FontDescription defaultFontDescription03;
445   defaultFontDescription03.family = "DejaVu Serif";
446   Vector<FontDescriptionRun> fontDescriptionRuns03;
447
448   FontDescriptionRun fontDescription0301 =
449   {
450     {
451       0u,
452       2u
453     },
454     const_cast<char*>( "DejaVu Sans" ),
455     11u,
456     TextAbstraction::FontWeight::NORMAL,
457     TextAbstraction::FontWidth::NORMAL,
458     TextAbstraction::FontSlant::NORMAL,
459     TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
460     true,
461     false,
462     false,
463     false,
464     false
465   };
466   FontDescriptionRun fontDescription0302 =
467   {
468     {
469       2u,
470       2u
471     },
472     NULL,
473     0u,
474     TextAbstraction::FontWeight::NORMAL,
475     TextAbstraction::FontWidth::NORMAL,
476     TextAbstraction::FontSlant::ITALIC,
477     TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
478     false,
479     false,
480     false,
481     true,
482     false
483   };
484   FontDescriptionRun fontDescription0303 =
485   {
486     {
487       4u,
488       2u
489     },
490     NULL,
491     0u,
492     TextAbstraction::FontWeight::BOLD,
493     TextAbstraction::FontWidth::NORMAL,
494     TextAbstraction::FontSlant::NORMAL,
495     TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
496     false,
497     true,
498     false,
499     false,
500     false
501   };
502   FontDescriptionRun fontDescription0304 =
503   {
504     {
505       6u,
506       2u
507     },
508     NULL,
509     0u,
510     TextAbstraction::FontWeight::NORMAL,
511     TextAbstraction::FontWidth::NORMAL,
512     TextAbstraction::FontSlant::NORMAL,
513     NON_DEFAULT_FONT_SIZE,
514     false,
515     false,
516     false,
517     false,
518     true
519   };
520   FontDescriptionRun fontDescription0305 =
521   {
522     {
523       8u,
524       2u
525     },
526     NULL,
527     0u,
528     TextAbstraction::FontWeight::NORMAL,
529     TextAbstraction::FontWidth::EXPANDED,
530     TextAbstraction::FontSlant::NORMAL,
531     TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
532     false,
533     false,
534     true,
535     false,
536     false
537   };
538
539   fontDescriptionRuns03.PushBack( fontDescription0301 );
540   fontDescriptionRuns03.PushBack( fontDescription0302 );
541   fontDescriptionRuns03.PushBack( fontDescription0303 );
542   fontDescriptionRuns03.PushBack( fontDescription0304 );
543   fontDescriptionRuns03.PushBack( fontDescription0305 );
544
545   Vector<FontId> expectedFontIds03;
546   expectedFontIds03.PushBack( 1u );
547   expectedFontIds03.PushBack( 1u );
548   expectedFontIds03.PushBack( 5u );
549   expectedFontIds03.PushBack( 5u );
550   expectedFontIds03.PushBack( 4u );
551   expectedFontIds03.PushBack( 4u );
552   expectedFontIds03.PushBack( 3u );
553   expectedFontIds03.PushBack( 3u );
554   expectedFontIds03.PushBack( 6u );
555   expectedFontIds03.PushBack( 6u );
556   Vector<bool> expectedIsFontDefault03;
557   expectedIsFontDefault03.PushBack( false );
558   expectedIsFontDefault03.PushBack( false );
559   expectedIsFontDefault03.PushBack( false );
560   expectedIsFontDefault03.PushBack( false );
561   expectedIsFontDefault03.PushBack( false );
562   expectedIsFontDefault03.PushBack( false );
563   expectedIsFontDefault03.PushBack( false );
564   expectedIsFontDefault03.PushBack( false );
565   expectedIsFontDefault03.PushBack( false );
566   expectedIsFontDefault03.PushBack( false );
567
568   const MergeFontDescriptionsData data[] =
569   {
570     {
571       "void text.",
572       fontDescriptionRuns01,
573       defaultFontDescription01,
574       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
575       0u,
576       0u,
577       expectedFontIds01,
578       expectedIsFontDefault01
579     },
580     {
581       "No description runs.",
582       fontDescriptionRuns02,
583       defaultFontDescription02,
584       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
585       0u,
586       2u,
587       expectedFontIds02,
588       expectedIsFontDefault02
589     },
590     {
591       "Some description runs.",
592       fontDescriptionRuns03,
593       defaultFontDescription03,
594       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
595       0u,
596       10u,
597       expectedFontIds03,
598       expectedIsFontDefault03
599     }
600   };
601   const unsigned int numberOfTests = 3u;
602
603   for( unsigned int index = 0u; index < numberOfTests; ++index )
604   {
605     if( !MergeFontDescriptionsTest( data[index] ) )
606     {
607       tet_result(TET_FAIL);
608     }
609   }
610
611   tet_result(TET_PASS);
612   END_TEST;
613 }
614
615 int UtcDaliTextMultiLanguageConstructor(void)
616 {
617   ToolkitTestApplication application;
618   tet_infoline(" UtcDaliTextMultiLanguageConstructor");
619
620   MultilanguageSupport multilanguageSupport;
621   DALI_TEST_CHECK( !multilanguageSupport );
622
623   MultilanguageSupport multilanguageSupport1 = MultilanguageSupport::Get();
624   DALI_TEST_CHECK( multilanguageSupport1 );
625
626   // To increase coverage.
627   MultilanguageSupport multilanguageSupport2 = MultilanguageSupport::Get();
628   DALI_TEST_CHECK( multilanguageSupport2 );
629
630   DALI_TEST_CHECK( multilanguageSupport1 == multilanguageSupport2 );
631
632   tet_result(TET_PASS);
633   END_TEST;
634 }
635
636 int UtcDaliTextMultiLanguageSetScripts(void)
637 {
638   ToolkitTestApplication application;
639   tet_infoline(" UtcDaliTextMultiLanguageSetScripts" );
640
641   // Void text.
642   Vector<ScriptRun> scriptRuns00;
643
644   // Hello world.
645   Vector<ScriptRun> scriptRuns01;
646   ScriptRun scriptRun0100 =
647   {
648     {
649       0u,
650       11u,
651     },
652     TextAbstraction::LATIN
653   };
654   scriptRuns01.PushBack( scriptRun0100 );
655
656   // Mix of LTR '\n'and RTL
657   Vector<ScriptRun> scriptRuns02;
658   ScriptRun scriptRun0200 =
659   {
660     {
661       0u,
662       12u,
663     },
664     TextAbstraction::LATIN
665   };
666   ScriptRun scriptRun0201 =
667   {
668     {
669       12u,
670       13u,
671     },
672     TextAbstraction::ARABIC
673   };
674   scriptRuns02.PushBack( scriptRun0200 );
675   scriptRuns02.PushBack( scriptRun0201 );
676
677   // Mix of RTL '\n'and LTR
678   Vector<ScriptRun> scriptRuns03;
679   ScriptRun scriptRun0300 =
680   {
681     {
682       0u,
683       14u,
684     },
685     TextAbstraction::ARABIC
686   };
687   ScriptRun scriptRun0301 =
688   {
689     {
690       14u,
691       11u,
692     },
693     TextAbstraction::LATIN
694   };
695   scriptRuns03.PushBack( scriptRun0300 );
696   scriptRuns03.PushBack( scriptRun0301 );
697
698   // White spaces. At the beginning of the text.
699   Vector<ScriptRun> scriptRuns04;
700   ScriptRun scriptRun0400 =
701   {
702     {
703       0u,
704       15u,
705     },
706     TextAbstraction::LATIN
707   };
708   scriptRuns04.PushBack( scriptRun0400 );
709
710   // White spaces. At the end of the text.
711   Vector<ScriptRun> scriptRuns05;
712   ScriptRun scriptRun0500 =
713   {
714     {
715       0u,
716       15u,
717     },
718     TextAbstraction::LATIN
719   };
720   scriptRuns05.PushBack( scriptRun0500 );
721
722   // White spaces. At the middle of the text.
723   Vector<ScriptRun> scriptRuns06;
724   ScriptRun scriptRun0600 =
725   {
726     {
727       0u,
728       15u,
729     },
730     TextAbstraction::LATIN
731   };
732   scriptRuns06.PushBack( scriptRun0600 );
733
734   // White spaces between different scripts.
735   Vector<ScriptRun> scriptRuns07;
736   ScriptRun scriptRun0700 =
737   {
738     {
739       0u,
740       8u,
741     },
742     TextAbstraction::LATIN
743   };
744   ScriptRun scriptRun0701 =
745   {
746     {
747       8u,
748       5u,
749     },
750     TextAbstraction::HANGUL
751   };
752   scriptRuns07.PushBack( scriptRun0700 );
753   scriptRuns07.PushBack( scriptRun0701 );
754
755   // White spaces between different scripts and differetn directions. Starting LTR.
756   Vector<ScriptRun> scriptRuns08;
757   ScriptRun scriptRun0800 =
758   {
759     {
760       0u,
761       18u,
762     },
763     TextAbstraction::LATIN
764   };
765   ScriptRun scriptRun0801 =
766   {
767     {
768       18u,
769       14u,
770     },
771     TextAbstraction::ARABIC
772   };
773   ScriptRun scriptRun0802 =
774   {
775     {
776       32u,
777       18u,
778     },
779     TextAbstraction::HANGUL
780   };
781   scriptRuns08.PushBack( scriptRun0800 );
782   scriptRuns08.PushBack( scriptRun0801 );
783   scriptRuns08.PushBack( scriptRun0802 );
784
785   // White spaces between different scripts and differetn directions. Starting RTL.
786   Vector<ScriptRun> scriptRuns09;
787   ScriptRun scriptRun0900 =
788   {
789     {
790       0u,
791       21u,
792     },
793     TextAbstraction::ARABIC
794   };
795   ScriptRun scriptRun0901 =
796   {
797     {
798       21u,
799       16u,
800     },
801     TextAbstraction::LATIN
802   };
803   ScriptRun scriptRun0902 =
804   {
805     {
806       37u,
807       10u,
808     },
809     TextAbstraction::HANGUL
810   };
811   ScriptRun scriptRun0903 =
812   {
813     {
814       47u,
815       20u,
816     },
817     TextAbstraction::ARABIC
818   };
819   scriptRuns09.PushBack( scriptRun0900 );
820   scriptRuns09.PushBack( scriptRun0901 );
821   scriptRuns09.PushBack( scriptRun0902 );
822   scriptRuns09.PushBack( scriptRun0903 );
823
824   // Paragraphs with different directions.
825   Vector<ScriptRun> scriptRuns10;
826   ScriptRun scriptRun1000 =
827   {
828     {
829       0u,
830       20u,
831     },
832     TextAbstraction::ARABIC
833   };
834   ScriptRun scriptRun1001 =
835   {
836     {
837       20u,
838       12u,
839     },
840     TextAbstraction::HEBREW
841   };
842   ScriptRun scriptRun1002 =
843   {
844     {
845       32u,
846       17u,
847     },
848     TextAbstraction::ARABIC
849   };
850   ScriptRun scriptRun1003 =
851   {
852     {
853       49u,
854       18u,
855     },
856     TextAbstraction::LATIN
857   };
858   ScriptRun scriptRun1004 =
859   {
860     {
861       67u,
862       14u,
863     },
864     TextAbstraction::HANGUL
865   };
866   ScriptRun scriptRun1005 =
867   {
868     {
869       81u,
870       19u,
871     },
872     TextAbstraction::ARABIC
873   };
874   ScriptRun scriptRun1006 =
875   {
876     {
877       100u,
878       13u,
879     },
880     TextAbstraction::LATIN
881   };
882   ScriptRun scriptRun1007 =
883   {
884     {
885       113u,
886       16u,
887     },
888     TextAbstraction::HEBREW
889   };
890   ScriptRun scriptRun1008 =
891   {
892     {
893       129u,
894       20u,
895     },
896     TextAbstraction::LATIN
897   };
898   ScriptRun scriptRun1009 =
899   {
900     {
901       149u,
902       14u,
903     },
904     TextAbstraction::ARABIC
905   };
906   ScriptRun scriptRun1010 =
907   {
908     {
909       163u,
910       18u,
911     },
912     TextAbstraction::HANGUL
913   };
914   ScriptRun scriptRun1011 =
915   {
916     {
917       181u,
918       17u,
919     },
920     TextAbstraction::HANGUL
921   };
922   scriptRuns10.PushBack( scriptRun1000 );
923   scriptRuns10.PushBack( scriptRun1001 );
924   scriptRuns10.PushBack( scriptRun1002 );
925   scriptRuns10.PushBack( scriptRun1003 );
926   scriptRuns10.PushBack( scriptRun1004 );
927   scriptRuns10.PushBack( scriptRun1005 );
928   scriptRuns10.PushBack( scriptRun1006 );
929   scriptRuns10.PushBack( scriptRun1007 );
930   scriptRuns10.PushBack( scriptRun1008 );
931   scriptRuns10.PushBack( scriptRun1009 );
932   scriptRuns10.PushBack( scriptRun1010 );
933   scriptRuns10.PushBack( scriptRun1011 );
934
935   // Paragraphs with no scripts mixed with paragraphs with scripts.
936   Vector<ScriptRun> scriptRuns11;
937   ScriptRun scriptRun1100 =
938   {
939     {
940       0u,
941       3u,
942     },
943     TextAbstraction::LATIN
944   };
945   ScriptRun scriptRun1101 =
946   {
947     {
948       3u,
949       3u,
950     },
951     TextAbstraction::LATIN
952   };
953   ScriptRun scriptRun1102 =
954   {
955     {
956       6u,
957       19u,
958     },
959     TextAbstraction::LATIN
960   };
961   ScriptRun scriptRun1103 =
962   {
963     {
964       25u,
965       3u,
966     },
967     TextAbstraction::LATIN
968   };
969   ScriptRun scriptRun1104 =
970   {
971     {
972       28u,
973       3u,
974     },
975     TextAbstraction::LATIN
976   };
977   ScriptRun scriptRun1105 =
978   {
979     {
980       31u,
981       15u,
982     },
983     TextAbstraction::HEBREW
984   };
985   ScriptRun scriptRun1106 =
986   {
987     {
988       46u,
989       2u,
990     },
991     TextAbstraction::LATIN
992   };
993   ScriptRun scriptRun1107 =
994   {
995     {
996       48u,
997       2u,
998     },
999     TextAbstraction::LATIN
1000   };
1001   ScriptRun scriptRun1108 =
1002   {
1003     {
1004       50u,
1005       2u,
1006     },
1007     TextAbstraction::LATIN
1008   };
1009   scriptRuns11.PushBack( scriptRun1100 );
1010   scriptRuns11.PushBack( scriptRun1101 );
1011   scriptRuns11.PushBack( scriptRun1102 );
1012   scriptRuns11.PushBack( scriptRun1103 );
1013   scriptRuns11.PushBack( scriptRun1104 );
1014   scriptRuns11.PushBack( scriptRun1105 );
1015   scriptRuns11.PushBack( scriptRun1106 );
1016   scriptRuns11.PushBack( scriptRun1107 );
1017   scriptRuns11.PushBack( scriptRun1108 );
1018
1019   // Paragraphs with no scripts.
1020   Vector<ScriptRun> scriptRuns12;
1021   ScriptRun scriptRun1200 =
1022   {
1023     {
1024       0u,
1025       3u,
1026     },
1027     TextAbstraction::LATIN
1028   };
1029   ScriptRun scriptRun1201 =
1030   {
1031     {
1032       3u,
1033       3u,
1034     },
1035     TextAbstraction::LATIN
1036   };
1037   ScriptRun scriptRun1202 =
1038   {
1039     {
1040       6u,
1041       3u,
1042     },
1043     TextAbstraction::LATIN
1044   };
1045   ScriptRun scriptRun1203 =
1046   {
1047     {
1048       9u,
1049       2u,
1050     },
1051     TextAbstraction::LATIN
1052   };
1053   scriptRuns12.PushBack( scriptRun1200 );
1054   scriptRuns12.PushBack( scriptRun1201 );
1055   scriptRuns12.PushBack( scriptRun1202 );
1056   scriptRuns12.PushBack( scriptRun1203 );
1057
1058   Vector<ScriptRun> scriptRuns13;
1059   ScriptRun scriptRun1301 =
1060   {
1061     {
1062       0u,
1063       4u,
1064     },
1065     TextAbstraction::LATIN // An unknown script is transformed to LATIN
1066   };
1067   scriptRuns13.PushBack( scriptRun1301 );
1068
1069   const ScriptsData data[] =
1070   {
1071     {
1072       "void text",
1073       "",
1074       0u,
1075       0u,
1076       scriptRuns00,
1077     },
1078     {
1079       "Easy latin script",
1080       "Hello world",
1081       0u,
1082       11u,
1083       scriptRuns01,
1084     },
1085     {
1086       "Mix of LTR '\\n'and RTL",
1087       "Hello world\nمرحبا بالعالم",
1088       0u,
1089       25u,
1090       scriptRuns02,
1091     },
1092     {
1093       "Update mix of LTR '\\n'and RTL. Update LTR",
1094       "Hello world\nمرحبا بالعالم",
1095       0u,
1096       12u,
1097       scriptRuns02,
1098     },
1099     {
1100       "Update mix of LTR '\\n'and RTL. Update RTL",
1101       "Hello world\nمرحبا بالعالم",
1102       12u,
1103       13u,
1104       scriptRuns02,
1105     },
1106     {
1107       "Mix of RTL '\\n'and LTR",
1108       "مرحبا بالعالم\nHello world",
1109       0u,
1110       25u,
1111       scriptRuns03,
1112     },
1113     {
1114       "Update mix of RTL '\\n'and LTR. Update RTL",
1115       "مرحبا بالعالم\nHello world",
1116       0u,
1117       14u,
1118       scriptRuns03,
1119     },
1120     {
1121       "Update mix of RTL '\\n'and LTR. Update LTR",
1122       "مرحبا بالعالم\nHello world",
1123       14u,
1124       11u,
1125       scriptRuns03,
1126     },
1127     {
1128       "White spaces. At the beginning of the text.",
1129       "    Hello world",
1130       0u,
1131       15u,
1132       scriptRuns04,
1133     },
1134     {
1135       "White spaces. At the end of the text.",
1136       "Hello world    ",
1137       0u,
1138       15u,
1139       scriptRuns05,
1140     },
1141     {
1142       "White spaces. At the middle of the text.",
1143       "Hello     world",
1144       0u,
1145       15u,
1146       scriptRuns06,
1147     },
1148     {
1149       "White spaces between different scripts.",
1150       "  Hel   세계   ",
1151       0u,
1152       13u,
1153       scriptRuns07,
1154     },
1155     {
1156       "White spaces between different scripts and differetn directions. Starting LTR.",
1157       "  Hello   world   مرحبا  بالعالم     안녕하세요   세계   ",
1158       0u,
1159       50u,
1160       scriptRuns08,
1161     },
1162     {
1163       "White spaces between different scripts and differetn directions. Starting RTL.",
1164       "   مرحبا  بالعالم    Hello   world   안녕하세요   세계   مرحبا  بالعالم   ",
1165       0u,
1166       67u,
1167       scriptRuns09
1168     },
1169     {
1170       "Paragraphs with different directions.",
1171       "   مرحبا  بالعالم   שלום עולם   مرحبا  بالعالم  \n "
1172       " Hello   world   안녕하세요   세계   \n "
1173       "  مرحبا  بالعالم  Hello   world    שלום עולם  \n  "
1174       " Hello   world    مرحبا  بالعالم    안녕하세요   세계   \n "
1175       "   안녕하세요   세계   ",
1176       0u,
1177       198u,
1178       scriptRuns10
1179     },
1180     {
1181       "Update paragraphs with different directions. Update initial paragraphs.",
1182       "   مرحبا  بالعالم   שלום עולם   مرحبا  بالعالم  \n "
1183       " Hello   world   안녕하세요   세계   \n "
1184       "  مرحبا  بالعالم  Hello   world    שלום עולם  \n  "
1185       " Hello   world    مرحبا  بالعالم    안녕하세요   세계   \n "
1186       "   안녕하세요   세계   ",
1187       0u,
1188       81u,
1189       scriptRuns10
1190     },
1191     {
1192       "Update paragraphs with different directions. Update middle paragraphs.",
1193       "   مرحبا  بالعالم   שלום עולם   مرحبا  بالعالم  \n "
1194       " Hello   world   안녕하세요   세계   \n "
1195       "  مرحبا  بالعالم  Hello   world    שלום עולם  \n  "
1196       " Hello   world    مرحبا  بالعالم    안녕하세요   세계   \n "
1197       "   안녕하세요   세계   ",
1198       49u,
1199       80u,
1200       scriptRuns10
1201     },
1202     {
1203       "Update paragraphs with different directions. Update final paragraphs.",
1204       "   مرحبا  بالعالم   שלום עולם   مرحبا  بالعالم  \n "
1205       " Hello   world   안녕하세요   세계   \n "
1206       "  مرحبا  بالعالم  Hello   world    שלום עולם  \n  "
1207       " Hello   world    مرحبا  بالعالم    안녕하세요   세계   \n "
1208       "   안녕하세요   세계   ",
1209       129u,
1210       69u,
1211       scriptRuns10
1212     },
1213     {
1214       "Paragraphs with no scripts mixed with paragraphs with scripts.",
1215       "  \n  \n   Hello   world  \n  \n  \n   שלום עולם  \n \n \n  ",
1216       0u,
1217       52u,
1218       scriptRuns11
1219     },
1220     {
1221       "Paragraphs with no scripts.",
1222       "  \n  \n  \n  ",
1223       0u,
1224       11u,
1225       scriptRuns12
1226     },
1227     {
1228       "Update paragraphs with no scripts. Update initial paragraphs.",
1229       "  \n  \n  \n  ",
1230       0u,
1231       3u,
1232       scriptRuns12
1233     },
1234     {
1235       "Update paragraphs with no scripts. Update middle paragraphs.",
1236       "  \n  \n  \n  ",
1237       3u,
1238       6u,
1239       scriptRuns12
1240     },
1241     {
1242       "Update paragraphs with no scripts. Update final paragraphs.",
1243       "  \n  \n  \n  ",
1244       9u,
1245       2u,
1246       scriptRuns12
1247     },
1248     {
1249       "Unknown scripts.",
1250       "ᚩᚯᚱᚸ", // Runic script not currentlu supported.
1251       0u,
1252       4u,
1253       scriptRuns13
1254     }
1255   };
1256   const unsigned int numberOfTests = 24u;
1257
1258   for( unsigned int index = 0u; index < numberOfTests; ++index )
1259   {
1260     if( !ScriptsTest( data[index] ) )
1261     {
1262       tet_result(TET_FAIL);
1263     }
1264   }
1265
1266   tet_result(TET_PASS);
1267   END_TEST;
1268 }
1269
1270 int UtcDaliTextMultiLanguageValidateFonts01(void)
1271 {
1272   ToolkitTestApplication application;
1273   tet_infoline(" UtcDaliTextMultiLanguageValidateFonts");
1274
1275   TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
1276
1277   char* pathNamePtr = get_current_dir_name();
1278   const std::string pathName( pathNamePtr );
1279   free( pathNamePtr );
1280
1281   const PointSize26Dot6 pointSize01 = static_cast<PointSize26Dot6>( 21.f * 64.f );
1282   const PointSize26Dot6 pointSize02 = static_cast<PointSize26Dot6>( 35.f * 64.f );
1283
1284   // Load some fonts.
1285   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
1286   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
1287   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenColorEmoji.ttf", EMOJI_FONT_SIZE );
1288   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf", pointSize01 );
1289   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf", pointSize02 );
1290   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf", pointSize01 );
1291   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf", pointSize02 );
1292
1293   // Font id 1 --> TizenSansArabicRegular.ttf
1294   // Font id 2 --> TizenSansHebrewRegular.ttf
1295   // Font id 3 --> TizenColorEmoji.ttf
1296   // Font id 4 --> TizenSansRegular.ttf, size 8
1297   // Font id 5 --> TizenSansRegular.ttf, size 16
1298   // Font id 6 --> TizenSansHebrewRegular.ttf, size 8
1299   // Font id 7 --> TizenSansHebrewRegular.ttf, size 16
1300   // Font id 8 --> (default)
1301
1302   Vector<FontRun> fontRuns01;
1303   Vector<FontDescriptionRun> fontDescriptions01;
1304
1305   FontRun fontRun0201 =
1306   {
1307     {
1308       0u,
1309       11u
1310     },
1311     8u
1312   };
1313   Vector<FontRun> fontRuns02;
1314   fontRuns02.PushBack( fontRun0201 );
1315
1316   FontDescriptionRun fontDescription0201 =
1317   {
1318     {
1319       0u,
1320       11u
1321     },
1322     const_cast<char*>( "TizenSans" ),
1323     9u,
1324     TextAbstraction::FontWeight::NORMAL,
1325     TextAbstraction::FontWidth::NORMAL,
1326     TextAbstraction::FontSlant::NORMAL,
1327     0u,
1328     true,
1329     false,
1330     false,
1331     false,
1332     false
1333   };
1334   Vector<FontDescriptionRun> fontDescriptions02;
1335   fontDescriptions02.PushBack( fontDescription0201 );
1336
1337   FontRun fontRun0301 =
1338   {
1339     {
1340       0u,
1341       12u
1342     },
1343     8u
1344   };
1345   FontRun fontRun0302 =
1346   {
1347     {
1348       12u,
1349       12u
1350     },
1351     8u
1352   };
1353   FontRun fontRun0303 =
1354   {
1355     {
1356       24u,
1357       4u
1358     },
1359     8u
1360   };
1361   Vector<FontRun> fontRuns03;
1362   fontRuns03.PushBack( fontRun0301 );
1363   fontRuns03.PushBack( fontRun0302 );
1364   fontRuns03.PushBack( fontRun0303 );
1365
1366   Vector<FontDescriptionRun> fontDescriptions03;
1367
1368   FontRun fontRun0701 =
1369   {
1370     {
1371       0u,
1372       4u
1373     },
1374     2u
1375   };
1376   FontRun fontRun0702 =
1377   {
1378     {
1379       4u,
1380       1u
1381     },
1382     8u
1383   };
1384   FontRun fontRun0703 =
1385   {
1386     {
1387       5u,
1388       4u
1389     },
1390     2u
1391   };
1392   Vector<FontRun> fontRuns07;
1393   fontRuns07.PushBack( fontRun0701 );
1394   fontRuns07.PushBack( fontRun0702 );
1395   fontRuns07.PushBack( fontRun0703 );
1396
1397   FontDescriptionRun fontDescription0701 =
1398   {
1399     {
1400       0u,
1401       4u
1402     },
1403     const_cast<char*>( "TizenSansHebrew" ),
1404     15u,
1405     TextAbstraction::FontWeight::NORMAL,
1406     TextAbstraction::FontWidth::NORMAL,
1407     TextAbstraction::FontSlant::NORMAL,
1408     0u,
1409     true,
1410     false,
1411     false,
1412     false,
1413     false
1414   };
1415   FontDescriptionRun fontDescription0702 =
1416   {
1417     {
1418       5u,
1419       4u
1420     },
1421     const_cast<char*>( "TizenSansHebrew" ),
1422     15u,
1423     TextAbstraction::FontWeight::NORMAL,
1424     TextAbstraction::FontWidth::NORMAL,
1425     TextAbstraction::FontSlant::NORMAL,
1426     0u,
1427     true,
1428     false,
1429     false,
1430     false,
1431     false
1432   };
1433   Vector<FontDescriptionRun> fontDescriptions07;
1434   fontDescriptions07.PushBack( fontDescription0701 );
1435   fontDescriptions07.PushBack( fontDescription0702 );
1436
1437   FontRun fontRun0801 =
1438   {
1439     {
1440       0u,
1441       9u
1442     },
1443     2u
1444   };
1445   Vector<FontRun> fontRuns08;
1446   fontRuns08.PushBack( fontRun0801 );
1447
1448   Vector<FontDescriptionRun> fontDescriptions08;
1449
1450   FontRun fontRun0901 =
1451   {
1452     {
1453       0u,
1454       4u
1455     },
1456     3u
1457   };
1458   Vector<FontRun> fontRuns09;
1459   fontRuns09.PushBack( fontRun0901 );
1460
1461   Vector<FontDescriptionRun> fontDescriptions09;
1462   FontDescriptionRun fontDescription0901 =
1463   {
1464     {
1465       0u,
1466       4u
1467     },
1468     const_cast<char*>( "TizenColorEmoji" ),
1469     15u,
1470     TextAbstraction::FontWeight::NORMAL,
1471     TextAbstraction::FontWidth::NORMAL,
1472     TextAbstraction::FontSlant::NORMAL,
1473     EMOJI_FONT_SIZE,
1474     true,
1475     false,
1476     false,
1477     false,
1478     true
1479   };
1480   fontDescriptions09.PushBack( fontDescription0901 );
1481
1482   FontRun fontRun1001 =
1483   {
1484     {
1485       0u,
1486       13u
1487     },
1488     4u
1489   };
1490   FontRun fontRun1002 =
1491   {
1492     {
1493       13u,
1494       9u
1495     },
1496     6u
1497   };
1498   FontRun fontRun1003 =
1499   {
1500     {
1501       22u,
1502       15u
1503     },
1504     5u
1505   };
1506   FontRun fontRun1004 =
1507   {
1508     {
1509       37u,
1510       9u
1511     },
1512     7u
1513   };
1514   Vector<FontRun> fontRuns10;
1515   fontRuns10.PushBack( fontRun1001 );
1516   fontRuns10.PushBack( fontRun1002 );
1517   fontRuns10.PushBack( fontRun1003 );
1518   fontRuns10.PushBack( fontRun1004 );
1519
1520   FontDescriptionRun fontDescription1001 =
1521   {
1522     {
1523       0u,
1524       13u
1525     },
1526     const_cast<char*>( "TizenSans" ),
1527     9u,
1528     TextAbstraction::FontWeight::NORMAL,
1529     TextAbstraction::FontWidth::NORMAL,
1530     TextAbstraction::FontSlant::NORMAL,
1531     pointSize01,
1532     true,
1533     false,
1534     false,
1535     false,
1536     true
1537   };
1538   FontDescriptionRun fontDescription1002 =
1539   {
1540     {
1541       13u,
1542       9u
1543     },
1544     const_cast<char*>( "TizenSansHebrew" ),
1545     15u,
1546     TextAbstraction::FontWeight::NORMAL,
1547     TextAbstraction::FontWidth::NORMAL,
1548     TextAbstraction::FontSlant::NORMAL,
1549     pointSize01,
1550     true,
1551     false,
1552     false,
1553     false,
1554     true
1555   };
1556   FontDescriptionRun fontDescription1003 =
1557   {
1558     {
1559       22u,
1560       15u
1561     },
1562     const_cast<char*>( "TizenSans" ),
1563     9u,
1564     TextAbstraction::FontWeight::NORMAL,
1565     TextAbstraction::FontWidth::NORMAL,
1566     TextAbstraction::FontSlant::NORMAL,
1567     pointSize02,
1568     true,
1569     false,
1570     false,
1571     false,
1572     true
1573   };
1574   FontDescriptionRun fontDescription1004 =
1575   {
1576     {
1577       37u,
1578       9u
1579     },
1580     const_cast<char*>( "TizenSansHebrew" ),
1581     15u,
1582     TextAbstraction::FontWeight::NORMAL,
1583     TextAbstraction::FontWidth::NORMAL,
1584     TextAbstraction::FontSlant::NORMAL,
1585     pointSize02,
1586     true,
1587     false,
1588     false,
1589     false,
1590     true
1591   };
1592   Vector<FontDescriptionRun> fontDescriptions10;
1593   fontDescriptions10.PushBack( fontDescription1001 );
1594   fontDescriptions10.PushBack( fontDescription1002 );
1595   fontDescriptions10.PushBack( fontDescription1003 );
1596   fontDescriptions10.PushBack( fontDescription1004 );
1597
1598   const ValidateFontsData data[] =
1599   {
1600     {
1601       "void text.",
1602       "",
1603       "/tizen/TizenSansRegular.ttf",
1604       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1605       0u,
1606       0u,
1607       fontDescriptions01,
1608       fontRuns01
1609     },
1610     {
1611       "Easy latin script.",
1612       "Hello world",
1613       "/tizen/TizenSansRegular.ttf",
1614       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1615       0u,
1616       11u,
1617       fontDescriptions02,
1618       fontRuns02
1619     },
1620     {
1621       "Different paragraphs.",
1622       "Hello world\nhello world\ndemo",
1623       "/tizen/TizenSansRegular.ttf",
1624       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1625       0u,
1626       28u,
1627       fontDescriptions03,
1628       fontRuns03
1629     },
1630     {
1631       "Different paragraphs. Update the initial paragraph.",
1632       "Hello world\nhello world\ndemo",
1633       "/tizen/TizenSansRegular.ttf",
1634       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1635       0u,
1636       12u,
1637       fontDescriptions03,
1638       fontRuns03
1639     },
1640     {
1641       "Different paragraphs. Update the middle paragraph.",
1642       "Hello world\nhello world\ndemo",
1643       "/tizen/TizenSansRegular.ttf",
1644       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1645       12u,
1646       12u,
1647       fontDescriptions03,
1648       fontRuns03
1649     },
1650     {
1651       "Different paragraphs. Update the final paragraph.",
1652       "Hello world\nhello world\ndemo",
1653       "/tizen/TizenSansRegular.ttf",
1654       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1655       24u,
1656       4u,
1657       fontDescriptions03,
1658       fontRuns03
1659     },
1660     {
1661       "Hebrew text. Default font: latin",
1662       "שלום עולם",
1663       "/tizen/TizenSansRegular.ttf",
1664       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1665       0u,
1666       9u,
1667       fontDescriptions07,
1668       fontRuns07
1669     },
1670     {
1671       "Hebrew text. Default font: hebrew",
1672       "שלום עולם",
1673       "/tizen/TizenSansHebrewRegular.ttf",
1674       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1675       0u,
1676       9u,
1677       fontDescriptions08,
1678       fontRuns08
1679     },
1680     {
1681       "Emojis",
1682       "\xF0\x9F\x98\x81\xF0\x9F\x98\x82\xF0\x9F\x98\x83\xF0\x9F\x98\x84",
1683       "/tizen/TizenColorEmoji.ttf",
1684       EMOJI_FONT_SIZE,
1685       0u,
1686       4u,
1687       fontDescriptions09,
1688       fontRuns09
1689     },
1690     {
1691       "Mix text. Default font: latin. Different font sizes",
1692       "Hello world, שלום עולם, hello world, שלום עולם",
1693       "/tizen/TizenSansRegular.ttf",
1694       TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
1695       0u,
1696       46u,
1697       fontDescriptions10,
1698       fontRuns10
1699     },
1700   };
1701   const unsigned int numberOfTests = 10u;
1702
1703   for( unsigned int index = 0u; index < numberOfTests; ++index )
1704   {
1705     if( !ValidateFontTest( data[index] ) )
1706     {
1707       tet_result(TET_FAIL);
1708     }
1709   }
1710
1711   tet_result(TET_PASS);
1712   END_TEST;
1713 }