From 9f955040735a2a83f724921ac7c082863b4a1872 Mon Sep 17 00:00:00 2001 From: sunlei Date: Mon, 6 Jul 2026 18:00:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DPio=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=8D=A2=E8=A3=85=E9=A6=96=E6=AC=A1=E5=8A=A0=E8=BD=BD=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/live2d/wordpress-moc/live2d.min.js | 4 ++-- src/__tests__/BlogLive2D.spec.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) 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();