diff --git a/public/live2d/wordpress-moc/live2d.min.js b/public/live2d/wordpress-moc/live2d.min.js index 364ae2c..199c5e2 100644 --- a/public/live2d/wordpress-moc/live2d.min.js +++ b/public/live2d/wordpress-moc/live2d.min.js @@ -8226,7 +8226,7 @@ function LAppModel() { this.gl = null; this.texPath = ""; this.modelPath = ""; - this.countOfTexure = -1 + this.countOfTexure = 0 } LAppModel.prototype = new L2DBaseModel(); var motionModel; @@ -8905,4 +8905,4 @@ function musicPlay(isPlay) { var audio = document.getElementById(LAppDefine.AUDIO_ID); audio.play(); } -autoPlayMusic(); \ No newline at end of file +autoPlayMusic(); diff --git a/src/__tests__/BlogLive2D.spec.ts b/src/__tests__/BlogLive2D.spec.ts index 6a77014..ab2522a 100644 --- a/src/__tests__/BlogLive2D.spec.ts +++ b/src/__tests__/BlogLive2D.spec.ts @@ -1,4 +1,7 @@ import { flushPromises, mount } from '@vue/test-utils'; +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; + import { afterEach, describe, expect, it, vi } from 'vitest'; import BlogLive2D from '@/components/blog/BlogLive2D'; @@ -277,6 +280,16 @@ describe('BlogLive2D', () => { expect(document.querySelector('.waifu-tips')?.textContent).toContain('只有一套'); }); + it('starts manual costume switching from the first variant and loops back to the default texture', () => { + const runtimeSource = readFileSync(resolve(process.cwd(), 'public/live2d/wordpress-moc/live2d.min.js'), 'utf-8'); + + expect(runtimeSource).toContain('this.countOfTexure = 0'); + expect(runtimeSource).not.toContain('this.countOfTexure = -1'); + expect(runtimeSource).toMatch( + /if \(no >= thisRef\.modelSetting\.getTextureNum\(\)\) \{\s*motionModel\.countOfTexure = 0;\s*no = 0\s*\}/, + ); + }); + it('reuses the page-level WordPress runtime after route component remounts', async () => { vi.stubGlobal('innerWidth', 1280); const initLive2D = vi.fn();