Files
lanyi e0b8dedc04 Fix APT CLI roundtrip visual and script preservation
Preserve edittext channels, alpha/color transforms, inactive placement fields,
zero ratio/clipping and null ClipAction presence. Keep unlabelled flag bits,
quoted/escaped script strings, export declarations and correctly typed CONST
and pushdata values. Validate signed integers and write byte-aligned UTF-8.

Add 23 public CLI regressions and record the native 174-resource batch plus
bounded retests: four discovered pages are repaired, while the sound placeholder
and native float formatting remain explicit accuracy limits. Rebuild the 1.0.1
Windows executable and leave unrelated SDK changes untouched.
2026-10-13 02:40:37 +02:00

27 lines
1.1 KiB
JavaScript

'use strict';
// Test-only transport boundary. This file does not emulate any CLI transformation.
const fs = require('node:fs');
const path = require('node:path');
const cp = require('node:child_process');
const marker = 'RA3_CLI_TEST_RAW_XML_ENVELOPE\n';
cp.execFileSync = function fakeConverter(file, args) {
const command = path.basename(file).replace(/\.exe$/i, '').toLowerCase();
if (!['apt2xml', 'xml2apt'].includes(command) || args.length !== 1) {
throw new Error('The test transport permits only apt2xml/xml2apt with one base path');
}
const base = args[0];
if (command === 'apt2xml') {
const envelope = fs.readFileSync(base + '.apt', 'utf8');
if (!envelope.startsWith(marker)) {
throw new Error('The simulated converter refuses real APT binaries');
}
fs.writeFileSync(base + '.xml', envelope.slice(marker.length));
} else {
// Keep the .const that production build() wrote; do not supply a fake one.
fs.writeFileSync(base + '.apt', marker + fs.readFileSync(base + '.xml', 'utf8'));
}
return Buffer.alloc(0);
};