Skip to content

Commit

Permalink
Merge pull request #20834 from Mugen87/dev40
Browse files Browse the repository at this point in the history
Tests: Fix remaining warnings.
  • Loading branch information
Mugen87 committed Dec 5, 2020
2 parents eb96029 + 10f68af commit 2287ea6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
5 changes: 4 additions & 1 deletion test/unit/src/animation/KeyframeTrack.tests.js
Original file line number Diff line number Diff line change
@@ -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', () => {

Expand Down Expand Up @@ -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;

} );

Expand Down
4 changes: 4 additions & 0 deletions test/unit/src/core/BufferGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
y,
z
} from '../math/Constants.tests';
import { CONSOLE_LEVEL } from '../../utils/console-wrapper';

var DegToRad = Math.PI / 180;

Expand Down Expand Up @@ -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" );

} );
Expand Down
14 changes: 2 additions & 12 deletions test/unit/src/helpers/BoxHelper.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
18 changes: 17 additions & 1 deletion test/unit/src/math/Color.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down

0 comments on commit 2287ea6

Please sign in to comment.