cylinders.spec.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { createRenderObject } from '../render-object';
  7. import { Scene } from '../scene';
  8. import { getGLContext, tryGetGLContext } from './gl';
  9. import { setDebugMode } from '../../mol-util/debug';
  10. import { ColorNames } from '../../mol-util/color/names';
  11. import { ParamDefinition as PD } from '../../mol-util/param-definition';
  12. import { Cylinders } from '../../mol-geo/geometry/cylinders/cylinders';
  13. export function createCylinders() {
  14. const cylinders = Cylinders.createEmpty();
  15. const props = PD.getDefaultValues(Cylinders.Params);
  16. const values = Cylinders.Utils.createValuesSimple(cylinders, props, ColorNames.orange, 1);
  17. const state = Cylinders.Utils.createRenderableState(props);
  18. return createRenderObject('cylinders', values, state, -1);
  19. }
  20. describe('cylinders', () => {
  21. const ctx = tryGetGLContext(32, 32, { fragDepth: true });
  22. (ctx ? it : it.skip)('basic', async () => {
  23. const ctx = getGLContext(32, 32);
  24. const scene = Scene.create(ctx);
  25. const cylinders = createCylinders();
  26. scene.add(cylinders);
  27. setDebugMode(true);
  28. expect(() => scene.commit()).not.toThrow();
  29. setDebugMode(false);
  30. ctx.destroy();
  31. });
  32. });