Integrate corrected char expressions into Liam code36

This commit is contained in:
zenord
2026-10-14 20:46:10 +08:00
parent 0c386ac8ec
commit 99a03e0487
23 changed files with 607 additions and 59 deletions
@@ -120,3 +120,51 @@ class CharacterProfilesTests(unittest.TestCase):
self.assertIn('-PcharacterProfile=liam-test',pack.flags('liam-test',35))
self.assertEqual(select.catalog()['profiles']['liam-test']['minimumVersionCode'],35)
with self.assertRaises(ValueError):pack.artifact_name('main',35)
def char(self,profile='liam-test',**changes):
media=select.catalog()['mediaBundles']['char-expressions-r02']
flags=dict(emotion_sha=media['indexSha256'],user_assets=True,mouth=True,startup=True,
media_bundle='char-expressions-r02')
flags.update(changes)
return select.selection(ASSETS,profile,**flags)
def test_char_is_explicit_liam_only_and_does_not_mix_black_pack(self):
selected=self.char()
self.assertEqual(selected['file_count'],3190)
self.assertEqual((selected['persona'],selected['media_identity']),('liam','a01'))
self.assertEqual(sum(n.startswith('avatar/char-expressions-r02/') for n in selected['files']),2593)
self.assertFalse(any('black-tulle' in n or 'startup-white' in n for n in selected['files']))
for profile in ('main','lvbu-test'):
with self.subTest(profile=profile),self.assertRaises(ValueError):self.char(profile)
for profile in ('main','lvbu-test','liam-test'):
self.assertFalse(any('char-expressions' in n for n in self.full(profile)['files']))
def test_char_pin_bootstrap_and_poster_cannot_be_mixed(self):
media=select.catalog()['mediaBundles']['char-expressions-r02']
with self.assertRaises(ValueError):self.char(emotion_sha=select.catalog()['mediaBundles']['black-correct03']['indexSha256'])
original=Path.read_bytes
for target in (ASSETS/media['assetRoot']/'manifest.json',
ASSETS/media['bootstrapRoot']/'manifest.json',
ROOT/media['resourceDirectory']/'drawable-nodpi'/(media['posterResource']+'.png')):
with self.subTest(target=target),patch.object(Path,'read_bytes',lambda p:b'corrupt' if p==target else original(p)),self.assertRaises(ValueError):self.char()
def test_char_retains_transparent_sections_and_runtime_not_ready(self):
from PIL import Image
media=select.catalog()['mediaBundles']['char-expressions-r02']
for name,restricted in [('happy',range(7,70)),('sad',range(24,55))]:
root=ASSETS/media['assetRoot']/'conversation'/name
runtime=json.loads((root/'manifest.json').read_bytes())
self.assertIs(runtime['runtimeReady'],False)
for frame in restricted:
for level in runtime['patches'][frame]['levels'][1:]:
with Image.open(root/level['path']) as image:
self.assertEqual(image.getchannel('A').getextrema(),(0,0))
def test_char_has_no_network_dance_authorization(self):
spec=importlib.util.spec_from_file_location('char_pack',ROOT/'scripts/package-character-test.py')
pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
flags=pack.flags('liam-test',36,'char-expressions-r02')
self.assertIn('-PavatarUserNetworkActions=false',flags)
self.assertIn('-PcharacterMediaBundle=char-expressions-r02',flags)
self.assertFalse(select.catalog()['mediaBundles']['char-expressions-r02']['networkActionsAllowed'])
self.assertIn('Network dance requires separate reviewed media registration',(ROOT/'app/build.gradle').read_text())