Browse Source

add tests for camera

simonThiele 10 years ago
parent
commit
761f98dd5b
1 changed files with 13 additions and 3 deletions
  1. 13 3
      test/unit/cameras/Camera.js

+ 13 - 3
test/unit/cameras/Camera.js

@@ -5,8 +5,18 @@
 module( "Camera" );
 module( "Camera" );
 
 
 test( "lookAt", function() {
 test( "lookAt", function() {
-	var obj = new THREE.Camera();
-	obj.lookAt(new THREE.Vector3(0, 1, -1));
+	var cam = new THREE.Camera();
+	cam.lookAt(new THREE.Vector3(0, 1, -1));
 
 
-	ok( obj.rotation.x * (180 / Math.PI) === 45 , "x is equal" );
+	ok( cam.rotation.x * (180 / Math.PI) === 45 , "x is equal" );
+});
+
+test( "clone", function() {
+	var cam = new THREE.Camera();
+	cam.lookAt(new THREE.Vector3(1, 2, 3));
+
+	var clonedCam = cam.clone();
+
+	ok( cam.matrixWorldInverse.equals(clonedCam.matrixWorldInverse) , "matrixWorldInverse is equal" );
+	ok( cam.projectionMatrix.equals(clonedCam.projectionMatrix) , "projectionMatrix is equal" );
 });
 });