3 using NUnit.Framework.TUnit;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("public/Common/Matrix")]
12 public class MatrixTest
14 private const string tag = "NUITEST";
19 tlog.Info(tag, "Init() is called!");
25 tlog.Info(tag, "Destroy() is called!");
30 [Description("Matrix constructor.")]
31 [Property("SPEC", "Tizen.NUI.Matrix.Matrix C")]
32 [Property("SPEC_URL", "-")]
33 [Property("CRITERIA", "CONSTR")]
34 [Property("AUTHOR", "guowei.wang@samsung.com")]
35 public void MatrixConstructor()
37 tlog.Debug(tag, $"MatrixConstructor START");
39 var testingTarget = new Matrix();
40 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
41 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
43 testingTarget.Dispose();
44 tlog.Debug(tag, $"MatrixConstructor END (OK)");
49 [Description("Matrix constructor. With boolean.")]
50 [Property("SPEC", "Tizen.NUI.Matrix.Matrix C")]
51 [Property("SPEC_URL", "-")]
52 [Property("CRITERIA", "CONSTR")]
53 [Property("AUTHOR", "guowei.wang@samsung.com")]
54 public void MatrixConstructorWithBoolean()
56 tlog.Debug(tag, $"MatrixConstructorWithBoolean START");
58 var testingTarget = new Matrix(true);
59 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
60 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
62 testingTarget.Dispose();
63 tlog.Debug(tag, $"MatrixConstructorWithBoolean END (OK)");
68 [Description("Matrix constructor. With float array.")]
69 [Property("SPEC", "Tizen.NUI.Matrix.Matrix C")]
70 [Property("SPEC_URL", "-")]
71 [Property("CRITERIA", "CONSTR")]
72 [Property("AUTHOR", "guowei.wang@samsung.com")]
73 public void MatrixConstructorWithFloatArray()
75 tlog.Debug(tag, $"MatrixConstructorWithFloatArray START");
77 float[] arr = new float[16]
78 { 0.0f, 1.0f, 2.0f, 3.0f,
79 0.1f, 1.1f, 2.1f, 3.1f,
80 0.2f, 1.2f, 2.2f, 3.2f,
81 0.3f, 1.3f, 2.3f, 3.3f};
83 var testingTarget = new Matrix(arr);
84 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
85 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
87 testingTarget.Dispose();
88 tlog.Debug(tag, $"MatrixConstructorWithFloatArray END (OK)");
93 [Description("Matrix constructor. With Rotation.")]
94 [Property("SPEC", "Tizen.NUI.Matrix.Matrix C")]
95 [Property("SPEC_URL", "-")]
96 [Property("CRITERIA", "CONSTR")]
97 [Property("AUTHOR", "guowei.wang@samsung.com")]
98 public void MatrixConstructorWithRotation()
100 tlog.Debug(tag, $"MatrixConstructorWithRotation START");
102 using (Rotation rotation = new Rotation())
104 var testingTarget = new Matrix(rotation);
105 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
106 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
108 testingTarget.Dispose();
111 tlog.Debug(tag, $"MatrixConstructorWithRotation END (OK)");
116 [Description("Matrix constructor. With Matrix.")]
117 [Property("SPEC", "Tizen.NUI.Matrix.Matrix C")]
118 [Property("SPEC_URL", "-")]
119 [Property("CRITERIA", "CONSTR")]
120 [Property("AUTHOR", "guowei.wang@samsung.com")]
121 public void MatrixConstructorWithMatrix()
123 tlog.Debug(tag, $"MatrixConstructorWithMatrix START");
125 using (Matrix martrix = new Matrix(true))
127 var testingTarget = new Matrix(martrix);
128 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
129 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
131 testingTarget.Dispose();
134 tlog.Debug(tag, $"MatrixConstructorWithMatrix END (OK)");
139 [Description("Matrix Assign.")]
140 [Property("SPEC", "Tizen.NUI.Matrix.Assign M")]
141 [Property("SPEC_URL", "-")]
142 [Property("CRITERIA", "MR")]
143 [Property("AUTHOR", "guowei.wang@samsung.com")]
144 public void MatrixAssign()
146 tlog.Debug(tag, $"MatrixAssign START");
148 using (Matrix martrix = new Matrix(true))
150 var testingTarget = martrix.Assign(martrix);
151 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
152 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
154 testingTarget.Dispose();
157 tlog.Debug(tag, $"MatrixAssign END (OK)");
162 [Description("Matrix Identity.")]
163 [Property("SPEC", "Tizen.NUI.Matrix.Identity A")]
164 [Property("SPEC_URL", "-")]
165 [Property("CRITERIA", "PRO")]
166 [Property("AUTHOR", "guowei.wang@samsung.com")]
167 public void MatrixIdentity()
169 tlog.Debug(tag, $"MatrixIdentity START");
173 var result = Matrix.Identity;
174 tlog.Debug(tag, "Identity : " + result);
178 tlog.Debug(tag, e.Message.ToString());
179 Assert.Fail("Caught Exception : Failed!");
182 tlog.Debug(tag, $"MatrixIdentity END (OK)");
187 [Description("Matrix SetIdentity.")]
188 [Property("SPEC", "Tizen.NUI.Matrix.SetIdentity M")]
189 [Property("SPEC_URL", "-")]
190 [Property("CRITERIA", "MR")]
191 [Property("AUTHOR", "guowei.wang@samsung.com")]
192 public void MatrixSetIdentity()
194 tlog.Debug(tag, $"MatrixSetIdentity START");
196 var testingTarget = new Matrix();
197 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
198 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
202 testingTarget.SetIdentity();
206 tlog.Debug(tag, e.Message.ToString());
207 Assert.Fail("Caught Exception : Failed!");
210 testingTarget.Dispose();
211 tlog.Debug(tag, $"MatrixSetIdentity END (OK)");
216 [Description("Matrix SetIdentityAndScale.")]
217 [Property("SPEC", "Tizen.NUI.Matrix.SetIdentityAndScale M")]
218 [Property("SPEC_URL", "-")]
219 [Property("CRITERIA", "MR")]
220 [Property("AUTHOR", "guowei.wang@samsung.com")]
221 public void MatrixSetIdentityAndScale()
223 tlog.Debug(tag, $"MatrixSetIdentityAndScale START");
225 var testingTarget = new Matrix();
226 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
227 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
231 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
233 testingTarget.SetIdentityAndScale(vector);
238 tlog.Debug(tag, e.Message.ToString());
239 Assert.Fail("Caught Exception : Failed!");
242 testingTarget.Dispose();
243 tlog.Debug(tag, $"MatrixSetIdentityAndScale END (OK)");
248 [Description("Matrix Invert.")]
249 [Property("SPEC", "Tizen.NUI.Matrix.Invert M")]
250 [Property("SPEC_URL", "-")]
251 [Property("CRITERIA", "MR")]
252 [Property("AUTHOR", "guowei.wang@samsung.com")]
253 public void MatrixInvert()
255 tlog.Debug(tag, $"MatrixInvert START");
257 // Initialize as invertable matrix
258 float[] arr = new float[16]
259 { 0.0f, 2.0f, 0.0f, 0.0f,
260 1.0f, 0.0f, 0.0f, 0.0f,
261 0.0f, 0.0f, 0.0f, 4.0f,
262 0.0f, 0.0f, 3.0f, 0.0f};
264 var testingTarget = new Matrix(arr);
265 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
266 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
270 var result = testingTarget.Invert();
271 tlog.Debug(tag, "Invert : " + result);
272 Assert.AreEqual(true, result, "Invert should be successed");
276 tlog.Debug(tag, e.Message.ToString());
277 Assert.Fail("Caught Exception : Failed!");
280 testingTarget.Dispose();
281 tlog.Debug(tag, $"MatrixInvert END (OK)");
286 [Description("Matrix Transpose.")]
287 [Property("SPEC", "Tizen.NUI.Matrix.Transpose M")]
288 [Property("SPEC_URL", "-")]
289 [Property("CRITERIA", "MR")]
290 [Property("AUTHOR", "guowei.wang@samsung.com")]
291 public void MatrixTranspose()
293 tlog.Debug(tag, $"MatrixTranspose START");
295 var testingTarget = new Matrix();
296 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
297 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
301 testingTarget.Transpose();
305 tlog.Debug(tag, e.Message.ToString());
306 Assert.Fail("Caught Exception : Failed!");
309 testingTarget.Dispose();
310 tlog.Debug(tag, $"MatrixTranspose END (OK)");
315 [Description("Matrix SetXAxis.")]
316 [Property("SPEC", "Tizen.NUI.Matrix.SetXAxis M")]
317 [Property("SPEC_URL", "-")]
318 [Property("CRITERIA", "MR")]
319 [Property("AUTHOR", "guowei.wang@samsung.com")]
320 public void MatrixSetXAxis()
322 tlog.Debug(tag, $"MatrixSetXAxis START");
324 var testingTarget = new Matrix();
325 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
326 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
329 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
331 testingTarget.SetXAxis(vector);
333 using (var result = testingTarget.GetXAxis())
335 Assert.AreEqual(1.0f, result.X, "Should be equal!");
336 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
337 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
342 testingTarget.Dispose();
343 tlog.Debug(tag, $"MatrixSetXAxis END (OK)");
348 [Description("Matrix SetYAxis.")]
349 [Property("SPEC", "Tizen.NUI.Matrix.SetYAxis M")]
350 [Property("SPEC_URL", "-")]
351 [Property("CRITERIA", "MR")]
352 [Property("AUTHOR", "guowei.wang@samsung.com")]
353 public void MatrixSetYAxis()
355 tlog.Debug(tag, $"MatrixSetYAxis START");
357 var testingTarget = new Matrix();
358 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
359 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
362 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
364 testingTarget.SetYAxis(vector);
366 using (var result = testingTarget.GetYAxis())
368 Assert.AreEqual(1.0f, result.X, "Should be equal!");
369 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
370 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
374 testingTarget.Dispose();
375 tlog.Debug(tag, $"MatrixSetYAxis END (OK)");
380 [Description("Matrix SetZAxis.")]
381 [Property("SPEC", "Tizen.NUI.Matrix.SetZAxis M")]
382 [Property("SPEC_URL", "-")]
383 [Property("CRITERIA", "MR")]
384 [Property("AUTHOR", "guowei.wang@samsung.com")]
385 public void MatrixSetZAxis()
387 tlog.Debug(tag, $"MatrixSetZAxis START");
389 var testingTarget = new Matrix();
390 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
391 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
394 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
396 testingTarget.SetZAxis(vector);
398 using (var result = testingTarget.GetZAxis())
400 Assert.AreEqual(1.0f, result.X, "Should be equal!");
401 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
402 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
406 testingTarget.Dispose();
407 tlog.Debug(tag, $"MatrixSetZAxis END (OK)");
412 [Description("Matrix SetTranslation.")]
413 [Property("SPEC", "Tizen.NUI.Matrix.SetTranslation M")]
414 [Property("SPEC_URL", "-")]
415 [Property("CRITERIA", "MR")]
416 [Property("AUTHOR", "guowei.wang@samsung.com")]
417 public void MatrixGetTranslation()
419 tlog.Debug(tag, $"MatrixGetTranslation START");
421 var testingTarget = new Matrix();
422 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
423 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
425 using (Vector4 vector = new Vector4(1.0f, 2.0f, 3.0f, 4.0f))
427 testingTarget.SetTranslation(vector);
429 using (var result = testingTarget.GetTranslation())
431 Assert.AreEqual(1.0f, result.X, "Should be equal!");
432 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
433 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
434 Assert.AreEqual(4.0f, result.W, "Should be equal!");
438 testingTarget.Dispose();
439 tlog.Debug(tag, $"MatrixGetTranslation END (OK)");
444 [Description("Matrix SetTranslation. With Vector3.")]
445 [Property("SPEC", "Tizen.NUI.Matrix.SetTranslation M")]
446 [Property("SPEC_URL", "-")]
447 [Property("CRITERIA", "MR")]
448 [Property("AUTHOR", "guowei.wang@samsung.com")]
449 public void MatrixSetTranslationWithVector3()
451 tlog.Debug(tag, $"MatrixSetTranslationWithVector3 START");
453 var testingTarget = new Matrix();
454 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
455 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
457 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
459 testingTarget.SetTranslation(vector);
461 using (var result = testingTarget.GetTranslation3())
463 Assert.AreEqual(1.0f, result.X, "Should be equal!");
464 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
465 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
469 testingTarget.Dispose();
470 tlog.Debug(tag, $"MatrixSetTranslationWithVector3 END (OK)");
475 [Description("Matrix OrthoNormalize.")]
476 [Property("SPEC", "Tizen.NUI.Matrix.OrthoNormalize M")]
477 [Property("SPEC_URL", "-")]
478 [Property("CRITERIA", "MR")]
479 [Property("AUTHOR", "guowei.wang@samsung.com")]
480 public void MatrixOrthoNormalize()
482 tlog.Debug(tag, $"MatrixOrthoNormalize START");
484 var testingTarget = new Matrix();
485 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
486 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
490 testingTarget.OrthoNormalize();
494 tlog.Debug(tag, e.Message.ToString());
495 Assert.Fail("Caught Exception : Failed!");
498 tlog.Debug(tag, $"MatrixOrthoNormalize END (OK)");
503 [Description("Matrix Multiply.")]
504 [Property("SPEC", "Tizen.NUI.Matrix.Multiply M")]
505 [Property("SPEC_URL", "-")]
506 [Property("CRITERIA", "MR")]
507 [Property("AUTHOR", "guowei.wang@samsung.com")]
508 public void MatrixMultiply()
510 tlog.Debug(tag, $"MatrixMultiply START");
512 var testingTarget = new Matrix();
513 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
514 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
516 using (Matrix lhs = new Matrix(true))
518 using (Matrix rhs = new Matrix(false))
522 Matrix.Multiply(testingTarget, lhs, rhs);
526 tlog.Debug(tag, e.Message.ToString());
527 Assert.Fail("Caught Exception : Failed!");
532 testingTarget.Dispose();
533 tlog.Debug(tag, $"MatrixMultiply END (OK)");
538 [Description("Matrix MultiplyAssign.")]
539 [Property("SPEC", "Tizen.NUI.Matrix.MultiplyAssign M")]
540 [Property("SPEC_URL", "-")]
541 [Property("CRITERIA", "MR")]
542 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
543 public void MatrixMultiplyAssign()
545 tlog.Debug(tag, $"MatrixMultiplyAssign START");
547 var testingTarget = new Matrix();
548 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
549 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
551 using (Matrix rhs = new Matrix(false))
555 testingTarget.MultiplyAssign(rhs);
559 tlog.Debug(tag, e.Message.ToString());
560 Assert.Fail("Caught Exception : Failed!");
564 testingTarget.Dispose();
565 tlog.Debug(tag, $"MatrixMultiplyAssign END (OK)");
570 [Description("Matrix Multiply. With Rotation.")]
571 [Property("SPEC", "Tizen.NUI.Matrix.Multiply M")]
572 [Property("SPEC_URL", "-")]
573 [Property("CRITERIA", "MR")]
574 [Property("AUTHOR", "guowei.wang@samsung.com")]
575 public void MatrixMultiplyWithRotation()
577 tlog.Debug(tag, $"MatrixMultiplyWithRotation START");
579 var testingTarget = new Matrix();
580 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
581 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
583 using (Matrix lhs = new Matrix(true))
585 using (Rotation rhs = new Rotation())
589 Matrix.Multiply(testingTarget, lhs, rhs);
593 tlog.Debug(tag, e.Message.ToString());
594 Assert.Fail("Caught Exception : Failed!");
599 testingTarget.Dispose();
600 tlog.Debug(tag, $"MatrixMultiplyWithRotation END (OK)");
605 [Description("Matrix Multiply. With Vector4.")]
606 [Property("SPEC", "Tizen.NUI.Matrix.Multiply M")]
607 [Property("SPEC_URL", "-")]
608 [Property("CRITERIA", "MR")]
609 [Property("AUTHOR", "guowei.wang@samsung.com")]
610 public void MatrixMultiplyWithVector4()
612 tlog.Debug(tag, $"MatrixMultiplyWithVector4 START");
614 var testingTarget = new Matrix();
615 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
616 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
618 using (Vector4 vector = new Vector4(1.0f, 2.0f, 3.0f, 4.0f))
622 var ret = testingTarget.Multiply(vector);
627 tlog.Debug(tag, e.Message.ToString());
628 Assert.Fail("Caught Exception : Failed!");
632 testingTarget.Dispose();
633 tlog.Debug(tag, $"MatrixMultiplyWithVector4 END (OK)");
638 [Description("Matrix EqualTo.")]
639 [Property("SPEC", "Tizen.NUI.Matrix.EqualTo M")]
640 [Property("SPEC_URL", "-")]
641 [Property("CRITERIA", "MR")]
642 [Property("AUTHOR", "guowei.wang@samsung.com")]
643 public void MatrixEqualTo()
645 tlog.Debug(tag, $"MatrixEqualTo START");
647 var testingTarget = new Matrix();
648 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
649 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
651 using (Matrix matrix = new Matrix(true))
653 var result = testingTarget.EqualTo(matrix);
654 tlog.Debug(tag, "EqualTo : " + result);
655 Assert.AreEqual(true, result, "EqualTo should be true");
658 testingTarget.Dispose();
659 tlog.Debug(tag, $"MatrixEqualTo END (OK)");
664 [Description("Matrix NotEqualTo.")]
665 [Property("SPEC", "Tizen.NUI.Matrix.NotEqualTo M")]
666 [Property("SPEC_URL", "-")]
667 [Property("CRITERIA", "MR")]
668 [Property("AUTHOR", "guowei.wang@samsung.com")]
669 public void MatrixNotEqualTo()
671 tlog.Debug(tag, $"MatrixNotEqualTo START");
673 var testingTarget = new Matrix();
674 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
675 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
677 using (Matrix matrix = new Matrix(true))
679 var result = testingTarget.NotEqualTo(matrix);
680 tlog.Debug(tag, "NotEqualTo : " + result);
681 Assert.AreEqual(false, result, "NotEqualTo should be false");
684 testingTarget.Dispose();
685 tlog.Debug(tag, $"MatrixNotEqualTo END (OK)");
690 [Description("Matrix SetTransformComponents.")]
691 [Property("SPEC", "Tizen.NUI.Matrix.SetTransformComponents M")]
692 [Property("SPEC_URL", "-")]
693 [Property("CRITERIA", "MR")]
694 [Property("AUTHOR", "guowei.wang@samsung.com")]
695 public void MatrixSetTransformComponents()
697 tlog.Debug(tag, $"MatrixSetTransformComponents START");
699 var testingTarget = new Matrix();
700 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
701 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
703 using (Vector3 scale = new Vector3(1.0f, 2.0f, 3.0f))
706 using (Rotation rotation = new Rotation())
708 using (Vector3 translation = new Vector3(3.0f, 2.0f, 1.0f))
712 testingTarget.SetTransformComponents(scale, rotation, translation);
716 tlog.Debug(tag, e.Message.ToString());
717 Assert.Fail("Caught Exception : Failed!");
724 testingTarget.Dispose();
725 tlog.Debug(tag, $"MatrixSetTransformComponents END (OK)");
730 [Description("Matrix SetInverseTransformComponents.")]
731 [Property("SPEC", "Tizen.NUI.Matrix.SetInverseTransformComponents M")]
732 [Property("SPEC_URL", "-")]
733 [Property("CRITERIA", "MR")]
734 [Property("AUTHOR", "guowei.wang@samsung.com")]
735 public void MatrixSetInverseTransformComponents()
737 tlog.Debug(tag, $"MatrixSetInverseTransformComponents START");
739 var testingTarget = new Matrix();
740 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
741 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
743 using (Vector3 scale = new Vector3(1.0f, 2.0f, 3.0f))
746 using (Rotation rotation = new Rotation())
748 using (Vector3 translation = new Vector3(3.0f, 2.0f, 1.0f))
752 testingTarget.SetInverseTransformComponents(scale, rotation, translation);
756 tlog.Debug(tag, e.Message.ToString());
757 Assert.Fail("Caught Exception : Failed!");
764 testingTarget.Dispose();
765 tlog.Debug(tag, $"MatrixSetInverseTransformComponents END (OK)");
770 [Description("Matrix SetInverseTransformComponents.")]
771 [Property("SPEC", "Tizen.NUI.Matrix.SetInverseTransformComponents M")]
772 [Property("SPEC_URL", "-")]
773 [Property("CRITERIA", "MR")]
774 [Property("AUTHOR", "guowei.wang@samsung.com")]
775 public void MatrixSetInverseTransformComponentsWithVector3()
777 tlog.Debug(tag, $"MatrixSetInverseTransformComponentsWithVector3 START");
779 var testingTarget = new Matrix();
780 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
781 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
783 using (Vector3 xAxis = new Vector3(1.0f, 2.0f, 3.0f))
786 using (Vector3 yAxis = new Vector3(3.0f, 4.0f, 5.0f))
788 using (Vector3 zAxis = new Vector3(5.0f, 6.0f, 7.0f))
790 using (Vector3 translation = new Vector3(7.0f, 8.0f, 9.0f))
794 testingTarget.SetInverseTransformComponents(xAxis, yAxis, zAxis, translation);
798 tlog.Debug(tag, e.Message.ToString());
799 Assert.Fail("Caught Exception : Failed!");
807 testingTarget.Dispose();
808 tlog.Debug(tag, $"MatrixSetInverseTransformComponentsWithVector3 END (OK)");
813 [Description("Matrix GetTransformComponents.")]
814 [Property("SPEC", "Tizen.NUI.Matrix.GetTransformComponents M")]
815 [Property("SPEC_URL", "-")]
816 [Property("CRITERIA", "MR")]
817 [Property("AUTHOR", "guowei.wang@samsung.com")]
818 public void MatrixGetTransformComponents()
820 tlog.Debug(tag, $"MatrixGetTransformComponents START");
822 var testingTarget = new Matrix();
823 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
824 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
826 using (Vector3 position = new Vector3(1.0f, 2.0f, 3.0f))
829 using (Rotation rotation = new Rotation())
831 using (Vector3 scale = new Vector3(3.0f, 2.0f, 1.0f))
835 testingTarget.GetTransformComponents(position, rotation, scale);
839 tlog.Debug(tag, e.Message.ToString());
840 Assert.Fail("Caught Exception : Failed!");
847 testingTarget.Dispose();
848 tlog.Debug(tag, $"MatrixGetTransformComponents END (OK)");
853 [Description("Matrix ValueOfIndex with signle index.")]
854 [Property("SPEC", "Tizen.NUI.Matrix.ValueOfIndex M")]
855 [Property("SPEC_URL", "-")]
856 [Property("CRITERIA", "MR")]
857 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
858 public void MatrixValueOfIndexSingleIndex()
861 tlog.Debug(tag, $"MatrixValueOfIndexSingleIndex START");
863 float[] arr = new float[16]
864 { 0.0f, 1.0f, 2.0f, 3.0f,
865 0.1f, 1.1f, 2.1f, 3.1f,
866 0.2f, 1.2f, 2.2f, 3.2f,
867 0.3f, 1.3f, 2.3f, 3.3f};
869 Matrix testingTarget = new Matrix(arr);
870 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
871 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
873 for(uint index = 0; index < 16; ++index)
875 float expectResult = (index / 4) * 0.1f + (index % 4) * 1.0f;
876 Assert.AreEqual(expectResult, testingTarget.ValueOfIndex(index), "The value of index is not correct!");
878 testingTarget.Dispose();
879 tlog.Debug(tag, $"MatrixValueOfIndexSingleIndex END (OK)");
884 [Description("Matrix ValueOfIndex with double index.")]
885 [Property("SPEC", "Tizen.NUI.Matrix.ValueOfIndex M")]
886 [Property("SPEC_URL", "-")]
887 [Property("CRITERIA", "MR")]
888 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
889 public void MatrixValueOfIndexDoubleIndex()
892 tlog.Debug(tag, $"MatrixValueOfIndexDoubleIndex START");
893 float[] arr = new float[16]
894 { 0.0f, 1.0f, 2.0f, 3.0f,
895 0.1f, 1.1f, 2.1f, 3.1f,
896 0.2f, 1.2f, 2.2f, 3.2f,
897 0.3f, 1.3f, 2.3f, 3.3f};
899 Matrix testingTarget = new Matrix(arr);
900 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
901 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
903 for(uint indexRow = 0; indexRow < 4; ++indexRow)
905 for(uint indexColumn = 0; indexColumn < 4; ++indexColumn)
907 float expectResult = indexColumn * 0.1f + indexRow * 1.0f;
908 Assert.AreEqual(expectResult, testingTarget.ValueOfIndex(indexRow, indexColumn), "The value of index is not correct!");
911 testingTarget.Dispose();
912 tlog.Debug(tag, $"MatrixValueOfIndexDoubleIndex END (OK)");
917 [Description("Matrix SetValueAtIndex with signle index.")]
918 [Property("SPEC", "Tizen.NUI.Matrix.SetValueAtIndex M")]
919 [Property("SPEC_URL", "-")]
920 [Property("CRITERIA", "MR")]
921 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
922 public void MatrixSetValueAtIndexSingleIndex()
925 tlog.Debug(tag, $"MatrixSetValueAtIndexSingleIndex START");
926 Matrix testingTarget = new Matrix(true);
927 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
928 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
930 for(uint index = 0; index < 16; ++index)
932 float expectResult = (index / 4) * 0.1f + (index % 4) * 1.0f;
933 testingTarget.SetValueAtIndex(index, expectResult);
934 Assert.AreEqual(expectResult, testingTarget[index], "The value of index is not correct!");
936 testingTarget.Dispose();
937 tlog.Debug(tag, $"MatrixSetValueAtIndexSingleIndex END (OK)");
942 [Description("Matrix SetValueAtIndex with double index.")]
943 [Property("SPEC", "Tizen.NUI.Matrix.SetValueAtIndex M")]
944 [Property("SPEC_URL", "-")]
945 [Property("CRITERIA", "MR")]
946 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
947 public void MatrixSetValueAtIndexDoubleIndex()
950 tlog.Debug(tag, $"MatrixSetValueAtIndexDoubleIndex START");
951 Matrix testingTarget = new Matrix(true);
952 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
953 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
955 for(uint indexRow = 0; indexRow < 4; ++indexRow)
957 for(uint indexColumn = 0; indexColumn < 4; ++indexColumn)
959 float expectResult = indexColumn * 0.1f + indexRow * 1.0f;
960 testingTarget.SetValueAtIndex(indexRow, indexColumn, expectResult);
961 Assert.AreEqual(expectResult, testingTarget.ValueOfIndex(indexRow, indexColumn), "The value of index is not correct!");
964 testingTarget.Dispose();
965 tlog.Debug(tag, $"MatrixSetValueAtIndexDoubleIndex END (OK)");
970 [Description("Test Tizen.NUI.Matrix.operator * with Matrix.")]
971 [Property("SPEC", "Tizen.NUI.Matrix.operator *() A")]
972 [Property("SPEC_URL", "-")]
973 [Property("CRITERIA", "MR")]
974 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
975 public void MatrixMultiplyOperator()
978 tlog.Debug(tag, $"MatrixMultiplyOperator START");
979 Matrix testingTarget = new Matrix(true);
980 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
981 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
985 Matrix rhs = new Matrix(false);
986 Matrix ret = testingTarget * rhs;
992 tlog.Debug(tag, e.Message.ToString());
993 Assert.Fail("Caught Exception : Failed!");
995 testingTarget.Dispose();
996 tlog.Debug(tag, $"MatrixMultiplyOperator END (OK)");
1001 [Description("Test Tizen.NUI.Matrix.operator * with Rotation.")]
1002 [Property("SPEC", "Tizen.NUI.Matrix.operator *() A")]
1003 [Property("SPEC_URL", "-")]
1004 [Property("CRITERIA", "MR")]
1005 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
1006 public void MatrixMultiplyOperatorWithRotation()
1009 tlog.Debug(tag, $"MatrixMultiplyOperatorWithRotation START");
1010 Matrix testingTarget = new Matrix(true);
1011 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
1012 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
1016 Rotation lhs = new Rotation();
1017 Matrix ret = lhs * testingTarget;
1023 tlog.Debug(tag, e.Message.ToString());
1024 Assert.Fail("Caught Exception : Failed!");
1026 testingTarget.Dispose();
1027 tlog.Debug(tag, $"MatrixMultiplyOperatorWithRotation END (OK)");
1032 [Description("Test Tizen.NUI.Matrix.operator * with Vector4.")]
1033 [Property("SPEC", "Tizen.NUI.Matrix.operator *() A")]
1034 [Property("SPEC_URL", "-")]
1035 [Property("CRITERIA", "MR")]
1036 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
1037 public void MatrixMultiplyOperatorWithVector4()
1040 tlog.Debug(tag, $"MatrixMultiplyOperatorWithVector4 START");
1041 Matrix testingTarget = new Matrix(true);
1042 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
1043 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
1047 Vector4 rhs = new Vector4();
1048 Vector4 ret = testingTarget * rhs;
1054 tlog.Debug(tag, e.Message.ToString());
1055 Assert.Fail("Caught Exception : Failed!");
1057 testingTarget.Dispose();
1058 tlog.Debug(tag, $"MatrixMultiplyOperatorWithVector4 END (OK)");
1063 [Description("Test this[uint index]. Check whether this[uint index] returns expected value or not.")]
1064 [Property("SPEC", "Tizen.NUI.Matrix.this[uint] A")]
1065 [Property("SPEC_URL", "-")]
1066 [Property("CRITERIA", "MR")]
1067 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
1068 public void this_SET_GET_VALUE()
1071 tlog.Debug(tag, $"Matrixthis_SET_GET_VALUE START");
1072 Matrix testingTarget = new Matrix(true);
1075 testingTarget[0] = 100.0f;
1076 testingTarget[1] = 200.0f;
1080 tlog.Debug(tag, e.Message.ToString());
1081 Assert.Fail("Caught Exception : Failed!");
1083 Assert.AreEqual(100.0f, testingTarget[0], "The value of index[0] is not correct!");
1084 Assert.AreEqual(200.0f, testingTarget[1], "The value of index[1] is not correct!");
1085 testingTarget.Dispose();
1086 tlog.Debug(tag, $"Matrixthis_SET_GET_VALUE END (OK)");