[cogl/wip/cogl-sharp: 31/51] cogl-sharp: Fix Matrix.InitTranslation() argument passing



commit b0bd7e53afded501f5b5c0ace6b24789f4c9b255
Author: Damien Lespiau <damien lespiau intel com>
Date:   Sun Oct 14 23:04:51 2012 +0100

    cogl-sharp: Fix Matrix.InitTranslation() argument passing
    
    And while at it, add a test case.

 cogl-sharp/Matrix.cs           |    2 +-
 cogl-sharp/tests/TestMatrix.cs |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/cogl-sharp/Matrix.cs b/cogl-sharp/Matrix.cs
index 47ee23b..50d76e7 100644
--- a/cogl-sharp/Matrix.cs
+++ b/cogl-sharp/Matrix.cs
@@ -84,7 +84,7 @@ namespace Cogl
 
         public void InitTranslation(float tx, float ty, float tz)
         {
-            cogl_matrix_init_translation(ref this, tz, ty, tz);
+            cogl_matrix_init_translation(ref this, tx, ty, tz);
         }
 
         [DllImport("cogl2.dll")]
diff --git a/cogl-sharp/tests/TestMatrix.cs b/cogl-sharp/tests/TestMatrix.cs
index 0e45a6d..eed3ca2 100644
--- a/cogl-sharp/tests/TestMatrix.cs
+++ b/cogl-sharp/tests/TestMatrix.cs
@@ -40,5 +40,33 @@ namespace Cogl.Test
             Expect(i.zw, EqualTo(0.0f));
             Expect(i.ww, EqualTo(1.0f));
         }
+
+        [Test]
+        public void InitTranslation()
+        {
+            Matrix i;
+
+            i.InitTranslation(1.0f, 2.0f, 3.0f);
+
+            Expect(i.xx, EqualTo(1.0f));
+            Expect(i.yx, EqualTo(0.0f));
+            Expect(i.zx, EqualTo(0.0f));
+            Expect(i.wx, EqualTo(0.0f));
+
+            Expect(i.xy, EqualTo(0.0f));
+            Expect(i.yy, EqualTo(1.0f));
+            Expect(i.zy, EqualTo(0.0f));
+            Expect(i.wy, EqualTo(0.0f));
+
+            Expect(i.xz, EqualTo(0.0f));
+            Expect(i.yz, EqualTo(0.0f));
+            Expect(i.zz, EqualTo(1.0f));
+            Expect(i.wz, EqualTo(0.0f));
+
+            Expect(i.xw, EqualTo(1.0f));
+            Expect(i.yw, EqualTo(2.0f));
+            Expect(i.zw, EqualTo(3.0f));
+            Expect(i.ww, EqualTo(1.0f));
+        }
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]