spheres.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 { Spheres } from '../../mol-geo/geometry/spheres/spheres';
  13. export function createSpheres() {
  14. const spheres = Spheres.createEmpty();
  15. const props = PD.getDefaultValues(Spheres.Params);
  16. const values = Spheres.Utils.createValuesSimple(spheres, props, ColorNames.orange, 1);
  17. const state = Spheres.Utils.createRenderableState(props);
  18. return createRenderObject('spheres', values, state, -1);
  19. }
  20. describe('spheres', () => {
  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 spheres = createSpheres();
  26. scene.add(spheres);
  27. setDebugMode(true);
  28. expect(() => scene.commit()).not.toThrow();
  29. setDebugMode(false);
  30. ctx.destroy();
  31. });
  32. });