[NUI] Rebase develnui (DevelNUI only patches --> master) (#3910)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / BaseComponents / TSTextMapHelper.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using Tizen.NUI.Text;
7 using System.Collections.Generic;
8
9 namespace Tizen.NUI.Devel.Tests
10 {
11     using tlog = Tizen.Log;
12
13     [TestFixture]
14     [Description("public/BaseComponents/TextMapHelper")]
15     class PublicTextMapHelperTest
16     {
17         private const string tag = "NUITEST";
18
19         public bool CheckColor(Color colorSrc, Color colorDst)
20         {
21             if (colorSrc.R == colorDst.R && colorSrc.G == colorDst.G && colorSrc.B == colorDst.B && colorSrc.A == colorDst.A)
22                 return true;
23
24             return false;
25         }
26
27         public bool CheckVector2(Vector2 vectorSrc, Vector2 vectorDst)
28         {
29             if (vectorSrc.X == vectorDst.X && vectorSrc.Y == vectorDst.Y)
30                 return true;
31
32             return false;
33         }
34
35         [SetUp]
36         public void Init()
37         {
38             tlog.Info(tag, "Init() is called!");
39         }
40
41         [TearDown]
42         public void Destroy()
43         {
44             tlog.Info(tag, "Destroy() is called!");
45         }
46
47         [Test]
48         [Category("P1")]
49         [Description("TextMapHelper GetFontWidthString.")]
50         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWidthString M")]
51         [Property("SPEC_URL", "-")]
52         [Property("CRITERIA", "MR")]
53         [Property("AUTHOR", "bowon.ryu@samsung.com")]
54         public void TextMapHelperGetFontWidthString()
55         {
56             tlog.Debug(tag, $"TextMapHelperGetFontWidthString START");
57
58             string fontWidthString;
59
60             fontWidthString = TextMapHelper.GetFontWidthString(FontWidthType.ExtraCondensed);
61             Assert.AreEqual("extraCondensed", fontWidthString, "Should be equal!");
62
63             tlog.Debug(tag, $"TextMapHelperGetFontWidthString END (OK)");
64         }
65
66         [Test]
67         [Category("P1")]
68         [Description("TextMapHelper GetFontWeightString.")]
69         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWeightString M")]
70         [Property("SPEC_URL", "-")]
71         [Property("CRITERIA", "MR")]
72         [Property("AUTHOR", "bowon.ryu@samsung.com")]
73         public void TextMapHelperGetFontWeightString()
74         {
75             tlog.Debug(tag, $"TextMapHelperGetFontWeightString START");
76
77             string fontWeightString;
78
79             fontWeightString = TextMapHelper.GetFontWeightString(FontWeightType.Light);
80             Assert.AreEqual("light", fontWeightString, "Should be equal!");
81
82             tlog.Debug(tag, $"TextMapHelperGetFontWeightString END (OK)");
83         }
84
85         [Test]
86         [Category("P1")]
87         [Description("TextMapHelper GetFontSlantString.")]
88         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSlantString M")]
89         [Property("SPEC_URL", "-")]
90         [Property("CRITERIA", "MR")]
91         [Property("AUTHOR", "bowon.ryu@samsung.com")]
92         public void TextMapHelperGetFontSlantString()
93         {
94             tlog.Debug(tag, $"TextMapHelperGetFontSlantString START");
95
96             string fontSlantString;
97
98             fontSlantString = TextMapHelper.GetFontSlantString(FontSlantType.Italic);
99             Assert.AreEqual("italic", fontSlantString, "Should be equal!");
100
101             tlog.Debug(tag, $"TextMapHelperGetFontSlantString END (OK)");
102         }
103
104         [Test]
105         [Category("P1")]
106         [Description("TextMapHelper GetFontWidthType.")]
107         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWidthType M")]
108         [Property("SPEC_URL", "-")]
109         [Property("CRITERIA", "MR")]
110         [Property("AUTHOR", "bowon.ryu@samsung.com")]
111         public void TextMapHelperGetFontWidthType()
112         {
113             tlog.Debug(tag, $"TextMapHelperGetFontWidthType START");
114
115             FontWidthType fontWidthType;
116
117             fontWidthType = TextMapHelper.GetFontWidthType("ExtraCondensed");
118             Assert.AreEqual(FontWidthType.ExtraCondensed, fontWidthType, "Should be equal!");
119
120             fontWidthType = TextMapHelper.GetFontWidthType("InvalidType");
121             Assert.AreEqual(FontWidthType.None, fontWidthType, "If invalid type, should be None type!");
122
123             tlog.Debug(tag, $"TextMapHelperGetFontWidthType END (OK)");
124         }
125
126         [Test]
127         [Category("P1")]
128         [Description("TextMapHelper GetFontWeightType.")]
129         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWeightType M")]
130         [Property("SPEC_URL", "-")]
131         [Property("CRITERIA", "MR")]
132         [Property("AUTHOR", "bowon.ryu@samsung.com")]
133         public void TextMapHelperGetFontWeightType()
134         {
135             tlog.Debug(tag, $"TextMapHelperGetFontWeightType START");
136
137             FontWeightType fontWeightType;
138
139             fontWeightType = TextMapHelper.GetFontWeightType("Light");
140             Assert.AreEqual(FontWeightType.Light, fontWeightType, "Should be equal!");
141
142             fontWeightType = TextMapHelper.GetFontWeightType("InvalidType");
143             Assert.AreEqual(FontWeightType.None, fontWeightType, "If invalid type, should be None type!");
144
145             tlog.Debug(tag, $"TextMapHelperGetFontWeightType END (OK)");
146         }
147
148         [Test]
149         [Category("P1")]
150         [Description("TextMapHelper GetFontSlantType.")]
151         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSlantType M")]
152         [Property("SPEC_URL", "-")]
153         [Property("CRITERIA", "MR")]
154         [Property("AUTHOR", "bowon.ryu@samsung.com")]
155         public void TextMapHelperGetFontSlantType()
156         {
157             tlog.Debug(tag, $"TextMapHelperGetFontSlantType START");
158
159             FontSlantType fontSlantType;
160
161             fontSlantType = TextMapHelper.GetFontSlantType("Italic");
162             Assert.AreEqual(FontSlantType.Italic, fontSlantType, "Should be equal!");
163
164             fontSlantType = TextMapHelper.GetFontSlantType("InvalidType");
165             Assert.AreEqual(FontSlantType.None, fontSlantType, "If invalid type, should be None type!");
166
167             tlog.Debug(tag, $"TextMapHelperGetFontSlantType END (OK)");
168         }
169
170         [Test]
171         [Category("P1")]
172         [Description("TextMapHelper GetFontStyleMap.")]
173         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontStyleMap M")]
174         [Property("SPEC_URL", "-")]
175         [Property("CRITERIA", "MR")]
176         [Property("AUTHOR", "bowon.ryu@samsung.com")]
177         public void TextMapHelperGetFontStyleMap()
178         {
179             tlog.Debug(tag, $"TextMapHelperGetFontStyleMap START");
180
181             var fontStyle = new Tizen.NUI.Text.FontStyle()
182             {
183                 Width = FontWidthType.Expanded,
184                 Weight = FontWeightType.Bold,
185                 Slant = FontSlantType.Italic
186             };
187
188             using (PropertyMap map = TextMapHelper.GetFontStyleMap(fontStyle))
189             {
190                 map.Find(0, "width").Get(out string width);
191                 map.Find(0, "weight").Get(out string weight);
192                 map.Find(0, "slant").Get(out string slant);
193
194                 Assert.AreEqual("expanded", width, "Should be equal!");
195                 Assert.AreEqual("bold", weight, "Should be equal!");
196                 Assert.AreEqual("italic", slant, "Should be equal!");
197             }
198
199             tlog.Debug(tag, $"TextMapHelperGetFontStyleMap END (OK)");
200         }
201
202         [Test]
203         [Category("P1")]
204         [Description("TextMapHelper GetFontStyleStruct.")]
205         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontStyleStruct M")]
206         [Property("SPEC_URL", "-")]
207         [Property("CRITERIA", "MR")]
208         [Property("AUTHOR", "bowon.ryu@samsung.com")]
209         public void TextMapHelperGetFontStyleStruct()
210         {
211             tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct START");
212
213             using (var map = new PropertyMap())
214             {
215                 map.Add("width", "expanded");
216                 map.Add("weight", "bold");
217                 map.Add("slant", "italic");
218
219                 FontStyle fontStyle = TextMapHelper.GetFontStyleStruct(map);
220                 Assert.AreEqual(FontWidthType.Expanded, fontStyle.Width, "Should be equal!");
221                 Assert.AreEqual(FontWeightType.Bold, fontStyle.Weight, "Should be equal!");
222                 Assert.AreEqual(FontSlantType.Italic, fontStyle.Slant, "Should be equal!");
223             }
224
225             tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct END (OK)");
226         }
227
228         [Test]
229         [Category("P1")]
230         [Description("TextMapHelper GetInputFilterMap.")]
231         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetInputFilterMap M")]
232         [Property("SPEC_URL", "-")]
233         [Property("CRITERIA", "MR")]
234         [Property("AUTHOR", "bowon.ryu@samsung.com")]
235         public void TextMapHelperGetInputFilterMap()
236         {
237             tlog.Debug(tag, $"TextMapHelperGetInputFilterMap START");
238
239             var inputFilter = new Tizen.NUI.Text.InputFilter()
240             {
241                 Accepted = @"[\d]",
242                 Rejected = "[0-3]"
243             };
244
245             using (PropertyMap map = TextMapHelper.GetInputFilterMap(inputFilter))
246             {
247                 map.Find(0).Get(out string accepted);
248                 map.Find(1).Get(out string rejected);
249
250                 Assert.AreEqual(accepted, inputFilter.Accepted, "Should be equal!");
251                 Assert.AreEqual(rejected, inputFilter.Rejected, "Should be equal!");
252             }
253
254             tlog.Debug(tag, $"TextMapHelperGetInputFilterMap END (OK)");
255         }
256
257         [Test]
258         [Category("P1")]
259         [Description("TextMapHelper GetInputFilterStruct.")]
260         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetInputFilterStruct M")]
261         [Property("SPEC_URL", "-")]
262         [Property("CRITERIA", "MR")]
263         [Property("AUTHOR", "bowon.ryu@samsung.com")]
264         public void TextMapHelperGGetInputFilterStruct()
265         {
266             tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct START");
267
268             using (var map = new PropertyMap())
269             {
270                 map.Add(0, @"[\d]");
271                 map.Add(1, "[0-3]");
272
273                 var inputFilter = TextMapHelper.GetInputFilterStruct(map);
274                 Assert.AreEqual(@"[\d]", inputFilter.Accepted, "Should be equal!");
275                 Assert.AreEqual("[0-3]", inputFilter.Rejected, "Should be equal!");
276             }
277
278             tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct END (OK)");
279         }
280
281         [Test]
282         [Category("P1")]
283         [Description("TextMapHelper GetUnderlineMap.")]
284         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetUnderlineMap M")]
285         [Property("SPEC_URL", "-")]
286         [Property("CRITERIA", "MR")]
287         [Property("AUTHOR", "bowon.ryu@samsung.com")]
288         public void TextMapHelperGetUnderlineMap()
289         {
290             tlog.Debug(tag, $"TextMapHelperGetUnderlineMap START");
291
292             var underline = new Tizen.NUI.Text.Underline()
293             {
294                 Enable = true,
295                 Color = new Color("#3498DB"),
296                 Height = 2.0f,
297                 Type = UnderlineType.Solid,
298                 DashWidth = 5.0f,
299                 DashGap = 3.0f,
300             };
301
302             using (PropertyMap map = TextMapHelper.GetUnderlineMap(underline))
303             {
304                 var color = new Color();
305                 map.Find(0, "enable").Get(out bool enable);
306                 map.Find(0, "color").Get(color);
307                 map.Find(0, "height").Get(out float height);
308                 map.Find(0, "type").Get(out int type);
309                 map.Find(0, "dashWidth").Get(out float dashWidth);
310                 map.Find(0, "dashGap").Get(out float dashGap);
311
312                 Assert.AreEqual(enable, underline.Enable, "Should be equal!");
313                 Assert.AreEqual(height, underline.Height, "Should be equal!");
314                 Assert.AreEqual(true, CheckColor(color, underline.Color), "Should be true!");
315                 Assert.AreEqual(type, (int)underline.Type, "Should be equal!");
316                 Assert.AreEqual(dashWidth, underline.DashWidth, "Should be equal!");
317                 Assert.AreEqual(dashGap, underline.DashGap, "Should be equal!");
318
319                 color.Dispose();
320             }
321
322             tlog.Debug(tag, $"TextMapHelperGetUnderlineMap END (OK)");
323         }
324
325         [Test]
326         [Category("P1")]
327         [Description("TextMapHelper GetStrikethroughStruct.")]
328         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetStrikethroughStruct M")]
329         [Property("SPEC_URL", "-")]
330         [Property("CRITERIA", "MR")]
331         [Property("AUTHOR", "bowon.ryu@samsung.com")]
332         public void TextMapHelperGetStrikethroughStruct()
333         {
334             tlog.Debug(tag, $"TextMapHelperGetStrikethroughStruct START");
335
336             using (var map = new PropertyMap())
337             {
338                 var color = new Color("#3498DB");
339                 map.Add("enable", true);
340                 map.Add("color", color);
341                 map.Add("height", (float)2.0f);
342
343                 var strikethrough = TextMapHelper.GetStrikethroughStruct(map);
344                 Assert.AreEqual(true, strikethrough.Enable, "Should be equal!");
345                 Assert.AreEqual(2.0f, strikethrough.Height, "Should be equal!");
346                 Assert.AreEqual(true, CheckColor(color, strikethrough.Color), "Should be true!");
347                 color.Dispose();
348             }
349
350             tlog.Debug(tag, $"TextMapHelperGetStrikethroughStruct END (OK)");
351         }
352
353         [Test]
354         [Category("P1")]
355         [Description("TextMapHelper GetStrikethroughMap.")]
356         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetStrikethroughMap M")]
357         [Property("SPEC_URL", "-")]
358         [Property("CRITERIA", "MR")]
359         [Property("AUTHOR", "bowon.ryu@samsung.com")]
360         public void TextMapHelperGetStrikethroughMap()
361         {
362             tlog.Debug(tag, $"TextMapHelperGetStrikethroughMap START");
363
364             var strikethrough = new Tizen.NUI.Text.Strikethrough()
365             {
366                 Enable = true,
367                 Color = new Color("#3498DB"),
368                 Height = 2.0f
369             };
370
371             using (PropertyMap map = TextMapHelper.GetStrikethroughMap(strikethrough))
372             {
373                 var color = new Color();
374                 map.Find(0, "enable").Get(out bool enable);
375                 map.Find(0, "color").Get(color);
376                 map.Find(0, "height").Get(out float height);
377
378                 Assert.AreEqual(enable, strikethrough.Enable, "Should be equal!");
379                 Assert.AreEqual(height, strikethrough.Height, "Should be equal!");
380                 Assert.AreEqual(true, CheckColor(color, strikethrough.Color), "Should be true!");
381                 color.Dispose();
382             }
383
384             tlog.Debug(tag, $"TextMapHelperGetStrikethroughMap END (OK)");
385         }
386
387         [Test]
388         [Category("P1")]
389         [Description("TextMapHelper GetUnderlineStruct.")]
390         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetUnderlineStruct M")]
391         [Property("SPEC_URL", "-")]
392         [Property("CRITERIA", "MR")]
393         [Property("AUTHOR", "bowon.ryu@samsung.com")]
394         public void TextMapHelperGetUnderlineStruct()
395         {
396             tlog.Debug(tag, $"TextMapHelperGetUnderlineStruct START");
397
398             using (var map = new PropertyMap())
399             {
400                 var color = new Color("#3498DB");
401                 map.Add("enable", true);
402                 map.Add("color", color);
403                 map.Add("height", (float)2.0f);
404
405                 var underline = TextMapHelper.GetUnderlineStruct(map);
406                 Assert.AreEqual(true, underline.Enable, "Should be equal!");
407                 Assert.AreEqual(2.0f, underline.Height, "Should be equal!");
408                 Assert.AreEqual(true, CheckColor(color, underline.Color), "Should be true!");
409                 color.Dispose();
410             }
411
412             tlog.Debug(tag, $"TextMapHelperGetUnderlineStruct END (OK)");
413         }
414
415         [Test]
416         [Category("P1")]
417         [Description("TextMapHelper GetShadowMap.")]
418         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetShadowMap M")]
419         [Property("SPEC_URL", "-")]
420         [Property("CRITERIA", "MR")]
421         [Property("AUTHOR", "bowon.ryu@samsung.com")]
422         public void TextMapHelperGetShadowMap()
423         {
424             tlog.Debug(tag, $"TextMapHelperGetShadowMap START");
425
426             var shadow = new Tizen.NUI.Text.Shadow()
427             {
428                 Offset = new Vector2(3, 3),
429                 Color = new Color("#F1C40F"),
430                 BlurRadius = 2.0f,
431             };
432
433             using (PropertyMap map = TextMapHelper.GetShadowMap(shadow))
434             {
435                 var offset = new Vector2();
436                 var color = new Color();
437                 map.Find(0, "offset").Get(offset);
438                 map.Find(0, "color").Get(color);
439                 map.Find(0, "blurRadius").Get(out float blurRadius);
440
441                 Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
442                 Assert.AreEqual(true, CheckVector2(offset, shadow.Offset), "Should be true!");
443                 Assert.AreEqual(true, CheckColor(color, shadow.Color), "Should be true!");
444                 offset.Dispose();
445                 color.Dispose();
446             }
447
448             tlog.Debug(tag, $"TextMapHelperGetShadowMap END (OK)");
449         }
450
451         [Test]
452         [Category("P1")]
453         [Description("TextMapHelper GetShadowStruct.")]
454         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetShadowStruct M")]
455         [Property("SPEC_URL", "-")]
456         [Property("CRITERIA", "MR")]
457         [Property("AUTHOR", "bowon.ryu@samsung.com")]
458         public void TextMapHelperGetShadowStruct()
459         {
460             tlog.Debug(tag, $"TextMapHelperGetShadowStruct START");
461
462             var offset = new Vector2(5, 5);
463             var color = new Color("#F1C40F");
464             float blurRadius = 5.0f;
465
466             using (var map = new PropertyMap())
467             {
468                 map.Add("offset", offset);
469                 map.Add("color", color);
470                 map.Add("blurRadius", (float)blurRadius);
471
472                 var shadow = TextMapHelper.GetShadowStruct(map);
473                 Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
474                 Assert.AreEqual(true, CheckVector2(offset, shadow.Offset), "Should be true!");
475                 Assert.AreEqual(true, CheckColor(color, shadow.Color), "Should be true!");
476             }
477
478             offset.Dispose();
479             color.Dispose();
480
481             tlog.Debug(tag, $"TextMapHelperGetShadowStruct END (OK)");
482         }
483
484         [Test]
485         [Category("P1")]
486         [Description("TextMapHelper GetOutlineMap.")]
487         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetOutlineMap M")]
488         [Property("SPEC_URL", "-")]
489         [Property("CRITERIA", "MR")]
490         [Property("AUTHOR", "guowei.wang@samsung.com")]
491         public void TextMapHelperGetOutlineMap()
492         {
493             tlog.Debug(tag, $"TextMapHelperGetOutlineMap START");
494
495             var outline = new Tizen.NUI.Text.Outline()
496             {
497                 Width = 2.0f,
498                 Color = new Color("#45B39D"),
499             };
500
501             using (PropertyMap map = TextMapHelper.GetOutlineMap(outline))
502             {
503                 var color = new Color();
504                 map.Find(0, "color").Get(color);
505                 map.Find(0, "width").Get(out float width);
506
507                 Assert.AreEqual(width, outline.Width, "Should be equal!");
508                 Assert.AreEqual(true, CheckColor(color, outline.Color), "Should be true!");
509                 color.Dispose();
510             }
511
512             tlog.Debug(tag, $"TextMapHelperGetOutlineMap END (OK)");
513         }
514
515         [Test]
516         [Category("P1")]
517         [Description("TextMapHelper GetOutlineStruct.")]
518         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetOutlineStruct M")]
519         [Property("SPEC_URL", "-")]
520         [Property("CRITERIA", "MR")]
521         [Property("AUTHOR", "guowei.wang@samsung.com")]
522         public void TextMapHelperGetOutlineStruct()
523         {
524             tlog.Debug(tag, $"TextMapHelperGetOutlineStruct START");
525
526             var width = 2.0f;
527             var color = new Color("#45B39D");
528
529             using (var map = new PropertyMap())
530             {
531                 map.Add("color", color);
532                 map.Add("width", (float)width);
533
534                 var outline = TextMapHelper.GetOutlineStruct(map);
535                 Assert.AreEqual(width, outline.Width, "Should be equal!");
536                 Assert.AreEqual(true, CheckColor(color, outline.Color), "Should be true!");
537             }
538
539             color.Dispose();
540
541             tlog.Debug(tag, $"TextMapHelperGetOutlineStruct END (OK)");
542         }
543
544         [Test]
545         [Category("P1")]
546         [Description("TextMapHelper GetFontSizeString.")]
547         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSizeString M")]
548         [Property("SPEC_URL", "-")]
549         [Property("CRITERIA", "MR")]
550         [Property("AUTHOR", "bowon.ryu@samsung.com")]
551         public void TextMapHelperGetFontSizeString()
552         {
553             tlog.Debug(tag, $"TextMapHelperGetFontSizeString START");
554
555             string fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PointSize);
556             Assert.AreEqual("pointSize", fontSizeTypeString, "Should be equal!");
557
558             fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PixelSize);
559             Assert.AreEqual("pixelSize", fontSizeTypeString, "Should be equal!");
560
561             tlog.Debug(tag, $"TextMapHelperGetFontSizeString END (OK)");
562         }
563
564         [Test]
565         [Category("P1")]
566         [Description("TextMapHelper GetFontSizeType.")]
567         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSizeType M")]
568         [Property("SPEC_URL", "-")]
569         [Property("CRITERIA", "MR")]
570         [Property("AUTHOR", "bowon.ryu@samsung.com")]
571         public void TextMapHelperGetFontSizeType()
572         {
573             tlog.Debug(tag, $"TextMapHelperGetFontSizeType START");
574
575             FontSizeType fontSizeType;
576
577             fontSizeType = TextMapHelper.GetFontSizeType("PointSize");
578             Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "Should be equal!");
579
580             fontSizeType = TextMapHelper.GetFontSizeType("PixelSize");
581             Assert.AreEqual(FontSizeType.PixelSize, fontSizeType, "Should be equal!");
582
583             fontSizeType = TextMapHelper.GetFontSizeType("InvalidType");
584             Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "If invalid type, should be PointSize type!");
585
586             tlog.Debug(tag, $"TextMapHelperGetFontSizeType END (OK)");
587         }
588
589         [Test]
590         [Category("P1")]
591         [Description("TextMapHelper GetTextFitMap.")]
592         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetTextFitMap M")]
593         [Property("SPEC_URL", "-")]
594         [Property("CRITERIA", "MR")]
595         [Property("AUTHOR", "bowon.ryu@samsung.com")]
596         public void TextMapHelperGetTextFitMap()
597         {
598             tlog.Debug(tag, $"TextMapHelperGetTextFitMap START");
599
600             var textFit = new Tizen.NUI.Text.TextFit()
601             {
602                 Enable = true,
603                 MinSize = 10.0f,
604                 MaxSize = 100.0f,
605                 StepSize = 5.0f,
606                 FontSizeType = FontSizeType.PointSize
607             };
608
609             using (PropertyMap map = TextMapHelper.GetTextFitMap(textFit))
610             {
611                 map.Find(0, "enable").Get(out bool enable);
612                 map.Find(0, "minSize").Get(out float minSize);
613                 map.Find(0, "maxSize").Get(out float maxSize);
614                 map.Find(0, "stepSize").Get(out float stepSize);
615                 map.Find(0, "fontSizeType").Get(out string fontSizeType);
616
617                 Assert.AreEqual(enable, textFit.Enable, "Should be equal!");
618                 Assert.AreEqual(minSize, textFit.MinSize, "Should be equal!");
619                 Assert.AreEqual(maxSize, textFit.MaxSize, "Should be equal!");
620                 Assert.AreEqual(stepSize, textFit.StepSize, "Should be equal!");
621                 Assert.AreEqual(fontSizeType, "pointSize", "Should be equal!");
622             }
623
624             tlog.Debug(tag, $"TextMapHelperGetTextFitMap END (OK)");
625         }
626
627         [Test]
628         [Category("P1")]
629         [Description("TextMapHelper GetTextFitStruct.")]
630         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetTextFitStruct M")]
631         [Property("SPEC_URL", "-")]
632         [Property("CRITERIA", "MR")]
633         [Property("AUTHOR", "bowon.ryu@samsung.com")]
634         public void TextMapHelperGetTextFitStruct()
635         {
636             tlog.Debug(tag, $"TextMapHelperGetTextFitStruct START");
637
638             bool enable = true;
639             float minSize = 10.0f;
640             float maxSize = 100.0f;
641             float stepSize = 5.0f;
642
643             using (var map = new PropertyMap())
644             {
645                 map.Add("enable", enable);
646                 map.Add("minSize", (float)minSize);
647                 map.Add("maxSize", (float)maxSize);
648                 map.Add("stepSize", (float)stepSize);
649                 map.Add("fontSizeType", "pointSize");
650
651                 var textFit = TextMapHelper.GetTextFitStruct(map);
652                 Assert.AreEqual(enable, textFit.Enable, "Should be equal!");
653                 Assert.AreEqual(minSize, textFit.MinSize, "Should be equal!");
654                 Assert.AreEqual(maxSize, textFit.MaxSize, "Should be equal!");
655                 Assert.AreEqual(stepSize, textFit.StepSize, "Should be equal!");
656                 Assert.AreEqual(FontSizeType.PointSize, textFit.FontSizeType, "Should be equal!");
657             }
658
659             tlog.Debug(tag, $"TextMapHelperGetTextFitStruct END (OK)");
660         }
661
662         [Test]
663         [Category("P1")]
664         [Description("TextMapHelper GetPlaceholderMap.")]
665         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetPlaceholderMap M")]
666         [Property("SPEC_URL", "-")]
667         [Property("CRITERIA", "MR")]
668         [Property("AUTHOR", "bowon.ryu@samsung.com")]
669         public void TextMapHelperGetPlaceholderMap()
670         {
671             tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap START");
672
673             var placeholder = new Tizen.NUI.Text.Placeholder()
674             {
675                 Text = "placeholder text",
676                 TextFocused = "placeholder textFocused",
677                 Color = new Color("#45B39D"),
678                 FontFamily = "BreezeSans",
679                 FontStyle = new Tizen.NUI.Text.FontStyle()
680                 {
681                     Width = FontWidthType.Expanded,
682                     Weight = FontWeightType.Bold,
683                     Slant = FontSlantType.Italic,
684                 },
685                 PointSize = 25.0f,
686                 Ellipsis = true
687             };
688
689             string text = "";
690             string textFocused = "";
691             Color color = new Color();
692             string fontFamily = null;
693             var fontStyle = new PropertyMap();
694             float pointSize;
695             bool ellipsis = false;
696
697             using (PropertyMap map = TextMapHelper.GetPlaceholderMap(placeholder))
698             {
699                 map.Find(0).Get(out text);
700                 map.Find(1).Get(out textFocused);
701                 map.Find(2).Get(color);
702                 map.Find(3).Get(out fontFamily);
703                 map.Find(4).Get(fontStyle);
704                 map.Find(5).Get(out pointSize);
705                 map.Find(7).Get(out ellipsis);
706                 fontStyle.Find(0, "width").Get(out string width);
707                 fontStyle.Find(0, "weight").Get(out string weight);
708                 fontStyle.Find(0, "slant").Get(out string slant);
709
710                 Assert.AreEqual(text, placeholder.Text, "Should be equal!");
711                 Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!");
712                 Assert.AreEqual(true, CheckColor(color, placeholder.Color), "Should be true!");
713                 Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!");
714                 Assert.AreEqual(width, "expanded", "Should be equal!");
715                 Assert.AreEqual(weight, "bold", "Should be equal!");
716                 Assert.AreEqual(slant, "italic", "Should be equal!");
717                 Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!");
718                 Assert.AreEqual(ellipsis, placeholder.Ellipsis, "Should be equal!");
719             }
720
721             color.Dispose();
722             fontStyle.Dispose();
723
724             tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap END (OK)");
725         }
726
727         [Test]
728         [Category("P1")]
729         [Description("TextMapHelper GetPlaceholderStruct.")]
730         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetPlaceholderStruct M")]
731         [Property("SPEC_URL", "-")]
732         [Property("CRITERIA", "MR")]
733         [Property("AUTHOR", "bowon.ryu@samsung.com")]
734         public void TextMapHelperGetPlaceholderStruct()
735         {
736             tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct START");
737
738             string text = "placeholder text";
739             string textFocused = "placeholder textFocused";
740             Color color = new Color("#45B39D");
741             string fontFamily = "BreezeSans";
742             var fontStyle = new PropertyMap();
743             fontStyle.Add("width", "expanded");
744             fontStyle.Add("weight", "bold");
745             fontStyle.Add("slant", "italic");
746             float pointSize = 25.0f;
747             bool ellipsis = false;
748
749             using (var map = new PropertyMap())
750             {
751                 map.Add(0, text);
752                 map.Add(1, textFocused);
753                 map.Add(2, color);
754                 map.Add(3, fontFamily);
755                 map.Add(4, new PropertyValue(fontStyle));
756                 map.Add(5, (float)pointSize);
757                 map.Add(7, ellipsis);
758
759                 var placeholder = TextMapHelper.GetPlaceholderStruct(map);
760
761                 Assert.AreEqual(text, placeholder.Text, "Should be equal!");
762                 Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!");
763                 Assert.AreEqual(true, CheckColor(color, placeholder.Color), "Should be true!");
764                 Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!");
765                 Assert.AreEqual(FontWidthType.Expanded, placeholder.FontStyle?.Width, "Should be equal!");
766                 Assert.AreEqual(FontWeightType.Bold, placeholder.FontStyle?.Weight, "Should be equal!");
767                 Assert.AreEqual(FontSlantType.Italic, placeholder.FontStyle?.Slant, "Should be equal!");
768                 Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!");
769                 Assert.AreEqual(ellipsis, false, "Should be equal!");
770             }
771
772             color.Dispose();
773             fontStyle.Dispose();
774
775             tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct END (OK)");
776         }
777
778         [Test]
779         [Category("P1")]
780         [Description("TextMapHelper GetHiddenInputMap.")]
781         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetHiddenInputMap M")]
782         [Property("SPEC_URL", "-")]
783         [Property("CRITERIA", "MR")]
784         [Property("AUTHOR", "bowon.ryu@samsung.com")]
785         public void TextMapHelperGetHiddenInputMap()
786         {
787             tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap START");
788
789             var hiddenInput = new Tizen.NUI.Text.HiddenInput()
790             {
791                 Mode = HiddenInputModeType.ShowLastCharacter,
792                 SubstituteCharacter = '★',
793                 SubstituteCount = 0,
794                 ShowLastCharacterDuration = 1000
795             };
796
797             using (PropertyMap map = TextMapHelper.GetHiddenInputMap(hiddenInput))
798             {
799                 map.Find(0).Get(out int mode);
800                 map.Find(1).Get(out int substituteCharacter);
801                 map.Find(2).Get(out int substituteCount);
802                 map.Find(3).Get(out int showLastCharacterDuration);
803
804                 Assert.AreEqual(mode, (int)hiddenInput.Mode, "Should be equal!");
805                 Assert.AreEqual(substituteCharacter, Convert.ToInt32(hiddenInput.SubstituteCharacter), "Should be equal!");
806                 Assert.AreEqual(substituteCount, hiddenInput.SubstituteCount, "Should be equal!");
807                 Assert.AreEqual(showLastCharacterDuration, hiddenInput.ShowLastCharacterDuration, "Should be equal!");
808             }
809
810             tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap END (OK)");
811         }
812
813         [Test]
814         [Category("P1")]
815         [Description("TextMapHelper GetHiddenInputStruct.")]
816         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetHiddenInputStruct M")]
817         [Property("SPEC_URL", "-")]
818         [Property("CRITERIA", "MR")]
819         [Property("AUTHOR", "bowon.ryu@samsung.com")]
820         public void TextMapHelperGetHiddenInputStruct()
821         {
822             tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct START");
823
824             int mode = (int)HiddenInputModeType.ShowLastCharacter;
825             int substituteCharacter = Convert.ToInt32('★');
826             int substituteCount = 0;
827             int showLastCharacterDuration = 1000;
828
829             using (var map = new PropertyMap())
830             {
831                 map.Add(0, mode);
832                 map.Add(1, substituteCharacter);
833                 map.Add(2, substituteCount);
834                 map.Add(3, showLastCharacterDuration);
835
836                 var hiddenInput = TextMapHelper.GetHiddenInputStruct(map);
837                 Assert.AreEqual(mode, (int)hiddenInput.Mode, "Should be equal!");
838                 Assert.AreEqual(substituteCharacter, Convert.ToInt32(hiddenInput.SubstituteCharacter), "Should be equal!");
839                 Assert.AreEqual(substituteCount, hiddenInput.SubstituteCount, "Should be equal!");
840                 Assert.AreEqual(showLastCharacterDuration, hiddenInput.ShowLastCharacterDuration, "Should be equal!");
841             }
842
843             tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct END (OK)");
844         }
845
846         [Test]
847         [Category("P1")]
848         [Description("TextMapHelper GetFileNameMap.")]
849         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFileNameMap M")]
850         [Property("SPEC_URL", "-")]
851         [Property("CRITERIA", "MR")]
852         [Property("AUTHOR", "bowon.ryu@samsung.com")]
853         public void TextMapHelperGetFileNameMap()
854         {
855             tlog.Debug(tag, $"TextMapHelperGetFileNameMap START");
856
857             string url = "filePath";
858
859             using (PropertyMap map = TextMapHelper.GetFileNameMap(url))
860             {
861                 map.Find(0, "filename").Get(out string fileName);
862                 Assert.AreEqual(url, fileName, "Should be equal!");
863             }
864
865             tlog.Debug(tag, $"TextMapHelperGetFileNameMap END (OK)");
866         }
867
868         [Test]
869         [Category("P1")]
870         [Description("TextMapHelper GetSelectionHandleImageStruct.")]
871         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetSelectionHandleImageStruct M")]
872         [Property("SPEC_URL", "-")]
873         [Property("CRITERIA", "MR")]
874         [Property("AUTHOR", "bowon.ryu@samsung.com")]
875         public void TextMapHelperGetSelectionHandleImageStruct()
876         {
877             tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct START");
878
879             string leftImageUrl = "leftImageUrl";
880             string rightImageUrl = "rightImageUrl";
881
882             using (var leftImageMap = new PropertyMap().Add("filename", leftImageUrl))
883             using (var rightImageMap = new PropertyMap().Add("filename", rightImageUrl))
884             {
885                 var selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
886
887                 Assert.AreEqual(leftImageUrl, selectionHandleImage.LeftImageUrl, "Should be equal!");
888                 Assert.AreEqual(rightImageUrl, selectionHandleImage.RightImageUrl, "Should be equal!");
889             }
890
891             tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct END (OK)");
892         }
893
894         [Test]
895         [Category("P1")]
896         [Description("TextMapHelper GetCamelCase.")]
897         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetCamelCase M")]
898         [Property("SPEC_URL", "-")]
899         [Property("CRITERIA", "MR")]
900         [Property("AUTHOR", "bowon.ryu@samsung.com")]
901         public void TextMapHelperGetCamelCase()
902         {
903             tlog.Debug(tag, $"TextMapHelperGetCamelCase START");
904
905             string pascalCase = "TextMapHelper";
906             string camelCase = "textMapHelper";
907             string expectedResult = TextMapHelper.GetCamelCase(pascalCase);
908
909             Assert.AreEqual(camelCase, expectedResult, "Should be equal!");
910
911             string emptyString = "";
912             expectedResult = TextMapHelper.GetCamelCase(emptyString);
913
914             Assert.AreEqual(emptyString, expectedResult, "Should be equal!");
915
916             tlog.Debug(tag, $"TextMapHelperGetCamelCase END (OK)");
917         }
918
919         [Test]
920         [Category("P1")]
921         [Description("TextMapHelper GetStringFromMap.")]
922         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetStringFromMap M")]
923         [Property("SPEC_URL", "-")]
924         [Property("CRITERIA", "MR")]
925         [Property("AUTHOR", "bowon.ryu@samsung.com")]
926         public void TextMapHelperGetStringFromMap()
927         {
928             tlog.Debug(tag, $"TextMapHelperGetStringFromMap START");
929
930             var stringKey = "width";
931             var stringInvalidKey = "invalidKey";
932             var intKey = 1;
933             var intInvalidKey = 10;
934             var value = "expanded";
935             var defaultValue = "none";
936
937             using (var map = new PropertyMap())
938             {
939                 map.Add(stringKey, value);
940                 map.Add(intKey, value);
941
942                 var result = TextMapHelper.GetStringFromMap(map, stringKey, defaultValue);
943                 Assert.AreEqual(value, result, "Should be equal!");
944
945                 result = TextMapHelper.GetStringFromMap(map, stringInvalidKey, defaultValue);
946                 Assert.AreEqual(defaultValue, result, "Should be equal!");
947
948                 result = TextMapHelper.GetStringFromMap(map, intKey, defaultValue);
949                 Assert.AreEqual(value, result, "Should be equal!");
950
951                 result = TextMapHelper.GetStringFromMap(map, intInvalidKey, defaultValue);
952                 Assert.AreEqual(defaultValue, result, "Should be equal!");
953             }
954
955             tlog.Debug(tag, $"TextMapHelperGetStringFromMap END (OK)");
956         }
957
958         [Test]
959         [Category("P1")]
960         [Description("TextMapHelper GetBoolFromMap.")]
961         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetBoolFromMap M")]
962         [Property("SPEC_URL", "-")]
963         [Property("CRITERIA", "MR")]
964         [Property("AUTHOR", "bowon.ryu@samsung.com")]
965         public void TextMapHelperGetBoolFromMap()
966         {
967             tlog.Debug(tag, $"TextMapHelperGetBoolFromMap START");
968
969             var stringKey = "width";
970             var stringInvalidKey = "invalidKey";
971             var intKey = 1;
972             var intInvalidKey = 10;
973             var value = true;
974             var defaultValue = false;
975
976             using (var map = new PropertyMap())
977             {
978                 map.Add(stringKey, value);
979                 map.Add(intKey, value);
980
981                 var result = TextMapHelper.GetBoolFromMap(map, stringKey, defaultValue);
982                 Assert.AreEqual(value, result, "Should be equal!");
983
984                 result = TextMapHelper.GetBoolFromMap(map, stringInvalidKey, defaultValue);
985                 Assert.AreEqual(defaultValue, result, "Should be equal!");
986
987                 result = TextMapHelper.GetBoolFromMap(map, intKey, defaultValue);
988                 Assert.AreEqual(value, result, "Should be equal!");
989
990                 result = TextMapHelper.GetBoolFromMap(map, intInvalidKey, defaultValue);
991                 Assert.AreEqual(defaultValue, result, "Should be equal!");
992             }
993
994             tlog.Debug(tag, $"TextMapHelperGetBoolFromMap END (OK)");
995         }
996
997         [Test]
998         [Category("P1")]
999         [Description("TextMapHelper GetIntFromMap.")]
1000         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetIntFromMap M")]
1001         [Property("SPEC_URL", "-")]
1002         [Property("CRITERIA", "MR")]
1003         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1004         public void TextMapHelperGetIntFromMap()
1005         {
1006             tlog.Debug(tag, $"TextMapHelperGetIntFromMap START");
1007
1008             var stringKey = "width";
1009             var stringInvalidKey = "invalidKey";
1010             var intKey = 1;
1011             var intInvalidKey = 10;
1012             var value = 3080;
1013             var defaultValue = 0;
1014
1015             using (var map = new PropertyMap())
1016             {
1017                 map.Add(stringKey, value);
1018                 map.Add(intKey, value);
1019
1020                 var result = TextMapHelper.GetIntFromMap(map, stringKey, defaultValue);
1021                 Assert.AreEqual(value, result, "Should be equal!");
1022
1023                 result = TextMapHelper.GetIntFromMap(map, stringInvalidKey, defaultValue);
1024                 Assert.AreEqual(defaultValue, result, "Should be equal!");
1025
1026                 result = TextMapHelper.GetIntFromMap(map, intKey, defaultValue);
1027                 Assert.AreEqual(value, result, "Should be equal!");
1028
1029                 result = TextMapHelper.GetIntFromMap(map, intInvalidKey, defaultValue);
1030                 Assert.AreEqual(defaultValue, result, "Should be equal!");
1031             }
1032
1033             tlog.Debug(tag, $"TextMapHelperGetIntFromMap END (OK)");
1034         }
1035
1036         [Test]
1037         [Category("P1")]
1038         [Description("TextMapHelper GetFloatFromMap.")]
1039         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFloatFromMap M")]
1040         [Property("SPEC_URL", "-")]
1041         [Property("CRITERIA", "MR")]
1042         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1043         public void TextMapHelperGetFloatFromMap()
1044         {
1045             tlog.Debug(tag, $"TextMapHelperGetFloatFromMap START");
1046
1047             var stringKey = "width";
1048             var stringInvalidKey = "invalidKey";
1049             float value = 3.14f;
1050             float defaultValue = 0.0f;
1051
1052             using (var map = new PropertyMap())
1053             {
1054                 map.Add(stringKey, value);
1055
1056                 var result = TextMapHelper.GetFloatFromMap(map, stringKey, defaultValue);
1057                 Assert.AreEqual(value, result, "Should be equal!");
1058
1059                 result = TextMapHelper.GetFloatFromMap(map, stringInvalidKey, defaultValue);
1060                 Assert.AreEqual(defaultValue, result, "Should be equal!");
1061             }
1062
1063             tlog.Debug(tag, $"TextMapHelperGetFloatFromMap END (OK)");
1064         }
1065
1066         [Test]
1067         [Category("P1")]
1068         [Description("TextMapHelper GetColorFromMap.")]
1069         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetColorFromMap M")]
1070         [Property("SPEC_URL", "-")]
1071         [Property("CRITERIA", "MR")]
1072         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1073         public void TextMapHelperGetColorFromMap()
1074         {
1075             tlog.Debug(tag, $"TextMapHelperGetColorFromMap START");
1076
1077             var stringKey = "color";
1078             var stringInvalidKey = "invalidKey";
1079             var intKey = 1;
1080             var value = new Color(1.0f, 0.2f, 0.5f, 1.0f);
1081
1082             using (var map = new PropertyMap())
1083             {
1084                 map.Add(stringKey, value);
1085                 map.Add(intKey, value);
1086
1087                 var result = TextMapHelper.GetColorFromMap(map, stringKey);
1088                 Assert.AreEqual(true, CheckColor(value, result), "Should be true!");
1089
1090                 result = TextMapHelper.GetColorFromMap(map, intKey);
1091                 Assert.AreEqual(true, CheckColor(value, result), "Should be true!");
1092             }
1093
1094             tlog.Debug(tag, $"TextMapHelperGetColorFromMap END (OK)");
1095         }
1096
1097         [Test]
1098         [Category("P1")]
1099         [Description("TextMapHelper GetVector2FromMap.")]
1100         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetVector2FromMap M")]
1101         [Property("SPEC_URL", "-")]
1102         [Property("CRITERIA", "MR")]
1103         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1104         public void TextMapHelperGetVector2FromMap()
1105         {
1106             tlog.Debug(tag, $"TextMapHelperGetVector2FromMap START");
1107
1108             var stringKey = "position";
1109             var stringInvalidKey = "invalidKey";
1110             var value = new Vector2(3, 10);
1111
1112             using (var map = new PropertyMap())
1113             {
1114                 map.Add(stringKey, value);
1115
1116                 var result = TextMapHelper.GetVector2FromMap(map, stringKey);
1117                 Assert.AreEqual(true, CheckVector2(value, result), "Should be true!");
1118             }
1119
1120             tlog.Debug(tag, $"TextMapHelperGetVector2FromMap END (OK)");
1121         }
1122
1123         [Test]
1124         [Category("P1")]
1125         [Description("TextMapHelper GetMapFromMap.")]
1126         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetMapFromMap M")]
1127         [Property("SPEC_URL", "-")]
1128         [Property("CRITERIA", "MR")]
1129         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1130         public void TextMapHelperGetMapFromMap()
1131         {
1132             tlog.Debug(tag, $"TextMapHelperGetMapFromMap START");
1133
1134             var intKey = 1;
1135             var value = new PropertyMap();
1136             value.Add("width", 10);
1137             value.Add("height", 20);
1138
1139             using (var map = new PropertyMap())
1140             {
1141                 map.Add(intKey, new PropertyValue(value));
1142
1143                 var result = TextMapHelper.GetMapFromMap(map, intKey);
1144                 result.Find(0, "width").Get(out int width);
1145                 result.Find(0, "height").Get(out int height);
1146                 Assert.AreEqual(10, width, "Should be equal!");
1147                 Assert.AreEqual(20, height, "Should be equal!");
1148             }
1149
1150             tlog.Debug(tag, $"TextMapHelperGetMapFromMap END (OK)");
1151         }
1152
1153         [Test]
1154         [Category("P1")]
1155         [Description("TextMapHelper GetNullableIntFromMap.")]
1156         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetNullableIntFromMap M")]
1157         [Property("SPEC_URL", "-")]
1158         [Property("CRITERIA", "MR")]
1159         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1160         public void TextMapHelperGetNullableIntFromMap()
1161         {
1162             tlog.Debug(tag, $"TextMapHelperGetNullableIntFromMap START");
1163
1164             var intKey = 1;
1165             var intInvalidKey = 10;
1166             int value = 3080;
1167             int? result = null;
1168
1169             using (var map = new PropertyMap())
1170             {
1171                 map.Add(intKey, value);
1172
1173                 result = TextMapHelper.GetNullableIntFromMap(map, intKey);
1174                 Assert.AreEqual(value, result, "Should be equal!");
1175
1176                 result = TextMapHelper.GetNullableIntFromMap(map, intInvalidKey);
1177                 Assert.AreEqual(null, result, "Should be equal!");
1178             }
1179
1180             tlog.Debug(tag, $"TextMapHelperGetNullableIntFromMap END (OK)");
1181         }
1182
1183         [Test]
1184         [Category("P1")]
1185         [Description("TextMapHelper GetNullableFloatFromMap.")]
1186         [Property("SPEC", "Tizen.NUI.TextMapHelper.GetNullableFloatFromMap M")]
1187         [Property("SPEC_URL", "-")]
1188         [Property("CRITERIA", "MR")]
1189         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1190         public void TextMapHelperGetNullableFloatFromMap()
1191         {
1192             tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap START");
1193
1194             var stringKey = "width";
1195             var stringInvalidKey = "invalidKey";
1196             var intKey = 1;
1197             var intInvalidKey = 10;
1198             float value = 3.14f;
1199             float? result = null;
1200
1201             using (var map = new PropertyMap())
1202             {
1203                 map.Add(stringKey, value);
1204                 map.Add(intKey, value);
1205
1206                 result = TextMapHelper.GetNullableFloatFromMap(map, stringKey);
1207                 Assert.AreEqual(value, result, "Should be equal!");
1208
1209                 result = TextMapHelper.GetNullableFloatFromMap(map, stringInvalidKey);
1210                 Assert.AreEqual(null, result, "Should be equal!");
1211
1212                 result = TextMapHelper.GetNullableFloatFromMap(map, intKey);
1213                 Assert.AreEqual(value, result, "Should be equal!");
1214
1215                 result = TextMapHelper.GetNullableFloatFromMap(map, intInvalidKey);
1216                 Assert.AreEqual(null, result, "Should be equal!");
1217             }
1218
1219             tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap END (OK)");
1220         }
1221
1222         [Test]
1223         [Category("P1")]
1224         [Description("TextMapHelper IsValue.")]
1225         [Property("SPEC", "Tizen.NUI.TextMapHelper.IsValue M")]
1226         [Property("SPEC_URL", "-")]
1227         [Property("CRITERIA", "MR")]
1228         [Property("AUTHOR", "bowon.ryu@samsung.com")]
1229         public void TextMapHelperIsValue()
1230         {
1231             tlog.Debug(tag, $"TextMapHelperIsValue START");
1232
1233             var intKey = 1;
1234             var intInvalidKey = 10;
1235             var value = "value";
1236
1237             using (var map = new PropertyMap())
1238             {
1239                 map.Add(intKey, value);
1240
1241                 var result = TextMapHelper.IsValue(map, intKey);
1242                 Assert.AreEqual(true, result, "Should be true!");
1243
1244                 result = TextMapHelper.IsValue(map, intInvalidKey);
1245                 Assert.AreEqual(false, result, "Should be false!");
1246             }
1247
1248             tlog.Debug(tag, $"TextMapHelperIsValue END (OK)");
1249         }
1250     }
1251 }