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 var result = testingTarget.GetXAxis();
334 Assert.AreEqual(1.0f, result.X, "Should be equal!");
335 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
336 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
339 testingTarget.Dispose();
340 tlog.Debug(tag, $"MatrixSetXAxis END (OK)");
345 [Description("Matrix SetYAxis.")]
346 [Property("SPEC", "Tizen.NUI.Matrix.SetYAxis M")]
347 [Property("SPEC_URL", "-")]
348 [Property("CRITERIA", "MR")]
349 [Property("AUTHOR", "guowei.wang@samsung.com")]
350 public void MatrixSetYAxis()
352 tlog.Debug(tag, $"MatrixSetYAxis START");
354 var testingTarget = new Matrix();
355 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
356 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
359 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
361 testingTarget.SetYAxis(vector);
363 var result = testingTarget.GetYAxis();
364 Assert.AreEqual(1.0f, result.X, "Should be equal!");
365 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
366 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
369 testingTarget.Dispose();
370 tlog.Debug(tag, $"MatrixSetYAxis END (OK)");
375 [Description("Matrix SetZAxis.")]
376 [Property("SPEC", "Tizen.NUI.Matrix.SetZAxis M")]
377 [Property("SPEC_URL", "-")]
378 [Property("CRITERIA", "MR")]
379 [Property("AUTHOR", "guowei.wang@samsung.com")]
380 public void MatrixSetZAxis()
382 tlog.Debug(tag, $"MatrixSetZAxis START");
384 var testingTarget = new Matrix();
385 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
386 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
389 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
391 testingTarget.SetZAxis(vector);
393 var result = testingTarget.GetZAxis();
394 Assert.AreEqual(1.0f, result.X, "Should be equal!");
395 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
396 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
399 testingTarget.Dispose();
400 tlog.Debug(tag, $"MatrixSetZAxis END (OK)");
405 [Description("Matrix SetTranslation.")]
406 [Property("SPEC", "Tizen.NUI.Matrix.SetTranslation M")]
407 [Property("SPEC_URL", "-")]
408 [Property("CRITERIA", "MR")]
409 [Property("AUTHOR", "guowei.wang@samsung.com")]
410 public void MatrixGetTranslation()
412 tlog.Debug(tag, $"MatrixGetTranslation START");
414 var testingTarget = new Matrix();
415 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
416 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
418 using (Vector4 vector = new Vector4(1.0f, 2.0f, 3.0f, 4.0f))
420 testingTarget.SetTranslation(vector);
422 var result = testingTarget.GetTranslation();
423 Assert.AreEqual(1.0f, result.X, "Should be equal!");
424 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
425 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
426 Assert.AreEqual(4.0f, result.W, "Should be equal!");
429 testingTarget.Dispose();
430 tlog.Debug(tag, $"MatrixGetTranslation END (OK)");
435 [Description("Matrix SetTranslation. With Vector3.")]
436 [Property("SPEC", "Tizen.NUI.Matrix.SetTranslation M")]
437 [Property("SPEC_URL", "-")]
438 [Property("CRITERIA", "MR")]
439 [Property("AUTHOR", "guowei.wang@samsung.com")]
440 public void MatrixSetTranslationWithVector3()
442 tlog.Debug(tag, $"MatrixSetTranslationWithVector3 START");
444 var testingTarget = new Matrix();
445 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
446 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
448 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
450 testingTarget.SetTranslation(vector);
452 var result = testingTarget.GetTranslation3();
453 Assert.AreEqual(1.0f, result.X, "Should be equal!");
454 Assert.AreEqual(2.0f, result.Y, "Should be equal!");
455 Assert.AreEqual(3.0f, result.Z, "Should be equal!");
458 testingTarget.Dispose();
459 tlog.Debug(tag, $"MatrixSetTranslationWithVector3 END (OK)");
464 [Description("Matrix OrthoNormalize.")]
465 [Property("SPEC", "Tizen.NUI.Matrix.OrthoNormalize M")]
466 [Property("SPEC_URL", "-")]
467 [Property("CRITERIA", "MR")]
468 [Property("AUTHOR", "guowei.wang@samsung.com")]
469 public void MatrixOrthoNormalize()
471 tlog.Debug(tag, $"MatrixOrthoNormalize START");
473 var testingTarget = new Matrix();
474 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
475 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
479 testingTarget.OrthoNormalize();
483 tlog.Debug(tag, e.Message.ToString());
484 Assert.Fail("Caught Exception : Failed!");
487 tlog.Debug(tag, $"MatrixOrthoNormalize END (OK)");
492 [Description("Matrix Multiply.")]
493 [Property("SPEC", "Tizen.NUI.Matrix.Multiply M")]
494 [Property("SPEC_URL", "-")]
495 [Property("CRITERIA", "MR")]
496 [Property("AUTHOR", "guowei.wang@samsung.com")]
497 public void MatrixMultiply()
499 tlog.Debug(tag, $"MatrixMultiply START");
501 var testingTarget = new Matrix();
502 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
503 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
505 using (Matrix lhs = new Matrix(true))
507 using (Matrix rhs = new Matrix(false))
511 Matrix.Multiply(testingTarget, lhs, rhs);
515 tlog.Debug(tag, e.Message.ToString());
516 Assert.Fail("Caught Exception : Failed!");
521 testingTarget.Dispose();
522 tlog.Debug(tag, $"MatrixMultiply END (OK)");
527 [Description("Matrix MultiplyAssign.")]
528 [Property("SPEC", "Tizen.NUI.Matrix.MultiplyAssign M")]
529 [Property("SPEC_URL", "-")]
530 [Property("CRITERIA", "MR")]
531 [Property("AUTHOR", "eunkiki.hong@samsung.com")]
532 public void MatrixMultiplyAssign()
534 tlog.Debug(tag, $"MatrixMultiplyAssign START");
536 var testingTarget = new Matrix();
537 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
538 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
540 using (Matrix rhs = new Matrix(false))
544 testingTarget.MultiplyAssign(rhs);
548 tlog.Debug(tag, e.Message.ToString());
549 Assert.Fail("Caught Exception : Failed!");
553 testingTarget.Dispose();
554 tlog.Debug(tag, $"MatrixMultiplyAssign END (OK)");
559 [Description("Matrix Multiply. With Rotation.")]
560 [Property("SPEC", "Tizen.NUI.Matrix.Multiply M")]
561 [Property("SPEC_URL", "-")]
562 [Property("CRITERIA", "MR")]
563 [Property("AUTHOR", "guowei.wang@samsung.com")]
564 public void MatrixMultiplyWithRotation()
566 tlog.Debug(tag, $"MatrixMultiplyWithRotation START");
568 var testingTarget = new Matrix();
569 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
570 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
572 using (Matrix lhs = new Matrix(true))
574 using (Rotation rhs = new Rotation())
578 Matrix.Multiply(testingTarget, lhs, rhs);
582 tlog.Debug(tag, e.Message.ToString());
583 Assert.Fail("Caught Exception : Failed!");
588 testingTarget.Dispose();
589 tlog.Debug(tag, $"MatrixMultiplyWithRotation END (OK)");
594 [Description("Matrix Multiply. With Vector4.")]
595 [Property("SPEC", "Tizen.NUI.Matrix.Multiply M")]
596 [Property("SPEC_URL", "-")]
597 [Property("CRITERIA", "MR")]
598 [Property("AUTHOR", "guowei.wang@samsung.com")]
599 public void MatrixMultiplyWithVector4()
601 tlog.Debug(tag, $"MatrixMultiplyWithVector4 START");
603 var testingTarget = new Matrix();
604 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
605 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
607 using (Vector4 vector = new Vector4(1.0f, 2.0f, 3.0f, 4.0f))
611 var ret = testingTarget.Multiply(vector);
616 tlog.Debug(tag, e.Message.ToString());
617 Assert.Fail("Caught Exception : Failed!");
621 testingTarget.Dispose();
622 tlog.Debug(tag, $"MatrixMultiplyWithVector4 END (OK)");
627 [Description("Matrix EqualTo.")]
628 [Property("SPEC", "Tizen.NUI.Matrix.EqualTo M")]
629 [Property("SPEC_URL", "-")]
630 [Property("CRITERIA", "MR")]
631 [Property("AUTHOR", "guowei.wang@samsung.com")]
632 public void MatrixEqualTo()
634 tlog.Debug(tag, $"MatrixEqualTo START");
636 var testingTarget = new Matrix();
637 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
638 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
640 using (Matrix matrix = new Matrix(true))
642 var result = testingTarget.EqualTo(matrix);
643 tlog.Debug(tag, "EqualTo : " + result);
644 Assert.AreEqual(true, result, "EqualTo should be true");
647 testingTarget.Dispose();
648 tlog.Debug(tag, $"MatrixEqualTo END (OK)");
653 [Description("Matrix NotEqualTo.")]
654 [Property("SPEC", "Tizen.NUI.Matrix.NotEqualTo M")]
655 [Property("SPEC_URL", "-")]
656 [Property("CRITERIA", "MR")]
657 [Property("AUTHOR", "guowei.wang@samsung.com")]
658 public void MatrixNotEqualTo()
660 tlog.Debug(tag, $"MatrixNotEqualTo START");
662 var testingTarget = new Matrix();
663 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
664 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
666 using (Matrix matrix = new Matrix(true))
668 var result = testingTarget.NotEqualTo(matrix);
669 tlog.Debug(tag, "NotEqualTo : " + result);
670 Assert.AreEqual(false, result, "NotEqualTo should be false");
673 testingTarget.Dispose();
674 tlog.Debug(tag, $"MatrixNotEqualTo END (OK)");
679 [Description("Matrix SetTransformComponents.")]
680 [Property("SPEC", "Tizen.NUI.Matrix.SetTransformComponents M")]
681 [Property("SPEC_URL", "-")]
682 [Property("CRITERIA", "MR")]
683 [Property("AUTHOR", "guowei.wang@samsung.com")]
684 public void MatrixSetTransformComponents()
686 tlog.Debug(tag, $"MatrixSetTransformComponents START");
688 var testingTarget = new Matrix();
689 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
690 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
692 using (Vector3 scale = new Vector3(1.0f, 2.0f, 3.0f))
695 using (Rotation rotation = new Rotation())
697 using (Vector3 translation = new Vector3(3.0f, 2.0f, 1.0f))
701 testingTarget.SetTransformComponents(scale, rotation, translation);
705 tlog.Debug(tag, e.Message.ToString());
706 Assert.Fail("Caught Exception : Failed!");
713 testingTarget.Dispose();
714 tlog.Debug(tag, $"MatrixSetTransformComponents END (OK)");
719 [Description("Matrix SetInverseTransformComponents.")]
720 [Property("SPEC", "Tizen.NUI.Matrix.SetInverseTransformComponents M")]
721 [Property("SPEC_URL", "-")]
722 [Property("CRITERIA", "MR")]
723 [Property("AUTHOR", "guowei.wang@samsung.com")]
724 public void MatrixSetInverseTransformComponents()
726 tlog.Debug(tag, $"MatrixSetInverseTransformComponents START");
728 var testingTarget = new Matrix();
729 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
730 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
732 using (Vector3 scale = new Vector3(1.0f, 2.0f, 3.0f))
735 using (Rotation rotation = new Rotation())
737 using (Vector3 translation = new Vector3(3.0f, 2.0f, 1.0f))
741 testingTarget.SetInverseTransformComponents(scale, rotation, translation);
745 tlog.Debug(tag, e.Message.ToString());
746 Assert.Fail("Caught Exception : Failed!");
753 testingTarget.Dispose();
754 tlog.Debug(tag, $"MatrixSetInverseTransformComponents END (OK)");
759 [Description("Matrix SetInverseTransformComponents.")]
760 [Property("SPEC", "Tizen.NUI.Matrix.SetInverseTransformComponents M")]
761 [Property("SPEC_URL", "-")]
762 [Property("CRITERIA", "MR")]
763 [Property("AUTHOR", "guowei.wang@samsung.com")]
764 public void MatrixSetInverseTransformComponentsWithVector3()
766 tlog.Debug(tag, $"MatrixSetInverseTransformComponentsWithVector3 START");
768 var testingTarget = new Matrix();
769 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
770 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
772 using (Vector3 xAxis = new Vector3(1.0f, 2.0f, 3.0f))
775 using (Vector3 yAxis = new Vector3(3.0f, 4.0f, 5.0f))
777 using (Vector3 zAxis = new Vector3(5.0f, 6.0f, 7.0f))
779 using (Vector3 translation = new Vector3(7.0f, 8.0f, 9.0f))
783 testingTarget.SetInverseTransformComponents(xAxis, yAxis, zAxis, translation);
787 tlog.Debug(tag, e.Message.ToString());
788 Assert.Fail("Caught Exception : Failed!");
796 testingTarget.Dispose();
797 tlog.Debug(tag, $"MatrixSetInverseTransformComponentsWithVector3 END (OK)");
802 [Description("Matrix GetTransformComponents.")]
803 [Property("SPEC", "Tizen.NUI.Matrix.GetTransformComponents M")]
804 [Property("SPEC_URL", "-")]
805 [Property("CRITERIA", "MR")]
806 [Property("AUTHOR", "guowei.wang@samsung.com")]
807 public void MatrixGetTransformComponents()
809 tlog.Debug(tag, $"MatrixGetTransformComponents START");
811 var testingTarget = new Matrix();
812 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
813 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
815 using (Vector3 position = new Vector3(1.0f, 2.0f, 3.0f))
818 using (Rotation rotation = new Rotation())
820 using (Vector3 scale = new Vector3(3.0f, 2.0f, 1.0f))
824 testingTarget.GetTransformComponents(position, rotation, scale);
828 tlog.Debug(tag, e.Message.ToString());
829 Assert.Fail("Caught Exception : Failed!");
836 testingTarget.Dispose();
837 tlog.Debug(tag, $"MatrixGetTransformComponents END (OK)");
842 [Description("Matrix ValueOfIndex with signle index.")]
843 [Property("SPEC", "Tizen.NUI.Matrix.ValueOfIndex M")]
844 [Property("SPEC_URL", "-")]
845 [Property("CRITERIA", "MR")]
846 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
847 public void MatrixValueOfIndexSingleIndex()
850 tlog.Debug(tag, $"MatrixValueOfIndexSingleIndex START");
852 float[] arr = new float[16]
853 { 0.0f, 1.0f, 2.0f, 3.0f,
854 0.1f, 1.1f, 2.1f, 3.1f,
855 0.2f, 1.2f, 2.2f, 3.2f,
856 0.3f, 1.3f, 2.3f, 3.3f};
858 Matrix testingTarget = new Matrix(arr);
859 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
860 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
862 for(uint index = 0; index < 16; ++index)
864 float expectResult = (index / 4) * 0.1f + (index % 4) * 1.0f;
865 Assert.AreEqual(expectResult, testingTarget.ValueOfIndex(index), "The value of index is not correct!");
867 testingTarget.Dispose();
868 tlog.Debug(tag, $"MatrixValueOfIndexSingleIndex END (OK)");
873 [Description("Matrix ValueOfIndex with double index.")]
874 [Property("SPEC", "Tizen.NUI.Matrix.ValueOfIndex M")]
875 [Property("SPEC_URL", "-")]
876 [Property("CRITERIA", "MR")]
877 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
878 public void MatrixValueOfIndexDoubleIndex()
881 tlog.Debug(tag, $"MatrixValueOfIndexDoubleIndex START");
882 float[] arr = new float[16]
883 { 0.0f, 1.0f, 2.0f, 3.0f,
884 0.1f, 1.1f, 2.1f, 3.1f,
885 0.2f, 1.2f, 2.2f, 3.2f,
886 0.3f, 1.3f, 2.3f, 3.3f};
888 Matrix testingTarget = new Matrix(arr);
889 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
890 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
892 for(uint indexRow = 0; indexRow < 4; ++indexRow)
894 for(uint indexColumn = 0; indexColumn < 4; ++indexColumn)
896 float expectResult = indexColumn * 0.1f + indexRow * 1.0f;
897 Assert.AreEqual(expectResult, testingTarget.ValueOfIndex(indexRow, indexColumn), "The value of index is not correct!");
900 testingTarget.Dispose();
901 tlog.Debug(tag, $"MatrixValueOfIndexDoubleIndex END (OK)");
906 [Description("Matrix SetValueAtIndex with signle index.")]
907 [Property("SPEC", "Tizen.NUI.Matrix.SetValueAtIndex M")]
908 [Property("SPEC_URL", "-")]
909 [Property("CRITERIA", "MR")]
910 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
911 public void MatrixSetValueAtIndexSingleIndex()
914 tlog.Debug(tag, $"MatrixSetValueAtIndexSingleIndex START");
915 Matrix testingTarget = new Matrix(true);
916 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
917 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
919 for(uint index = 0; index < 16; ++index)
921 float expectResult = (index / 4) * 0.1f + (index % 4) * 1.0f;
922 testingTarget.SetValueAtIndex(index, expectResult);
923 Assert.AreEqual(expectResult, testingTarget[index], "The value of index is not correct!");
925 testingTarget.Dispose();
926 tlog.Debug(tag, $"MatrixSetValueAtIndexSingleIndex END (OK)");
931 [Description("Matrix SetValueAtIndex with double index.")]
932 [Property("SPEC", "Tizen.NUI.Matrix.SetValueAtIndex M")]
933 [Property("SPEC_URL", "-")]
934 [Property("CRITERIA", "MR")]
935 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
936 public void MatrixSetValueAtIndexDoubleIndex()
939 tlog.Debug(tag, $"MatrixSetValueAtIndexDoubleIndex START");
940 Matrix testingTarget = new Matrix(true);
941 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
942 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
944 for(uint indexRow = 0; indexRow < 4; ++indexRow)
946 for(uint indexColumn = 0; indexColumn < 4; ++indexColumn)
948 float expectResult = indexColumn * 0.1f + indexRow * 1.0f;
949 testingTarget.SetValueAtIndex(indexRow, indexColumn, expectResult);
950 Assert.AreEqual(expectResult, testingTarget.ValueOfIndex(indexRow, indexColumn), "The value of index is not correct!");
953 testingTarget.Dispose();
954 tlog.Debug(tag, $"MatrixSetValueAtIndexDoubleIndex END (OK)");
959 [Description("Test Tizen.NUI.Matrix.operator * with Matrix.")]
960 [Property("SPEC", "Tizen.NUI.Matrix.operator *() A")]
961 [Property("SPEC_URL", "-")]
962 [Property("CRITERIA", "MR")]
963 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
964 public void MatrixMultiplyOperator()
967 tlog.Debug(tag, $"MatrixMultiplyOperator START");
968 Matrix testingTarget = new Matrix(true);
969 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
970 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
974 Matrix rhs = new Matrix(false);
975 Matrix ret = testingTarget * rhs;
981 tlog.Debug(tag, e.Message.ToString());
982 Assert.Fail("Caught Exception : Failed!");
984 testingTarget.Dispose();
985 tlog.Debug(tag, $"MatrixMultiplyOperator END (OK)");
990 [Description("Test Tizen.NUI.Matrix.operator * with Rotation.")]
991 [Property("SPEC", "Tizen.NUI.Matrix.operator *() A")]
992 [Property("SPEC_URL", "-")]
993 [Property("CRITERIA", "MR")]
994 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
995 public void MatrixMultiplyOperatorWithRotation()
998 tlog.Debug(tag, $"MatrixMultiplyOperatorWithRotation START");
999 Matrix testingTarget = new Matrix(true);
1000 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
1001 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
1005 Rotation rhs = new Rotation();
1006 Matrix ret = testingTarget * rhs;
1012 tlog.Debug(tag, e.Message.ToString());
1013 Assert.Fail("Caught Exception : Failed!");
1015 testingTarget.Dispose();
1016 tlog.Debug(tag, $"MatrixMultiplyOperatorWithRotation END (OK)");
1021 [Description("Test Tizen.NUI.Matrix.operator * with Vector4.")]
1022 [Property("SPEC", "Tizen.NUI.Matrix.operator *() A")]
1023 [Property("SPEC_URL", "-")]
1024 [Property("CRITERIA", "MR")]
1025 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
1026 public void MatrixMultiplyOperatorWithVector4()
1029 tlog.Debug(tag, $"MatrixMultiplyOperatorWithVector4 START");
1030 Matrix testingTarget = new Matrix(true);
1031 Assert.IsNotNull(testingTarget, "Can't create success object Matrix.");
1032 Assert.IsInstanceOf<Matrix>(testingTarget, "Should return Matrix instance.");
1036 Vector4 rhs = new Vector4();
1037 Vector4 ret = testingTarget * rhs;
1043 tlog.Debug(tag, e.Message.ToString());
1044 Assert.Fail("Caught Exception : Failed!");
1046 testingTarget.Dispose();
1047 tlog.Debug(tag, $"MatrixMultiplyOperatorWithVector4 END (OK)");
1052 [Description("Test this[uint index]. Check whether this[uint index] returns expected value or not.")]
1053 [Property("SPEC", "Tizen.NUI.Matrix.this[uint] A")]
1054 [Property("SPEC_URL", "-")]
1055 [Property("CRITERIA", "MR")]
1056 [Property("AUTHOR", "Eunki Hong, eunkiki.hong@samsung.com")]
1057 public void this_SET_GET_VALUE()
1060 tlog.Debug(tag, $"Matrixthis_SET_GET_VALUE START");
1061 Matrix testingTarget = new Matrix(true);
1064 testingTarget[0] = 100.0f;
1065 testingTarget[1] = 200.0f;
1069 tlog.Debug(tag, e.Message.ToString());
1070 Assert.Fail("Caught Exception : Failed!");
1072 Assert.AreEqual(100.0f, testingTarget[0], "The value of index[0] is not correct!");
1073 Assert.AreEqual(200.0f, testingTarget[1], "The value of index[1] is not correct!");
1074 testingTarget.Dispose();
1075 tlog.Debug(tag, $"Matrixthis_SET_GET_VALUE END (OK)");