feat: add isolated Liam square540 head-chest build preset

This commit is contained in:
zenord
2026-10-15 11:43:38 +08:00
parent f705c27eee
commit 2405026402
16 changed files with 379 additions and 35 deletions
@@ -220,3 +220,57 @@ class WaitingPackTests(unittest.TestCase):
self.assertEqual(provenance['sourceInventoryMismatches'],['HANDOFF.md'])
self.assertEqual(len(provenance['sourceInventoryOmissions']),7)
self.assertFalse(provenance['runtimeReadyOverridden'])
class Square540Tests(unittest.TestCase):
def test_same_exact_media_separate_identity_and_output(self):
media=select.catalog()['mediaBundles']['char-waiting-poses-r01']
def get(profile):
return select.selection(ASSETS,profile,emotion_sha=media['indexSha256'],user_assets=True,mouth=True,startup=True,media_bundle='char-waiting-poses-r01')
old,new=get('liam-test'),get('liam-test-square540')
self.assertEqual(old['files'],new['files']);self.assertEqual(new['file_count'],3192)
self.assertEqual(new['persona'],'liam');self.assertEqual(new['application_id'],'com.gorios.lanvoice.liamtest.square540')
self.assertEqual(new['framing_preset'],'square540-headchest');self.assertEqual(old['framing_preset'],'legacy')
self.assertEqual(select.build_directory('liam-test'),ROOT/'app/build/characters/liam-test')
self.assertEqual(select.build_directory('liam-test-square540'),ROOT/'app/build/characters/liam-test-square540/framing/square540-headchest')
with self.assertRaises(ValueError):select.stage(ASSETS,select.build_directory('liam-test')/'generated/packagedAssets',new)
self.assertFalse(select.catalog()['profiles']['liam-test-square540']['allowBackup'])
self.assertFalse(select.catalog()['profiles']['liam-test-square540']['permissionConnectionRetention'])
def test_controlled_preset_cannot_bleed_into_legacy_or_different_media(self):
for profile in ('main','lvbu-test','liam-test'):
with self.assertRaises(ValueError):select.framing(profile,'char-waiting-poses-r01','square540-headchest')
for media in ('white-full04','black-correct03','char-expressions-r02',None):
with self.assertRaises(ValueError):select.framing('liam-test-square540',media)
with self.assertRaises(ValueError):select.build_directory('liam-test-square540','legacy')
with self.assertRaises(ValueError):select.framing('liam-test-square540','char-waiting-poses-r01','legacy')
p=select.framing('liam-test-square540','char-waiting-poses-r01')
self.assertEqual(p['sourceRect'],[180,-16,540,344]);self.assertAlmostEqual(p['zoom'],1280/360)
self.assertAlmostEqual(p['centerY'],164/1280)
text=(ROOT/'app/build.gradle').read_text()
self.assertIn('Controlled preset cannot be overridden',text)
self.assertIn("avatarFrameZoom > 2f",text);self.assertIn("avatarFrameCenterY < 0.4f",text)
def test_independent_entry_keeps_old_wrapper_and_names(self):
spec=importlib.util.spec_from_file_location('pack',ROOT/'scripts/package-character-test.py');pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
self.assertEqual(pack.artifact_name('liam-test-square540',42),'lan-voice-v0714-liam-test-square540-code42-arm64-debug.apk')
flags=pack.flags('liam-test-square540',42,'char-waiting-poses-r01')
self.assertIn('-PavatarUserNetworkActions=true',flags)
self.assertTrue(any(f.startswith('--project-cache-dir=') and 'liam-test-square540/square540-headchest' in f for f in flags))
self.assertFalse(any(f.startswith('--project-cache-dir=') for f in pack.flags('liam-test',41,'char-waiting-poses-r01')))
yangmi=(ROOT/'scripts/package-avatar-framing.py').read_text()
self.assertIn("'-PavatarFrameZoom=1.45','-PavatarFrameCenterY=0.489'",yangmi)
def test_actual_dex_float_bits_preserve_existing_framing(self):
import struct
spec=importlib.util.spec_from_file_location('pack',ROOT/'scripts/package-character-test.py');pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
# Known immutable prior APK: ensure exact float bits, independent of dexdump text rounding.
with zipfile.ZipFile(ROOT/'artifacts/lan-voice-v0714-yangmi-framing145-code39-arm64-debug.apk') as z:
values=None
for name in z.namelist():
if name.startswith('classes') and name.endswith('.dex'):
try:values=pack.dex_float_fields(z.read(name));break
except ValueError:pass
self.assertIsNotNone(values)
for field,value in [('AVATAR_FRAME_ZOOM',1.45),('AVATAR_FRAME_CENTER_Y',.489)]:
self.assertEqual(values[field],struct.unpack('<f',struct.pack('<f',value))[0])