One directory with sixty scripts stopped being navigable, and the grouping is also the sandbox boundary:
Tools/unreal/ commandlets and the two map builders, with ue_common.py and ue_placement.py as the
shared imports (they need the engine)
Tools/blender/ builders, exporters, the FBX preset, the MPFB character pipeline, blender_screenshots
(they need the Blender Flatpak)
Tools/review/ the visual loop: render_screenshots.sh, judge_screenshot.py, hero_compare.py,
build_comparison_md.py, e2e_asset_check.py, hero_iterate.sh, visual_loop.py,
visual_targets.json
Tools/gen/ image and texture generation: the ComfyUI driver, deterministic texture writers,
reference fetching
Tools/input/ OS-level input injection
root _common.py, check-lfs.sh, addon_compat_probe.py, sibling_asset_audit.py, tests/
Every moved script now resolves the repository root as ../.. and puts the tools root plus its siblings on
sys.path, so 'import ue_common' still works from unreal/. The test suite bootstrap does the same for the five
folders. render_screenshots.sh takes the folder as a third argument to run_cmdlet, and the e2e driver,
hero_iterate.sh and the comparison generator were repointed.
51 README rows now link to their new location, the README gains a Layout section naming each folder's
sandbox, and the architecture notes and Blender README follow the moves.
Verified: 108 tests pass, prettier is clean, judge_screenshot.py and hero_compare.py run from their new
homes, and the e2e run was aborted mid-way (it had been rebuilding an empty DemoMap for 15 minutes) and is
being rerun against the new layout.
67 lines
2.1 KiB
Python
67 lines
2.1 KiB
Python
"""Tests for Tools/input_emulation.py — the pure ioctl/key-code parts.
|
|
|
|
The device path itself needs /dev/uinput, so only the encoding helpers are
|
|
covered here; the end-to-end injection is verified by running the tool (see
|
|
Docs/release-checks.md and MEMORY.md).
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
_TOOLS = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
sys.path.insert(0, _TOOLS)
|
|
for _sub in ("review", "gen", "unreal", "blender", "input"):
|
|
sys.path.insert(0, os.path.join(_TOOLS, _sub))
|
|
|
|
|
|
import unittest
|
|
|
|
import input_emulation as ie
|
|
|
|
|
|
class IocEncodingTest(unittest.TestCase):
|
|
"""_IOC must match the Linux ioctl bit layout."""
|
|
|
|
def test_layout_constants(self):
|
|
self.assertEqual(ie._IOC_NRSHIFT, 0)
|
|
self.assertEqual(ie._IOC_TYPESHIFT, 8)
|
|
self.assertEqual(ie._IOC_SIZESHIFT, 16)
|
|
self.assertEqual(ie._IOC_DIRSHIFT, 30)
|
|
|
|
def test_known_values(self):
|
|
# UI_SET_EVBIT = _IOW('U', 100, int) -> 0x40045564 on Linux.
|
|
self.assertEqual(ie.UI_SET_EVBIT, 0x40045564)
|
|
# UI_DEV_CREATE = _IO('U', 1) -> 0x5501.
|
|
self.assertEqual(ie.UI_DEV_CREATE, 0x5501)
|
|
|
|
def test_type_accepts_char_or_int(self):
|
|
self.assertEqual(ie._ioc(1, 4, "U", 100), ie._ioc(1, 4, ord("U"), 100))
|
|
|
|
|
|
class KeyCodeTest(unittest.TestCase):
|
|
"""KEYCODES must hold the Linux input-event codes the demo uses."""
|
|
|
|
EXPECTED = {
|
|
"w": 17, "s": 31, "a": 30, "d": 32,
|
|
"space": 57, "r": 19, "esc": 1,
|
|
}
|
|
|
|
def test_demo_controls(self):
|
|
for name, code in self.EXPECTED.items():
|
|
self.assertEqual(ie.KEYCODES[name], code, f"{name} code")
|
|
|
|
def test_lookup_is_case_insensitive(self):
|
|
dev = ie.InputDevice.__new__(ie.InputDevice) # no device opened
|
|
self.assertEqual(dev._key_code("W"), 17)
|
|
self.assertEqual(dev._key_code("SPACE"), 57)
|
|
self.assertEqual(dev._key_code(19), 19) # a raw code passes through
|
|
|
|
def test_unknown_key_raises(self):
|
|
dev = ie.InputDevice.__new__(ie.InputDevice)
|
|
with self.assertRaises(ie.UInputError):
|
|
dev._key_code("not-a-key")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|