Browse Source

started adding Color unit tests

Brian Cajes 12 years ago
parent
commit
9f23d866af
3 changed files with 33 additions and 1 deletions
  1. 25 0
      test/unit/math/Color.js
  2. 6 0
      test/unit/math/Color.js~
  3. 2 1
      test/unit/unittests_sources.html

+ 25 - 0
test/unit/math/Color.js

@@ -0,0 +1,25 @@
+module( "Color" );
+
+test( "constructor", function(){
+    var c = new THREE.Color();
+    ok( c.r, "Red: " + c.r );
+    ok( c.g, "Green: " + c.g );
+    ok( c.b, "Blue: " + c.g );
+});
+
+test( "copy", function(){
+    var c = new THREE.Color();
+    var c2 = new THREE.Color('red');
+    c.copy(c2);
+    ok( c.r == 1, "Red c: " + c.r + " Red c2: " + c2.r);
+    ok( c.g == 0, "Green c: " + c.g + " Green c2: " + c2.g);
+    ok( c.b == 0, "Blue c: " + c.g + " Blue c2: " + c2.b);
+});
+
+test( "setRGB", function(){
+    var c = new THREE.Color()
+    c.setRGB(0, 1, 2);
+    ok( c.r == 0, "Red: " + c.r );
+    ok( c.g == 1, "Green: " + c.g );
+    ok( c.b == 1, "Blue: " + c.b );
+});

+ 6 - 0
test/unit/math/Color.js~

@@ -0,0 +1,6 @@
+module( "Color" );
+
+test( "constructor", function(){
+    var c = new Color()
+    ok(c, "Passed!")
+});

+ 2 - 1
test/unit/unittests_sources.html

@@ -42,6 +42,7 @@
   <script src="math/Quaternion.js"></script>
   <script src="math/Matrix3.js"></script>
   <script src="math/Matrix4.js"></script>
+  <script src="math/Color.js"></script>
   
 </body>
-</html>
+</html>