mirror of
https://github.com/SK8-ENGINE/skate-3-rust-engine.git
synced 2026-10-26 19:47:44 +00:00
Remove checkout dependency from packaged gesture menu preparation
This commit is contained in:
1 parent
8d34dca161
commit
f55c17dc4b
3 files changed
+13
-4
No files matched your search
@@ -2,7 +2,6 @@
|
||||
import json,struct,re
|
||||
from pathlib import Path
|
||||
from tools.asset_pipeline.customisation_native import key_hash
|
||||
from tools.asset_pipeline.customisation_worker import ROOT
|
||||
|
||||
def generate(native):
|
||||
def page(name,children):return dict(label=name,children=children)
|
||||
@@ -25,9 +24,8 @@ def generate(native):
|
||||
if len(values)!=19:raise ValueError('Incomplete native face preset')
|
||||
gender,number=row['key'].split('_')
|
||||
presets.append(choice('Face '+str(int(number)),{'morphs':values},gender=gender))
|
||||
source=(ROOT/'crates/skate-game/src/graph_host/motion_character_gesture.rs').read_text()
|
||||
names=re.findall(r'"B_GSTR_([A-Z_]+)"',source)
|
||||
if len(names)!=37:raise ValueError('Native gesture table changed')
|
||||
# These indices match the runtime gesture table. Source-tree consistency
|
||||
# belongs in tests; a player's setup has no Rust checkout.
|
||||
labels=['Air guitar','Airplane','Boxing','Bruce Lee','Check the time','Devil horns','Finger guns','Dunno',
|
||||
'Finger wag','Fists','Flex','Flip the table','The Fonz','Freedom','Raised fist','Get away','Get outta here',
|
||||
'Handcuffs','High fist pump','Low fist pump','Wind up','Peace','Point','Raise the roof','Shaka','Shrug',
|
||||
|
||||
@@ -8,6 +8,15 @@ from tools.asset_pipeline import customiser_setup as s
|
||||
|
||||
|
||||
class CharacterSetup(unittest.TestCase):
|
||||
def test_gesture_menu_matches_runtime_table_without_reading_source(self):
|
||||
import re
|
||||
from tools.asset_pipeline.customisation_profiles import generate
|
||||
source = Path(__file__).resolve().parents[2]/'crates/skate-game/src/graph_host/motion_character_gesture.rs'
|
||||
count = len(re.findall(r'"B_GSTR_([A-Z_]+)"', source.read_text()))
|
||||
with patch.object(Path, 'read_text', side_effect=AssertionError('setup must not read Rust source')):
|
||||
menu = generate({'morphs': [], 'collections': []})
|
||||
self.assertEqual(len(menu[-1]['children'][0]['children'][0]['children']), count)
|
||||
|
||||
def setUp(self):
|
||||
source = patch.object(s, 'source_fingerprint', return_value='owned-disc')
|
||||
source.start()
|
||||
|
||||
@@ -31,6 +31,8 @@ def main():
|
||||
assert result.returncode == 0, result.stderr
|
||||
assert b'0.9.7' in result.stdout + result.stderr
|
||||
assert len(customiser_setup.fingerprint()) == 64
|
||||
menu = customisation_profiles.generate({'morphs': [], 'collections': []})
|
||||
assert len(menu[-1]['children'][0]['children'][0]['children']) == 37
|
||||
return
|
||||
from test_converter import fixture
|
||||
from converter import validate_output
|
||||
|
||||
Reference in new issue
Block a user