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";
19 public bool CheckColor(Color colorSrc, Color colorDst)
21 if (colorSrc.R == colorDst.R && colorSrc.G == colorDst.G && colorSrc.B == colorDst.B && colorSrc.A == colorDst.A)
27 public bool CheckVector2(Vector2 vectorSrc, Vector2 vectorDst)
29 if (vectorSrc.X == vectorDst.X && vectorSrc.Y == vectorDst.Y)
38 tlog.Info(tag, "Init() is called!");
44 tlog.Info(tag, "Destroy() is called!");
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()
56 tlog.Debug(tag, $"TextMapHelperGetFontWidthString START");
58 string fontWidthString;
60 fontWidthString = TextMapHelper.GetFontWidthString(FontWidthType.ExtraCondensed);
61 Assert.AreEqual("extraCondensed", fontWidthString, "Should be equal!");
63 tlog.Debug(tag, $"TextMapHelperGetFontWidthString END (OK)");
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()
75 tlog.Debug(tag, $"TextMapHelperGetFontWeightString START");
77 string fontWeightString;
79 fontWeightString = TextMapHelper.GetFontWeightString(FontWeightType.Light);
80 Assert.AreEqual("light", fontWeightString, "Should be equal!");
82 tlog.Debug(tag, $"TextMapHelperGetFontWeightString END (OK)");
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()
94 tlog.Debug(tag, $"TextMapHelperGetFontSlantString START");
96 string fontSlantString;
98 fontSlantString = TextMapHelper.GetFontSlantString(FontSlantType.Italic);
99 Assert.AreEqual("italic", fontSlantString, "Should be equal!");
101 tlog.Debug(tag, $"TextMapHelperGetFontSlantString END (OK)");
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()
113 tlog.Debug(tag, $"TextMapHelperGetFontWidthType START");
115 FontWidthType fontWidthType;
117 fontWidthType = TextMapHelper.GetFontWidthType("ExtraCondensed");
118 Assert.AreEqual(FontWidthType.ExtraCondensed, fontWidthType, "Should be equal!");
120 fontWidthType = TextMapHelper.GetFontWidthType("InvalidType");
121 Assert.AreEqual(FontWidthType.None, fontWidthType, "If invalid type, should be None type!");
123 tlog.Debug(tag, $"TextMapHelperGetFontWidthType END (OK)");
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()
135 tlog.Debug(tag, $"TextMapHelperGetFontWeightType START");
137 FontWeightType fontWeightType;
139 fontWeightType = TextMapHelper.GetFontWeightType("Light");
140 Assert.AreEqual(FontWeightType.Light, fontWeightType, "Should be equal!");
142 fontWeightType = TextMapHelper.GetFontWeightType("InvalidType");
143 Assert.AreEqual(FontWeightType.None, fontWeightType, "If invalid type, should be None type!");
145 tlog.Debug(tag, $"TextMapHelperGetFontWeightType END (OK)");
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()
157 tlog.Debug(tag, $"TextMapHelperGetFontSlantType START");
159 FontSlantType fontSlantType;
161 fontSlantType = TextMapHelper.GetFontSlantType("Italic");
162 Assert.AreEqual(FontSlantType.Italic, fontSlantType, "Should be equal!");
164 fontSlantType = TextMapHelper.GetFontSlantType("InvalidType");
165 Assert.AreEqual(FontSlantType.None, fontSlantType, "If invalid type, should be None type!");
167 tlog.Debug(tag, $"TextMapHelperGetFontSlantType END (OK)");
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()
179 tlog.Debug(tag, $"TextMapHelperGetFontStyleMap START");
181 var fontStyle = new Tizen.NUI.Text.FontStyle()
183 Width = FontWidthType.Expanded,
184 Weight = FontWeightType.Bold,
185 Slant = FontSlantType.Italic
188 using (PropertyMap map = TextMapHelper.GetFontStyleMap(fontStyle))
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);
194 Assert.AreEqual("expanded", width, "Should be equal!");
195 Assert.AreEqual("bold", weight, "Should be equal!");
196 Assert.AreEqual("italic", slant, "Should be equal!");
199 tlog.Debug(tag, $"TextMapHelperGetFontStyleMap END (OK)");
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()
211 tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct START");
213 using (var map = new PropertyMap())
215 map.Add("width", "expanded");
216 map.Add("weight", "bold");
217 map.Add("slant", "italic");
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!");
225 tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct END (OK)");
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()
237 tlog.Debug(tag, $"TextMapHelperGetInputFilterMap START");
239 var inputFilter = new Tizen.NUI.Text.InputFilter()
245 using (PropertyMap map = TextMapHelper.GetInputFilterMap(inputFilter))
247 map.Find(0).Get(out string accepted);
248 map.Find(1).Get(out string rejected);
250 Assert.AreEqual(accepted, inputFilter.Accepted, "Should be equal!");
251 Assert.AreEqual(rejected, inputFilter.Rejected, "Should be equal!");
254 tlog.Debug(tag, $"TextMapHelperGetInputFilterMap END (OK)");
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()
266 tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct START");
268 using (var map = new PropertyMap())
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!");
278 tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct END (OK)");
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()
290 tlog.Debug(tag, $"TextMapHelperGetUnderlineMap START");
292 var underline = new Tizen.NUI.Text.Underline()
295 Color = new Color("#3498DB"),
297 Type = UnderlineType.Solid,
302 using (PropertyMap map = TextMapHelper.GetUnderlineMap(underline))
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);
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!");
322 tlog.Debug(tag, $"TextMapHelperGetUnderlineMap END (OK)");
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()
334 tlog.Debug(tag, $"TextMapHelperGetStrikethroughStruct START");
336 using (var map = new PropertyMap())
338 var color = new Color("#3498DB");
339 map.Add("enable", true);
340 map.Add("color", color);
341 map.Add("height", (float)2.0f);
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!");
350 tlog.Debug(tag, $"TextMapHelperGetStrikethroughStruct END (OK)");
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()
362 tlog.Debug(tag, $"TextMapHelperGetStrikethroughMap START");
364 var strikethrough = new Tizen.NUI.Text.Strikethrough()
367 Color = new Color("#3498DB"),
371 using (PropertyMap map = TextMapHelper.GetStrikethroughMap(strikethrough))
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);
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!");
384 tlog.Debug(tag, $"TextMapHelperGetStrikethroughMap END (OK)");
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()
396 tlog.Debug(tag, $"TextMapHelperGetUnderlineStruct START");
398 using (var map = new PropertyMap())
400 var color = new Color("#3498DB");
401 map.Add("enable", true);
402 map.Add("color", color);
403 map.Add("height", (float)2.0f);
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!");
412 tlog.Debug(tag, $"TextMapHelperGetUnderlineStruct END (OK)");
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()
424 tlog.Debug(tag, $"TextMapHelperGetShadowMap START");
426 var shadow = new Tizen.NUI.Text.Shadow()
428 Offset = new Vector2(3, 3),
429 Color = new Color("#F1C40F"),
433 using (PropertyMap map = TextMapHelper.GetShadowMap(shadow))
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);
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!");
448 tlog.Debug(tag, $"TextMapHelperGetShadowMap END (OK)");
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()
460 tlog.Debug(tag, $"TextMapHelperGetShadowStruct START");
462 var offset = new Vector2(5, 5);
463 var color = new Color("#F1C40F");
464 float blurRadius = 5.0f;
466 using (var map = new PropertyMap())
468 map.Add("offset", offset);
469 map.Add("color", color);
470 map.Add("blurRadius", (float)blurRadius);
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!");
481 tlog.Debug(tag, $"TextMapHelperGetShadowStruct END (OK)");
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()
493 tlog.Debug(tag, $"TextMapHelperGetOutlineMap START");
495 var outline = new Tizen.NUI.Text.Outline()
498 Color = new Color("#45B39D"),
501 using (PropertyMap map = TextMapHelper.GetOutlineMap(outline))
503 var color = new Color();
504 map.Find(0, "color").Get(color);
505 map.Find(0, "width").Get(out float width);
507 Assert.AreEqual(width, outline.Width, "Should be equal!");
508 Assert.AreEqual(true, CheckColor(color, outline.Color), "Should be true!");
512 tlog.Debug(tag, $"TextMapHelperGetOutlineMap END (OK)");
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()
524 tlog.Debug(tag, $"TextMapHelperGetOutlineStruct START");
527 var color = new Color("#45B39D");
529 using (var map = new PropertyMap())
531 map.Add("color", color);
532 map.Add("width", (float)width);
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!");
541 tlog.Debug(tag, $"TextMapHelperGetOutlineStruct END (OK)");
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()
553 tlog.Debug(tag, $"TextMapHelperGetFontSizeString START");
555 string fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PointSize);
556 Assert.AreEqual("pointSize", fontSizeTypeString, "Should be equal!");
558 fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PixelSize);
559 Assert.AreEqual("pixelSize", fontSizeTypeString, "Should be equal!");
561 tlog.Debug(tag, $"TextMapHelperGetFontSizeString END (OK)");
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()
573 tlog.Debug(tag, $"TextMapHelperGetFontSizeType START");
575 FontSizeType fontSizeType;
577 fontSizeType = TextMapHelper.GetFontSizeType("PointSize");
578 Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "Should be equal!");
580 fontSizeType = TextMapHelper.GetFontSizeType("PixelSize");
581 Assert.AreEqual(FontSizeType.PixelSize, fontSizeType, "Should be equal!");
583 fontSizeType = TextMapHelper.GetFontSizeType("InvalidType");
584 Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "If invalid type, should be PointSize type!");
586 tlog.Debug(tag, $"TextMapHelperGetFontSizeType END (OK)");
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()
598 tlog.Debug(tag, $"TextMapHelperGetTextFitMap START");
600 var textFit = new Tizen.NUI.Text.TextFit()
606 FontSizeType = FontSizeType.PointSize
609 using (PropertyMap map = TextMapHelper.GetTextFitMap(textFit))
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);
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!");
624 tlog.Debug(tag, $"TextMapHelperGetTextFitMap END (OK)");
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()
636 tlog.Debug(tag, $"TextMapHelperGetTextFitStruct START");
639 float minSize = 10.0f;
640 float maxSize = 100.0f;
641 float stepSize = 5.0f;
643 using (var map = new PropertyMap())
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");
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!");
659 tlog.Debug(tag, $"TextMapHelperGetTextFitStruct END (OK)");
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()
671 tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap START");
673 var placeholder = new Tizen.NUI.Text.Placeholder()
675 Text = "placeholder text",
676 TextFocused = "placeholder textFocused",
677 Color = new Color("#45B39D"),
678 FontFamily = "BreezeSans",
679 FontStyle = new Tizen.NUI.Text.FontStyle()
681 Width = FontWidthType.Expanded,
682 Weight = FontWeightType.Bold,
683 Slant = FontSlantType.Italic,
690 string textFocused = "";
691 Color color = new Color();
692 string fontFamily = null;
693 var fontStyle = new PropertyMap();
695 bool ellipsis = false;
697 using (PropertyMap map = TextMapHelper.GetPlaceholderMap(placeholder))
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);
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!");
724 tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap END (OK)");
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()
736 tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct START");
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;
749 using (var map = new PropertyMap())
752 map.Add(1, textFocused);
754 map.Add(3, fontFamily);
755 map.Add(4, new PropertyValue(fontStyle));
756 map.Add(5, (float)pointSize);
757 map.Add(7, ellipsis);
759 var placeholder = TextMapHelper.GetPlaceholderStruct(map);
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!");
775 tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct END (OK)");
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()
787 tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap START");
789 var hiddenInput = new Tizen.NUI.Text.HiddenInput()
791 Mode = HiddenInputModeType.ShowLastCharacter,
792 SubstituteCharacter = '★',
794 ShowLastCharacterDuration = 1000
797 using (PropertyMap map = TextMapHelper.GetHiddenInputMap(hiddenInput))
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);
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!");
810 tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap END (OK)");
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()
822 tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct START");
824 int mode = (int)HiddenInputModeType.ShowLastCharacter;
825 int substituteCharacter = Convert.ToInt32('★');
826 int substituteCount = 0;
827 int showLastCharacterDuration = 1000;
829 using (var map = new PropertyMap())
832 map.Add(1, substituteCharacter);
833 map.Add(2, substituteCount);
834 map.Add(3, showLastCharacterDuration);
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!");
843 tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct END (OK)");
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()
855 tlog.Debug(tag, $"TextMapHelperGetFileNameMap START");
857 string url = "filePath";
859 using (PropertyMap map = TextMapHelper.GetFileNameMap(url))
861 map.Find(0, "filename").Get(out string fileName);
862 Assert.AreEqual(url, fileName, "Should be equal!");
865 tlog.Debug(tag, $"TextMapHelperGetFileNameMap END (OK)");
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()
877 tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct START");
879 string leftImageUrl = "leftImageUrl";
880 string rightImageUrl = "rightImageUrl";
882 using (var leftImageMap = new PropertyMap().Add("filename", leftImageUrl))
883 using (var rightImageMap = new PropertyMap().Add("filename", rightImageUrl))
885 var selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
887 Assert.AreEqual(leftImageUrl, selectionHandleImage.LeftImageUrl, "Should be equal!");
888 Assert.AreEqual(rightImageUrl, selectionHandleImage.RightImageUrl, "Should be equal!");
891 tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct END (OK)");
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()
903 tlog.Debug(tag, $"TextMapHelperGetCamelCase START");
905 string pascalCase = "TextMapHelper";
906 string camelCase = "textMapHelper";
907 string expectedResult = TextMapHelper.GetCamelCase(pascalCase);
909 Assert.AreEqual(camelCase, expectedResult, "Should be equal!");
911 string emptyString = "";
912 expectedResult = TextMapHelper.GetCamelCase(emptyString);
914 Assert.AreEqual(emptyString, expectedResult, "Should be equal!");
916 tlog.Debug(tag, $"TextMapHelperGetCamelCase END (OK)");
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()
928 tlog.Debug(tag, $"TextMapHelperGetStringFromMap START");
930 var stringKey = "width";
931 var stringInvalidKey = "invalidKey";
933 var intInvalidKey = 10;
934 var value = "expanded";
935 var defaultValue = "none";
937 using (var map = new PropertyMap())
939 map.Add(stringKey, value);
940 map.Add(intKey, value);
942 var result = TextMapHelper.GetStringFromMap(map, stringKey, defaultValue);
943 Assert.AreEqual(value, result, "Should be equal!");
945 result = TextMapHelper.GetStringFromMap(map, stringInvalidKey, defaultValue);
946 Assert.AreEqual(defaultValue, result, "Should be equal!");
948 result = TextMapHelper.GetStringFromMap(map, intKey, defaultValue);
949 Assert.AreEqual(value, result, "Should be equal!");
951 result = TextMapHelper.GetStringFromMap(map, intInvalidKey, defaultValue);
952 Assert.AreEqual(defaultValue, result, "Should be equal!");
955 tlog.Debug(tag, $"TextMapHelperGetStringFromMap END (OK)");
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()
967 tlog.Debug(tag, $"TextMapHelperGetBoolFromMap START");
969 var stringKey = "width";
970 var stringInvalidKey = "invalidKey";
972 var intInvalidKey = 10;
974 var defaultValue = false;
976 using (var map = new PropertyMap())
978 map.Add(stringKey, value);
979 map.Add(intKey, value);
981 var result = TextMapHelper.GetBoolFromMap(map, stringKey, defaultValue);
982 Assert.AreEqual(value, result, "Should be equal!");
984 result = TextMapHelper.GetBoolFromMap(map, stringInvalidKey, defaultValue);
985 Assert.AreEqual(defaultValue, result, "Should be equal!");
987 result = TextMapHelper.GetBoolFromMap(map, intKey, defaultValue);
988 Assert.AreEqual(value, result, "Should be equal!");
990 result = TextMapHelper.GetBoolFromMap(map, intInvalidKey, defaultValue);
991 Assert.AreEqual(defaultValue, result, "Should be equal!");
994 tlog.Debug(tag, $"TextMapHelperGetBoolFromMap END (OK)");
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()
1006 tlog.Debug(tag, $"TextMapHelperGetIntFromMap START");
1008 var stringKey = "width";
1009 var stringInvalidKey = "invalidKey";
1011 var intInvalidKey = 10;
1013 var defaultValue = 0;
1015 using (var map = new PropertyMap())
1017 map.Add(stringKey, value);
1018 map.Add(intKey, value);
1020 var result = TextMapHelper.GetIntFromMap(map, stringKey, defaultValue);
1021 Assert.AreEqual(value, result, "Should be equal!");
1023 result = TextMapHelper.GetIntFromMap(map, stringInvalidKey, defaultValue);
1024 Assert.AreEqual(defaultValue, result, "Should be equal!");
1026 result = TextMapHelper.GetIntFromMap(map, intKey, defaultValue);
1027 Assert.AreEqual(value, result, "Should be equal!");
1029 result = TextMapHelper.GetIntFromMap(map, intInvalidKey, defaultValue);
1030 Assert.AreEqual(defaultValue, result, "Should be equal!");
1033 tlog.Debug(tag, $"TextMapHelperGetIntFromMap END (OK)");
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()
1045 tlog.Debug(tag, $"TextMapHelperGetFloatFromMap START");
1047 var stringKey = "width";
1048 var stringInvalidKey = "invalidKey";
1049 float value = 3.14f;
1050 float defaultValue = 0.0f;
1052 using (var map = new PropertyMap())
1054 map.Add(stringKey, value);
1056 var result = TextMapHelper.GetFloatFromMap(map, stringKey, defaultValue);
1057 Assert.AreEqual(value, result, "Should be equal!");
1059 result = TextMapHelper.GetFloatFromMap(map, stringInvalidKey, defaultValue);
1060 Assert.AreEqual(defaultValue, result, "Should be equal!");
1063 tlog.Debug(tag, $"TextMapHelperGetFloatFromMap END (OK)");
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()
1075 tlog.Debug(tag, $"TextMapHelperGetColorFromMap START");
1077 var stringKey = "color";
1078 var stringInvalidKey = "invalidKey";
1080 var value = new Color(1.0f, 0.2f, 0.5f, 1.0f);
1082 using (var map = new PropertyMap())
1084 map.Add(stringKey, value);
1085 map.Add(intKey, value);
1087 var result = TextMapHelper.GetColorFromMap(map, stringKey);
1088 Assert.AreEqual(true, CheckColor(value, result), "Should be true!");
1090 result = TextMapHelper.GetColorFromMap(map, intKey);
1091 Assert.AreEqual(true, CheckColor(value, result), "Should be true!");
1094 tlog.Debug(tag, $"TextMapHelperGetColorFromMap END (OK)");
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()
1106 tlog.Debug(tag, $"TextMapHelperGetVector2FromMap START");
1108 var stringKey = "position";
1109 var stringInvalidKey = "invalidKey";
1110 var value = new Vector2(3, 10);
1112 using (var map = new PropertyMap())
1114 map.Add(stringKey, value);
1116 var result = TextMapHelper.GetVector2FromMap(map, stringKey);
1117 Assert.AreEqual(true, CheckVector2(value, result), "Should be true!");
1120 tlog.Debug(tag, $"TextMapHelperGetVector2FromMap END (OK)");
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()
1132 tlog.Debug(tag, $"TextMapHelperGetMapFromMap START");
1135 var value = new PropertyMap();
1136 value.Add("width", 10);
1137 value.Add("height", 20);
1139 using (var map = new PropertyMap())
1141 map.Add(intKey, new PropertyValue(value));
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!");
1150 tlog.Debug(tag, $"TextMapHelperGetMapFromMap END (OK)");
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()
1162 tlog.Debug(tag, $"TextMapHelperGetNullableIntFromMap START");
1165 var intInvalidKey = 10;
1169 using (var map = new PropertyMap())
1171 map.Add(intKey, value);
1173 result = TextMapHelper.GetNullableIntFromMap(map, intKey);
1174 Assert.AreEqual(value, result, "Should be equal!");
1176 result = TextMapHelper.GetNullableIntFromMap(map, intInvalidKey);
1177 Assert.AreEqual(null, result, "Should be equal!");
1180 tlog.Debug(tag, $"TextMapHelperGetNullableIntFromMap END (OK)");
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()
1192 tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap START");
1194 var stringKey = "width";
1195 var stringInvalidKey = "invalidKey";
1197 var intInvalidKey = 10;
1198 float value = 3.14f;
1199 float? result = null;
1201 using (var map = new PropertyMap())
1203 map.Add(stringKey, value);
1204 map.Add(intKey, value);
1206 result = TextMapHelper.GetNullableFloatFromMap(map, stringKey);
1207 Assert.AreEqual(value, result, "Should be equal!");
1209 result = TextMapHelper.GetNullableFloatFromMap(map, stringInvalidKey);
1210 Assert.AreEqual(null, result, "Should be equal!");
1212 result = TextMapHelper.GetNullableFloatFromMap(map, intKey);
1213 Assert.AreEqual(value, result, "Should be equal!");
1215 result = TextMapHelper.GetNullableFloatFromMap(map, intInvalidKey);
1216 Assert.AreEqual(null, result, "Should be equal!");
1219 tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap END (OK)");
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()
1231 tlog.Debug(tag, $"TextMapHelperIsValue START");
1234 var intInvalidKey = 10;
1235 var value = "value";
1237 using (var map = new PropertyMap())
1239 map.Add(intKey, value);
1241 var result = TextMapHelper.IsValue(map, intKey);
1242 Assert.AreEqual(true, result, "Should be true!");
1244 result = TextMapHelper.IsValue(map, intInvalidKey);
1245 Assert.AreEqual(false, result, "Should be false!");
1248 tlog.Debug(tag, $"TextMapHelperIsValue END (OK)");