Browse Source

use texture loader to load textures in test

simonThiele 9 years ago
parent
commit
0bfe511c91
1 changed files with 10 additions and 8 deletions
  1. 10 8
      test/unit/extras/ImageUtils.test.js

+ 10 - 8
test/unit/extras/ImageUtils.test.js

@@ -17,20 +17,19 @@ QUnit.test( "test load handler", function( assert ) {
 
 	var done = assert.async();
 
-	THREE.ImageUtils.loadTexture( good_url, undefined, function ( tex ) {
+  new THREE.TextureLoader().load(good_url, function ( tex ) {
 
 		assert.success( "load handler should be called" );
 		assert.ok( tex, "texture is defined" );
 		assert.ok( tex.image, "texture.image is defined" );
 		done();
 
-	}, function () {
+	}, undefined, function () {
 
 		assert.fail( "error handler should not be called" );
 		done();
 
 	});
-
 });
 
 
@@ -38,12 +37,16 @@ QUnit.test( "test error handler", function( assert ) {
 
 	var done = assert.async();
 
-	THREE.ImageUtils.loadTexture( bad_url, undefined, function () {
+	new THREE.TextureLoader().load(bad_url, function () {
 
 		assert.fail( "load handler should not be called" );
 		done();
 
-	}, function ( event ) {
+	},
+
+	undefined,
+
+	function ( event ) {
 
 		assert.success( "error handler should be called" );
 		assert.ok( event.type === 'error', "should have error event" );
@@ -59,12 +62,12 @@ QUnit.test( "test cached texture", function( assert ) {
 
 	var done = assert.async();
 
-	var rtex1 = THREE.ImageUtils.loadTexture( good_url, undefined, function ( tex1 ) {
+	var rtex1 = new THREE.TextureLoader().load(good_url, function ( tex1 ) {
 
 		assert.ok( rtex1.image !== undefined, "texture 1 image is loaded" );
 		assert.equal( rtex1, tex1, "texture 1 callback is equal to return" );
 
-		var rtex2 = THREE.ImageUtils.loadTexture( good_url, undefined, function ( tex2 ) {
+		var rtex2 = new THREE.TextureLoader().load(good_url, function ( tex2 ) {
 
 			assert.ok( rtex2 !== undefined, "cached callback is async" );
 			assert.ok( rtex2.image !== undefined, "texture 2 image is loaded" );
@@ -82,4 +85,3 @@ QUnit.test( "test cached texture", function( assert ) {
 	assert.ok( rtex1.image === undefined, "texture 1 image is not loaded" );
 
 });
-