From 10f68afec1f320fe2fc8d85113fb7cdd937eb078 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 5 Dec 2020 11:02:18 +0100 Subject: [PATCH] Tests: Fix remaining warnings. --- test/unit/src/animation/KeyframeTrack.tests.js | 5 ++++- test/unit/src/core/BufferGeometry.tests.js | 4 ++++ test/unit/src/helpers/BoxHelper.tests.js | 14 ++------------ test/unit/src/math/Color.tests.js | 18 +++++++++++++++++- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/test/unit/src/animation/KeyframeTrack.tests.js b/test/unit/src/animation/KeyframeTrack.tests.js index c657b6da41..6348050699 100644 --- a/test/unit/src/animation/KeyframeTrack.tests.js +++ b/test/unit/src/animation/KeyframeTrack.tests.js @@ -1,7 +1,7 @@ /* global QUnit */ -import { KeyframeTrack } from '../../../../src/animation/KeyframeTrack'; import { NumberKeyframeTrack } from '../../../../src/animation/tracks/NumberKeyframeTrack'; +import { CONSOLE_LEVEL } from '../../utils/console-wrapper'; export default QUnit.module( 'Animation', () => { @@ -100,7 +100,10 @@ export default QUnit.module( 'Animation', () => { var invalidTrack = new NumberKeyframeTrack( '.material.opacity', [ 0, 1 ], [ 0, NaN ] ); assert.ok( validTrack.validate() ); + + console.level = CONSOLE_LEVEL.OFF; assert.notOk( invalidTrack.validate() ); + console.level = CONSOLE_LEVEL.DEFAULT; } ); diff --git a/test/unit/src/core/BufferGeometry.tests.js b/test/unit/src/core/BufferGeometry.tests.js index 6fa86d381d..addf215c5a 100644 --- a/test/unit/src/core/BufferGeometry.tests.js +++ b/test/unit/src/core/BufferGeometry.tests.js @@ -21,6 +21,7 @@ import { y, z } from '../math/Constants.tests'; +import { CONSOLE_LEVEL } from '../../utils/console-wrapper'; var DegToRad = Math.PI / 180; @@ -769,7 +770,10 @@ export default QUnit.module( 'Core', () => { } + console.level = CONSOLE_LEVEL.ERROR; geometry1.merge( geometry2 ); + console.level = CONSOLE_LEVEL.DEFAULT; + assert.ok( attr[ 0 ] === 4 && attr[ 1 ] === 5 && attr[ 2 ] === 6, "copied the 3 attributes without offset" ); } ); diff --git a/test/unit/src/helpers/BoxHelper.tests.js b/test/unit/src/helpers/BoxHelper.tests.js index 171e0e4bdd..8b5692e205 100644 --- a/test/unit/src/helpers/BoxHelper.tests.js +++ b/test/unit/src/helpers/BoxHelper.tests.js @@ -13,23 +13,13 @@ export default QUnit.module( 'Helpers', () => { var geometries = undefined; hooks.beforeEach( function () { - const parameters = { - radius: 10, - widthSegments: 20, - heightSegments: 30, - phiStart: 0.5, - phiLength: 1.0, - thetaStart: 0.4, - thetaLength: 2.0, - }; - // Test with a normal cube and a box helper - var boxGeometry = new BoxGeometry( parameters.diameter ); + var boxGeometry = new BoxGeometry(); var box = new Mesh( boxGeometry ); var boxHelper = new BoxHelper( box ); // The same should happen with a comparable sphere - var sphereGeometry = new SphereGeometry( parameters.diameter / 2 ); + var sphereGeometry = new SphereGeometry(); var sphere = new Mesh( sphereGeometry ); var sphereBoxHelper = new BoxHelper( sphere ); diff --git a/test/unit/src/math/Color.tests.js b/test/unit/src/math/Color.tests.js index 0f9f78559b..73608f49da 100644 --- a/test/unit/src/math/Color.tests.js +++ b/test/unit/src/math/Color.tests.js @@ -125,7 +125,7 @@ export default QUnit.module( 'Maths', () => { assert.ok( hsl.l == 0.75, "lightness: " + hsl.l ); hsl = { h: 0, s: 0, l: 0 }; - a.setStyle( "hsl(270,50%,75%,0.5)" ); + a.setStyle( "hsl(270,50%,75%)" ); a.getHSL( hsl ); assert.ok( hsl.h == 0.75, "hue: " + hsl.h ); assert.ok( hsl.s == 0.5, "saturation: " + hsl.s ); @@ -528,7 +528,11 @@ export default QUnit.module( 'Maths', () => { QUnit.test( "setStyleRGBAPercent", ( assert ) => { var c = new Color(); + + console.level = CONSOLE_LEVEL.ERROR; c.setStyle( 'rgba(100%,50%,10%, 0.5)' ); + console.level = CONSOLE_LEVEL.DEFAULT; + assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.g == 0.5, "Green: " + c.g ); assert.ok( c.b == 0.1, "Blue: " + c.b ); @@ -548,7 +552,11 @@ export default QUnit.module( 'Maths', () => { QUnit.test( "setStyleRGBAPercentWithSpaces", ( assert ) => { var c = new Color(); + + console.level = CONSOLE_LEVEL.ERROR; c.setStyle( 'rgba( 100% ,50% , 10%, 0.5 )' ); + console.level = CONSOLE_LEVEL.DEFAULT; + assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.g == 0.5, "Green: " + c.g ); assert.ok( c.b == 0.1, "Blue: " + c.b ); @@ -568,7 +576,11 @@ export default QUnit.module( 'Maths', () => { QUnit.test( "setStyleHSLARed", ( assert ) => { var c = new Color(); + + console.level = CONSOLE_LEVEL.ERROR; c.setStyle( 'hsla(360,100%,50%,0.5)' ); + console.level = CONSOLE_LEVEL.DEFAULT; + assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.g === 0, "Green: " + c.g ); assert.ok( c.b === 0, "Blue: " + c.b ); @@ -588,7 +600,11 @@ export default QUnit.module( 'Maths', () => { QUnit.test( "setStyleHSLARedWithSpaces", ( assert ) => { var c = new Color(); + + console.level = CONSOLE_LEVEL.ERROR; c.setStyle( 'hsla( 360, 100% , 50%, 0.5 )' ); + console.level = CONSOLE_LEVEL.DEFAULT; + assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.g === 0, "Green: " + c.g ); assert.ok( c.b === 0, "Blue: " + c.b ); -- GitLab