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/Common/PropertyArray")]
15 private const string tag = "NUITEST";
20 tlog.Info(tag, "Init() is called!");
26 tlog.Info(tag, "Destroy() is called!");
31 [Description("PropertyArray constructor")]
32 [Property("SPEC", "Tizen.NUI.PropertyArray.PropertyArray C")]
33 [Property("SPEC_URL", "-")]
34 [Property("CRITERIA", "CONSTR")]
35 [Property("AUTHOR", "guowei.wang@samsung.com")]
36 public void PropertyArrayConstructor()
38 tlog.Debug(tag, $"PropertyArrayConstructor START");
40 var testingTarget = new PropertyArray();
41 Assert.IsNotNull(testingTarget, "should be not null");
42 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
44 testingTarget.Dispose();
45 tlog.Debug(tag, $"PropertyArrayConstructor END (OK)");
50 [Description("PropertyArray Size")]
51 [Property("SPEC", "Tizen.NUI.PropertyArray.Size M")]
52 [Property("SPEC_URL", "-")]
53 [Property("CRITERIA", "MR")]
54 [Property("AUTHOR", "guowei.wang@samsung.com")]
55 public void PropertyArraySize()
57 tlog.Debug(tag, $"PropertyArraySize START");
59 var testingTarget = new PropertyArray();
60 Assert.IsNotNull(testingTarget, "should be not null");
61 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
63 testingTarget.Reserve(3);
64 Assert.IsTrue(testingTarget.Size() == 0, "testingTarget's size should be 1");
65 var pValue = new PropertyValue(1);
66 testingTarget.PushBack(pValue);
67 Assert.IsTrue(testingTarget.Size() == 1, "testingTarget's size should be 1");
70 testingTarget.Dispose();
71 tlog.Debug(tag, $"PropertyArraySize END (OK)");
76 [Description("PropertyArray Count")]
77 [Property("SPEC", "Tizen.NUI.PropertyArray.Count M")]
78 [Property("SPEC_URL", "-")]
79 [Property("CRITERIA", "MR")]
80 [Property("AUTHOR", "guowei.wang@samsung.com")]
81 public void PropertyArrayCount()
83 tlog.Debug(tag, $"PropertyArrayCount START");
85 var testingTarget = new PropertyArray();
86 Assert.IsNotNull(testingTarget, "should be not null");
87 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
88 Assert.AreEqual(0, testingTarget.Count(), "Retrieved testingTarget.Count() should be equal to 0.");
90 testingTarget.Reserve(3);
91 var pValue = new PropertyValue(1);
92 testingTarget.PushBack(pValue);
93 Assert.IsTrue(testingTarget.Count() == 1, "testingTarget's count should be 1");
96 testingTarget.Dispose();
97 tlog.Debug(tag, $"PropertyArrayCount END (OK)");
102 [Description("PropertyArray Empty")]
103 [Property("SPEC", "Tizen.NUI.PropertyArray.Empty M")]
104 [Property("SPEC_URL", "-")]
105 [Property("CRITERIA", " MR")]
106 [Property("AUTHOR", "guowei.wang@samsung.com")]
107 public void PropertyArrayEmpty()
109 tlog.Debug(tag, $"PropertyArrayEmpty START");
111 var testingTarget = new PropertyArray();
112 Assert.IsNotNull(testingTarget, "should be not null");
113 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
115 testingTarget.Reserve(3);
116 Assert.IsTrue(testingTarget.Empty());
118 var pVal = new PropertyValue(1);
119 testingTarget.PushBack(pVal);
120 Assert.IsFalse(testingTarget.Empty());
123 testingTarget.Dispose();
124 tlog.Debug(tag, $"PropertyArrayEmpty END (OK)");
129 [Description("PropertyArray Clear")]
130 [Property("SPEC", "Tizen.NUI.PropertyArray.Clear M")]
131 [Property("SPEC_URL", "-")]
132 [Property("CRITERIA", "MR MCST")]
133 [Property("AUTHOR", "guowei.wang@samsung.com")]
134 public void PropertyArrayClear()
136 tlog.Debug(tag, $"PropertyArrayClear START");
138 var testingTarget = new PropertyArray();
139 Assert.IsNotNull(testingTarget, "should be not null");
140 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
142 testingTarget.Reserve(3);
143 var pValue = new PropertyValue(1);
144 testingTarget.PushBack(pValue);
145 Assert.IsFalse(testingTarget.Empty());
147 testingTarget.Clear();
148 Assert.IsTrue(testingTarget.Empty());
151 testingTarget.Dispose();
152 tlog.Debug(tag, $"PropertyArrayClear END (OK)");
157 [Description("PropertyArray Reserve")]
158 [Property("SPEC", "Tizen.NUI.PropertyArray.Reserve M")]
159 [Property("SPEC_URL", "-")]
160 [Property("CRITERIA", "MR MCST")]
161 [Property("AUTHOR", "guowei.wang@samsung.com")]
162 public void PropertyArrayReserve()
164 tlog.Debug(tag, $"PropertyArrayReserve START");
166 var testingTarget = new PropertyArray();
167 Assert.IsNotNull(testingTarget, "should be not null");
168 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
169 Assert.IsTrue(testingTarget.Capacity() == 0, "testingTarget's capacity should be 0");
171 testingTarget.Reserve(3);
172 Assert.IsTrue(testingTarget.Capacity() == 3, "testingTarget's capacity should be 3");
174 testingTarget.Dispose();
175 tlog.Debug(tag, $"PropertyArrayClear END (OK)");
180 [Description("PropertyArray Resize")]
181 [Property("SPEC", "Tizen.NUI.PropertyArray.Resize M")]
182 [Property("SPEC_URL", "-")]
183 [Property("CRITERIA", "MR MCST")]
184 [Property("AUTHOR", "guowei.wang@samsung.com")]
185 public void PropertyArrayResize()
187 tlog.Debug(tag, $"PropertyArrayResize START");
189 var testingTarget = new PropertyArray();
190 Assert.IsNotNull(testingTarget, "should be not null");
191 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
193 testingTarget.Resize(5);
194 var result = testingTarget.Count();
195 Assert.IsTrue(result == 5, "result should be 5");
197 testingTarget.Dispose();
198 tlog.Debug(tag, $"PropertyArrayResize END (OK)");
203 [Description("PropertyArray Capacity")]
204 [Property("SPEC", "Tizen.NUI.PropertyArray.Capacity M")]
205 [Property("SPEC_URL", "-")]
206 [Property("CRITERIA", "MR")]
207 [Property("AUTHOR", "guowei.wang@samsung.com")]
208 public void PropertyArrayCapacity()
210 tlog.Debug(tag, $"PropertyArrayCapacity START");
212 var testingTarget = new PropertyArray();
213 Assert.IsNotNull(testingTarget, "should be not null");
214 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
216 testingTarget.Reserve(6);
217 var result = testingTarget.Capacity();
218 Assert.IsTrue(result == 6, "result should be 6");
220 testingTarget.Dispose();
221 tlog.Debug(tag, $"PropertyArrayCapacity END (OK)");
226 [Description("PropertyArray PushBack")]
227 [Property("SPEC", "Tizen.NUI.PropertyArray.PushBack M")]
228 [Property("SPEC_URL", "-")]
229 [Property("CRITERIA", "MR MCST")]
230 [Property("AUTHOR", "guowei.wang@samsung.com")]
231 public void PropertyArrayPushBack()
233 tlog.Debug(tag, $"PropertyArrayPushBack START");
235 var testingTarget = new PropertyArray();
236 Assert.IsNotNull(testingTarget, "should be not null");
237 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
239 var pValue = new PropertyValue(4);
240 testingTarget.PushBack(pValue);
241 var result = testingTarget.Size();
242 Assert.IsTrue(result == 1, "result should be 1");
245 testingTarget.Dispose();
246 tlog.Debug(tag, $"PropertyArrayPushBack END (OK)");
251 [Description("PropertyArray Add. Add with property value")]
252 [Property("SPEC", "Tizen.NUI.PropertyArray.Add M")]
253 [Property("SPEC_URL", "-")]
254 [Property("CRITERIA", "MR")]
255 [Property("AUTHOR", "guowei.wang@samsung.com")]
256 public void PropertyArrayAddWithProperty()
258 tlog.Debug(tag, $"PropertyArrayAddWithProperty START");
260 var testingTarget = new PropertyArray();
261 Assert.IsNotNull(testingTarget, "should be not null");
262 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
264 var pValue = new PropertyValue(14.0f);
265 testingTarget.Add(pValue);
266 Assert.AreEqual(1, testingTarget.Size(), "Retrieved testingTarget.Size() should be equal to 1.");
269 testingTarget[0].Get(out result);
270 Assert.IsTrue(result == 14.0f, "result should be 14.0f");
273 testingTarget.Dispose();
274 tlog.Debug(tag, $"PropertyArrayAddWithProperty END (OK)");
279 [Description("PropertyArray Add. Add with key value")]
280 [Property("SPEC", "Tizen.NUI.PropertyArray.Add M")]
281 [Property("SPEC_URL", "-")]
282 [Property("CRITERIA", "MR")]
283 [Property("AUTHOR", "guowei.wang@samsung.com")]
284 public void PropertyArrayAddWithKey()
286 tlog.Debug(tag, $"PropertyArrayAddWithKey START");
288 var testingTarget = new PropertyArray();
289 Assert.IsNotNull(testingTarget, "should be not null");
290 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
292 var kValue = new KeyValue();
293 kValue.SingleValue = 14.0f;
294 testingTarget.Add(kValue);
295 Assert.AreEqual(1, testingTarget.Size(), "Retrieved testingTarget.Size() should be equal to 1.");
298 testingTarget[0].Get(out result);
299 Assert.IsTrue(result == 14.0f, "result should be 14.0f");
302 testingTarget.Dispose();
303 tlog.Debug(tag, $"PropertyArrayAddWithKey END (OK)");
308 [Description("PropertyArray GetElementAt")]
309 [Property("SPEC", "Tizen.NUI.PropertyArray.GetElementAt M")]
310 [Property("SPEC_URL", "-")]
311 [Property("CRITERIA", "MR")]
312 [Property("AUTHOR", "guowei.wang@samsung.com")]
313 public void PropertyArrayGetElementAt()
315 tlog.Debug(tag, $"PropertyArrayGetElementAt START");
317 var testingTarget = new PropertyArray();
318 Assert.IsNotNull(testingTarget, "should be not null");
319 Assert.IsInstanceOf<PropertyArray>(testingTarget, "should be an instance of testing target class!");
321 var pValue = new PropertyValue(3.0f);
322 testingTarget.Add(pValue);
325 testingTarget.GetElementAt(0).Get(out result);
326 Assert.IsTrue(result == 3.0f, "result should be 3.0f");
329 testingTarget.Dispose();
330 tlog.Debug(tag, $"PropertyArrayGetElementAt END (OK)");