mirror of
https://github.com/galacean/engine.git
synced 2026-06-21 18:02:50 +08:00
fix(animation): stabilize animator coverage path
This commit is contained in:
@@ -322,7 +322,9 @@ export class Animator extends Component {
|
||||
_reset(): void {
|
||||
const layersData = this._animatorLayersData;
|
||||
for (let i = 0, n = layersData.length; i < n; i++) {
|
||||
const stateDataList = layersData[i].stateDataList;
|
||||
const layerData = layersData[i];
|
||||
if (!layerData) continue;
|
||||
const stateDataList = layerData.stateDataList;
|
||||
for (let j = 0, m = stateDataList.length; j < m; j++) {
|
||||
const layerOwners = stateDataList[j].curveLayerOwner;
|
||||
for (let k = 0, l = layerOwners.length; k < l; k++) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
import "@galacean/engine-loader";
|
||||
import type { GLTFResource } from "@galacean/engine-loader";
|
||||
import { Quaternion } from "@galacean/engine-math";
|
||||
import { WebGLEngine } from "@galacean/engine-rhi-webgl";
|
||||
import { WebGLEngine } from "@galacean/engine";
|
||||
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { glbResource } from "./model/fox";
|
||||
const canvasDOM = document.createElement("canvas");
|
||||
@@ -58,8 +58,8 @@ describe("Animator test", function () {
|
||||
});
|
||||
|
||||
afterAll(function () {
|
||||
animator.destroy();
|
||||
engine.destroy();
|
||||
animator?.destroy();
|
||||
engine?.destroy();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
@@ -1446,7 +1446,7 @@ describe("Animator test", function () {
|
||||
animator.engine.time._frameCount++;
|
||||
animator.update(preExitDeltaTime);
|
||||
expect(layerData.srcPlayData.state.name).to.eq("Walk");
|
||||
expect(layerData.destPlayData.state).to.be.undefined;
|
||||
expect(layerData.destPlayData).to.be.null;
|
||||
|
||||
// Update past exitTime, should transition to Run.
|
||||
// @ts-ignore
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Animator, Camera } from "@galacean/engine-core";
|
||||
import "@galacean/engine-loader";
|
||||
import type { GLTFResource } from "@galacean/engine-loader";
|
||||
import { WebGLEngine } from "@galacean/engine-rhi-webgl";
|
||||
import { beforeAll, describe, expect, it } from "vitest";
|
||||
import { WebGLEngine } from "@galacean/engine";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { glbResource } from "./model/fox";
|
||||
|
||||
const canvasDOM = document.createElement("canvas");
|
||||
@@ -11,9 +11,10 @@ canvasDOM.height = 1024;
|
||||
|
||||
describe("Canvas 1024 test", function () {
|
||||
let animator: Animator;
|
||||
let engine: WebGLEngine;
|
||||
|
||||
beforeAll(async function () {
|
||||
const engine = await WebGLEngine.create({ canvas: canvasDOM });
|
||||
engine = await WebGLEngine.create({ canvas: canvasDOM });
|
||||
const scene = engine.sceneManager.activeScene;
|
||||
const rootEntity = scene.createRootEntity();
|
||||
rootEntity.addComponent(Camera);
|
||||
@@ -23,6 +24,10 @@ describe("Canvas 1024 test", function () {
|
||||
animator = defaultSceneRoot.getComponent(Animator);
|
||||
});
|
||||
|
||||
afterAll(function () {
|
||||
engine?.destroy();
|
||||
});
|
||||
|
||||
it("loaded", () => {
|
||||
expect(animator).not.eq(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user