提交 10f68afe 编写于 作者: M Mugen87

Tests: Fix remaining warnings.

上级 eb960291
/* global QUnit */ /* global QUnit */
import { KeyframeTrack } from '../../../../src/animation/KeyframeTrack';
import { NumberKeyframeTrack } from '../../../../src/animation/tracks/NumberKeyframeTrack'; import { NumberKeyframeTrack } from '../../../../src/animation/tracks/NumberKeyframeTrack';
import { CONSOLE_LEVEL } from '../../utils/console-wrapper';
export default QUnit.module( 'Animation', () => { export default QUnit.module( 'Animation', () => {
...@@ -100,7 +100,10 @@ export default QUnit.module( 'Animation', () => { ...@@ -100,7 +100,10 @@ export default QUnit.module( 'Animation', () => {
var invalidTrack = new NumberKeyframeTrack( '.material.opacity', [ 0, 1 ], [ 0, NaN ] ); var invalidTrack = new NumberKeyframeTrack( '.material.opacity', [ 0, 1 ], [ 0, NaN ] );
assert.ok( validTrack.validate() ); assert.ok( validTrack.validate() );
console.level = CONSOLE_LEVEL.OFF;
assert.notOk( invalidTrack.validate() ); assert.notOk( invalidTrack.validate() );
console.level = CONSOLE_LEVEL.DEFAULT;
} ); } );
......
...@@ -21,6 +21,7 @@ import { ...@@ -21,6 +21,7 @@ import {
y, y,
z z
} from '../math/Constants.tests'; } from '../math/Constants.tests';
import { CONSOLE_LEVEL } from '../../utils/console-wrapper';
var DegToRad = Math.PI / 180; var DegToRad = Math.PI / 180;
...@@ -769,7 +770,10 @@ export default QUnit.module( 'Core', () => { ...@@ -769,7 +770,10 @@ export default QUnit.module( 'Core', () => {
} }
console.level = CONSOLE_LEVEL.ERROR;
geometry1.merge( geometry2 ); 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" ); assert.ok( attr[ 0 ] === 4 && attr[ 1 ] === 5 && attr[ 2 ] === 6, "copied the 3 attributes without offset" );
} ); } );
......
...@@ -13,23 +13,13 @@ export default QUnit.module( 'Helpers', () => { ...@@ -13,23 +13,13 @@ export default QUnit.module( 'Helpers', () => {
var geometries = undefined; var geometries = undefined;
hooks.beforeEach( function () { 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 // 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 box = new Mesh( boxGeometry );
var boxHelper = new BoxHelper( box ); var boxHelper = new BoxHelper( box );
// The same should happen with a comparable sphere // 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 sphere = new Mesh( sphereGeometry );
var sphereBoxHelper = new BoxHelper( sphere ); var sphereBoxHelper = new BoxHelper( sphere );
......
...@@ -125,7 +125,7 @@ export default QUnit.module( 'Maths', () => { ...@@ -125,7 +125,7 @@ export default QUnit.module( 'Maths', () => {
assert.ok( hsl.l == 0.75, "lightness: " + hsl.l ); assert.ok( hsl.l == 0.75, "lightness: " + hsl.l );
hsl = { h: 0, s: 0, l: 0 }; hsl = { h: 0, s: 0, l: 0 };
a.setStyle( "hsl(270,50%,75%,0.5)" ); a.setStyle( "hsl(270,50%,75%)" );
a.getHSL( hsl ); a.getHSL( hsl );
assert.ok( hsl.h == 0.75, "hue: " + hsl.h ); assert.ok( hsl.h == 0.75, "hue: " + hsl.h );
assert.ok( hsl.s == 0.5, "saturation: " + hsl.s ); assert.ok( hsl.s == 0.5, "saturation: " + hsl.s );
...@@ -528,7 +528,11 @@ export default QUnit.module( 'Maths', () => { ...@@ -528,7 +528,11 @@ export default QUnit.module( 'Maths', () => {
QUnit.test( "setStyleRGBAPercent", ( assert ) => { QUnit.test( "setStyleRGBAPercent", ( assert ) => {
var c = new Color(); var c = new Color();
console.level = CONSOLE_LEVEL.ERROR;
c.setStyle( 'rgba(100%,50%,10%, 0.5)' ); c.setStyle( 'rgba(100%,50%,10%, 0.5)' );
console.level = CONSOLE_LEVEL.DEFAULT;
assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.r == 1, "Red: " + c.r );
assert.ok( c.g == 0.5, "Green: " + c.g ); assert.ok( c.g == 0.5, "Green: " + c.g );
assert.ok( c.b == 0.1, "Blue: " + c.b ); assert.ok( c.b == 0.1, "Blue: " + c.b );
...@@ -548,7 +552,11 @@ export default QUnit.module( 'Maths', () => { ...@@ -548,7 +552,11 @@ export default QUnit.module( 'Maths', () => {
QUnit.test( "setStyleRGBAPercentWithSpaces", ( assert ) => { QUnit.test( "setStyleRGBAPercentWithSpaces", ( assert ) => {
var c = new Color(); var c = new Color();
console.level = CONSOLE_LEVEL.ERROR;
c.setStyle( 'rgba( 100% ,50% , 10%, 0.5 )' ); c.setStyle( 'rgba( 100% ,50% , 10%, 0.5 )' );
console.level = CONSOLE_LEVEL.DEFAULT;
assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.r == 1, "Red: " + c.r );
assert.ok( c.g == 0.5, "Green: " + c.g ); assert.ok( c.g == 0.5, "Green: " + c.g );
assert.ok( c.b == 0.1, "Blue: " + c.b ); assert.ok( c.b == 0.1, "Blue: " + c.b );
...@@ -568,7 +576,11 @@ export default QUnit.module( 'Maths', () => { ...@@ -568,7 +576,11 @@ export default QUnit.module( 'Maths', () => {
QUnit.test( "setStyleHSLARed", ( assert ) => { QUnit.test( "setStyleHSLARed", ( assert ) => {
var c = new Color(); var c = new Color();
console.level = CONSOLE_LEVEL.ERROR;
c.setStyle( 'hsla(360,100%,50%,0.5)' ); c.setStyle( 'hsla(360,100%,50%,0.5)' );
console.level = CONSOLE_LEVEL.DEFAULT;
assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.r == 1, "Red: " + c.r );
assert.ok( c.g === 0, "Green: " + c.g ); assert.ok( c.g === 0, "Green: " + c.g );
assert.ok( c.b === 0, "Blue: " + c.b ); assert.ok( c.b === 0, "Blue: " + c.b );
...@@ -588,7 +600,11 @@ export default QUnit.module( 'Maths', () => { ...@@ -588,7 +600,11 @@ export default QUnit.module( 'Maths', () => {
QUnit.test( "setStyleHSLARedWithSpaces", ( assert ) => { QUnit.test( "setStyleHSLARedWithSpaces", ( assert ) => {
var c = new Color(); var c = new Color();
console.level = CONSOLE_LEVEL.ERROR;
c.setStyle( 'hsla( 360, 100% , 50%, 0.5 )' ); c.setStyle( 'hsla( 360, 100% , 50%, 0.5 )' );
console.level = CONSOLE_LEVEL.DEFAULT;
assert.ok( c.r == 1, "Red: " + c.r ); assert.ok( c.r == 1, "Red: " + c.r );
assert.ok( c.g === 0, "Green: " + c.g ); assert.ok( c.g === 0, "Green: " + c.g );
assert.ok( c.b === 0, "Blue: " + c.b ); assert.ok( c.b === 0, "Blue: " + c.b );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册