2018-10-17 03:13:26 -04:00
|
|
|
import { BoxGeometry } from 'three/build/three.module';
|
2017-04-06 06:02:24 -04:00
|
|
|
import MeshObject from '~/blob/3d_viewer/mesh_object';
|
|
|
|
|
|
|
|
describe('Mesh object', () => {
|
|
|
|
it('defaults to non-wireframe material', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
const object = new MeshObject(new BoxGeometry(10, 10, 10));
|
2017-04-06 06:02:24 -04:00
|
|
|
|
2022-08-09 11:11:31 -04:00
|
|
|
expect(object.material.wireframe).toBe(false);
|
2017-04-06 06:02:24 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('changes to wirefame material', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
const object = new MeshObject(new BoxGeometry(10, 10, 10));
|
2017-04-06 06:02:24 -04:00
|
|
|
|
|
|
|
object.changeMaterial('wireframe');
|
|
|
|
|
2022-08-09 11:11:31 -04:00
|
|
|
expect(object.material.wireframe).toBe(true);
|
2017-04-06 06:02:24 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('scales object down', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
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', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|