gitlab-org--gitlab-foss/spec/frontend/blob/3d_viewer/mesh_object_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
939 B
JavaScript
Raw Normal View History

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
expect(object.material.wireframe).toBeFalsy();
});
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');
expect(object.material.wireframe).toBeTruthy();
});
it('scales object down', () => {
2018-10-17 03:13:26 -04:00
const object = new MeshObject(new BoxGeometry(10, 10, 10));
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));
const { radius } = object.geometry.boundingSphere;
2017-04-06 06:02:24 -04:00
expect(radius).toBeLessThan(1);
});
});