fix(scripts): final review Critical+Important fixes (Widget alignment, full readLayerXml, Label _string, atlas selection, hard-coded paths, exit code, dead code removal)
This commit is contained in:
+7
-1
@@ -1,6 +1,6 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { resolveSpriteFrameUuid } from '../../scripts/legacy-layer-to-cocos-prefab.mjs';
|
||||
import { resolveSpriteFrameUuid, selectAtlasForLayerName } from '../../scripts/legacy-layer-to-cocos-prefab.mjs';
|
||||
|
||||
// 数据源权威: gameabc_Image.json id=20 -> bmp="00020.png" 位于 atlas-login/,
|
||||
// 该 .meta 的 subMetas.f9941.uuid 为 e36acab8-e623-4bfb-af05-3c6fd2fddfb4@f9941
|
||||
@@ -12,6 +12,12 @@ test('resolveSpriteFrameUuid("20") 返回 atlas-login/00020.png 的 SpriteFrame
|
||||
assert.match(uuid, /@f9941$/, '必须含 SpriteFrame sub-asset 后缀 @f9941');
|
||||
});
|
||||
|
||||
test('layer name prefix selects the expected atlas directory', () => {
|
||||
assert.equal(selectAtlasForLayerName('Login_Layer'), 'atlas-login');
|
||||
assert.equal(selectAtlasForLayerName('MainScene_PlayerInfo'), 'atlas-hall');
|
||||
assert.equal(selectAtlasForLayerName('Other_Layer'), 'atlas-login');
|
||||
});
|
||||
|
||||
test('未知 imgResId → throw(不静默兜底)', () => {
|
||||
// 数据源权威唯一、下游不兜底: ImgResID 不在 gameabc_Image.json 时必须显式报错.
|
||||
assert.throws(
|
||||
|
||||
Reference in New Issue
Block a user