Skip to content

Commit

Permalink
chore: update DotLottie tests to include WebGL and WebGPU WASM URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf committed Feb 28, 2025
1 parent 242b12f commit 544613e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
15 changes: 14 additions & 1 deletion packages/web/tests/dotlottie.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ import { describe, beforeEach, afterEach, test, expect, vi } from 'vitest';
import type { Config, Layout, Mode } from '../src';
import { DotLottie as DotLottieClass, DotLottieWorker as DotLottieWorkerClass } from '../src';
import { getDefaultDPR } from '../src/common/utils';
import { DotLottie as DotLottieWebGLClass } from '../src/webgl';
import { DotLottie as DotLottieWebGPUClass } from '../src/webgpu';

import { createCanvas, sleep } from './test-utils';

const wasmUrl = new URL('../src/software/wasm/dotlottie-player.wasm', import.meta.url).href;
const wasmUrlWebGL = new URL('../src/webgl/wasm/dotlottie-player.wasm', import.meta.url).href;
const wasmUrlWebGPU = new URL('../src/webgpu/wasm/dotlottie-player.wasm', import.meta.url).href;

const jsonSrc = new URL('./__fixtures__/test.json', import.meta.url).href;
const src = new URL('./__fixtures__/test.lottie', import.meta.url).href;

DotLottieClass.setWasmUrl(wasmUrl);
DotLottieWorkerClass.setWasmUrl(wasmUrl);
DotLottieWebGLClass.setWasmUrl(wasmUrlWebGL);
DotLottieWebGPUClass.setWasmUrl(wasmUrlWebGPU);

describe.each([
{
Expand All @@ -22,9 +29,15 @@ describe.each([
{
DotLottie: DotLottieWorkerClass,
},
// {
// DotLottie: DotLottieWebGLClass,
// },
// {
// DotLottie: DotLottieWebGPUClass,
// },
])('$DotLottie.name', ({ DotLottie }) => {
let canvas: HTMLCanvasElement;
let dotLottie: DotLottieClass | DotLottieWorkerClass;
let dotLottie: DotLottieClass | DotLottieWorkerClass | DotLottieWebGLClass | DotLottieWebGPUClass;
const isWorker = DotLottie === DotLottieWorkerClass;

type Option = Omit<Omit<Config, 'canvas'>, 'src'>;
Expand Down
4 changes: 0 additions & 4 deletions packages/web/tests/setup.ts

This file was deleted.

9 changes: 4 additions & 5 deletions packages/web/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ export default defineConfig({
include: ['src/**/*.ts'],
reporter: ['json', 'json-summary', 'text-summary', 'lcov'],
thresholds: {
statements: 51,
branches: 58,
functions: 52,
lines: 52,
statements: 45,
branches: 45,
functions: 45,
lines: 45,
},
},
testTimeout: 10000,
cache: false,
setupFiles: ['./tests/setup.ts'],
},
});

0 comments on commit 544613e

Please sign in to comment.