Beispiel #1
0
        public void TextMapHelperGetShadowMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetShadowMap START");

            var shadow = new Tizen.NUI.Text.Shadow()
            {
                Offset     = new Vector2(3, 3),
                Color      = new Color("#F1C40F"),
                BlurRadius = 2.0f,
            };

            using (PropertyMap map = TextMapHelper.GetShadowMap(shadow))
            {
                var offset = new Vector2();
                var color  = new Color();
                map.Find(0, "offset").Get(offset);
                map.Find(0, "color").Get(color);
                map.Find(0, "blurRadius").Get(out float blurRadius);

                Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
                Assert.AreEqual(true, CheckVector2(offset, shadow.Offset), "Should be true!");
                Assert.AreEqual(true, CheckColor(color, shadow.Color), "Should be true!");
                offset.Dispose();
                color.Dispose();
            }

            tlog.Debug(tag, $"TextMapHelperGetShadowMap END (OK)");
        }
Beispiel #2
0
        public void TextMapHelperGetShadowStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetShadowStruct START");

            var   offset     = new Vector2(5, 5);
            var   color      = new Color("#F1C40F");
            float blurRadius = 5.0f;

            using (var map = new PropertyMap())
            {
                map.Add("offset", offset);
                map.Add("color", color);
                map.Add("blurRadius", (float)blurRadius);

                var shadow = TextMapHelper.GetShadowStruct(map);
                Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
                Assert.AreEqual(true, CheckVector2(offset, shadow.Offset), "Should be true!");
                Assert.AreEqual(true, CheckColor(color, shadow.Color), "Should be true!");
            }

            offset.Dispose();
            color.Dispose();

            tlog.Debug(tag, $"TextMapHelperGetShadowStruct END (OK)");
        }
Beispiel #3
0
        public void TextMapHelperGetStrikethroughMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetStrikethroughMap START");

            var strikethrough = new Tizen.NUI.Text.Strikethrough()
            {
                Enable = true,
                Color  = new Color("#3498DB"),
                Height = 2.0f
            };

            using (PropertyMap map = TextMapHelper.GetStrikethroughMap(strikethrough))
            {
                var color = new Color();
                map.Find(0, "enable").Get(out bool enable);
                map.Find(0, "color").Get(color);
                map.Find(0, "height").Get(out float height);

                Assert.AreEqual(enable, strikethrough.Enable, "Should be equal!");
                Assert.AreEqual(height, strikethrough.Height, "Should be equal!");
                Assert.AreEqual(true, CheckColor(color, strikethrough.Color), "Should be true!");
                color.Dispose();
            }

            tlog.Debug(tag, $"TextMapHelperGetStrikethroughMap END (OK)");
        }
Beispiel #4
0
        public void TextMapHelperGetColorFromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetColorFromMap START");

            var stringKey        = "color";
            var stringInvalidKey = "invalidKey";
            var intKey           = 1;
            var value            = new Color(1.0f, 0.2f, 0.5f, 1.0f);

            var map = new PropertyMap();

            map.Add(stringKey, new PropertyValue(value));
            map.Add(intKey, new PropertyValue(value));

            var result = TextMapHelper.GetColorFromMap(map, stringKey);

            Assert.AreEqual(value.R, result.R, "Should be equal!");
            Assert.AreEqual(value.G, result.G, "Should be equal!");
            Assert.AreEqual(value.B, result.B, "Should be equal!");
            Assert.AreEqual(value.A, result.A, "Should be equal!");

            result = TextMapHelper.GetColorFromMap(map, intKey);
            Assert.AreEqual(value.R, result.R, "Should be equal!");
            Assert.AreEqual(value.G, result.G, "Should be equal!");
            Assert.AreEqual(value.B, result.B, "Should be equal!");
            Assert.AreEqual(value.A, result.A, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetColorFromMap END (OK)");
        }
Beispiel #5
0
        public void TextMapHelperGetNullableFloatFromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap START");

            var   stringKey        = "width";
            var   stringInvalidKey = "invalidKey";
            var   intKey           = 1;
            var   intInvalidKey    = 10;
            float value            = 3.14f;
            float?result           = null;

            using (var map = new PropertyMap())
            {
                map.Add(stringKey, value);
                map.Add(intKey, value);

                result = TextMapHelper.GetNullableFloatFromMap(map, stringKey);
                Assert.AreEqual(value, result, "Should be equal!");

                result = TextMapHelper.GetNullableFloatFromMap(map, stringInvalidKey);
                Assert.AreEqual(null, result, "Should be equal!");

                result = TextMapHelper.GetNullableFloatFromMap(map, intKey);
                Assert.AreEqual(value, result, "Should be equal!");

                result = TextMapHelper.GetNullableFloatFromMap(map, intInvalidKey);
                Assert.AreEqual(null, result, "Should be equal!");
            }

            tlog.Debug(tag, $"TextMapHelperGetNullableFloatFromMap END (OK)");
        }
Beispiel #6
0
        public void TextMapHelperGetShadowStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetShadowStruct START");

            var   offset     = new Vector2(5, 5);
            var   color      = new Color("#F1C40F");
            float blurRadius = 5.0f;

            var map = new PropertyMap();

            map.Add("offset", new PropertyValue(offset));
            map.Add("color", new PropertyValue(color));
            map.Add("blurRadius", new PropertyValue((float)blurRadius));

            var shadow = TextMapHelper.GetShadowStruct(map);

            Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
            Assert.AreEqual(offset.X, shadow.Offset.X, "Should be equal!");
            Assert.AreEqual(offset.Y, shadow.Offset.Y, "Should be equal!");
            Assert.AreEqual(color.R, shadow.Color.R, "Should be equal!");
            Assert.AreEqual(color.G, shadow.Color.G, "Should be equal!");
            Assert.AreEqual(color.B, shadow.Color.B, "Should be equal!");
            Assert.AreEqual(color.A, shadow.Color.A, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetShadowStruct END (OK)");
        }
Beispiel #7
0
        public void TextMapHelperGetStringFromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetStringFromMap START");

            var stringKey        = "width";
            var stringInvalidKey = "invalidKey";
            var intKey           = 1;
            var intInvalidKey    = 10;
            var value            = "expanded";
            var defaultValue     = "none";

            using (var map = new PropertyMap())
            {
                map.Add(stringKey, value);
                map.Add(intKey, value);

                var result = TextMapHelper.GetStringFromMap(map, stringKey, defaultValue);
                Assert.AreEqual(value, result, "Should be equal!");

                result = TextMapHelper.GetStringFromMap(map, stringInvalidKey, defaultValue);
                Assert.AreEqual(defaultValue, result, "Should be equal!");

                result = TextMapHelper.GetStringFromMap(map, intKey, defaultValue);
                Assert.AreEqual(value, result, "Should be equal!");

                result = TextMapHelper.GetStringFromMap(map, intInvalidKey, defaultValue);
                Assert.AreEqual(defaultValue, result, "Should be equal!");
            }

            tlog.Debug(tag, $"TextMapHelperGetStringFromMap END (OK)");
        }
Beispiel #8
0
        public void TextMapHelperGetShadowMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetShadowMap START");

            var shadow = new Tizen.NUI.Text.Shadow()
            {
                Offset     = new Vector2(3, 3),
                Color      = new Color("#F1C40F"),
                BlurRadius = 2.0f,
            };

            var map    = TextMapHelper.GetShadowMap(shadow);
            var offset = new Vector2();
            var color  = new Color();

            map.Find(0, "offset").Get(offset);
            map.Find(0, "color").Get(color);
            map.Find(0, "blurRadius").Get(out float blurRadius);

            Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
            Assert.AreEqual(offset.X, shadow.Offset.X, "Should be equal!");
            Assert.AreEqual(offset.Y, shadow.Offset.Y, "Should be equal!");
            Assert.AreEqual(color.R, shadow.Color.R, "Should be equal!");
            Assert.AreEqual(color.G, shadow.Color.G, "Should be equal!");
            Assert.AreEqual(color.B, shadow.Color.B, "Should be equal!");
            Assert.AreEqual(color.A, shadow.Color.A, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetShadowMap END (OK)");
        }
Beispiel #9
0
        public void TextMapHelperGetHiddenInputMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap START");

            var hiddenInput = new Tizen.NUI.Text.HiddenInput()
            {
                Mode = HiddenInputModeType.ShowLastCharacter,
                SubstituteCharacter       = '★',
                SubstituteCount           = 0,
                ShowLastCharacterDuration = 1000
            };

            var map = TextMapHelper.GetHiddenInputMap(hiddenInput);

            map.Find(0).Get(out int mode);
            map.Find(1).Get(out int substituteCharacter);
            map.Find(2).Get(out int substituteCount);
            map.Find(3).Get(out int showLastCharacterDuration);

            Assert.AreEqual(mode, (int)hiddenInput.Mode, "Should be equal!");
            Assert.AreEqual(substituteCharacter, Convert.ToInt32(hiddenInput.SubstituteCharacter), "Should be equal!");
            Assert.AreEqual(substituteCount, hiddenInput.SubstituteCount, "Should be equal!");
            Assert.AreEqual(showLastCharacterDuration, hiddenInput.ShowLastCharacterDuration, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetHiddenInputMap END (OK)");
        }
Beispiel #10
0
        public void TextMapHelperGetUnderlineMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetUnderlineMap START");

            var underline = new Tizen.NUI.Text.Underline()
            {
                Enable = true,
                Color  = new Color("#3498DB"),
                Height = 2.0f
            };

            var map   = TextMapHelper.GetUnderlineMap(underline);
            var color = new Color();

            map.Find(0, "enable").Get(out bool enable);
            map.Find(0, "color").Get(color);
            map.Find(0, "height").Get(out float height);

            Assert.AreEqual(enable, underline.Enable, "Should be equal!");
            Assert.AreEqual(height, underline.Height, "Should be equal!");
            Assert.AreEqual(color.R, underline.Color.R, "Should be equal!");
            Assert.AreEqual(color.G, underline.Color.G, "Should be equal!");
            Assert.AreEqual(color.B, underline.Color.B, "Should be equal!");
            Assert.AreEqual(color.A, underline.Color.A, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetUnderlineMap END (OK)");
        }
Beispiel #11
0
        public void TextMapHelperGetHiddenInputStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct START");

            int mode = (int)HiddenInputModeType.ShowLastCharacter;
            int substituteCharacter       = Convert.ToInt32('★');
            int substituteCount           = 0;
            int showLastCharacterDuration = 1000;

            var map = new PropertyMap();

            map.Add(0, new PropertyValue(mode));
            map.Add(1, new PropertyValue(substituteCharacter));
            map.Add(2, new PropertyValue(substituteCount));
            map.Add(3, new PropertyValue(showLastCharacterDuration));

            var hiddenInput = TextMapHelper.GetHiddenInputStruct(map);

            Assert.AreEqual(mode, (int)hiddenInput.Mode, "Should be equal!");
            Assert.AreEqual(substituteCharacter, Convert.ToInt32(hiddenInput.SubstituteCharacter), "Should be equal!");
            Assert.AreEqual(substituteCount, hiddenInput.SubstituteCount, "Should be equal!");
            Assert.AreEqual(showLastCharacterDuration, hiddenInput.ShowLastCharacterDuration, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetHiddenInputStruct END (OK)");
        }
Beispiel #12
0
        public void TextMapHelperGetBoolFromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetBoolFromMap START");

            var stringKey        = "width";
            var stringInvalidKey = "invalidKey";
            var intKey           = 1;
            var intInvalidKey    = 10;
            var value            = true;
            var defaultValue     = false;

            var map = new PropertyMap();

            map.Add(stringKey, new PropertyValue(value));
            map.Add(intKey, new PropertyValue(value));

            var result = TextMapHelper.GetBoolFromMap(map, stringKey, defaultValue);

            Assert.AreEqual(value, result, "Should be equal!");

            result = TextMapHelper.GetBoolFromMap(map, stringInvalidKey, defaultValue);
            Assert.AreEqual(defaultValue, result, "Should be equal!");

            result = TextMapHelper.GetBoolFromMap(map, intKey, defaultValue);
            Assert.AreEqual(value, result, "Should be equal!");

            result = TextMapHelper.GetBoolFromMap(map, intInvalidKey, defaultValue);
            Assert.AreEqual(defaultValue, result, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetBoolFromMap END (OK)");
        }
Beispiel #13
0
        public void TextMapHelperGetTextFitStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetTextFitStruct START");

            bool  enable   = true;
            float minSize  = 10.0f;
            float maxSize  = 100.0f;
            float stepSize = 5.0f;

            var map = new PropertyMap();

            map.Add("enable", new PropertyValue(enable));
            map.Add("minSize", new PropertyValue((float)minSize));
            map.Add("maxSize", new PropertyValue((float)maxSize));
            map.Add("stepSize", new PropertyValue((float)stepSize));
            map.Add("fontSizeType", new PropertyValue("pointSize"));

            var textFit = TextMapHelper.GetTextFitStruct(map);

            Assert.AreEqual(enable, textFit.Enable, "Should be equal!");
            Assert.AreEqual(minSize, textFit.MinSize, "Should be equal!");
            Assert.AreEqual(maxSize, textFit.MaxSize, "Should be equal!");
            Assert.AreEqual(stepSize, textFit.StepSize, "Should be equal!");
            Assert.AreEqual(FontSizeType.PointSize, textFit.FontSizeType, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetTextFitStruct END (OK)");
        }
Beispiel #14
0
        public void TextMapHelperGetTextFitMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetTextFitMap START");

            var textFit = new Tizen.NUI.Text.TextFit()
            {
                Enable       = true,
                MinSize      = 10.0f,
                MaxSize      = 100.0f,
                StepSize     = 5.0f,
                FontSizeType = FontSizeType.PointSize
            };

            var map = TextMapHelper.GetTextFitMap(textFit);

            map.Find(0, "enable").Get(out bool enable);
            map.Find(0, "minSize").Get(out float minSize);
            map.Find(0, "maxSize").Get(out float maxSize);
            map.Find(0, "stepSize").Get(out float stepSize);
            map.Find(0, "fontSizeType").Get(out string fontSizeType);

            Assert.AreEqual(enable, textFit.Enable, "Should be equal!");
            Assert.AreEqual(minSize, textFit.MinSize, "Should be equal!");
            Assert.AreEqual(maxSize, textFit.MaxSize, "Should be equal!");
            Assert.AreEqual(stepSize, textFit.StepSize, "Should be equal!");
            Assert.AreEqual(fontSizeType, "pointSize", "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetTextFitMap END (OK)");
        }
Beispiel #15
0
        public void TextMapHelperGetPlaceholderMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap START");

            var placeholder = new Tizen.NUI.Text.Placeholder()
            {
                Text        = "placeholder text",
                TextFocused = "placeholder textFocused",
                Color       = new Color("#45B39D"),
                FontFamily  = "BreezeSans",
                FontStyle   = new Tizen.NUI.Text.FontStyle()
                {
                    Width  = FontWidthType.Expanded,
                    Weight = FontWeightType.Bold,
                    Slant  = FontSlantType.Italic,
                },
                PointSize = 25.0f,
                Ellipsis  = true
            };

            string text        = "";
            string textFocused = "";
            Color  color       = new Color();
            string fontFamily  = null;
            var    fontStyle   = new PropertyMap();
            float  pointSize;
            bool   ellipsis = false;

            var map = TextMapHelper.GetPlaceholderMap(placeholder);

            map.Find(0).Get(out text);
            map.Find(1).Get(out textFocused);
            map.Find(2).Get(color);
            map.Find(3).Get(out fontFamily);
            map.Find(4).Get(fontStyle);
            map.Find(5).Get(out pointSize);
            map.Find(7).Get(out ellipsis);

            fontStyle["width"].Get(out string width);
            fontStyle["weight"].Get(out string weight);
            fontStyle["slant"].Get(out string slant);

            Assert.AreEqual(text, placeholder.Text, "Should be equal!");
            Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!");
            Assert.AreEqual(color.R, placeholder.Color.R, "Should be equal!");
            Assert.AreEqual(color.G, placeholder.Color.G, "Should be equal!");
            Assert.AreEqual(color.B, placeholder.Color.B, "Should be equal!");
            Assert.AreEqual(color.A, placeholder.Color.A, "Should be equal!");
            Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!");
            Assert.AreEqual(width, "expanded", "Should be equal!");
            Assert.AreEqual(weight, "bold", "Should be equal!");
            Assert.AreEqual(slant, "italic", "Should be equal!");
            Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!");
            Assert.AreEqual(ellipsis, placeholder.Ellipsis, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap END (OK)");
        }
Beispiel #16
0
        public void TextMapHelperGetFontWeightString()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontWeightString START");

            string fontWeightString;

            fontWeightString = TextMapHelper.GetFontWeightString(FontWeightType.Light);
            Assert.AreEqual("light", fontWeightString, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetFontWeightString END (OK)");
        }
Beispiel #17
0
        public void TextMapHelperGetFontWidthString()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontWidthString START");

            string fontWidthString;

            fontWidthString = TextMapHelper.GetFontWidthString(FontWidthType.ExtraCondensed);
            Assert.AreEqual("extraCondensed", fontWidthString, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetFontWidthString END (OK)");
        }
Beispiel #18
0
        public void TextMapHelperGetFontSlantString()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontSlantString START");

            string fontSlantString;

            fontSlantString = TextMapHelper.GetFontSlantString(FontSlantType.Italic);
            Assert.AreEqual("italic", fontSlantString, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetFontSlantString END (OK)");
        }
Beispiel #19
0
        public void TextMapHelperGetFontSizeString()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontSizeString START");

            string fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PointSize);

            Assert.AreEqual("pointSize", fontSizeTypeString, "Should be equal!");

            fontSizeTypeString = TextMapHelper.GetFontSizeString(FontSizeType.PixelSize);
            Assert.AreEqual("pixelSize", fontSizeTypeString, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetFontSizeString END (OK)");
        }
Beispiel #20
0
        public void TextMapHelperGetFontWidthType()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontWidthType START");

            FontWidthType fontWidthType;

            fontWidthType = TextMapHelper.GetFontWidthType("ExtraCondensed");
            Assert.AreEqual(FontWidthType.ExtraCondensed, fontWidthType, "Should be equal!");

            fontWidthType = TextMapHelper.GetFontWidthType("InvalidType");
            Assert.AreEqual(FontWidthType.None, fontWidthType, "If invalid type, should be None type!");

            tlog.Debug(tag, $"TextMapHelperGetFontWidthType END (OK)");
        }
Beispiel #21
0
        public void TextMapHelperGetFileNameMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetFileNameMap START");

            string url = "filePath";

            var map = TextMapHelper.GetFileNameMap(url);

            map.Find(0, "filename").Get(out string fileName);

            Assert.AreEqual(url, fileName, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetFileNameMap END (OK)");
        }
Beispiel #22
0
        public void TextMapHelperGetFontSlantType()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontSlantType START");

            FontSlantType fontSlantType;

            fontSlantType = TextMapHelper.GetFontSlantType("Italic");
            Assert.AreEqual(FontSlantType.Italic, fontSlantType, "Should be equal!");

            fontSlantType = TextMapHelper.GetFontSlantType("InvalidType");
            Assert.AreEqual(FontSlantType.None, fontSlantType, "If invalid type, should be None type!");

            tlog.Debug(tag, $"TextMapHelperGetFontSlantType END (OK)");
        }
Beispiel #23
0
        public void TextMapHelperGGetInputFilterStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct START");

            var map = new PropertyMap();

            map.Add(0, new PropertyValue(@"[\d]"));
            map.Add(1, new PropertyValue("[0-3]"));

            var inputFilter = TextMapHelper.GetInputFilterStruct(map);

            Assert.AreEqual(@"[\d]", inputFilter.Accepted, "Should be equal!");
            Assert.AreEqual("[0-3]", inputFilter.Rejected, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetInputFilterStruct END (OK)");
        }
Beispiel #24
0
        public void TextMapHelperGetSelectionHandleImageStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct START");

            string leftImageUrl  = "leftImageUrl";
            string rightImageUrl = "rightImageUrl";

            var leftImageMap  = new PropertyMap().Add("filename", new PropertyValue(leftImageUrl));
            var rightImageMap = new PropertyMap().Add("filename", new PropertyValue(rightImageUrl));

            var selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);

            Assert.AreEqual(leftImageUrl, selectionHandleImage.LeftImageUrl, "Should be equal!");
            Assert.AreEqual(rightImageUrl, selectionHandleImage.RightImageUrl, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetSelectionHandleImageStruct END (OK)");
        }
Beispiel #25
0
        public void TextMapHelperGetFontSizeType()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontSizeType START");

            FontSizeType fontSizeType;

            fontSizeType = TextMapHelper.GetFontSizeType("PointSize");
            Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "Should be equal!");

            fontSizeType = TextMapHelper.GetFontSizeType("PixelSize");
            Assert.AreEqual(FontSizeType.PixelSize, fontSizeType, "Should be equal!");

            fontSizeType = TextMapHelper.GetFontSizeType("InvalidType");
            Assert.AreEqual(FontSizeType.PointSize, fontSizeType, "If invalid type, should be PointSize type!");

            tlog.Debug(tag, $"TextMapHelperGetFontSizeType END (OK)");
        }
Beispiel #26
0
        public void TextMapHelperGetCamelCase()
        {
            tlog.Debug(tag, $"TextMapHelperGetCamelCase START");

            string pascalCase     = "TextMapHelper";
            string camelCase      = "textMapHelper";
            string expectedResult = TextMapHelper.GetCamelCase(pascalCase);

            Assert.AreEqual(camelCase, expectedResult, "Should be equal!");

            string emptyString = "";

            expectedResult = TextMapHelper.GetCamelCase(emptyString);

            Assert.AreEqual(emptyString, expectedResult, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetCamelCase END (OK)");
        }
Beispiel #27
0
        public void TextMapHelperGetFontStyleStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct START");

            var map = new PropertyMap();

            map.Add("width", new PropertyValue("expanded"));
            map.Add("weight", new PropertyValue("bold"));
            map.Add("slant", new PropertyValue("italic"));

            FontStyle fontStyle = TextMapHelper.GetFontStyleStruct(map);

            Assert.AreEqual(FontWidthType.Expanded, fontStyle.Width, "Should be equal!");
            Assert.AreEqual(FontWeightType.Bold, fontStyle.Weight, "Should be equal!");
            Assert.AreEqual(FontSlantType.Italic, fontStyle.Slant, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetFontStyleStruct END (OK)");
        }
Beispiel #28
0
        public void TextMapHelperGetVector2FromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetVector2FromMap START");

            var stringKey        = "position";
            var stringInvalidKey = "invalidKey";
            var value            = new Vector2(3, 10);

            using (var map = new PropertyMap())
            {
                map.Add(stringKey, value);

                var result = TextMapHelper.GetVector2FromMap(map, stringKey);
                Assert.AreEqual(true, CheckVector2(value, result), "Should be true!");
            }

            tlog.Debug(tag, $"TextMapHelperGetVector2FromMap END (OK)");
        }
Beispiel #29
0
        public void TextMapHelperGetPlaceholderStruct()
        {
            tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct START");

            string text        = "placeholder text";
            string textFocused = "placeholder textFocused";
            Color  color       = new Color("#45B39D");
            string fontFamily  = "BreezeSans";
            var    fontStyle   = new PropertyMap();

            fontStyle.Add("width", "expanded");
            fontStyle.Add("weight", "bold");
            fontStyle.Add("slant", "italic");
            float pointSize = 25.0f;
            bool  ellipsis  = false;

            using (var map = new PropertyMap())
            {
                map.Add(0, text);
                map.Add(1, textFocused);
                map.Add(2, color);
                map.Add(3, fontFamily);
                map.Add(4, new PropertyValue(fontStyle));
                map.Add(5, (float)pointSize);
                map.Add(7, ellipsis);

                var placeholder = TextMapHelper.GetPlaceholderStruct(map);

                Assert.AreEqual(text, placeholder.Text, "Should be equal!");
                Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!");
                Assert.AreEqual(true, CheckColor(color, placeholder.Color), "Should be true!");
                Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!");
                Assert.AreEqual(FontWidthType.Expanded, placeholder.FontStyle?.Width, "Should be equal!");
                Assert.AreEqual(FontWeightType.Bold, placeholder.FontStyle?.Weight, "Should be equal!");
                Assert.AreEqual(FontSlantType.Italic, placeholder.FontStyle?.Slant, "Should be equal!");
                Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!");
                Assert.AreEqual(ellipsis, false, "Should be equal!");
            }

            color.Dispose();
            fontStyle.Dispose();

            tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct END (OK)");
        }
Beispiel #30
0
        public void TextMapHelperGetVector2FromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetVector2FromMap START");

            var stringKey        = "position";
            var stringInvalidKey = "invalidKey";
            var value            = new Vector2(3, 10);

            var map = new PropertyMap();

            map.Add(stringKey, new PropertyValue(value));

            var result = TextMapHelper.GetVector2FromMap(map, stringKey);

            Assert.AreEqual(value.X, result.X, "Should be equal!");
            Assert.AreEqual(value.Y, result.Y, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetVector2FromMap END (OK)");
        }