Merge "TextField is re-laied out after its properties are changed." into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-Text-Circular.cpp
1 /*
2  * Copyright (c) 2019 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 <fstream>
20 #include <stdlib.h>
21 #include <unistd.h>
22
23 #include <dali-toolkit-test-suite-utils.h>
24 #include <dali-toolkit/dali-toolkit.h>
25 #include <toolkit-text-utils.h>
26
27 // EXTERNAL INCLUDES
28 #include <dali-toolkit/devel-api/text/bitmap-font.h>
29 #include <dali/devel-api/text-abstraction/bitmap-font.h>
30 #include <dali-toolkit/devel-api/text/text-utils-devel.h>
31 #include <devel-api/adaptor-framework/image-loading.h>
32
33
34
35 using namespace std;
36 using namespace Dali;
37 using namespace Toolkit;
38 using namespace Text;
39
40 namespace
41 {
42 const std::string TEST_IMAGE_FILE_NAME1 =  TEST_RESOURCE_DIR  "/application-icon-20.png";
43 const std::string TEST_IMAGE_FILE_NAME2 =  TEST_RESOURCE_DIR  "/application-icon-26.png";
44
45 const std::vector<std::string> embeddedItems = { TEST_IMAGE_FILE_NAME2, TEST_IMAGE_FILE_NAME2, TEST_IMAGE_FILE_NAME2, TEST_IMAGE_FILE_NAME2, TEST_IMAGE_FILE_NAME2 };
46
47 struct CircularTextData
48 {
49   std::string                      description;
50   std::string                      text;
51   DevelText::RendererParameters&   textParameters;
52   const std::vector<std::string>&  embeddedItems;
53   bool                             blend:1;
54 };
55
56
57 bool CircularRenderTest( const CircularTextData& data )
58 {
59   bool ret = true;
60
61   Dali::Vector<Dali::Toolkit::DevelText::EmbeddedItemInfo> embeddedItemLayout;
62
63   Devel::PixelBuffer pixelBuffer = Toolkit::DevelText::Render( data.textParameters, embeddedItemLayout );
64
65    const int dstWidth = static_cast<int>( pixelBuffer.GetWidth() );
66    const int dstHeight = static_cast<int>( pixelBuffer.GetHeight() );
67
68    unsigned int index = 0u;
69    for( const auto& itemLayout : embeddedItemLayout )
70    {
71      int width = static_cast<int>( itemLayout.size.width );
72      int height = static_cast<int>( itemLayout.size.height );
73      int x = static_cast<int>( itemLayout.position.x );
74      int y = static_cast<int>( itemLayout.position.y );
75
76      Dali::Devel::PixelBuffer itemPixelBuffer = Dali::LoadImageFromFile( data.embeddedItems[index++] );
77      itemPixelBuffer.Resize( width, height );
78      itemPixelBuffer.Rotate( itemLayout.angle );
79
80      width = static_cast<int>( itemPixelBuffer.GetWidth() );
81      height = static_cast<int>( itemPixelBuffer.GetHeight() );
82
83      Dali::Pixel::Format itemPixelFormat = itemPixelBuffer.GetPixelFormat();
84
85      // Check if the item is out of the buffer.
86      if( ( x + width < 0 ) ||
87          ( x > dstWidth ) ||
88          ( y < 0 ) ||
89          ( y - height > dstHeight ) )
90      {
91        // The embedded item is completely out of the buffer.
92        continue;
93      }
94
95      // Crop if it exceeds the boundaries of the destination buffer.
96      int layoutX = 0;
97      int layoutY = 0;
98      int cropX = 0;
99      int cropY = 0;
100      int newWidth = width;
101      int newHeight = height;
102
103      bool crop = false;
104
105      if( 0 > x )
106      {
107        newWidth += x;
108        cropX = std::abs( x );
109        crop = true;
110      }
111      else
112      {
113        layoutX = x;
114      }
115
116      if( cropX + newWidth > dstWidth )
117      {
118        crop = true;
119        newWidth -= ( ( cropX + newWidth ) - dstWidth );
120      }
121
122      layoutY = y;
123      if( 0.f > layoutY )
124      {
125        newHeight += layoutY;
126        cropY = std::abs(layoutY);
127        crop = true;
128      }
129
130      if( cropY + newHeight > dstHeight )
131      {
132        crop = true;
133        newHeight -= ( ( cropY + newHeight ) - dstHeight );
134      }
135
136      uint16_t uiCropX = static_cast<uint16_t>(cropX);
137      uint16_t uiCropY = static_cast<uint16_t>(cropY);
138      uint16_t uiNewWidth = static_cast<uint16_t>(newWidth);
139      uint16_t uiNewHeight = static_cast<uint16_t>(newHeight);
140
141      if( crop )
142      {
143        itemPixelBuffer.Crop( uiCropX, uiCropY, uiNewWidth, uiNewHeight );
144      }
145
146      // Blend the item pixel buffer with the text's color according its blending mode.
147      if( Dali::TextAbstraction::ColorBlendingMode::MULTIPLY == itemLayout.colorBlendingMode )
148      {
149        Dali::Devel::PixelBuffer buffer = Dali::Devel::PixelBuffer::New( uiNewWidth,
150                                                                         uiNewHeight,
151                                                                         itemPixelFormat );
152
153        unsigned char* bufferPtr = buffer.GetBuffer();
154        const unsigned char* itemBufferPtr = itemPixelBuffer.GetBuffer();
155        const unsigned int bytesPerPixel = Dali::Pixel::GetBytesPerPixel(itemPixelFormat);
156        const unsigned int size = uiNewWidth * uiNewHeight * bytesPerPixel;
157
158        for (unsigned int i = 0u; i < size; i += bytesPerPixel)
159        {
160          *(bufferPtr + 0u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 0u) ) * data.textParameters.textColor.r );
161          *(bufferPtr + 1u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 1u) ) * data.textParameters.textColor.g );
162          *(bufferPtr + 2u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 2u) ) * data.textParameters.textColor.b );
163          *(bufferPtr + 3u) = static_cast<unsigned char>( static_cast<float>( *(itemBufferPtr + 3u) ) * data.textParameters.textColor.a );
164
165          itemBufferPtr += bytesPerPixel;
166          bufferPtr += bytesPerPixel;
167        }
168
169        itemPixelBuffer = buffer;
170      }
171
172      Dali::Toolkit::DevelText::UpdateBuffer(itemPixelBuffer, pixelBuffer, layoutX, layoutY, data.blend);
173    }
174
175   return  ret;
176 }
177
178 } // namespace
179
180 int UtcDaliTextCircularBitmapFont(void)
181 {
182   ToolkitTestApplication application;
183   tet_infoline(" UtcDaliTextCircularBitmapFont");
184
185   Dali::Toolkit::DevelText::BitmapFontDescription description;
186   Dali::Toolkit::DevelText::Glyph glyph;
187   glyph.url = "BitmapFontUrl";
188   glyph.utf8 = "BitmapFontUrl";
189   glyph.ascender = 1.f;
190   glyph.descender = 1.f;
191   description.glyphs.push_back( glyph );
192
193   TextAbstraction::BitmapFont bitmapFont;
194   Dali::Toolkit::DevelText::CreateBitmapFont( description, bitmapFont );
195
196   for( const auto& bitmapGlyph : bitmapFont.glyphs )
197   {
198     if( glyph.url != bitmapGlyph.url )
199     {
200       std::cout << "  different output string : " << bitmapGlyph.url << ", expected : " << glyph.url << " " << std::endl;
201       tet_result(TET_FAIL);
202     }
203   }
204
205   tet_result(TET_PASS);
206   END_TEST;
207 }
208
209 int UtcDaliTextCircularShadowText(void)
210 {
211   ToolkitTestApplication application;
212   tet_infoline(" UtcDaliTextCircularShadowText");
213
214   Dali::Toolkit::DevelText::ShadowParameters shadowParameters;
215   Devel::PixelBuffer outPixelBuffer;
216   shadowParameters.input = Devel::PixelBuffer::New( 100, 100, Pixel::RGBA8888 );
217   shadowParameters.textColor = Color::BLACK;
218   shadowParameters.color =  Color::BLACK;
219   shadowParameters.offset.x = 10u;
220   shadowParameters.offset.y = 10u;
221   shadowParameters.blendShadow = true;
222   outPixelBuffer = Dali::Toolkit::DevelText::CreateShadow( shadowParameters );
223   DALI_TEST_CHECK( outPixelBuffer );
224   DALI_TEST_EQUALS( outPixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION  );
225
226   shadowParameters.blendShadow = false;
227   outPixelBuffer = Dali::Toolkit::DevelText::CreateShadow( shadowParameters );
228   DALI_TEST_CHECK( outPixelBuffer );
229   DALI_TEST_EQUALS( outPixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION  );
230
231   shadowParameters.input = Devel::PixelBuffer::New( 100, 100, Pixel::A8 );
232   outPixelBuffer = Dali::Toolkit::DevelText::CreateShadow( shadowParameters );
233   DALI_TEST_CHECK( outPixelBuffer );
234   DALI_TEST_EQUALS( outPixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION  );
235
236   tet_result(TET_PASS);
237   END_TEST;
238 }
239
240 int UtcDaliTextCircularPixelBufferText(void)
241 {
242   ToolkitTestApplication application;
243   tet_infoline(" UtcDaliTextCircularPixelBufferText");
244
245   Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::A8 );
246   Vector4 color;
247   Devel::PixelBuffer pixelBufferRgba = Dali::Toolkit::DevelText::ConvertToRgba8888( pixbuf, color, true );
248   pixelBufferRgba = Dali::Toolkit::DevelText::ConvertToRgba8888( pixbuf, color, false );
249   DALI_TEST_CHECK( pixelBufferRgba );
250   DALI_TEST_EQUALS( pixelBufferRgba.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION  );
251
252   pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::RGBA8888 );
253   pixelBufferRgba = Dali::Toolkit::DevelText::ConvertToRgba8888( pixbuf, color, false );
254   DALI_TEST_CHECK( pixelBufferRgba );
255   DALI_TEST_EQUALS( pixelBufferRgba.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION  );
256
257   tet_result(TET_PASS);
258   END_TEST;
259 }
260
261 int UtcDaliTextCircularNoText(void)
262 {
263   ToolkitTestApplication application;
264   tet_infoline(" UtcDaliTextCircularNoText");
265
266   Dali::Toolkit::DevelText::RendererParameters textParameters;
267   textParameters.text = "";
268   textParameters.fontSize = 25.f;
269   textParameters.textWidth = 360u;
270   textParameters.textHeight = 360u;
271
272   CircularTextData data =
273   {
274       "No text",
275       "",
276       textParameters,
277       embeddedItems,
278       true
279   };
280
281   if( !CircularRenderTest( data ) )
282   {
283     tet_result(TET_FAIL);
284   }
285
286   textParameters.text = "<item 'width'=26 'height'=26/>";
287   textParameters.markupEnabled = true;
288   if( !CircularRenderTest( data ) )
289   {
290     tet_result(TET_FAIL);
291   }
292
293   tet_result(TET_PASS);
294   END_TEST;
295 }
296
297 int UtcDaliTextCircularIncrementAngle(void)
298 {
299
300   ToolkitTestApplication application;
301   tet_infoline(" UtcDaliTextCircularIncrementAngle");
302
303   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
304   const std::string image2 = "<item 'width'=26 'height'=26/>";
305
306   Dali::Toolkit::DevelText::RendererParameters textParameters;
307   textParameters.text = "Hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
308   textParameters.horizontalAlignment = "center";
309   textParameters.verticalAlignment = "center";
310   textParameters.circularAlignment = "center";
311   textParameters.fontFamily = "SamsungUI";
312   textParameters.fontWeight = "";
313   textParameters.fontWidth = "";
314   textParameters.fontSlant = "";
315   textParameters.layout = "circular";
316   textParameters.textColor = Color::BLACK;
317   textParameters.fontSize = 25.f;
318   textParameters.textWidth = 360u;
319   textParameters.textHeight = 360u;
320   textParameters.radius = 180u;
321   textParameters.beginAngle = 15.f;
322   textParameters.incrementAngle = 0.f;
323   textParameters.ellipsisEnabled = true;
324   textParameters.markupEnabled = true;
325
326
327   CircularTextData data =
328   {
329       "IncrementAngle",
330       "",
331       textParameters,
332       embeddedItems,
333       true
334   };
335
336   if( !CircularRenderTest( data ) )
337   {
338     tet_result(TET_FAIL);
339   }
340
341   tet_result(TET_PASS);
342   END_TEST;
343 }
344
345
346
347 int UtcDaliTextCircularMarkup(void)
348 {
349   ToolkitTestApplication application;
350   tet_infoline(" UtcDaliTextCircularMarkup");
351
352   Dali::Toolkit::DevelText::RendererParameters textParameters;
353   textParameters.text = "Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World";
354   textParameters.horizontalAlignment = "center";
355   textParameters.verticalAlignment = "center";
356   textParameters.circularAlignment = "center";
357   textParameters.fontFamily = "SamsungUI";
358   textParameters.fontWeight = "";
359   textParameters.fontWidth = "";
360   textParameters.fontSlant = "";
361   textParameters.layout = "circular";
362   textParameters.textColor = Color::BLACK;
363   textParameters.fontSize = 25.f;
364   textParameters.textWidth = 360u;
365   textParameters.textHeight = 360u;
366   textParameters.radius = 180u;
367   textParameters.beginAngle = 15.f;
368   textParameters.incrementAngle = 360.f;
369   textParameters.ellipsisEnabled = true;
370   textParameters.markupEnabled = false;
371
372   CircularTextData data =
373   {
374       "Markup",
375       "",
376       textParameters,
377       embeddedItems,
378       true
379   };
380
381   if( !CircularRenderTest( data ) )
382   {
383     tet_result(TET_FAIL);
384   }
385
386   tet_result(TET_PASS);
387   END_TEST;
388 }
389
390 int UtcDaliTextCircularFont(void)
391 {
392   ToolkitTestApplication application;
393   tet_infoline(" UtcDaliTextCircularFont");
394
395   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
396   const std::string image2 = "<item 'width'=26 'height'=26/>";
397
398   Dali::Toolkit::DevelText::RendererParameters textParameters;
399   textParameters.text = "Hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
400   textParameters.horizontalAlignment = "center";
401   textParameters.verticalAlignment = "center";
402   textParameters.circularAlignment = "center";
403   textParameters.fontFamily = "SamsungUI";
404   textParameters.fontWeight = "thin";
405   textParameters.fontWidth = "condensed";
406   textParameters.fontSlant = "normal";
407   textParameters.layout = "circular";
408   textParameters.textColor = Color::BLACK;
409   textParameters.fontSize = 25.f;
410   textParameters.textWidth = 360u;
411   textParameters.textHeight = 360u;
412   textParameters.radius = 180u;
413   textParameters.beginAngle = 15.f;
414   textParameters.incrementAngle = 360.f;
415   textParameters.ellipsisEnabled = true;
416   textParameters.markupEnabled = true;
417
418   CircularTextData data =
419   {
420       "Font",
421       "",
422       textParameters,
423       embeddedItems,
424       true
425   };
426
427   if( !CircularRenderTest( data ) )
428   {
429     tet_result(TET_FAIL);
430   }
431
432   tet_result(TET_PASS);
433   END_TEST;
434 }
435
436 int UtcDaliTextCircularAlignment(void)
437 {
438
439   ToolkitTestApplication application;
440   tet_infoline(" UtcDaliTextCircularAlignment");
441
442   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
443   const std::string image2 = "<item 'width'=26 'height'=26/>";
444
445   Dali::Toolkit::DevelText::RendererParameters textParameters;
446   textParameters.text = "Hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
447   textParameters.horizontalAlignment = "center";
448   textParameters.verticalAlignment = "center";
449   textParameters.circularAlignment = "center";
450   textParameters.fontFamily = "SamsungUI";
451   textParameters.fontWeight = "";
452   textParameters.fontWidth = "";
453   textParameters.fontSlant = "";
454   textParameters.layout = "circular";
455   textParameters.textColor = Color::BLACK;
456   textParameters.fontSize = 25.f;
457   textParameters.textWidth = 360u;
458   textParameters.textHeight = 360u;
459   textParameters.radius = 180u;
460   textParameters.beginAngle = 15.f;
461   textParameters.incrementAngle = 360.f;
462   textParameters.ellipsisEnabled = true;
463   textParameters.markupEnabled = true;
464
465   CircularTextData data =
466   {
467       "Alignment",
468       "",
469       textParameters,
470       embeddedItems,
471       true
472   };
473
474   if( !CircularRenderTest( data ) )
475   {
476     tet_result(TET_FAIL);
477   }
478
479   textParameters.horizontalAlignment = "begin";
480   textParameters.verticalAlignment = "top";
481   textParameters.circularAlignment = "begin";
482
483   if( !CircularRenderTest( data ) )
484   {
485     tet_result(TET_FAIL);
486   }
487
488   textParameters.horizontalAlignment = "end";
489   textParameters.verticalAlignment = "bottom";
490   textParameters.circularAlignment = "end";
491
492   if( !CircularRenderTest( data ) )
493   {
494     tet_result(TET_FAIL);
495   }
496
497   tet_result(TET_PASS);
498   END_TEST;
499 }
500
501 int UtcDaliTextCircularRTL(void)
502 {
503   ToolkitTestApplication application;
504   tet_infoline(" UtcDaliTextCircularRTL");
505
506   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
507   const std::string image2 = "<item 'width'=26 'height'=26/>";
508
509   Dali::Toolkit::DevelText::RendererParameters textParameters;
510   textParameters.text = "مرحبا بالعالم" + image1 + " hello world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
511   textParameters.horizontalAlignment = "center";
512   textParameters.verticalAlignment = "center";
513   textParameters.circularAlignment = "center";
514   textParameters.fontFamily = "SamsungUI";
515   textParameters.fontWeight = "";
516   textParameters.fontWidth = "";
517   textParameters.fontSlant = "";
518   textParameters.layout = "circular";
519   textParameters.textColor = Color::BLACK;
520   textParameters.fontSize = 25.f;
521   textParameters.textWidth = 360u;
522   textParameters.textHeight = 360u;
523   textParameters.radius = 180u;
524   textParameters.beginAngle = 15.f;
525   textParameters.incrementAngle = 360.f;
526   textParameters.ellipsisEnabled = true;
527   textParameters.markupEnabled = true;
528
529   CircularTextData data =
530   {
531       "RTL",
532       "",
533       textParameters,
534       embeddedItems,
535       true
536   };
537
538   if( !CircularRenderTest( data ) )
539   {
540     tet_result(TET_FAIL);
541   }
542
543   textParameters.circularAlignment = "begin";
544   if( !CircularRenderTest( data ) )
545   {
546     tet_result(TET_FAIL);
547   }
548
549   textParameters.circularAlignment = "end";
550   if( !CircularRenderTest( data ) )
551   {
552     tet_result(TET_FAIL);
553   }
554
555   textParameters.text = "שלום עולם مرحبا بالعالم שלום עולם مرحبا بالعالم שלום עולם مرحبا بالعالم";
556   textParameters.layout = "singleLine";
557   textParameters.horizontalAlignment = "end";
558   textParameters.fontSize = 90.f;
559   if( !CircularRenderTest( data ) )
560   {
561     tet_result(TET_FAIL);
562   }
563
564   tet_result(TET_PASS);
565   END_TEST;
566 }
567
568 int UtcDaliTextCircularN(void)
569 {
570
571   ToolkitTestApplication application;
572   tet_infoline(" UtcDaliTextCircularN");
573
574   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
575   const std::string image2 = "<item 'width'=26 'height'=26/>";
576
577   Dali::Toolkit::DevelText::RendererParameters textParameters;
578   textParameters.text = "hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
579   textParameters.horizontalAlignment = "center";
580   textParameters.verticalAlignment = "center";
581   textParameters.circularAlignment = "center";
582   textParameters.fontFamily = "SamsungUI";
583   textParameters.fontWeight = "";
584   textParameters.fontWidth = "";
585   textParameters.fontSlant = "";
586   textParameters.layout = "singleLine";
587   textParameters.textColor = Color::BLACK;
588   textParameters.fontSize = 25.f;
589   textParameters.textWidth = 360u;
590   textParameters.textHeight = 360u;
591   textParameters.radius = 180u;
592   textParameters.beginAngle = 15.f;
593   textParameters.incrementAngle = 360.f;
594   textParameters.ellipsisEnabled = true;
595   textParameters.markupEnabled = true;
596
597   CircularTextData data =
598   {
599       "singleLine",
600       "",
601       textParameters,
602       embeddedItems,
603       true
604   };
605
606   if( !CircularRenderTest( data ) )
607   {
608     tet_result(TET_FAIL);
609   }
610
611   textParameters.verticalAlignment = "top";
612   if( !CircularRenderTest( data ) )
613   {
614     tet_result(TET_FAIL);
615   }
616
617   textParameters.verticalAlignment = "bottom";
618   if( !CircularRenderTest( data ) )
619   {
620     tet_result(TET_FAIL);
621   }
622
623   textParameters.textWidth = 90u;
624   if( !CircularRenderTest( data ) )
625   {
626     tet_result(TET_FAIL);
627   }
628
629   tet_result(TET_PASS);
630   END_TEST;
631 }
632
633 int UtcDaliTextCircularBlend(void)
634 {
635   tet_infoline(" UtcDaliTextCircularN");
636
637   ToolkitTestApplication application;
638   Stage stage = Stage::GetCurrent();
639   stage.SetBackgroundColor( Color::WHITE );
640   stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
641
642
643   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
644   const std::string image2 = "<item 'width'=26 'height'=26/>";
645
646   Dali::Toolkit::DevelText::RendererParameters textParameters;
647   textParameters.text = "hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
648   textParameters.horizontalAlignment = "center";
649   textParameters.verticalAlignment = "center";
650   textParameters.circularAlignment = "center";
651   textParameters.fontFamily = "SamsungUI";
652   textParameters.fontWeight = "";
653   textParameters.fontWidth = "";
654   textParameters.fontSlant = "";
655   textParameters.layout = "circular";
656   textParameters.textColor = Color::BLACK;
657   textParameters.fontSize = 25.f;
658   textParameters.textWidth = 360u;
659   textParameters.textHeight = 360u;
660   textParameters.radius = 180u;
661   textParameters.beginAngle = 15.f;
662   textParameters.incrementAngle = 360.f;
663   textParameters.ellipsisEnabled = true;
664   textParameters.markupEnabled = true;
665
666   CircularTextData data =
667   {
668       "blend",
669       "",
670       textParameters,
671       embeddedItems,
672       false
673   };
674
675   if( !CircularRenderTest( data ) )
676   {
677     tet_result(TET_FAIL);
678   }
679
680   tet_result(TET_PASS);
681   END_TEST;
682 }
683
684 int UtcDaliTextCircularEllipsis(void)
685 {
686   tet_infoline(" UtcDaliTextCircularEllipsis");
687
688   ToolkitTestApplication application;
689
690   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
691   const std::string image2 = "<item 'width'=26 'height'=26/>";
692
693   Dali::Toolkit::DevelText::RendererParameters textParameters;
694   textParameters.text = "hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
695   textParameters.horizontalAlignment = "center";
696   textParameters.verticalAlignment = "center";
697   textParameters.circularAlignment = "center";
698   textParameters.fontFamily = "SamsungUI";
699   textParameters.fontWeight = "";
700   textParameters.fontWidth = "";
701   textParameters.fontSlant = "";
702   textParameters.layout = "circular";
703   textParameters.textColor = Color::BLACK;
704   textParameters.fontSize = 25.f;
705   textParameters.textWidth = 360u;
706   textParameters.textHeight = 360u;
707   textParameters.radius = 180u;
708   textParameters.beginAngle = 15.f;
709   textParameters.incrementAngle = 360.f;
710   textParameters.ellipsisEnabled = false;
711   textParameters.markupEnabled = true;
712
713   CircularTextData data =
714   {
715       "ellipsis",
716       "",
717       textParameters,
718       embeddedItems,
719       true
720   };
721
722   if( !CircularRenderTest( data ) )
723   {
724     tet_result(TET_FAIL);
725   }
726
727   textParameters.layout = "singleLine";
728   textParameters.textHeight = 50u;
729   textParameters.ellipsisEnabled = true;
730
731   if( !CircularRenderTest( data ) )
732   {
733     tet_result(TET_FAIL);
734   }
735
736   tet_result(TET_PASS);
737   END_TEST;
738 }
739
740 int UtcDaliTextCircularEmoji(void)
741 {
742   tet_infoline(" UtcDaliTextCircularEmoji");
743
744   ToolkitTestApplication application;
745
746   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
747   const std::string image2 = "<item 'width'=26 'height'=26/>";
748
749   Dali::Toolkit::DevelText::RendererParameters textParameters;
750   textParameters.text = "<font family='BreezeColorEmoji' size='60'>\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84</font>";
751   textParameters.horizontalAlignment = "center";
752   textParameters.verticalAlignment = "center";
753   textParameters.circularAlignment = "center";
754   textParameters.fontFamily = "SamsungUI";
755   textParameters.fontWeight = "";
756   textParameters.fontWidth = "";
757   textParameters.fontSlant = "";
758   textParameters.layout = "circular";
759   textParameters.textColor = Color::BLACK;
760   textParameters.fontSize = 25.f;
761   textParameters.textWidth = 360u;
762   textParameters.textHeight = 360u;
763   textParameters.radius = 180u;
764   textParameters.beginAngle = 15.f;
765   textParameters.incrementAngle = 360.f;
766   textParameters.ellipsisEnabled = true;
767   textParameters.markupEnabled = true;
768
769   CircularTextData data =
770   {
771       "Emoji",
772       "",
773       textParameters,
774       embeddedItems,
775       true
776   };
777
778   if( !CircularRenderTest( data ) )
779   {
780     tet_result(TET_FAIL);
781   }
782
783   tet_result(TET_PASS);
784   END_TEST;
785 }
786
787 int UtcDaliTextUpdateBufferFormatCheck(void)
788 {
789   tet_infoline(" UtcDaliTextUpdateBufferFormatCheck");
790   ToolkitTestApplication application;
791
792   Devel::PixelBuffer srcBuffer = Devel::PixelBuffer::New( 10, 10, Pixel::RGBA8888 );
793   Devel::PixelBuffer dstBuffer = Devel::PixelBuffer::New( 10, 10, Pixel::A8 );
794
795   Dali::Toolkit::DevelText::UpdateBuffer(srcBuffer, dstBuffer, 0, 0, true);
796
797   tet_result(TET_PASS);
798   END_TEST;
799 }
800
801 int UtcDaliTextCircularTextColor(void)
802 {
803   tet_infoline(" UtcDaliTextCircularTextColor");
804
805   ToolkitTestApplication application;
806
807   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 + "'/>";
808   const std::string image2 = "<item 'width'=26 'height'=26/>";
809
810   Dali::Toolkit::DevelText::RendererParameters textParameters;
811   textParameters.text = "hello " + image1 + " <color value='blue'>world</color> " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
812   textParameters.horizontalAlignment = "center";
813   textParameters.verticalAlignment = "center";
814   textParameters.circularAlignment = "center";
815   textParameters.fontFamily = "SamsungUI";
816   textParameters.fontWeight = "";
817   textParameters.fontWidth = "";
818   textParameters.fontSlant = "";
819   textParameters.layout = "circular";
820   textParameters.textColor = Color::BLACK;
821   textParameters.fontSize = 25.f;
822   textParameters.textWidth = 360u;
823   textParameters.textHeight = 360u;
824   textParameters.radius = 180u;
825   textParameters.beginAngle = 15.f;
826   textParameters.incrementAngle = 360.f;
827   textParameters.ellipsisEnabled = true;
828   textParameters.markupEnabled = true;
829
830   CircularTextData data =
831   {
832       "textColor",
833       "",
834       textParameters,
835       embeddedItems,
836       true
837   };
838
839   if( !CircularRenderTest( data ) )
840   {
841     tet_result(TET_FAIL);
842   }
843
844   tet_result(TET_PASS);
845   END_TEST;
846 }
847
848 int UtcDaliTextCircularColorBlend(void)
849 {
850   tet_infoline(" UtcDaliTextCircularColorBlend");
851
852   ToolkitTestApplication application;
853
854   const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + TEST_IMAGE_FILE_NAME1 +  "' 'color-blending'=multiply/>";
855   const std::string image2 = "<item 'width'=26 'height'=26/>";
856
857   Dali::Toolkit::DevelText::RendererParameters textParameters;
858   textParameters.text = "hello " + image1 + " world " + image2 + " this " + image1 + " is " + image2 + " a " + image1 + " demo " + image2 + " of " + image1 + " circular " + image2 + " text " + image1 + " width " + image2 + " icons.";
859   textParameters.horizontalAlignment = "center";
860   textParameters.verticalAlignment = "center";
861   textParameters.circularAlignment = "center";
862   textParameters.fontFamily = "SamsungUI";
863   textParameters.fontWeight = "";
864   textParameters.fontWidth = "";
865   textParameters.fontSlant = "";
866   textParameters.layout = "circular";
867   textParameters.textColor = Color::BLACK;
868   textParameters.fontSize = 25.f;
869   textParameters.textWidth = 360u;
870   textParameters.textHeight = 360u;
871   textParameters.radius = 180u;
872   textParameters.beginAngle = 15.f;
873   textParameters.incrementAngle = 360.f;
874   textParameters.ellipsisEnabled = true;
875   textParameters.markupEnabled = true;
876
877   CircularTextData data =
878   {
879       "colorBlend",
880       "",
881       textParameters,
882       embeddedItems,
883       true
884   };
885
886   if( !CircularRenderTest( data ) )
887   {
888     tet_result(TET_FAIL);
889   }
890
891   tet_result(TET_PASS);
892   END_TEST;
893 }