Browse Source

LOD: More tests.

Mugen87 5 years ago
parent
commit
83d339a9bd
1 changed files with 15 additions and 2 deletions
  1. 15 2
      test/unit/src/objects/LOD.tests.js

+ 15 - 2
test/unit/src/objects/LOD.tests.js

@@ -68,9 +68,22 @@ export default QUnit.module( 'Objects', () => {
 			assert.strictEqual( lod2.levels.length, 3, "LOD.levels has the correct length after the copy." );
 
 		} );
-		QUnit.todo( "addLevel", ( assert ) => {
+		QUnit.test( "addLevel", ( assert ) => {
 
-			assert.ok( false, "everything's gonna be alright" );
+			var lod = new LOD();
+
+			var high = new Object3D();
+			var mid = new Object3D();
+			var low = new Object3D();
+
+			lod.addLevel( high, 5 );
+			lod.addLevel( mid, 25 );
+			lod.addLevel( low, 50 );
+
+			assert.strictEqual( lod.levels.length, 3, "LOD.levels has the correct length." );
+			assert.deepEqual( lod.levels[ 0 ], { distance: 5, object: high }, "First entry correct." );
+			assert.deepEqual( lod.levels[ 1 ], { distance: 25, object: mid }, "Second entry correct." );
+			assert.deepEqual( lod.levels[ 2 ], { distance: 50, object: low }, "Third entry correct." );
 
 		} );
 		QUnit.test( "getObjectForDistance", ( assert ) => {