2017-04-06 06:02:24 -04:00
|
|
|
import {
|
|
|
|
BoxGeometry,
|
|
|
|
} from 'three/build/three.module';
|
|
|
|
import MeshObject from '~/blob/3d_viewer/mesh_object';
|
|
|
|
|
|
|
|
describe('Mesh object', () => {
|
|
|
|
it('defaults to non-wireframe material', () => {
|
|
|
|
const object = new MeshObject(
|
|
|
|
new BoxGeometry(10, 10, 10),
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(object.material.wireframe).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('changes to wirefame material', () => {
|
|
|
|
const object = new MeshObject(
|
|
|
|
new BoxGeometry(10, 10, 10),
|
|
|
|
);
|
|
|
|
|
|
|
|
object.changeMaterial('wireframe');
|
|
|
|
|
|
|
|
expect(object.material.wireframe).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('scales object down', () => {
|
|
|
|
const object = new MeshObject(
|
|
|
|
new BoxGeometry(10, 10, 10),
|
|
|
|
);
|
2018-06-16 17:50:13 -04:00
|
|
|
const { radius } = object.geometry.boundingSphere;
|
2017-04-06 06:02:24 -04:00
|
|
|
|
|
|
|
expect(radius).not.toBeGreaterThan(4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not scale object down', () => {
|
|
|
|
const object = new MeshObject(
|
|
|
|
new BoxGeometry(1, 1, 1),
|
|
|
|
);
|
2018-06-16 17:50:13 -04:00
|
|
|
const { radius } = object.geometry.boundingSphere;
|
2017-04-06 06:02:24 -04:00
|
|
|
|
|
|
|
expect(radius).toBeLessThan(1);
|
|
|
|
});
|
|
|
|
});
|