Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Fixed some unit tests #13555

Merged
merged 3 commits into from Mar 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
216 changes: 104 additions & 112 deletions test/unit/src/animation/AnimationAction.tests.js

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions test/unit/src/core/BufferAttribute.tests.js
Expand Up @@ -130,29 +130,6 @@ export default QUnit.module( 'Core', () => {

} );

QUnit.test( "copyIndicesArray", ( assert ) => {

var attr = new BufferAttribute( new Float32Array( 6 ), 3 );

attr.copyIndicesArray( [
{
a: 1,
b: 2,
c: 3
},
{
a: 4,
b: 5,
c: 6
}
] );

var i = attr.array;
assert.ok( i[ 0 ] === 1 && i[ 1 ] === 2 && i[ 2 ] === 3, 'first indices were copied correctly' );
assert.ok( i[ 3 ] === 4 && i[ 4 ] === 5 && i[ 5 ] === 6, 'second indices were copied correctly' );

} );

QUnit.test( "copyVector2sArray", ( assert ) => {

var attr = new BufferAttribute( new Float32Array( 4 ), 2 );
Expand Down
12 changes: 0 additions & 12 deletions test/unit/src/core/BufferGeometry.tests.js
Expand Up @@ -603,15 +603,6 @@ export default QUnit.module( 'Core', () => {

}

if ( geometry.indices.length > 0 ) {

var TypeArray = arrayMax( geometry.indices ) > 65535 ? Uint32Array : Uint16Array;
var indices = new TypeArray( geometry.indices.length * 3 );
attr = new BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices );
assert.ok( bufferAttributeEquals( a.indices, attr ), "Indices are identical" );

}

// groups
assert.deepEqual( a.groups, geometry.groups, "Groups are identical" );

Expand Down Expand Up @@ -657,9 +648,6 @@ export default QUnit.module( 'Core', () => {

}

// TODO
// DirectGeometry doesn't actually copy boundingSphere and boundingBox yet,
// so they're always null
if ( geometry.boundingSphere !== null ) {

assert.ok( a.boundingSphere.equals( geometry.boundingSphere ), "BoundingSphere is identical" );
Expand Down
8 changes: 1 addition & 7 deletions test/unit/src/extras/ShapeUtils.tests.js
Expand Up @@ -16,7 +16,7 @@ export default QUnit.module( 'Extras', () => {

} );

QUnit.todo( "triangulate", ( assert ) => {
QUnit.todo( "isClockWise", ( assert ) => {

assert.ok( false, "everything's gonna be alright" );

Expand All @@ -28,12 +28,6 @@ export default QUnit.module( 'Extras', () => {

} );

QUnit.todo( "isClockWise", ( assert ) => {

assert.ok( false, "everything's gonna be alright" );

} );

} );

} );
90 changes: 45 additions & 45 deletions test/unit/src/extras/curves/CatmullRomCurve3.tests.js
Expand Up @@ -54,7 +54,7 @@ export default QUnit.module( 'Extras', () => {
QUnit.test( "catmullrom check", ( assert ) => {

var curve = new CatmullRomCurve3( positions );
curve.type = 'catmullrom';
curve.curveType = 'catmullrom';

var expectedPoints = [

Expand Down Expand Up @@ -90,7 +90,7 @@ export default QUnit.module( 'Extras', () => {

var curve = new CatmullRomCurve3( positions );

curve.type = 'chordal';
curve.curveType = 'chordal';

var expectedPoints = [
new Vector3( - 60, - 100, 60 ),
Expand Down Expand Up @@ -123,7 +123,7 @@ export default QUnit.module( 'Extras', () => {
QUnit.test( "centripetal basic check", ( assert ) => {

var curve = new CatmullRomCurve3( positions );
curve.type = 'centripetal';
curve.curveType = 'centripetal';

var expectedPoints = [
new Vector3( - 60, - 100, 60 ),
Expand Down Expand Up @@ -156,7 +156,7 @@ export default QUnit.module( 'Extras', () => {
QUnit.test( "closed catmullrom basic check", ( assert ) => {

var curve = new CatmullRomCurve3( positions );
curve.type = 'catmullrom';
curve.curveType = 'catmullrom';
curve.closed = true;

var expectedPoints = [
Expand Down Expand Up @@ -192,8 +192,8 @@ export default QUnit.module( 'Extras', () => {
//
QUnit.test( "getLength/getLengths", ( assert ) => {

var curve = new THREE.CatmullRomCurve3( positions );
curve.type = 'catmullrom';
var curve = new CatmullRomCurve3( positions );
curve.curveType = 'catmullrom';

var length = curve.getLength();
var expectedLength = 551.549686276872;
Expand Down Expand Up @@ -221,14 +221,14 @@ export default QUnit.module( 'Extras', () => {

QUnit.test( "getPointAt", ( assert ) => {

var curve = new THREE.CatmullRomCurve3( positions );
curve.type = 'catmullrom';
var curve = new CatmullRomCurve3( positions );
curve.curveType = 'catmullrom';

var expectedPoints = [
new THREE.Vector3( - 60, - 100, 60 ),
new THREE.Vector3( - 64.84177333183106, 64.86956465359813, 64.84177333183106 ),
new THREE.Vector3( - 28.288507045700854, 104.83101184518996, 28.288507045700854 ),
new THREE.Vector3( 60, - 100, - 60 )
new Vector3( - 60, - 100, 60 ),
new Vector3( - 64.84177333183106, 64.86956465359813, 64.84177333183106 ),
new Vector3( - 28.288507045700854, 104.83101184518996, 28.288507045700854 ),
new Vector3( 60, - 100, - 60 )
];

var points = [
Expand All @@ -244,15 +244,15 @@ export default QUnit.module( 'Extras', () => {

QUnit.test( "getTangent/getTangentAt", ( assert ) => {

var curve = new THREE.CatmullRomCurve3( positions );
curve.type = 'catmullrom';
var curve = new CatmullRomCurve3( positions );
curve.curveType = 'catmullrom';

var expectedTangents = [
new THREE.Vector3( 0, 1, 0 ),
new THREE.Vector3( - 0.0001090274561657922, 0.9999999881130137, 0.0001090274561657922 ),
new THREE.Vector3( 0.7071067811865475, - 2.0930381713877622e-13, - 0.7071067811865475 ),
new THREE.Vector3( 0.43189437062802816, - 0.7917919583070032, - 0.43189437062802816 ),
new THREE.Vector3( - 0.00019991333100812723, - 0.9999999600346592, 0.00019991333100812723 )
new Vector3( 0, 1, 0 ),
new Vector3( - 0.0001090274561657922, 0.9999999881130137, 0.0001090274561657922 ),
new Vector3( 0.7071067811865475, - 2.0930381713877622e-13, - 0.7071067811865475 ),
new Vector3( 0.43189437062802816, - 0.7917919583070032, - 0.43189437062802816 ),
new Vector3( - 0.00019991333100812723, - 0.9999999600346592, 0.00019991333100812723 )
];

var tangents = [
Expand All @@ -275,11 +275,11 @@ export default QUnit.module( 'Extras', () => {
//

var expectedTangents = [
new THREE.Vector3( 0, 1, 0 ),
new THREE.Vector3( - 0.10709018822205997, 0.9884651653817284, 0.10709018822205997 ),
new THREE.Vector3( 0.6396363672964268, - 0.4262987629159402, - 0.6396363672964268 ),
new THREE.Vector3( 0.5077298411616501, - 0.6960034603275557, - 0.5077298411616501 ),
new THREE.Vector3( - 0.00019991333100812723, - 0.9999999600346592, 0.00019991333100812723 )
new Vector3( 0, 1, 0 ),
new Vector3( - 0.10709018822205997, 0.9884651653817284, 0.10709018822205997 ),
new Vector3( 0.6396363672964268, - 0.4262987629159402, - 0.6396363672964268 ),
new Vector3( 0.5077298411616501, - 0.6960034603275557, - 0.5077298411616501 ),
new Vector3( - 0.00019991333100812723, - 0.9999999600346592, 0.00019991333100812723 )
];

var tangents = [
Expand All @@ -303,24 +303,24 @@ export default QUnit.module( 'Extras', () => {

QUnit.test( "computeFrenetFrames", ( assert ) => {

var curve = new THREE.CatmullRomCurve3( positions );
curve.type = 'catmullrom';
var curve = new CatmullRomCurve3( positions );
curve.curveType = 'catmullrom';

var expected = {
binormals: [
new THREE.Vector3( - 1, 0, 0 ),
new THREE.Vector3( - 0.28685061854203, 0.6396363672964267, - 0.7131493814579701 ),
new THREE.Vector3( - 1.9982670528160395e-8, - 0.0001999133310081272, - 0.9999999800173295 )
new Vector3( - 1, 0, 0 ),
new Vector3( - 0.28685061854203, 0.6396363672964267, - 0.7131493814579701 ),
new Vector3( - 1.9982670528160395e-8, - 0.0001999133310081272, - 0.9999999800173295 )
],
normals: [
new THREE.Vector3( 0, 0, - 1 ),
new THREE.Vector3( - 0.7131493814579699, - 0.6396363672964268, - 0.2868506185420297 ),
new THREE.Vector3( - 0.9999999800173294, 0.00019991333100810582, - 1.99826701852146e-8 )
new Vector3( 0, 0, - 1 ),
new Vector3( - 0.7131493814579699, - 0.6396363672964268, - 0.2868506185420297 ),
new Vector3( - 0.9999999800173294, 0.00019991333100810582, - 1.99826701852146e-8 )
],
tangents: [
new THREE.Vector3( 0, 1, 0 ),
new THREE.Vector3( 0.6396363672964269, - 0.4262987629159403, - 0.6396363672964269 ),
new THREE.Vector3( - 0.0001999133310081273, - 0.9999999600346594, 0.0001999133310081273 )
new Vector3( 0, 1, 0 ),
new Vector3( 0.6396363672964269, - 0.4262987629159403, - 0.6396363672964269 ),
new Vector3( - 0.0001999133310081273, - 0.9999999600346594, 0.0001999133310081273 )
]
};

Expand All @@ -342,8 +342,8 @@ export default QUnit.module( 'Extras', () => {

QUnit.test( "getUtoTmapping", ( assert ) => {

var curve = new THREE.CatmullRomCurve3( positions );
curve.type = 'catmullrom';
var curve = new CatmullRomCurve3( positions );
curve.curveType = 'catmullrom';

var start = curve.getUtoTmapping( 0, 0 );
var end = curve.getUtoTmapping( 0, curve.getLength() );
Expand All @@ -359,16 +359,16 @@ export default QUnit.module( 'Extras', () => {

QUnit.test( "getSpacedPoints", ( assert ) => {

var curve = new THREE.CatmullRomCurve3( positions );
curve.type = 'catmullrom';
var curve = new CatmullRomCurve3( positions );
curve.curveType = 'catmullrom';

var expectedPoints = [
new THREE.Vector3( - 60, - 100, 60 ),
new THREE.Vector3( - 60, 10.311489426555056, 60 ),
new THREE.Vector3( - 65.05889864636504, 117.99691802595966, 65.05889864636504 ),
new THREE.Vector3( 6.054276900088592, 78.7153118386369, - 6.054276900088592 ),
new THREE.Vector3( 64.9991491385602, 8.386980812799566, - 64.9991491385602 ),
new THREE.Vector3( 60, - 100, - 60 )
new Vector3( - 60, - 100, 60 ),
new Vector3( - 60, 10.311489426555056, 60 ),
new Vector3( - 65.05889864636504, 117.99691802595966, 65.05889864636504 ),
new Vector3( 6.054276900088592, 78.7153118386369, - 6.054276900088592 ),
new Vector3( 64.9991491385602, 8.386980812799566, - 64.9991491385602 ),
new Vector3( 60, - 100, - 60 )
];

var points = curve.getSpacedPoints();
Expand Down
21 changes: 0 additions & 21 deletions test/unit/src/math/Quaternion.tests.js
Expand Up @@ -406,26 +406,6 @@ export default QUnit.module( 'Maths', () => {

} );

QUnit.test( "inverse", ( assert ) => {

assert.expect( 6 );

var a = new Quaternion( x, y, z, w );
var inverted = new Quaternion( - 0.2721655269759087, - 0.408248290463863, - 0.5443310539518174, 0.6804138174397717 );
a.onChange( function () {

assert.ok( true, "onChange called" );

} );

a.inverse();
assert.ok( Math.abs( a.x - inverted.x ) <= eps, "Check x" );
assert.ok( Math.abs( a.y - inverted.y ) <= eps, "Check y" );
assert.ok( Math.abs( a.z - inverted.z ) <= eps, "Check z" );
assert.ok( Math.abs( a.w - inverted.w ) <= eps, "Check w" );

} );

QUnit.todo( "dot", ( assert ) => {

assert.ok( false, "everything's gonna be alright" );
Expand All @@ -435,7 +415,6 @@ export default QUnit.module( 'Maths', () => {
QUnit.test( "normalize/length/lengthSq", ( assert ) => {

var a = new Quaternion( x, y, z, w );
var b = new Quaternion( - x, - y, - z, - w );

assert.ok( a.length() != 1, "Passed!" );
assert.ok( a.lengthSq() != 1, "Passed!" );
Expand Down