[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Common / TSProperty.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
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("public/Common/Property")]
13     class PublicPropertyTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("Property constructor")]
32         [Property("SPEC", "Tizen.NUI.Property.Property C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void PropertyConstructor()
37         {
38             tlog.Debug(tag, $"PropertyConstructor START");
39
40             var animatable  = new Animatable();
41             Assert.IsNotNull(animatable, "Should be not null!");
42             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
43
44             var dummyIndex = 28000000;
45             var testingTarget =  new Property(animatable, dummyIndex);
46             Assert.IsNotNull(testingTarget, "Should be not null!");
47             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
48
49             tlog.Debug(tag, "InvalidKey : " + Property.InvalidKey);
50             tlog.Debug(tag, "InvalidComponentIndex : " + Property.InvalidComponentIndex);
51
52             using (Animatable ani = new Animatable())
53             {
54                 testingTarget.Object = ani;
55                 tlog.Debug(tag, "Object : " + testingTarget.Object);
56             }
57
58             testingTarget.Dispose();
59             animatable.Dispose();
60             tlog.Debug(tag, $"PropertyConstructor END (OK)");
61         }
62
63         [Test]
64         [Category("P1")]
65         [Description("Property constructor. With sub component index")]
66         [Property("SPEC", "Tizen.NUI.Property.Property C")]
67         [Property("SPEC_URL", "-")]
68         [Property("CRITERIA", "CONSTR")]
69         [Property("AUTHOR", "guowei.wang@samsung.com")]
70         public void PropertyConstructorWithSubComponentIndex()
71         {
72             tlog.Debug(tag, $"PropertyConstructorWithSubComponentIndex START");
73
74             var animatable = new Animatable();
75             Assert.IsNotNull(animatable, "Should be not null!");
76             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
77
78             var dummyIndex = 28000000;
79             var testingTarget = new Property(animatable, dummyIndex, -1);
80             Assert.IsNotNull(testingTarget, "Should be not null!");
81             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
82
83             testingTarget.Dispose();
84             animatable.Dispose();
85             tlog.Debug(tag, $"PropertyConstructorWithSubComponentIndex END (OK)");
86         }
87
88         [Test]
89         [Category("P1")]
90         [Description("Property constructor. With property name")]
91         [Property("SPEC", "Tizen.NUI.Property.Property C")]
92         [Property("SPEC_URL", "-")]
93         [Property("CRITERIA", "CONSTR")]
94         [Property("AUTHOR", "guowei.wang@samsung.com")]
95         public void PropertyConstructorWithPropertyName()
96         {
97             tlog.Debug(tag, $"PropertyConstructorWithPropertyName START");
98
99             var animatable = new Animatable();
100             Assert.IsNotNull(animatable, "Should be not null!");
101             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
102
103             var testingTarget = new Property(animatable, "image");
104             Assert.IsNotNull(testingTarget, "Should be not null!");
105             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
106
107             testingTarget.Dispose();
108             animatable.Dispose();
109             tlog.Debug(tag, $"PropertyConstructorWithPropertyName END (OK)");
110         }
111
112         [Test]
113         [Category("P1")]
114         [Description("Property constructor. With property name and sub component index")]
115         [Property("SPEC", "Tizen.NUI.Property.Property C")]
116         [Property("SPEC_URL", "-")]
117         [Property("CRITERIA", "CONSTR")]
118         [Property("AUTHOR", "guowei.wang@samsung.com")]
119         public void PropertyConstructorWithPropertyNameSubComponentIndex()
120         {
121             tlog.Debug(tag, $"PropertyConstructorWithPropertyNameSubComponentIndex START");
122
123             var animatable = new Animatable();
124             Assert.IsNotNull(animatable, "Should be not null!");
125             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
126
127             var testingTarget = new Property(animatable, "image", -1);
128             Assert.IsNotNull(testingTarget, "Should be not null!");
129             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
130
131             testingTarget.Dispose();
132             animatable.Dispose();
133             tlog.Debug(tag, $"PropertyConstructorWithPropertyNameSubComponentIndex END (OK)");
134         }
135
136         [Test]
137         [Category("P1")]
138         [Description("Property propertyIndex. Get")]
139         [Property("SPEC", "Tizen.NUI.Property.propertyIndex A")]
140         [Property("SPEC_URL", "-")]
141         [Property("CRITERIA", "PRO")]
142         [Property("AUTHOR", "guowei.wang@samsung.com")]
143         public void PropertyPropertyIndexGet()
144         {
145             tlog.Debug(tag, $"PropertyPropertyIndexGet START");
146
147             var animatable = new Animatable();
148             Assert.IsNotNull(animatable, "Should be not null!");
149             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
150
151             var testingTarget = new Property(animatable, 28000000);
152             Assert.IsNotNull(testingTarget, "Should be not null!");
153             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
154
155             var result = testingTarget.propertyIndex;
156             Assert.IsTrue(28000000 == result);
157
158             testingTarget.Dispose();
159             animatable.Dispose();
160             tlog.Debug(tag, $"PropertyPropertyIndexGet END (OK)");
161         }
162
163         [Test]
164         [Category("P1")]
165         [Description("Property propertyIndex. Set")]
166         [Property("SPEC", "Tizen.NUI.Property.propertyIndex A")]
167         [Property("SPEC_URL", "-")]
168         [Property("CRITERIA", "PRO")]
169         [Property("AUTHOR", "guowei.wang@samsung.com")]
170         public void PropertyPropertyIndexSet()
171         {
172             tlog.Debug(tag, $"PropertyPropertyIndexSet START");
173
174             var animatable = new Animatable();
175             Assert.IsNotNull(animatable, "Should be not null!");
176             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
177
178             var testingTarget = new Property(animatable, 28000000);
179             Assert.IsNotNull(testingTarget, "Should be not null!");
180             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
181
182             testingTarget.propertyIndex = 29000000;
183             var result = testingTarget.propertyIndex;
184             Assert.IsTrue(29000000 == result);
185
186             testingTarget.Dispose();
187             animatable.Dispose();
188             tlog.Debug(tag, $"PropertyPropertyIndexSet END (OK)");
189         }
190
191         [Test]
192         [Category("P1")]
193         [Description("Property componentIndex. Get")]
194         [Property("SPEC", "Tizen.NUI.Property.componentIndex A")]
195         [Property("SPEC_URL", "-")]
196         [Property("CRITERIA", "PRO")]
197         [Property("AUTHOR", "guowei.wang@samsung.com")]
198         public void PropertyComponentIndexGet()
199         {
200             tlog.Debug(tag, $"PropertyComponentIndexGet START");
201
202             var animatable = new Animatable();
203             Assert.IsNotNull(animatable, "Should be not null!");
204             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
205
206             var testingTarget = new Property(animatable, 28000000, -1);
207             Assert.IsNotNull(testingTarget, "Should be not null!");
208             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
209
210             var result = testingTarget.componentIndex;
211             Assert.IsTrue(-1 == result);
212
213             testingTarget.Dispose();
214             animatable.Dispose();
215             tlog.Debug(tag, $"PropertyComponentIndexGet END (OK)");
216         }
217
218         [Test]
219         [Category("P1")]
220         [Description("Property componentIndex. Get")]
221         [Property("SPEC", "Tizen.NUI.Property.componentIndex A")]
222         [Property("SPEC_URL", "-")]
223         [Property("CRITERIA", "PRO")]
224         [Property("AUTHOR", "guowei.wang@samsung.com")]
225         public void PropertyComponentIndexSet()
226         {
227             tlog.Debug(tag, $"PropertyComponentIndexSet START");
228
229             var animatable = new Animatable();
230             Assert.IsNotNull(animatable, "Should be not null!");
231             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
232
233             var testingTarget = new Property(animatable, 28000000, -1);
234             Assert.IsNotNull(testingTarget, "Should be not null!");
235             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
236
237             testingTarget.componentIndex = 30000000;
238             var result = testingTarget.componentIndex;
239             Assert.IsTrue(30000000 == result);
240
241             testingTarget.Dispose();
242             animatable.Dispose();
243             tlog.Debug(tag, $"PropertyComponentIndexSet END (OK)");
244         }
245     }
246 }