1 using NUnit.Framework;
2 using NUnit.Framework.TUnit;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("public/Input/KeyValue")]
13 internal class PublicKeyValueTest
15 private const string tag = "NUITEST";
16 private KeyValue keyValue = null;
21 tlog.Info(tag, "Init() is called!");
22 keyValue = new KeyValue();
29 tlog.Info(tag, "Destroy() is called!");
34 [Description("KeyValue OriginalKey")]
35 [Property("SPEC", "Tizen.NUI.KeyValue.OriginalKey A")]
36 [Property("SPEC_URL", "-")]
37 [Property("CRITERIA", "PRW")]
38 [Property("AUTHOR", "guowei.wang@samsung.com")]
39 public void KeyValueOriginalKey()
41 tlog.Debug(tag, $"KeyValueOriginalKey START");
43 keyValue.OriginalKey = 10;
45 tlog.Debug(tag, $"KeyValueOriginalKey END (OK)");
50 [Description("KeyValue OriginalKey")]
51 [Property("SPEC", "Tizen.NUI.KeyValue.OriginalKey A")]
52 [Property("SPEC_URL", "-")]
53 [Property("CRITERIA", "PRW")]
54 [Property("AUTHOR", "guowei.wang@samsung.com")]
55 public void KeyValueOriginalKeyWithNull()
57 tlog.Debug(tag, $"KeyValueOriginalKeyWithNull START");
61 keyValue.OriginalKey = null;
63 catch (ArgumentNullException)
65 tlog.Debug(tag, $"KeyValueOriginalKeyWithNull END (OK)");
66 Assert.Pass("Caught ArgumentNullException : Passed!");
72 [Description("KeyValue IntegerKey")]
73 [Property("SPEC", "Tizen.NUI.KeyValue.IntegerKey A")]
74 [Property("SPEC_URL", "-")]
75 [Property("CRITERIA", "PRW")]
76 [Property("AUTHOR", "guowei.wang@samsung.com")]
77 public void KeyValueIntegerKey()
79 tlog.Debug(tag, $"KeyValueIntegerKey START");
81 keyValue.IntegerKey = 10;
82 tlog.Debug(tag, "IntegerKey : " + keyValue.IntegerKey);
84 tlog.Debug(tag, $"KeyValueIntegerKey END (OK)");
89 [Description("KeyValue StringKey")]
90 [Property("SPEC", "Tizen.NUI.KeyValue.StringKey A")]
91 [Property("SPEC_URL", "-")]
92 [Property("CRITERIA", "PRW")]
93 [Property("AUTHOR", "guowei.wang@samsung.com")]
94 public void KeyValueStringKey()
96 tlog.Debug(tag, $"KeyValueStringKey START");
98 keyValue.StringKey = "keyvalue";
99 tlog.Debug(tag, "IntegerKey : " + keyValue.StringKey);
101 tlog.Debug(tag, $"KeyValueStringKey END (OK)");
106 [Description("KeyValue PropertyValue")]
107 [Property("SPEC", "Tizen.NUI.KeyValue.PropertyValue A")]
108 [Property("SPEC_URL", "-")]
109 [Property("CRITERIA", "PRW")]
110 [Property("AUTHOR", "guowei.wang@samsung.com")]
111 public void KeyValuePropertyValue()
113 tlog.Debug(tag, $"KeyValuePropertyValue START");
115 using (PropertyValue pValue = new PropertyValue())
117 keyValue.PropertyValue = pValue;
118 tlog.Debug(tag, "PropertyValue : " + keyValue.PropertyValue);
121 tlog.Debug(tag, $"KeyValuePropertyValue END (OK)");
126 [Description("KeyValue IntergerValue")]
127 [Property("SPEC", "Tizen.NUI.KeyValue.IntergerValue A")]
128 [Property("SPEC_URL", "-")]
129 [Property("CRITERIA", "PRW")]
130 [Property("AUTHOR", "guowei.wang@samsung.com")]
131 public void KeyValueIntergerValue()
133 tlog.Debug(tag, $"KeyValueIntergerValue START");
135 keyValue.IntergerValue = 10;
136 tlog.Debug(tag, "IntergerValue : " + keyValue.IntergerValue);
138 tlog.Debug(tag, $"KeyValueIntergerValue END (OK)");
143 [Description("KeyValue BooleanValue")]
144 [Property("SPEC", "Tizen.NUI.KeyValue.BooleanValue A")]
145 [Property("SPEC_URL", "-")]
146 [Property("CRITERIA", "PRW")]
147 [Property("AUTHOR", "guowei.wang@samsung.com")]
148 public void KeyValueBooleanValue()
150 tlog.Debug(tag, $"KeyValueBooleanValue START");
152 keyValue.BooleanValue = true;
153 tlog.Debug(tag, "BooleanValue : " + keyValue.BooleanValue);
155 var strVal = keyValue.StringValue;
156 Assert.AreEqual("error to get StringValue", strVal, "Should be equal!");
158 tlog.Debug(tag, $"KeyValueBooleanValue END (OK)");
163 [Description("KeyValue SingleValue")]
164 [Property("SPEC", "Tizen.NUI.KeyValue.SingleValue A")]
165 [Property("SPEC_URL", "-")]
166 [Property("CRITERIA", "PRW")]
167 [Property("AUTHOR", "guowei.wang@samsung.com")]
168 public void KeyValueSingleValue()
170 tlog.Debug(tag, $"KeyValueSingleValue START");
172 keyValue.SingleValue = 10;
173 tlog.Debug(tag, "SingleValue : " + keyValue.SingleValue);
175 tlog.Debug(tag, $"KeyValueSingleValue END (OK)");
180 [Description("KeyValue StringValue")]
181 [Property("SPEC", "Tizen.NUI.KeyValue.StringValue A")]
182 [Property("SPEC_URL", "-")]
183 [Property("CRITERIA", "PRW")]
184 [Property("AUTHOR", "guowei.wang@samsung.com")]
185 public void KeyValueStringValue()
187 tlog.Debug(tag, $"KeyValueStringValue START");
189 keyValue.StringValue = "stringvalue";
190 tlog.Debug(tag, "SingleValue : " + keyValue.StringValue);
192 tlog.Debug(tag, $"KeyValueStringValue END (OK)");
197 [Description("KeyValue Vector2Value")]
198 [Property("SPEC", "Tizen.NUI.KeyValue.Vector2Value A")]
199 [Property("SPEC_URL", "-")]
200 [Property("CRITERIA", "PRW")]
201 [Property("AUTHOR", "guowei.wang@samsung.com")]
202 public void KeyValueVector2Value()
204 tlog.Debug(tag, $"KeyValueVector2Value START");
206 using (Vector2 vec2 = new Vector2(1, 1))
208 keyValue.Vector2Value = vec2;
209 tlog.Debug(tag, "Vector2Value : " + keyValue.Vector2Value);
212 tlog.Debug(tag, $"KeyValueVector2Value END (OK)");
217 [Description("KeyValue Vector3Value")]
218 [Property("SPEC", "Tizen.NUI.KeyValue.Vector3Value A")]
219 [Property("SPEC_URL", "-")]
220 [Property("CRITERIA", "PRW")]
221 [Property("AUTHOR", "guowei.wang@samsung.com")]
222 public void KeyValueVector3Value()
224 tlog.Debug(tag, $"KeyValueVector3Value START");
226 using (Vector3 vec3 = new Vector3(1, 1, 1))
228 keyValue.Vector3Value = vec3;
229 tlog.Debug(tag, "Vector2Value : " + keyValue.Vector3Value);
232 tlog.Debug(tag, $"KeyValueVector3Value END (OK)");
237 [Description("KeyValue Vector4Value")]
238 [Property("SPEC", "Tizen.NUI.KeyValue.Vector4Value A")]
239 [Property("SPEC_URL", "-")]
240 [Property("CRITERIA", "PRW")]
241 [Property("AUTHOR", "guowei.wang@samsung.com")]
242 public void KeyValueVector4Value()
244 tlog.Debug(tag, $"KeyValueVector4Value START");
246 using (Vector4 vec4 = new Vector4(1, 1, 1, 0))
248 keyValue.Vector4Value = vec4;
249 tlog.Debug(tag, "Vector4Value : " + keyValue.Vector4Value);
252 tlog.Debug(tag, $"KeyValueVector4Value END (OK)");
257 [Description("KeyValue PositionValue")]
258 [Property("SPEC", "Tizen.NUI.KeyValue.PositionValue A")]
259 [Property("SPEC_URL", "-")]
260 [Property("CRITERIA", "PRW")]
261 [Property("AUTHOR", "guowei.wang@samsung.com")]
262 public void KeyValuePositionValue()
264 tlog.Debug(tag, $"KeyValuePositionValue START");
266 using (Position pos = new Position(1, 1, 0))
268 keyValue.PositionValue = pos;
269 tlog.Debug(tag, "PositionValue : " + keyValue.PositionValue);
272 tlog.Debug(tag, $"KeyValuePositionValue END (OK)");
277 [Description("KeyValue Position2DValue")]
278 [Property("SPEC", "Tizen.NUI.KeyValue.Position2DValue A")]
279 [Property("SPEC_URL", "-")]
280 [Property("CRITERIA", "PRW")]
281 [Property("AUTHOR", "guowei.wang@samsung.com")]
282 public void KeyValuePosition2DValue()
284 tlog.Debug(tag, $"KeyValuePosition2DValue START");
286 using (Position2D pos2d = new Position2D(1, 1))
288 keyValue.Position2DValue = pos2d;
289 tlog.Debug(tag, "Position2DValue : " + keyValue.Position2DValue.X);
292 tlog.Debug(tag, $"KeyValuePosition2DValue END (OK)");
297 [Description("KeyValue SizeValue")]
298 [Property("SPEC", "Tizen.NUI.KeyValue.SizeValue A")]
299 [Property("SPEC_URL", "-")]
300 [Property("CRITERIA", "PRW")]
301 [Property("AUTHOR", "guowei.wang@samsung.com")]
302 public void KeyValueSizeValue()
304 tlog.Debug(tag, $"KeyValueSizeValue START");
306 using (Size size = new Size(1, 1, 0))
308 keyValue.SizeValue = size;
309 tlog.Debug(tag, "SizeValue : " + keyValue.SizeValue);
312 tlog.Debug(tag, $"KeyValueSizeValue END (OK)");
317 [Description("KeyValue Size2DValue")]
318 [Property("SPEC", "Tizen.NUI.KeyValue.Size2DValue A")]
319 [Property("SPEC_URL", "-")]
320 [Property("CRITERIA", "PRW")]
321 [Property("AUTHOR", "guowei.wang@samsung.com")]
322 public void KeyValueSize2DValue()
324 tlog.Debug(tag, $"KeyValueSize2DValue START");
326 using (Size2D size2d = new Size2D(0, 0))
328 keyValue.Size2DValue = size2d;
329 tlog.Debug(tag, "Size2DValue : " + keyValue.Size2DValue);
332 tlog.Debug(tag, $"KeyValueSize2DValue END (OK)");
337 [Description("KeyValue ColorValue")]
338 [Property("SPEC", "Tizen.NUI.KeyValue.ColorValue A")]
339 [Property("SPEC_URL", "-")]
340 [Property("CRITERIA", "PRW")]
341 [Property("AUTHOR", "guowei.wang@samsung.com")]
342 public void KeyValueColorValue()
344 tlog.Debug(tag, $"KeyValueColorValue START");
346 using (Color color = new Color(0, 0, 0, 0))
348 keyValue.ColorValue = color;
349 tlog.Debug(tag, "ColorValue : " + keyValue.ColorValue);
352 tlog.Debug(tag, $"KeyValueColorValue END (OK)");
357 [Description("KeyValue RectangleValue")]
358 [Property("SPEC", "Tizen.NUI.KeyValue.RectangleValue A")]
359 [Property("SPEC_URL", "-")]
360 [Property("CRITERIA", "PRW")]
361 [Property("AUTHOR", "guowei.wang@samsung.com")]
362 public void KeyValueRectangleValue()
364 tlog.Debug(tag, $"KeyValueRectangleValue START");
366 using (Rectangle rec = new Rectangle(0, 0, 0, 0))
368 keyValue.RectangleValue = rec;
369 tlog.Debug(tag, "RectangleValue : " + keyValue.RectangleValue);
372 tlog.Debug(tag, $"KeyValueRectangleValue END (OK)");
377 [Description("KeyValue RotationValue")]
378 [Property("SPEC", "Tizen.NUI.KeyValue.RotationValue A")]
379 [Property("SPEC_URL", "-")]
380 [Property("CRITERIA", "PRW")]
381 [Property("AUTHOR", "guowei.wang@samsung.com")]
382 public void KeyValueRotationValue()
384 tlog.Debug(tag, $"KeyValueRotationValue START");
386 using (Rotation rotation = new Rotation())
388 keyValue.RotationValue = rotation;
389 tlog.Debug(tag, "RotationValue : " + keyValue.RotationValue);
392 tlog.Debug(tag, $"KeyValueRotationValue END (OK)");
397 [Description("KeyValue RelativeVector2Value")]
398 [Property("SPEC", "Tizen.NUI.KeyValue.RelativeVector2Value A")]
399 [Property("SPEC_URL", "-")]
400 [Property("CRITERIA", "PRW")]
401 [Property("AUTHOR", "guowei.wang@samsung.com")]
402 public void KeyValueRelativeVector2Value()
404 tlog.Debug(tag, $"KeyValueRelativeVector2Value START");
406 using (RelativeVector2 rVec2 = new RelativeVector2(0, 0))
408 keyValue.RelativeVector2Value = rVec2;
409 tlog.Debug(tag, "RelativeVector2Value : " + keyValue.RelativeVector2Value);
412 tlog.Debug(tag, $"KeyValueRelativeVector2Value END (OK)");
417 [Description("KeyValue RelativeVector3Value")]
418 [Property("SPEC", "Tizen.NUI.KeyValue.RelativeVector3Value A")]
419 [Property("SPEC_URL", "-")]
420 [Property("CRITERIA", "PRW")]
421 [Property("AUTHOR", "guowei.wang@samsung.com")]
422 public void KeyValueRelativeVector3Value()
424 tlog.Debug(tag, $"KeyValueRelativeVector3Value START");
426 using (RelativeVector3 rVec3 = new RelativeVector3(0, 0, 0))
428 keyValue.RelativeVector3Value = rVec3;
429 tlog.Debug(tag, "RelativeVector3Value : " + keyValue.RelativeVector3Value);
432 tlog.Debug(tag, $"KeyValueRelativeVector3Value END (OK)");
437 [Description("KeyValue RelativeVector4Value")]
438 [Property("SPEC", "Tizen.NUI.KeyValue.RelativeVector4Value A")]
439 [Property("SPEC_URL", "-")]
440 [Property("CRITERIA", "PRW")]
441 [Property("AUTHOR", "guowei.wang@samsung.com")]
442 public void KeyValueRelativeVector4Value()
444 tlog.Debug(tag, $"KeyValueRelativeVector4Value START");
446 using (RelativeVector4 rVec4 = new RelativeVector4(0, 0, 0, 0))
448 keyValue.RelativeVector4Value = rVec4;
449 tlog.Debug(tag, "RelativeVector4Value : " + keyValue.RelativeVector4Value);
452 tlog.Debug(tag, $"KeyValueRelativeVector4Value END (OK)");
457 [Description("KeyValue ExtentsValue")]
458 [Property("SPEC", "Tizen.NUI.KeyValue.ExtentsValue A")]
459 [Property("SPEC_URL", "-")]
460 [Property("CRITERIA", "PRW")]
461 [Property("AUTHOR", "guowei.wang@samsung.com")]
462 public void KeyValueExtentsValue()
464 tlog.Debug(tag, $"KeyValueExtentsValue START");
466 using (Extents ext = new Extents(0, 0, 0, 0))
468 keyValue.ExtentsValue = ext;
469 tlog.Debug(tag, "ExtentsValue : " + keyValue.ExtentsValue);
472 tlog.Debug(tag, $"KeyValueExtentsValue END (OK)");
477 [Description("KeyValue PropertyArrayValue")]
478 [Property("SPEC", "Tizen.NUI.KeyValue.PropertyArrayValue A")]
479 [Property("SPEC_URL", "-")]
480 [Property("CRITERIA", "PRW")]
481 [Property("AUTHOR", "guowei.wang@samsung.com")]
482 public void KeyValuePropertyArrayValue()
484 tlog.Debug(tag, $"KeyValuePropertyArrayValue START");
486 using (PropertyArray pArr = new PropertyArray())
488 keyValue.PropertyArrayValue = pArr;
489 tlog.Debug(tag, "PropertyArrayValue : " + keyValue.PropertyArrayValue);
492 tlog.Debug(tag, $"KeyValuePropertyArrayValue END (OK)");
497 [Description("KeyValue PropertyMapValue")]
498 [Property("SPEC", "Tizen.NUI.KeyValue.PropertyMapValue A")]
499 [Property("SPEC_URL", "-")]
500 [Property("CRITERIA", "PRW")]
501 [Property("AUTHOR", "guowei.wang@samsung.com")]
502 public void KeyValuePropertyMapValue()
504 tlog.Debug(tag, $"KeyValuePropertyMapValue START");
506 using (PropertyMap pMap = new PropertyMap())
508 keyValue.PropertyMapValue = pMap;
509 tlog.Debug(tag, "PropertyMapValue : " + keyValue.PropertyMapValue);
512 tlog.Debug(tag, $"KeyValuePropertyMapValue END (OK)");
517 [Description("KeyValue IntergerValue")]
518 [Property("SPEC", "Tizen.NUI.KeyValue.IntergerValue A")]
519 [Property("SPEC_URL", "-")]
520 [Property("CRITERIA", "PRW")]
521 [Property("AUTHOR", "guowei.wang@samsung.com")]
522 public void KeyValueIntergerValueGetError()
524 tlog.Debug(tag, $"KeyValueIntergerValueGetError START");
526 keyValue.Value = "IntergerValue";
528 var result = keyValue.IntergerValue;
529 Assert.AreEqual(-1, result, "Should be equal!");
531 var sigVal = keyValue.SingleValue;
532 Assert.AreEqual(-1, sigVal, "Should be equal!");
534 var boolVal = keyValue.BooleanValue;
535 Assert.AreEqual(false, boolVal, "Should be equal!");
537 var v2Value = keyValue.Vector2Value;
538 Assert.AreEqual(0, v2Value.X, "Should be equal!");
539 Assert.AreEqual(0, v2Value.Y, "Should be equal!");
541 var v3Value = keyValue.Vector3Value;
542 Assert.AreEqual(0, v3Value.X, "Should be equal!");
543 Assert.AreEqual(0, v3Value.Y, "Should be equal!");
544 Assert.AreEqual(0, v3Value.Z, "Should be equal!");
546 var v4Value = keyValue.Vector4Value;
547 Assert.AreEqual(0, v4Value.X, "Should be equal!");
548 Assert.AreEqual(0, v4Value.Y, "Should be equal!");
549 Assert.AreEqual(0, v4Value.Z, "Should be equal!");
550 Assert.AreEqual(0, v4Value.W, "Should be equal!");
552 var pos = keyValue.PositionValue;
553 Assert.AreEqual(0, pos.X, "Should be equal!");
554 Assert.AreEqual(0, pos.Y, "Should be equal!");
555 Assert.AreEqual(0, pos.Z, "Should be equal!");
557 var size = keyValue.SizeValue;
558 Assert.AreEqual(0, size.Width, "Should be equal!");
559 Assert.AreEqual(0, size.Height, "Should be equal!");
560 Assert.AreEqual(0, size.Depth, "Should be equal!");
562 var size2d = keyValue.Size2DValue;
563 Assert.AreEqual(0, size2d.Width, "Should be equal!");
564 Assert.AreEqual(0, size2d.Height, "Should be equal!");
566 var colorVal = keyValue.ColorValue;
567 Assert.AreEqual(0, colorVal.R, "Should be equal!");
568 Assert.AreEqual(0, colorVal.G, "Should be equal!");
569 Assert.AreEqual(0, colorVal.B, "Should be equal!");
570 Assert.AreEqual(0, colorVal.A, "Should be equal!");
572 var recVal = keyValue.RectangleValue;
573 Assert.AreEqual(0, recVal.X, "Should be equal!");
574 Assert.AreEqual(0, recVal.Y, "Should be equal!");
575 Assert.AreEqual(0, recVal.Width, "Should be equal!");
576 Assert.AreEqual(0, recVal.Height, "Should be equal!");
578 var relativeV2 = keyValue.RelativeVector2Value;
579 Assert.AreEqual(0, relativeV2.X, "Should be equal!");
580 Assert.AreEqual(0, relativeV2.Y, "Should be equal!");
582 var relativeV3 = keyValue.RelativeVector3Value;
583 Assert.AreEqual(0, relativeV3.X, "Should be equal!");
584 Assert.AreEqual(0, relativeV3.Y, "Should be equal!");
585 Assert.AreEqual(0, relativeV3.Z, "Should be equal!");
587 var relativeV4 = keyValue.RelativeVector4Value;
588 Assert.AreEqual(0, relativeV4.X, "Should be equal!");
589 Assert.AreEqual(0, relativeV4.Y, "Should be equal!");
590 Assert.AreEqual(0, relativeV4.Z, "Should be equal!");
591 Assert.AreEqual(0, relativeV4.W, "Should be equal!");
593 var extVal = keyValue.ExtentsValue;
594 Assert.AreEqual(0, extVal.Start, "Should be equal!");
595 Assert.AreEqual(0, extVal.End, "Should be equal!");
596 Assert.AreEqual(0, extVal.Top, "Should be equal!");
597 Assert.AreEqual(0, extVal.Bottom, "Should be equal!");
599 var propertyArr = keyValue.PropertyArrayValue;
600 Assert.IsNotNull(propertyArr, "Can't create success object PropertyArray");
601 Assert.IsInstanceOf<PropertyArray>(propertyArr, "Should be an instance of PropertyArray type.");
603 var propertyMap = keyValue.PropertyMapValue;
604 Assert.IsNotNull(propertyMap, "Can't create success object PropertyMap");
605 Assert.IsInstanceOf<PropertyMap>(propertyMap, "Should be an instance of PropertyMap type.");
607 tlog.Debug(tag, $"KeyValueIntergerValueGetError END (OK)");