dcbe39485d7bf5722169bd240475a7bb8a5ecb9d
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / ViewProperty / TSTextShadow.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Collections.Generic;
7 using System.Threading.Tasks;
8
9 namespace Tizen.NUI.Devel.Tests
10 {
11     using tlog = Tizen.Log;
12
13     [TestFixture]
14     [Description("public/ViewProperty/TextShadow.cs")]
15     public class PublicTextShadowTest
16     {
17         private const string tag = "NUITEST";
18
19         [SetUp]
20         public void Init()
21         {
22             tlog.Info(tag, "Init() is called!");
23         }
24
25         [TearDown]
26         public void Destroy()
27         {
28             tlog.Info(tag, "Destroy() is called!");
29         }
30
31         [Test]
32         [Category("P1")]
33         [Description("TextShadow constructor. With PropertyMap.")]
34         [Property("SPEC", "Tizen.NUI.TextShadow.TextShadow C")]
35         [Property("SPEC_URL", "-")]
36         [Property("CRITERIA", "CONSTR")]
37         [Property("AUTHOR", "guowei.wang@samsung.com")]
38         public void TextShadowConstructorWithPropertyMap()
39         {
40             tlog.Debug(tag, $"TextShadowConstructorWithPropertyMap START");
41
42             TextLabel textLabel = new TextLabel()
43             {
44                 Text = "TextShadowConstructor",
45                 Color = Color.Green,
46                 PointSize = 15.0f,
47             };
48             PropertyMap temp = new PropertyMap();
49             Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp);
50
51             var testingTarget = new TextShadow(temp);
52             Assert.IsNotNull(testingTarget, "Can't create success object TextShadow");
53             Assert.IsInstanceOf<TextShadow>(testingTarget, "Should be an instance of TextShadow type.");
54
55             textLabel.Dispose();
56             testingTarget.Dispose();
57             tlog.Debug(tag, $"TextShadowConstructorWithPropertyMap END (OK)");
58         }
59
60         [Test]
61         [Category("P1")]
62         [Description("TextShadow Clone.")]
63         [Property("SPEC", "Tizen.NUI.TextShadow.Clone M")]
64         [Property("SPEC_URL", "-")]
65         [Property("CRITERIA", "MR")]
66         [Property("AUTHOR", "guowei.wang@samsung.com")]
67         public void TextShadowClone()
68         {
69             tlog.Debug(tag, $"TextShadowClone START");
70
71             using (Vector2 vector = new Vector2(1.5f, 3.0f))
72             {
73                 using (TextShadow textShadow = new TextShadow(Color.Cyan, vector, 0.3f))
74                 {
75                     try
76                     {
77                         textShadow.Clone();
78                     }
79                     catch (Exception e)
80                     {
81                         tlog.Debug(tag, e.Message.ToString());
82                         Assert.Fail("Caught Exception: Failed!");
83                     }
84                 }
85             }
86
87             tlog.Debug(tag, $"TextShadowClone END (OK)");
88         }
89
90         [Test]
91         [Category("P1")]
92         [Description("TextShadow Clone. With TextShadow.")]
93         [Property("SPEC", "Tizen.NUI.TextShadow.Clone M")]
94         [Property("SPEC_URL", "-")]
95         [Property("CRITERIA", "MR")]
96         [Property("AUTHOR", "guowei.wang@samsung.com")]
97         public void TextShadowCloneWithTextShadow()
98         {
99             tlog.Debug(tag, $"TextShadowCloneWithTextShadow START");
100
101             TextLabel textLabel = new TextLabel()
102             {
103                 Text = "TextShadowConstructor",
104                 Color = Color.Green,
105                 PointSize = 15.0f,
106             };
107             PropertyMap temp = new PropertyMap();
108             Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp);
109
110             try
111             {
112                 TextShadow.Clone(new TextShadow(temp));
113             }
114             catch (Exception e)
115             {
116                 tlog.Debug(tag, e.Message.ToString());
117                 Assert.Fail("Caught Exception: Failed!");
118             }
119
120             textLabel.Dispose();
121             tlog.Debug(tag, $"TextShadowCloneWithTextShadow END (OK)");
122         }
123
124         [Test]
125         [Category("P1")]
126         [Description("TextShadow Clone. With null TextShadow.")]
127         [Property("SPEC", "Tizen.NUI.TextShadow.Clone M")]
128         [Property("SPEC_URL", "-")]
129         [Property("CRITERIA", "MR")]
130         [Property("AUTHOR", "guowei.wang@samsung.com")]
131         public void TextShadowCloneWithNullTextShadow()
132         {
133             tlog.Debug(tag, $"TextShadowCloneWithNullTextShadow START");
134
135             TextShadow textShadow = null;
136             var testingTarget = TextShadow.Clone(textShadow);
137             Assert.IsNull(testingTarget);
138
139             tlog.Debug(tag, $"TextShadowCloneWithNullTextShadow END (OK)");
140         }
141
142         [Test]
143         [Category("P1")]
144         [Description("TextShadow ToPropertyValue.")]
145         [Property("SPEC", "Tizen.NUI.TextShadow.ToPropertyValue M")]
146         [Property("SPEC_URL", "-")]
147         [Property("CRITERIA", "MR")]
148         [Property("AUTHOR", "guowei.wang@samsung.com")]
149         public void TextShadowToPropertyValue()
150         {
151             tlog.Debug(tag, $"TextShadowToPropertyValue START");
152
153             TextLabel textLabel = new TextLabel()
154             {
155                 Text = "TextShadowConstructor",
156                 Color = Color.Green,
157                 PointSize = 15.0f,
158             };
159             PropertyMap temp = new PropertyMap();
160             Tizen.NUI.Object.GetProperty((global::System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.SHADOW).Get(temp);
161
162             using (TextShadow textShadow = new TextShadow(temp))
163             {
164
165                 var testingTarget = TextShadow.ToPropertyValue(textShadow);
166                 Assert.IsNotNull(testingTarget, "Can't create success object PropertyValue");
167                 Assert.IsInstanceOf<PropertyValue>(testingTarget, "Should be an instance of PropertyValue type.");
168
169                 testingTarget.Dispose();
170             }
171
172             textLabel.Dispose();
173             tlog.Debug(tag, $"TextShadowToPropertyValue END (OK)");
174         }
175
176         [Test]
177         [Category("P2")]
178         [Description("TextShadow ToPropertyValue. Instance is null.")]
179         [Property("SPEC", "Tizen.NUI.TextShadow.ToPropertyValue M")]
180         [Property("SPEC_URL", "-")]
181         [Property("CRITERIA", "MR")]
182         [Property("AUTHOR", "guowei.wang@samsung.com")]
183         public void TextShadowToPropertyValueWithNullInstance()
184         {
185             tlog.Debug(tag, $"TextShadowToPropertyValueWithNullInstance START");
186
187             var testingTarget = TextShadow.ToPropertyValue(null);
188             Assert.IsNotNull(testingTarget, "Can't create success object PropertyValue");
189             Assert.IsInstanceOf<PropertyValue>(testingTarget, "Should be an instance of PropertyValue type.");
190
191             testingTarget.Dispose();
192             tlog.Debug(tag, $"TextShadowToPropertyValueWithNullInstance END (OK)");
193         }
194     }
195 }