3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("public/BaseComponents/Style/TextLabelStyle")]
13 public class PublicBaseComponentsStyleTextLabelStyleTest
15 private const string tag = "NUITEST";
20 tlog.Info(tag, "Init() is called!");
26 tlog.Info(tag, "Destroy() is called!");
31 [Description("TextLabelStyle TextLabelStyle.")]
32 [Property("SPEC", "Tizen.NUI.BaseComponents.Style.TextLabelStyle M")]
33 [Property("SPEC_URL", "-")]
34 [Property("CRITERIA", "PRW")]
35 [Property("AUTHOR", "guowei.wang@samsung.com")]
36 public void BaseComponentsStyleTextLabelStyle()
38 tlog.Debug(tag, $"BaseComponentsStyleTextLabelStyle START");
40 var testingTarget = new TextLabelStyle();
41 Assert.IsNotNull(testingTarget, "should be not null");
42 Assert.IsInstanceOf<TextLabelStyle>(testingTarget, "should be an instance of TextLabelStyle class!");
46 testingTarget.TranslatableText = new Selector<string>()
48 All = "SamsungOneUI400",
50 Assert.AreEqual("SamsungOneUI400", testingTarget.TranslatableText.All, "Should be equal!");
52 testingTarget.FontFamily = new Selector<string>()
54 All = "SamsungOneUI400",
55 Normal = "BreezeSans",
57 Assert.AreEqual("BreezeSans", testingTarget.FontFamily.Normal, "Should be equal!");
59 testingTarget.MultiLine = true ;
60 Assert.IsTrue(testingTarget.MultiLine);
62 testingTarget.HorizontalAlignment = HorizontalAlignment.Center;
63 Assert.AreEqual(HorizontalAlignment.Center, testingTarget.HorizontalAlignment, "Should be equal!");
65 testingTarget.VerticalAlignment = VerticalAlignment.Center;
66 Assert.AreEqual(VerticalAlignment.Center, testingTarget.VerticalAlignment, "Should be equal!");
68 testingTarget.EnableMarkup = false ;
69 Assert.IsTrue(!testingTarget.EnableMarkup);
71 testingTarget.EnableAutoScroll = true ;
72 Assert.IsTrue(testingTarget.EnableAutoScroll);
74 testingTarget.AutoScrollSpeed = 80 ;
75 Assert.AreEqual(80, testingTarget.AutoScrollSpeed, "Should be equal!");
77 testingTarget.AutoScrollLoopCount = 2 ;
78 Assert.AreEqual(2, testingTarget.AutoScrollLoopCount, "Should be equal!");
80 testingTarget.AutoScrollGap = 50.0f ;
81 Assert.AreEqual(50.0f, testingTarget.AutoScrollGap, "Should be equal!");
83 testingTarget.LineSpacing = 2.0f ;
84 Assert.AreEqual(2.0f, testingTarget.LineSpacing, "Should be equal!");
86 testingTarget.RelativeLineHeight = 5.0f ;
87 Assert.AreEqual(5.0f, testingTarget.RelativeLineHeight, "Should be equal!");
89 testingTarget.Emboss = FrameworkInformation.ResourcePath + "IoT_handler_center_downW.png";
90 tlog.Debug(tag, "Emboss : " + testingTarget.Emboss);
92 testingTarget.PixelSize = 24.0f;
93 Assert.AreEqual(24.0f, testingTarget.PixelSize, "Should be equal!");
95 testingTarget.Ellipsis = true ;
96 Assert.IsTrue(testingTarget.Ellipsis);
98 testingTarget.AutoScrollLoopDelay = 2.0f ;
99 Assert.AreEqual(2.0f, testingTarget.AutoScrollLoopDelay, "Should be equal!");
101 testingTarget.AutoScrollStopMode = AutoScrollStopMode.Immediate;
102 Assert.AreEqual(AutoScrollStopMode.Immediate, testingTarget.AutoScrollStopMode, "Should be equal!");
104 testingTarget.LineWrapMode = LineWrapMode.Character;
105 Assert.AreEqual(LineWrapMode.Character, testingTarget.LineWrapMode, "Should be equal!");
107 testingTarget.VerticalLineAlignment = VerticalLineAlignment.Center;
108 Assert.AreEqual(VerticalLineAlignment.Center, testingTarget.VerticalLineAlignment, "Should be equal!");
110 testingTarget.EllipsisPosition = EllipsisPosition.Start;
111 Assert.AreEqual(EllipsisPosition.Start, testingTarget.EllipsisPosition, "Should be equal!");
113 testingTarget.CharacterSpacing = 0;
114 Assert.AreEqual(0, testingTarget.CharacterSpacing, "Should be equal!");
116 testingTarget.MatchSystemLanguageDirection = false;
117 Assert.IsTrue(!testingTarget.MatchSystemLanguageDirection);
119 testingTarget.TextColor = new Selector<Color>()
121 Normal = new Color(0.2196f, 0.6131f, 0.9882f, 1),
122 Disabled = new Color(1, 1, 1, 0.35f),
124 Assert.AreEqual(0.35f, testingTarget.TextColor.Disabled.A, "Should be equal!");
126 testingTarget.PointSize = new Selector<float?>()
130 Assert.AreEqual(16.0f, testingTarget.PointSize.All, "Should be equal!");
132 using (TextLabel textLabel = new TextLabel())
134 textLabel.Text = "TextShadowConstructor";
135 textLabel.Color = Color.Red;
136 textLabel.PointSize = 15.0f;
138 using (PropertyMap temp = new PropertyMap())
140 Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp);
142 TextShadow shadow = new TextShadow(temp);
144 testingTarget.TextShadow = new Selector<TextShadow>()
148 Assert.AreEqual(1.0f, testingTarget.TextShadow.All.Color.A, "Should be equal!");
152 testingTarget.FontStyle = new PropertyMap().Add("weight", new PropertyValue("regular"));
153 testingTarget.FontStyle.Find(-1, "weight").Get(out string style);
154 Assert.AreEqual("regular", style, "Should be equal!");
158 tlog.Debug(tag, e.Message.ToString());
159 Assert.Fail("Caught Exception: Failed!");
162 testingTarget.Dispose();
163 tlog.Debug(tag, $"BaseComponentsStyleTextLabelStyle END (OK)");