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:
@@ -27,6 +27,30 @@ test('emitPrefabJson 含 PrefabInfo 块', () => {
|
||||
assert.equal(prefabInfo.asset.__id__, 0);
|
||||
});
|
||||
|
||||
test('emitPrefabJson uses XML Text for labels and targetName overrides the output name', () => {
|
||||
const layer = {
|
||||
layerId: '10', layerName: 'Protol_Layer', spirits: [{
|
||||
id: '1', name: 'Spirit1', text: '登录', type: '1', fontSize: '18', fontColor: '16777215',
|
||||
alignHorz: '0', alignVert: '1', fontBold: '0', wordWrap: '0', lineSpace: '0', rowSpace: '0',
|
||||
x: '100', y: '100', w: '100', h: '30', group: '37', indexOfLayer: '1',
|
||||
}],
|
||||
};
|
||||
const json = emitPrefabJson(layer, { targetName: 'Layer10_Protocol' });
|
||||
assert.equal(json[0]._name, 'Layer10_Protocol');
|
||||
const textNode = json.find(o => o.__type__ === 'cc.Node' && o._name === 'Spirit1');
|
||||
assert.ok(textNode);
|
||||
const label = json.filter(o => o.__type__ === 'cc.Label')[0];
|
||||
assert.equal(label._string, '登录');
|
||||
assert.equal(label._fontSize, 18);
|
||||
assert.equal(label._color.r, 255);
|
||||
assert.equal(label._color.g, 255);
|
||||
assert.equal(label._color.b, 255);
|
||||
assert.equal(label._horizontalAlign, 0);
|
||||
assert.equal(label._verticalAlign, 1);
|
||||
assert.equal(label._isBold, false);
|
||||
assert.equal(label._enableWrapText, false);
|
||||
});
|
||||
|
||||
test('emitPrefabJson 渠道logo _lpos 误差 < 0.001', () => {
|
||||
// 注: brief 原版用 spirit name='Spirit405' 但断言搜 /渠道/; 实际 fixture 里 id=405 的 spirit
|
||||
// 坐标 (734, 143, 59, 148) 严格对应 Login_Layer '渠道logo' 节点; 这里 name 用 '渠道logo'
|
||||
|
||||
Reference in New Issue
Block a user