2a44194f38d1a9ce6f2b5444ad3998111696555b
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.TCT / 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             testingTarget.Dispose();
50             animatable.Dispose();
51             tlog.Debug(tag, $"PropertyConstructor END (OK)");
52         }
53
54         [Test]
55         [Category("P1")]
56         [Description("Property constructor. With sub component index")]
57         [Property("SPEC", "Tizen.NUI.Property.Property C")]
58         [Property("SPEC_URL", "-")]
59         [Property("CRITERIA", "CONSTR")]
60         [Property("AUTHOR", "guowei.wang@samsung.com")]
61         public void PropertyConstructorWithSubComponentIndex()
62         {
63             tlog.Debug(tag, $"PropertyConstructorWithSubComponentIndex START");
64
65             var animatable = new Animatable();
66             Assert.IsNotNull(animatable, "Should be not null!");
67             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
68
69             var dummyIndex = 28000000;
70             var testingTarget = new Property(animatable, dummyIndex, -1);
71             Assert.IsNotNull(testingTarget, "Should be not null!");
72             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
73
74             testingTarget.Dispose();
75             animatable.Dispose();
76             tlog.Debug(tag, $"PropertyConstructorWithSubComponentIndex END (OK)");
77         }
78
79         [Test]
80         [Category("P1")]
81         [Description("Property constructor. With property name")]
82         [Property("SPEC", "Tizen.NUI.Property.Property C")]
83         [Property("SPEC_URL", "-")]
84         [Property("CRITERIA", "CONSTR")]
85         [Property("AUTHOR", "guowei.wang@samsung.com")]
86         public void PropertyConstructorWithPropertyName()
87         {
88             tlog.Debug(tag, $"PropertyConstructorWithPropertyName START");
89
90             var animatable = new Animatable();
91             Assert.IsNotNull(animatable, "Should be not null!");
92             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
93
94             var testingTarget = new Property(animatable, "image");
95             Assert.IsNotNull(testingTarget, "Should be not null!");
96             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
97
98             testingTarget.Dispose();
99             animatable.Dispose();
100             tlog.Debug(tag, $"PropertyConstructorWithPropertyName END (OK)");
101         }
102
103         [Test]
104         [Category("P1")]
105         [Description("Property constructor. With property name and sub component index")]
106         [Property("SPEC", "Tizen.NUI.Property.Property C")]
107         [Property("SPEC_URL", "-")]
108         [Property("CRITERIA", "CONSTR")]
109         [Property("AUTHOR", "guowei.wang@samsung.com")]
110         public void PropertyConstructorWithPropertyNameSubComponentIndex()
111         {
112             tlog.Debug(tag, $"PropertyConstructorWithPropertyNameSubComponentIndex START");
113
114             var animatable = new Animatable();
115             Assert.IsNotNull(animatable, "Should be not null!");
116             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
117
118             var testingTarget = new Property(animatable, "image", -1);
119             Assert.IsNotNull(testingTarget, "Should be not null!");
120             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
121
122             testingTarget.Dispose();
123             animatable.Dispose();
124             tlog.Debug(tag, $"PropertyConstructorWithPropertyNameSubComponentIndex END (OK)");
125         }
126
127         [Test]
128         [Category("P1")]
129         [Description("Property propertyIndex. Get")]
130         [Property("SPEC", "Tizen.NUI.Property.propertyIndex A")]
131         [Property("SPEC_URL", "-")]
132         [Property("CRITERIA", "PRO")]
133         [Property("AUTHOR", "guowei.wang@samsung.com")]
134         public void PropertyPropertyIndexGet()
135         {
136             tlog.Debug(tag, $"PropertyPropertyIndexGet START");
137
138             var animatable = new Animatable();
139             Assert.IsNotNull(animatable, "Should be not null!");
140             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
141
142             var testingTarget = new Property(animatable, 28000000);
143             Assert.IsNotNull(testingTarget, "Should be not null!");
144             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
145
146             var result = testingTarget.propertyIndex;
147             Assert.IsTrue(28000000 == result);
148
149             testingTarget.Dispose();
150             animatable.Dispose();
151             tlog.Debug(tag, $"PropertyPropertyIndexGet END (OK)");
152         }
153
154         [Test]
155         [Category("P1")]
156         [Description("Property propertyIndex. Set")]
157         [Property("SPEC", "Tizen.NUI.Property.propertyIndex A")]
158         [Property("SPEC_URL", "-")]
159         [Property("CRITERIA", "PRO")]
160         [Property("AUTHOR", "guowei.wang@samsung.com")]
161         public void PropertyPropertyIndexSet()
162         {
163             tlog.Debug(tag, $"PropertyPropertyIndexSet START");
164
165             var animatable = new Animatable();
166             Assert.IsNotNull(animatable, "Should be not null!");
167             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
168
169             var testingTarget = new Property(animatable, 28000000);
170             Assert.IsNotNull(testingTarget, "Should be not null!");
171             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
172
173             testingTarget.propertyIndex = 29000000;
174             var result = testingTarget.propertyIndex;
175             Assert.IsTrue(29000000 == result);
176
177             testingTarget.Dispose();
178             animatable.Dispose();
179             tlog.Debug(tag, $"PropertyPropertyIndexSet END (OK)");
180         }
181
182         [Test]
183         [Category("P1")]
184         [Description("Property componentIndex. Get")]
185         [Property("SPEC", "Tizen.NUI.Property.componentIndex A")]
186         [Property("SPEC_URL", "-")]
187         [Property("CRITERIA", "PRO")]
188         [Property("AUTHOR", "guowei.wang@samsung.com")]
189         public void PropertyComponentIndexGet()
190         {
191             tlog.Debug(tag, $"PropertyPropertyIndexGet START");
192
193             var animatable = new Animatable();
194             Assert.IsNotNull(animatable, "Should be not null!");
195             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
196
197             var testingTarget = new Property(animatable, 28000000, -1);
198             Assert.IsNotNull(testingTarget, "Should be not null!");
199             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
200
201             var result = testingTarget.componentIndex;
202             Assert.IsTrue(-1 == result);
203
204             testingTarget.Dispose();
205             animatable.Dispose();
206             tlog.Debug(tag, $"PropertyPropertyIndexGet END (OK)");
207         }
208
209         [Test]
210         [Category("P1")]
211         [Description("Property componentIndex. Get")]
212         [Property("SPEC", "Tizen.NUI.Property.componentIndex A")]
213         [Property("SPEC_URL", "-")]
214         [Property("CRITERIA", "PRO")]
215         [Property("AUTHOR", "guowei.wang@samsung.com")]
216         public void PropertyComponentIndexIndexSet()
217         {
218             tlog.Debug(tag, $"PropertyPropertyIndexSet START");
219
220             var animatable = new Animatable();
221             Assert.IsNotNull(animatable, "Should be not null!");
222             Assert.IsInstanceOf<Animatable>(animatable, "Should return PropertyValue instance.");
223
224             var testingTarget = new Property(animatable, 28000000, -1);
225             Assert.IsNotNull(testingTarget, "Should be not null!");
226             Assert.IsInstanceOf<Property>(testingTarget, "Should return PropertyValue instance.");
227
228             testingTarget.componentIndex = 30000000;
229             var result = testingTarget.componentIndex;
230             Assert.IsTrue(30000000 == result);
231
232             testingTarget.Dispose();
233             animatable.Dispose();
234             tlog.Debug(tag, $"PropertyPropertyIndexSet END (OK)");
235         }
236     }
237 }