3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 using System.Collections.Generic;
9 namespace Tizen.NUI.Devel.Tests
11 using tlog = Tizen.Log;
14 [Description("public/BaseComponents/TextMapHelper")]
15 class PublicTextMapHelperTest
17 private const string tag = "NUITEST";
22 tlog.Info(tag, "Init() is called!");
28 tlog.Info(tag, "Destroy() is called!");
33 [Description("TextMapHelper GetFontWidthString.")]
34 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWidthString M")]
35 [Property("SPEC_URL", "-")]
36 [Property("CRITERIA", "MR")]
37 [Property("AUTHOR", "bowon.ryu@samsung.com")]
38 public void TextMapHelperGetFontWidthString()
40 tlog.Debug(tag, $"TextMapHelperGetFontWidthString START");
42 string fontWidthString;
44 fontWidthString = TextMapHelper.GetFontWidthString(FontWidthType.ExtraCondensed);
45 Assert.AreEqual("extraCondensed", fontWidthString, "Should be equal!");
47 tlog.Debug(tag, $"TextMapHelperGetFontWidthString END (OK)");
52 [Description("TextMapHelper GetFontWeightString.")]
53 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWeightString M")]
54 [Property("SPEC_URL", "-")]
55 [Property("CRITERIA", "MR")]
56 [Property("AUTHOR", "bowon.ryu@samsung.com")]
57 public void TextMapHelperGetFontWeightString()
59 tlog.Debug(tag, $"TextMapHelperGetFontWeightString START");
61 string fontWeightString;
63 fontWeightString = TextMapHelper.GetFontWeightString(FontWeightType.Light);
64 Assert.AreEqual("light", fontWeightString, "Should be equal!");
66 tlog.Debug(tag, $"TextMapHelperGetFontWeightString END (OK)");
71 [Description("TextMapHelper GetFontSlantString.")]
72 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSlantString M")]
73 [Property("SPEC_URL", "-")]
74 [Property("CRITERIA", "MR")]
75 [Property("AUTHOR", "bowon.ryu@samsung.com")]
76 public void TextMapHelperGetFontSlantString()
78 tlog.Debug(tag, $"TextMapHelperGetFontSlantString START");
80 string fontSlantString;
82 fontSlantString = TextMapHelper.GetFontSlantString(FontSlantType.Italic);
83 Assert.AreEqual("italic", fontSlantString, "Should be equal!");
85 tlog.Debug(tag, $"TextMapHelperGetFontSlantString END (OK)");
90 [Description("TextMapHelper GetFontWidthType.")]
91 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWidthType M")]
92 [Property("SPEC_URL", "-")]
93 [Property("CRITERIA", "MR")]
94 [Property("AUTHOR", "bowon.ryu@samsung.com")]
95 public void TextMapHelperGetFontWidthType()
97 tlog.Debug(tag, $"TextMapHelperGetFontWidthType START");
99 FontWidthType fontWidthType;
101 fontWidthType = TextMapHelper.GetFontWidthType("ExtraCondensed");
102 Assert.AreEqual(FontWidthType.ExtraCondensed, fontWidthType, "Should be equal!");
104 fontWidthType = TextMapHelper.GetFontWidthType("InvalidType");
105 Assert.AreEqual(FontWidthType.None, fontWidthType, "If invalid type, should be None type!");
107 tlog.Debug(tag, $"TextMapHelperGetFontWidthType END (OK)");
112 [Description("TextMapHelper GetFontWeightType.")]
113 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontWeightType M")]
114 [Property("SPEC_URL", "-")]
115 [Property("CRITERIA", "MR")]
116 [Property("AUTHOR", "bowon.ryu@samsung.com")]
117 public void TextMapHelperGetFontWeightType()
119 tlog.Debug(tag, $"TextMapHelperGetFontWeightType START");
121 FontWeightType fontWeightType;
123 fontWeightType = TextMapHelper.GetFontWeightType("Light");
124 Assert.AreEqual(FontWeightType.Light, fontWeightType, "Should be equal!");
126 fontWeightType = TextMapHelper.GetFontWeightType("InvalidType");
127 Assert.AreEqual(FontWeightType.None, fontWeightType, "If invalid type, should be None type!");
129 tlog.Debug(tag, $"TextMapHelperGetFontWeightType END (OK)");
134 [Description("TextMapHelper GetFontSlantType.")]
135 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSlantType M")]
136 [Property("SPEC_URL", "-")]
137 [Property("CRITERIA", "MR")]
138 [Property("AUTHOR", "bowon.ryu@samsung.com")]
139 public void TextMapHelperGetFontSlantType()
141 tlog.Debug(tag, $"TextMapHelperGetFontSlantType START");
143 FontSlantType fontSlantType;
145 fontSlantType = TextMapHelper.GetFontSlantType("Italic");
146 Assert.AreEqual(FontSlantType.Italic, fontSlantType, "Should be equal!");
148 fontSlantType = TextMapHelper.GetFontSlantType("InvalidType");
149 Assert.AreEqual(FontSlantType.None, fontSlantType, "If invalid type, should be None type!");
151 tlog.Debug(tag, $"TextMapHelperGetFontSlantType END (OK)");
156 [Description("TextMapHelper GetFontStyleMap.")]
157 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontStyleMap M")]
158 [Property("SPEC_URL", "-")]
159 [Property("CRITERIA", "MR")]
160 [Property("AUTHOR", "bowon.ryu@samsung.com")]
161 public void TextMapHelperGetFontStyleMap()
163 tlog.Debug(tag, $"TextMapHelperGetFontStyleMap START");
165 var fontStyle = new Tizen.NUI.Text.FontStyle()
167 Width = FontWidthType.Expanded,
168 Weight = FontWeightType.Bold,
169 Slant = FontSlantType.Italic
172 var map = TextMapHelper.GetFontStyleMap(fontStyle);
173 map["width"].Get(out string width);
174 map["weight"].Get(out string weight);
175 map["slant"].Get(out string slant);
177 Assert.AreEqual("expanded", width, "Should be equal!");
178 Assert.AreEqual("bold", weight, "Should be equal!");
179 Assert.AreEqual("italic", slant, "Should be equal!");
181 tlog.Debug(tag, $"TextMapHelperGetFontStyleMap END (OK)");
186 [Description("TextMapHelper GetFontStyleStruct.")]
187 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontStyleStruct M")]
188 [Property("SPEC_URL", "-")]
189 [Property("CRITERIA", "MR")]
190 [Property("AUTHOR", "bowon.ryu@samsung.com")]
191 public void TextMapHelperGetFontStyleStruct()
193 tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct START");
195 var map = new PropertyMap();
196 map.Add("width", new PropertyValue("expanded"));
197 map.Add("weight", new PropertyValue("bold"));
198 map.Add("slant", new PropertyValue("italic"));
200 FontStyle fontStyle = TextMapHelper.GetFontStyleStruct(map);
201 Assert.AreEqual(FontWidthType.Expanded, fontStyle.Width, "Should be equal!");
202 Assert.AreEqual(FontWeightType.Bold, fontStyle.Weight, "Should be equal!");
203 Assert.AreEqual(FontSlantType.Italic, fontStyle.Slant, "Should be equal!");
205 tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct END (OK)");
210 [Description("TextMapHelper GetInputFilterMap.")]
211 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetInputFilterMap M")]
212 [Property("SPEC_URL", "-")]
213 [Property("CRITERIA", "MR")]
214 [Property("AUTHOR", "bowon.ryu@samsung.com")]
215 public void TextMapHelperGetInputFilterMap()
217 tlog.Debug(tag, $"TextMapHelperGetInputFilterMap START");
219 var inputFilter = new Tizen.NUI.Text.InputFilter()
225 var map = TextMapHelper.GetInputFilterMap(inputFilter);
226 map.Find(0).Get(out string accepted);
227 map.Find(1).Get(out string rejected);
229 Assert.AreEqual(accepted, inputFilter.Accepted, "Should be equal!");
230 Assert.AreEqual(rejected, inputFilter.Rejected, "Should be equal!");
232 tlog.Debug(tag, $"TextMapHelperGetInputFilterMap END (OK)");
237 [Description("TextMapHelper GetInputFilterStruct.")]
238 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetInputFilterStruct M")]
239 [Property("SPEC_URL", "-")]
240 [Property("CRITERIA", "MR")]
241 [Property("AUTHOR", "bowon.ryu@samsung.com")]
242 public void TextMapHelperGGetInputFilterStruct()
244 tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct START");
246 var map = new PropertyMap();
247 map.Add(0, new PropertyValue(@"[\d]"));
248 map.Add(1, new PropertyValue("[0-3]"));
250 var inputFilter = TextMapHelper.GetInputFilterStruct(map);
251 Assert.AreEqual(@"[\d]", inputFilter.Accepted, "Should be equal!");
252 Assert.AreEqual("[0-3]", inputFilter.Rejected, "Should be equal!");
254 tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct END (OK)");
259 [Description("TextMapHelper GetUnderlineMap.")]
260 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetUnderlineMap M")]
261 [Property("SPEC_URL", "-")]
262 [Property("CRITERIA", "MR")]
263 [Property("AUTHOR", "bowon.ryu@samsung.com")]
264 public void TextMapHelperGetUnderlineMap()
266 tlog.Debug(tag, $"TextMapHelperGetUnderlineMap START");
268 var underline = new Tizen.NUI.Text.Underline()
271 Color = new Color("#3498DB"),
275 var map = TextMapHelper.GetUnderlineMap(underline);
276 var color = new Color();
277 map.Find(0, "enable").Get(out bool enable);
278 map.Find(0, "color").Get(color);
279 map.Find(0, "height").Get(out float height);
281 Assert.AreEqual(enable, underline.Enable, "Should be equal!");
282 Assert.AreEqual(height, underline.Height, "Should be equal!");
283 Assert.AreEqual(color.R, underline.Color.R, "Should be equal!");
284 Assert.AreEqual(color.G, underline.Color.G, "Should be equal!");
285 Assert.AreEqual(color.B, underline.Color.B, "Should be equal!");
286 Assert.AreEqual(color.A, underline.Color.A, "Should be equal!");
288 tlog.Debug(tag, $"TextMapHelperGetUnderlineMap END (OK)");
293 [Description("TextMapHelper GetUnderlineStruct.")]
294 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetUnderlineStruct M")]
295 [Property("SPEC_URL", "-")]
296 [Property("CRITERIA", "MR")]
297 [Property("AUTHOR", "bowon.ryu@samsung.com")]
298 public void TextMapHelperGetUnderlineStruct()
300 tlog.Debug(tag, $"TextMapHelperGetUnderlineStruct START");
302 var map = new PropertyMap();
303 var color = new Color("#3498DB");
304 map.Add("enable", new PropertyValue(true));
305 map.Add("color", new PropertyValue(color));
306 map.Add("height", new PropertyValue((float)2.0f));
308 var underline = TextMapHelper.GetUnderlineStruct(map);
310 Assert.AreEqual(true, underline.Enable, "Should be equal!");
311 Assert.AreEqual(2.0f, underline.Height, "Should be equal!");
312 Assert.AreEqual(color.R, underline.Color.R, "Should be equal!");
313 Assert.AreEqual(color.G, underline.Color.G, "Should be equal!");
314 Assert.AreEqual(color.B, underline.Color.B, "Should be equal!");
315 Assert.AreEqual(color.A, underline.Color.A, "Should be equal!");
317 tlog.Debug(tag, $"TextMapHelperGetUnderlineStruct END (OK)");
322 [Description("TextMapHelper GetShadowMap.")]
323 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetShadowMap M")]
324 [Property("SPEC_URL", "-")]
325 [Property("CRITERIA", "MR")]
326 [Property("AUTHOR", "bowon.ryu@samsung.com")]
327 public void TextMapHelperGetShadowMap()
329 tlog.Debug(tag, $"TextMapHelperGetShadowMap START");
331 var shadow = new Tizen.NUI.Text.Shadow()
333 Offset = new Vector2(3, 3),
334 Color = new Color("#F1C40F"),
338 var map = TextMapHelper.GetShadowMap(shadow);
339 var offset = new Vector2();
340 var color = new Color();
341 map.Find(0, "offset").Get(offset);
342 map.Find(0, "color").Get(color);
343 map.Find(0, "blurRadius").Get(out float blurRadius);
345 Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
346 Assert.AreEqual(offset.X, shadow.Offset.X, "Should be equal!");
347 Assert.AreEqual(offset.Y, shadow.Offset.Y, "Should be equal!");
348 Assert.AreEqual(color.R, shadow.Color.R, "Should be equal!");
349 Assert.AreEqual(color.G, shadow.Color.G, "Should be equal!");
350 Assert.AreEqual(color.B, shadow.Color.B, "Should be equal!");
351 Assert.AreEqual(color.A, shadow.Color.A, "Should be equal!");
353 tlog.Debug(tag, $"TextMapHelperGetShadowMap END (OK)");
358 [Description("TextMapHelper GetShadowStruct.")]
359 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetShadowStruct M")]
360 [Property("SPEC_URL", "-")]
361 [Property("CRITERIA", "MR")]
362 [Property("AUTHOR", "bowon.ryu@samsung.com")]
363 public void TextMapHelperGetShadowStruct()
365 tlog.Debug(tag, $"TextMapHelperGetShadowStruct START");
367 var offset = new Vector2(5, 5);
368 var color = new Color("#F1C40F");
369 float blurRadius = 5.0f;
371 var map = new PropertyMap();
372 map.Add("offset", new PropertyValue(offset));
373 map.Add("color", new PropertyValue(color));
374 map.Add("blurRadius", new PropertyValue((float)blurRadius));
376 var shadow = TextMapHelper.GetShadowStruct(map);
378 Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
379 Assert.AreEqual(offset.X, shadow.Offset.X, "Should be equal!");
380 Assert.AreEqual(offset.Y, shadow.Offset.Y, "Should be equal!");
381 Assert.AreEqual(color.R, shadow.Color.R, "Should be equal!");
382 Assert.AreEqual(color.G, shadow.Color.G, "Should be equal!");
383 Assert.AreEqual(color.B, shadow.Color.B, "Should be equal!");
384 Assert.AreEqual(color.A, shadow.Color.A, "Should be equal!");
386 tlog.Debug(tag, $"TextMapHelperGetShadowStruct END (OK)");
391 [Description("TextMapHelper GetOutlineMap.")]
392 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetOutlineMap M")]
393 [Property("SPEC_URL", "-")]
394 [Property("CRITERIA", "MR")]
395 [Property("AUTHOR", "guowei.wang@samsung.com")]
396 public void TextMapHelperGetOutlineMap()
398 tlog.Debug(tag, $"TextMapHelperGetOutlineMap START");
400 var outline = new Tizen.NUI.Text.Outline()
403 Color = new Color("#45B39D"),
406 var map = TextMapHelper.GetOutlineMap(outline);
407 var color = new Color();
408 map.Find(0, "color").Get(color);
409 map.Find(0, "width").Get(out float width);
411 Assert.AreEqual(width, outline.Width, "Should be equal!");
412 Assert.AreEqual(color.R, outline.Color.R, "Should be equal!");
413 Assert.AreEqual(color.G, outline.Color.G, "Should be equal!");
414 Assert.AreEqual(color.B, outline.Color.B, "Should be equal!");
415 Assert.AreEqual(color.A, outline.Color.A, "Should be equal!");
417 tlog.Debug(tag, $"TextMapHelperGetOutlineMap END (OK)");
422 [Description("TextMapHelper GetOutlineStruct.")]
423 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetOutlineStruct M")]
424 [Property("SPEC_URL", "-")]
425 [Property("CRITERIA", "MR")]
426 [Property("AUTHOR", "guowei.wang@samsung.com")]
427 public void TextMapHelperGetOutlineStruct()
429 tlog.Debug(tag, $"TextMapHelperGetOutlineStruct START");
432 var color = new Color("#45B39D");
434 var map = new PropertyMap();
435 map.Add("color", new PropertyValue(color));
436 map.Add("width", new PropertyValue((float)width));
438 var outline = TextMapHelper.GetOutlineStruct(map);
439 Assert.AreEqual(width, outline.Width, "Should be equal!");
440 Assert.AreEqual(color.R, outline.Color.R, "Should be equal!");
441 Assert.AreEqual(color.G, outline.Color.G, "Should be equal!");
442 Assert.AreEqual(color.B, outline.Color.B, "Should be equal!");
443 Assert.AreEqual(color.A, outline.Color.A, "Should be equal!");
445 tlog.Debug(tag, $"TextMapHelperGetOutlineStruct END (OK)");
450 [Description("TextMapHelper GetFontSizeString.")]
451 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSizeString M")]
452 [Property("SPEC_URL", "-")]
453 [Property("CRITERIA", "MR")]
454 [Property("AUTHOR", "bowon.ryu@samsung.com")]
455 public void TextMapHelperGetFontSizeString()
457 tlog.Debug(tag, $"TextMapHelperGetFontSizeString START");
459 string fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PointSize);
460 Assert.AreEqual("pointSize", fontSizeTypeString, "Should be equal!");
462 fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PixelSize);
463 Assert.AreEqual("pixelSize", fontSizeTypeString, "Should be equal!");
465 tlog.Debug(tag, $"TextMapHelperGetFontSizeString END (OK)");
470 [Description("TextMapHelper GetFontSizeType.")]
471 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFontSizeType M")]
472 [Property("SPEC_URL", "-")]
473 [Property("CRITERIA", "MR")]
474 [Property("AUTHOR", "bowon.ryu@samsung.com")]
475 public void TextMapHelperGetFontSizeType()
477 tlog.Debug(tag, $"TextMapHelperGetFontSizeType START");
479 FontSizeType fontSizeType;
481 fontSizeType = TextMapHelper.GetFontSizeType("PointSize");
482 Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "Should be equal!");
484 fontSizeType = TextMapHelper.GetFontSizeType("PixelSize");
485 Assert.AreEqual(FontSizeType.PixelSize, fontSizeType, "Should be equal!");
487 fontSizeType = TextMapHelper.GetFontSizeType("InvalidType");
488 Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "If invalid type, should be PointSize type!");
490 tlog.Debug(tag, $"TextMapHelperGetFontSizeType END (OK)");
495 [Description("TextMapHelper GetTextFitMap.")]
496 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetTextFitMap M")]
497 [Property("SPEC_URL", "-")]
498 [Property("CRITERIA", "MR")]
499 [Property("AUTHOR", "bowon.ryu@samsung.com")]
500 public void TextMapHelperGetTextFitMap()
502 tlog.Debug(tag, $"TextMapHelperGetTextFitMap START");
504 var textFit = new Tizen.NUI.Text.TextFit()
510 FontSizeType = FontSizeType.PointSize
513 var map = TextMapHelper.GetTextFitMap(textFit);
514 map.Find(0, "enable").Get(out bool enable);
515 map.Find(0, "minSize").Get(out float minSize);
516 map.Find(0, "maxSize").Get(out float maxSize);
517 map.Find(0, "stepSize").Get(out float stepSize);
518 map.Find(0, "fontSizeType").Get(out string fontSizeType);
520 Assert.AreEqual(enable, textFit.Enable, "Should be equal!");
521 Assert.AreEqual(minSize, textFit.MinSize, "Should be equal!");
522 Assert.AreEqual(maxSize, textFit.MaxSize, "Should be equal!");
523 Assert.AreEqual(stepSize, textFit.StepSize, "Should be equal!");
524 Assert.AreEqual(fontSizeType, "pointSize", "Should be equal!");
526 tlog.Debug(tag, $"TextMapHelperGetTextFitMap END (OK)");
531 [Description("TextMapHelper GetTextFitStruct.")]
532 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetTextFitStruct M")]
533 [Property("SPEC_URL", "-")]
534 [Property("CRITERIA", "MR")]
535 [Property("AUTHOR", "bowon.ryu@samsung.com")]
536 public void TextMapHelperGetTextFitStruct()
538 tlog.Debug(tag, $"TextMapHelperGetTextFitStruct START");
541 float minSize = 10.0f;
542 float maxSize = 100.0f;
543 float stepSize = 5.0f;
545 var map = new PropertyMap();
546 map.Add("enable", new PropertyValue(enable));
547 map.Add("minSize", new PropertyValue((float)minSize));
548 map.Add("maxSize", new PropertyValue((float)maxSize));
549 map.Add("stepSize", new PropertyValue((float)stepSize));
550 map.Add("fontSizeType", new PropertyValue("pointSize"));
552 var textFit = TextMapHelper.GetTextFitStruct(map);
554 Assert.AreEqual(enable, textFit.Enable, "Should be equal!");
555 Assert.AreEqual(minSize, textFit.MinSize, "Should be equal!");
556 Assert.AreEqual(maxSize, textFit.MaxSize, "Should be equal!");
557 Assert.AreEqual(stepSize, textFit.StepSize, "Should be equal!");
558 Assert.AreEqual(FontSizeType.PointSize, textFit.FontSizeType, "Should be equal!");
560 tlog.Debug(tag, $"TextMapHelperGetTextFitStruct END (OK)");
565 [Description("TextMapHelper GetPlaceholderMap.")]
566 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetPlaceholderMap M")]
567 [Property("SPEC_URL", "-")]
568 [Property("CRITERIA", "MR")]
569 [Property("AUTHOR", "bowon.ryu@samsung.com")]
570 public void TextMapHelperGetPlaceholderMap()
572 tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap START");
574 var placeholder = new Tizen.NUI.Text.Placeholder()
576 Text = "placeholder text",
577 TextFocused = "placeholder textFocused",
578 Color = new Color("#45B39D"),
579 FontFamily = "BreezeSans",
580 FontStyle = new Tizen.NUI.Text.FontStyle()
582 Width = FontWidthType.Expanded,
583 Weight = FontWeightType.Bold,
584 Slant = FontSlantType.Italic,
591 string textFocused = "";
592 Color color = new Color();
593 string fontFamily = null;
594 var fontStyle = new PropertyMap();
596 bool ellipsis = false;
598 var map = TextMapHelper.GetPlaceholderMap(placeholder);
599 map.Find(0).Get(out text);
600 map.Find(1).Get(out textFocused);
601 map.Find(2).Get(color);
602 map.Find(3).Get(out fontFamily);
603 map.Find(4).Get(fontStyle);
604 map.Find(5).Get(out pointSize);
605 map.Find(7).Get(out ellipsis);
607 fontStyle["width"].Get(out string width);
608 fontStyle["weight"].Get(out string weight);
609 fontStyle["slant"].Get(out string slant);
611 Assert.AreEqual(text, placeholder.Text, "Should be equal!");
612 Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!");
613 Assert.AreEqual(color.R, placeholder.Color.R, "Should be equal!");
614 Assert.AreEqual(color.G, placeholder.Color.G, "Should be equal!");
615 Assert.AreEqual(color.B, placeholder.Color.B, "Should be equal!");
616 Assert.AreEqual(color.A, placeholder.Color.A, "Should be equal!");
617 Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!");
618 Assert.AreEqual(width, "expanded", "Should be equal!");
619 Assert.AreEqual(weight, "bold", "Should be equal!");
620 Assert.AreEqual(slant, "italic", "Should be equal!");
621 Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!");
622 Assert.AreEqual(ellipsis, placeholder.Ellipsis, "Should be equal!");
624 tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap END (OK)");
629 [Description("TextMapHelper GetPlaceholderStruct.")]
630 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetPlaceholderStruct M")]
631 [Property("SPEC_URL", "-")]
632 [Property("CRITERIA", "MR")]
633 [Property("AUTHOR", "bowon.ryu@samsung.com")]
634 public void TextMapHelperGetPlaceholderStruct()
636 tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct START");
638 string text = "placeholder text";
639 string textFocused = "placeholder textFocused";
640 Color color = new Color("#45B39D");
641 string fontFamily = "BreezeSans";
642 var fontStyle = new PropertyMap();
643 fontStyle.Add("width", new PropertyValue("expanded"));
644 fontStyle.Add("weight", new PropertyValue("bold"));
645 fontStyle.Add("slant", new PropertyValue("italic"));
646 float pointSize = 25.0f;
647 bool ellipsis = false;
649 var map = new PropertyMap();
650 map.Add(0, new PropertyValue(text));
651 map.Add(1, new PropertyValue(textFocused));
652 map.Add(2, new PropertyValue(color));
653 map.Add(3, new PropertyValue(fontFamily));
654 map.Add(4, new PropertyValue(fontStyle));
655 map.Add(5, new PropertyValue((float)pointSize));
656 map.Add(7, new PropertyValue(ellipsis));
658 var placeholder = TextMapHelper.GetPlaceholderStruct(map);
660 Assert.AreEqual(text, placeholder.Text, "Should be equal!");
661 Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!");
662 Assert.AreEqual(color.R, placeholder.Color.R, "Should be equal!");
663 Assert.AreEqual(color.G, placeholder.Color.G, "Should be equal!");
664 Assert.AreEqual(color.B, placeholder.Color.B, "Should be equal!");
665 Assert.AreEqual(color.A, placeholder.Color.A, "Should be equal!");
666 Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!");
667 Assert.AreEqual(FontWidthType.Expanded, placeholder.FontStyle?.Width, "Should be equal!");
668 Assert.AreEqual(FontWeightType.Bold, placeholder.FontStyle?.Weight, "Should be equal!");
669 Assert.AreEqual(FontSlantType.Italic, placeholder.FontStyle?.Slant, "Should be equal!");
670 Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!");
671 Assert.AreEqual(ellipsis, false, "Should be equal!");
673 tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct END (OK)");
678 [Description("TextMapHelper GetHiddenInputMap.")]
679 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetHiddenInputMap M")]
680 [Property("SPEC_URL", "-")]
681 [Property("CRITERIA", "MR")]
682 [Property("AUTHOR", "bowon.ryu@samsung.com")]
683 public void TextMapHelperGetHiddenInputMap()
685 tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap START");
687 var hiddenInput = new Tizen.NUI.Text.HiddenInput()
689 Mode = HiddenInputModeType.ShowLastCharacter,
690 SubstituteCharacter = '★',
692 ShowLastCharacterDuration = 1000
695 var map = TextMapHelper.GetHiddenInputMap(hiddenInput);
697 map.Find(0).Get(out int mode);
698 map.Find(1).Get(out int substituteCharacter);
699 map.Find(2).Get(out int substituteCount);
700 map.Find(3).Get(out int showLastCharacterDuration);
702 Assert.AreEqual(mode, (int)hiddenInput.Mode, "Should be equal!");
703 Assert.AreEqual(substituteCharacter, Convert.ToInt32(hiddenInput.SubstituteCharacter), "Should be equal!");
704 Assert.AreEqual(substituteCount, hiddenInput.SubstituteCount, "Should be equal!");
705 Assert.AreEqual(showLastCharacterDuration, hiddenInput.ShowLastCharacterDuration, "Should be equal!");
707 tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap END (OK)");
712 [Description("TextMapHelper GetHiddenInputStruct.")]
713 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetHiddenInputStruct M")]
714 [Property("SPEC_URL", "-")]
715 [Property("CRITERIA", "MR")]
716 [Property("AUTHOR", "bowon.ryu@samsung.com")]
717 public void TextMapHelperGetHiddenInputStruct()
719 tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct START");
721 int mode = (int)HiddenInputModeType.ShowLastCharacter;
722 int substituteCharacter = Convert.ToInt32('★');
723 int substituteCount = 0;
724 int showLastCharacterDuration = 1000;
726 var map = new PropertyMap();
727 map.Add(0, new PropertyValue(mode));
728 map.Add(1, new PropertyValue(substituteCharacter));
729 map.Add(2, new PropertyValue(substituteCount));
730 map.Add(3, new PropertyValue(showLastCharacterDuration));
732 var hiddenInput = TextMapHelper.GetHiddenInputStruct(map);
734 Assert.AreEqual(mode, (int)hiddenInput.Mode, "Should be equal!");
735 Assert.AreEqual(substituteCharacter, Convert.ToInt32(hiddenInput.SubstituteCharacter), "Should be equal!");
736 Assert.AreEqual(substituteCount, hiddenInput.SubstituteCount, "Should be equal!");
737 Assert.AreEqual(showLastCharacterDuration, hiddenInput.ShowLastCharacterDuration, "Should be equal!");
739 tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct END (OK)");
744 [Description("TextMapHelper GetFileNameMap.")]
745 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFileNameMap M")]
746 [Property("SPEC_URL", "-")]
747 [Property("CRITERIA", "MR")]
748 [Property("AUTHOR", "bowon.ryu@samsung.com")]
749 public void TextMapHelperGetFileNameMap()
751 tlog.Debug(tag, $"TextMapHelperGetFileNameMap START");
753 string url = "filePath";
755 var map = TextMapHelper.GetFileNameMap(url);
756 map.Find(0, "filename").Get(out string fileName);
758 Assert.AreEqual(url, fileName, "Should be equal!");
760 tlog.Debug(tag, $"TextMapHelperGetFileNameMap END (OK)");
765 [Description("TextMapHelper GetSelectionHandleImageStruct.")]
766 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetSelectionHandleImageStruct M")]
767 [Property("SPEC_URL", "-")]
768 [Property("CRITERIA", "MR")]
769 [Property("AUTHOR", "bowon.ryu@samsung.com")]
770 public void TextMapHelperGetSelectionHandleImageStruct()
772 tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct START");
774 string leftImageUrl = "leftImageUrl";
775 string rightImageUrl = "rightImageUrl";
777 var leftImageMap = new PropertyMap().Add("filename", new PropertyValue(leftImageUrl));
778 var rightImageMap = new PropertyMap().Add("filename", new PropertyValue(rightImageUrl));
780 var selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
782 Assert.AreEqual(leftImageUrl, selectionHandleImage.LeftImageUrl, "Should be equal!");
783 Assert.AreEqual(rightImageUrl, selectionHandleImage.RightImageUrl, "Should be equal!");
785 tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct END (OK)");
790 [Description("TextMapHelper GetCamelCase.")]
791 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetCamelCase M")]
792 [Property("SPEC_URL", "-")]
793 [Property("CRITERIA", "MR")]
794 [Property("AUTHOR", "bowon.ryu@samsung.com")]
795 public void TextMapHelperGetCamelCase()
797 tlog.Debug(tag, $"TextMapHelperGetCamelCase START");
799 string pascalCase = "TextMapHelper";
800 string camelCase = "textMapHelper";
801 string expectedResult = TextMapHelper.GetCamelCase(pascalCase);
803 Assert.AreEqual(camelCase, expectedResult, "Should be equal!");
805 string emptyString = "";
806 expectedResult = TextMapHelper.GetCamelCase(emptyString);
808 Assert.AreEqual(emptyString, expectedResult, "Should be equal!");
810 tlog.Debug(tag, $"TextMapHelperGetCamelCase END (OK)");
815 [Description("TextMapHelper GetStringFromMap.")]
816 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetStringFromMap M")]
817 [Property("SPEC_URL", "-")]
818 [Property("CRITERIA", "MR")]
819 [Property("AUTHOR", "bowon.ryu@samsung.com")]
820 public void TextMapHelperGetStringFromMap()
822 tlog.Debug(tag, $"TextMapHelperGetStringFromMap START");
824 var stringKey = "width";
825 var stringInvalidKey = "invalidKey";
827 var intInvalidKey = 10;
828 var value = "expanded";
829 var defaultValue = "none";
831 var map = new PropertyMap();
832 map.Add(stringKey, new PropertyValue(value));
833 map.Add(intKey, new PropertyValue(value));
835 var result = TextMapHelper.GetStringFromMap(map, stringKey, defaultValue);
836 Assert.AreEqual(value, result, "Should be equal!");
838 result = TextMapHelper.GetStringFromMap(map, stringInvalidKey, defaultValue);
839 Assert.AreEqual(defaultValue, result, "Should be equal!");
841 result = TextMapHelper.GetStringFromMap(map, intKey, defaultValue);
842 Assert.AreEqual(value, result, "Should be equal!");
844 result = TextMapHelper.GetStringFromMap(map, intInvalidKey, defaultValue);
845 Assert.AreEqual(defaultValue, result, "Should be equal!");
847 tlog.Debug(tag, $"TextMapHelperGetStringFromMap END (OK)");
852 [Description("TextMapHelper GetBoolFromMap.")]
853 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetBoolFromMap M")]
854 [Property("SPEC_URL", "-")]
855 [Property("CRITERIA", "MR")]
856 [Property("AUTHOR", "bowon.ryu@samsung.com")]
857 public void TextMapHelperGetBoolFromMap()
859 tlog.Debug(tag, $"TextMapHelperGetBoolFromMap START");
861 var stringKey = "width";
862 var stringInvalidKey = "invalidKey";
864 var intInvalidKey = 10;
866 var defaultValue = false;
868 var map = new PropertyMap();
869 map.Add(stringKey, new PropertyValue(value));
870 map.Add(intKey, new PropertyValue(value));
872 var result = TextMapHelper.GetBoolFromMap(map, stringKey, defaultValue);
873 Assert.AreEqual(value, result, "Should be equal!");
875 result = TextMapHelper.GetBoolFromMap(map, stringInvalidKey, defaultValue);
876 Assert.AreEqual(defaultValue, result, "Should be equal!");
878 result = TextMapHelper.GetBoolFromMap(map, intKey, defaultValue);
879 Assert.AreEqual(value, result, "Should be equal!");
881 result = TextMapHelper.GetBoolFromMap(map, intInvalidKey, defaultValue);
882 Assert.AreEqual(defaultValue, result, "Should be equal!");
884 tlog.Debug(tag, $"TextMapHelperGetBoolFromMap END (OK)");
889 [Description("TextMapHelper GetIntFromMap.")]
890 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetIntFromMap M")]
891 [Property("SPEC_URL", "-")]
892 [Property("CRITERIA", "MR")]
893 [Property("AUTHOR", "bowon.ryu@samsung.com")]
894 public void TextMapHelperGetIntFromMap()
896 tlog.Debug(tag, $"TextMapHelperGetIntFromMap START");
899 var intInvalidKey = 10;
901 var defaultValue = 0;
903 var map = new PropertyMap();
904 map.Add(intKey, new PropertyValue(value));
906 var result = TextMapHelper.GetIntFromMap(map, intKey, defaultValue);
907 Assert.AreEqual(value, result, "Should be equal!");
909 result = TextMapHelper.GetIntFromMap(map, intInvalidKey, defaultValue);
910 Assert.AreEqual(defaultValue, result, "Should be equal!");
912 tlog.Debug(tag, $"TextMapHelperGetIntFromMap END (OK)");
917 [Description("TextMapHelper GetFloatFromMap.")]
918 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetFloatFromMap M")]
919 [Property("SPEC_URL", "-")]
920 [Property("CRITERIA", "MR")]
921 [Property("AUTHOR", "bowon.ryu@samsung.com")]
922 public void TextMapHelperGetFloatFromMap()
924 tlog.Debug(tag, $"TextMapHelperGetFloatFromMap START");
926 var stringKey = "width";
927 var stringInvalidKey = "invalidKey";
929 float defaultValue = 0.0f;
931 var map = new PropertyMap();
932 map.Add(stringKey, new PropertyValue(value));
934 var result = TextMapHelper.GetFloatFromMap(map, stringKey, defaultValue);
935 Assert.AreEqual(value, result, "Should be equal!");
937 result = TextMapHelper.GetFloatFromMap(map, stringInvalidKey, defaultValue);
938 Assert.AreEqual(defaultValue, result, "Should be equal!");
940 tlog.Debug(tag, $"TextMapHelperGetFloatFromMap END (OK)");
945 [Description("TextMapHelper GetColorFromMap.")]
946 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetColorFromMap M")]
947 [Property("SPEC_URL", "-")]
948 [Property("CRITERIA", "MR")]
949 [Property("AUTHOR", "bowon.ryu@samsung.com")]
950 public void TextMapHelperGetColorFromMap()
952 tlog.Debug(tag, $"TextMapHelperGetColorFromMap START");
954 var stringKey = "color";
955 var stringInvalidKey = "invalidKey";
957 var value = new Color(1.0f, 0.2f, 0.5f, 1.0f);
959 var map = new PropertyMap();
960 map.Add(stringKey, new PropertyValue(value));
961 map.Add(intKey, new PropertyValue(value));
963 var result = TextMapHelper.GetColorFromMap(map, stringKey);
964 Assert.AreEqual(value.R, result.R, "Should be equal!");
965 Assert.AreEqual(value.G, result.G, "Should be equal!");
966 Assert.AreEqual(value.B, result.B, "Should be equal!");
967 Assert.AreEqual(value.A, result.A, "Should be equal!");
969 result = TextMapHelper.GetColorFromMap(map, intKey);
970 Assert.AreEqual(value.R, result.R, "Should be equal!");
971 Assert.AreEqual(value.G, result.G, "Should be equal!");
972 Assert.AreEqual(value.B, result.B, "Should be equal!");
973 Assert.AreEqual(value.A, result.A, "Should be equal!");
975 tlog.Debug(tag, $"TextMapHelperGetColorFromMap END (OK)");
980 [Description("TextMapHelper GetVector2FromMap.")]
981 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetVector2FromMap M")]
982 [Property("SPEC_URL", "-")]
983 [Property("CRITERIA", "MR")]
984 [Property("AUTHOR", "bowon.ryu@samsung.com")]
985 public void TextMapHelperGetVector2FromMap()
987 tlog.Debug(tag, $"TextMapHelperGetVector2FromMap START");
989 var stringKey = "position";
990 var stringInvalidKey = "invalidKey";
991 var value = new Vector2(3, 10);
993 var map = new PropertyMap();
994 map.Add(stringKey, new PropertyValue(value));
996 var result = TextMapHelper.GetVector2FromMap(map, stringKey);
997 Assert.AreEqual(value.X, result.X, "Should be equal!");
998 Assert.AreEqual(value.Y, result.Y, "Should be equal!");
1000 tlog.Debug(tag, $"TextMapHelperGetVector2FromMap END (OK)");
1005 [Description("TextMapHelper GetMapFromMap.")]
1006 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetMapFromMap M")]
1007 [Property("SPEC_URL", "-")]
1008 [Property("CRITERIA", "MR")]
1009 [Property("AUTHOR", "bowon.ryu@samsung.com")]
1010 public void TextMapHelperGetMapFromMap()
1012 tlog.Debug(tag, $"TextMapHelperGetMapFromMap START");
1015 var value = new PropertyMap();
1016 value.Add("width", new PropertyValue(10));
1017 value.Add("height", new PropertyValue(20));
1019 var map = new PropertyMap();
1020 map.Add(intKey, new PropertyValue(value));
1022 var result = TextMapHelper.GetMapFromMap(map, intKey);
1023 result.Find(0, "width").Get(out int width);
1024 result.Find(0, "height").Get(out int height);
1025 Assert.AreEqual(10, width, "Should be equal!");
1026 Assert.AreEqual(20, height, "Should be equal!");
1028 tlog.Debug(tag, $"TextMapHelperGetMapFromMap END (OK)");
1033 [Description("TextMapHelper GetNullableIntFromMap.")]
1034 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetNullableIntFromMap M")]
1035 [Property("SPEC_URL", "-")]
1036 [Property("CRITERIA", "MR")]
1037 [Property("AUTHOR", "bowon.ryu@samsung.com")]
1038 public void TextMapHelperGetNullableIntFromMap()
1040 tlog.Debug(tag, $"TextMapHelperGetNullableIntFromMap START");
1043 var intInvalidKey = 10;
1047 var map = new PropertyMap();
1048 map.Add(intKey, new PropertyValue(value));
1050 result = TextMapHelper.GetNullableIntFromMap(map, intKey);
1051 Assert.AreEqual(value, result, "Should be equal!");
1053 result = TextMapHelper.GetNullableIntFromMap(map, intInvalidKey);
1054 Assert.AreEqual(null, result, "Should be equal!");
1056 tlog.Debug(tag, $"TextMapHelperGetNullableIntFromMap END (OK)");
1061 [Description("TextMapHelper GetNullableFloatFromMap.")]
1062 [Property("SPEC", "Tizen.NUI.TextMapHelper.GetNullableFloatFromMap M")]
1063 [Property("SPEC_URL", "-")]
1064 [Property("CRITERIA", "MR")]
1065 [Property("AUTHOR", "bowon.ryu@samsung.com")]
1066 public void TextMapHelperGetNullableFloatFromMap()
1068 tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap START");
1071 var intInvalidKey = 10;
1072 float value = 3.14f;
1073 float? result = null;
1075 var map = new PropertyMap();
1076 map.Add(intKey, new PropertyValue(value));
1078 result = TextMapHelper.GetNullableFloatFromMap(map, intKey);
1079 Assert.AreEqual(value, result, "Should be equal!");
1081 result = TextMapHelper.GetNullableFloatFromMap(map, intInvalidKey);
1082 Assert.AreEqual(null, result, "Should be equal!");
1084 tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap END (OK)");
1089 [Description("TextMapHelper IsValue.")]
1090 [Property("SPEC", "Tizen.NUI.TextMapHelper.IsValue M")]
1091 [Property("SPEC_URL", "-")]
1092 [Property("CRITERIA", "MR")]
1093 [Property("AUTHOR", "bowon.ryu@samsung.com")]
1094 public void TextMapHelperIsValue()
1096 tlog.Debug(tag, $"TextMapHelperIsValue START");
1099 var intInvalidKey = 10;
1100 var value = "value";
1102 var map = new PropertyMap();
1103 map.Add(intKey, new PropertyValue(value));
1105 var result = TextMapHelper.IsValue(map, intKey);
1106 Assert.AreEqual(true, result, "Should be true!");
1108 result = TextMapHelper.IsValue(map, intInvalidKey);
1109 Assert.AreEqual(false, result, "Should be false!");
1111 tlog.Debug(tag, $"TextMapHelperIsValue END (OK)");