2018-12-13 13:39:08 +05:30
|
|
|
import { BoxGeometry } from 'three/build/three.module';
|
2017-08-17 22:00:37 +05:30
|
|
|
import MeshObject from '~/blob/3d_viewer/mesh_object';
|
|
|
|
|
|
|
|
describe('Mesh object', () => {
|
|
|
|
it('defaults to non-wireframe material', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
const object = new MeshObject(new BoxGeometry(10, 10, 10));
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
expect(object.material.wireframe).toBe(false);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('changes to wirefame material', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
const object = new MeshObject(new BoxGeometry(10, 10, 10));
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
object.changeMaterial('wireframe');
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
expect(object.material.wireframe).toBe(true);
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('scales object down', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
const object = new MeshObject(new BoxGeometry(10, 10, 10));
|
2018-11-08 19:23:39 +05:30
|
|
|
const { radius } = object.geometry.boundingSphere;
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(radius).not.toBeGreaterThan(4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not scale object down', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
const object = new MeshObject(new BoxGeometry(1, 1, 1));
|
2018-11-08 19:23:39 +05:30
|
|
|
const { radius } = object.geometry.boundingSphere;
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(radius).toBeLessThan(1);
|
|
|
|
});
|
|
|
|
});
|