Prepare Wormhole 0.1.2 with registered settings and Ctrl shortcut
This commit is contained in:
1 parent
48f7d5262c
commit
9823d77b55
4 files changed
+23
-12
No files matched your search
+16
-4
@@ -36,7 +36,7 @@ def check_metadata(repoRoot):
|
||||
require(item["manifest"] == f"{name}/tentacle.toml", "Manifest path must match ID")
|
||||
manifest = read_toml(repoRoot / item["manifest"])
|
||||
require(manifest["format-version"] == 1 and manifest["id"] == name
|
||||
and manifest["name"] and manifest["version"] == ("0.1.1" if name == "wormhole" else "0.1.0"), "Invalid Tentacle metadata")
|
||||
and manifest["name"] and manifest["version"] == ("0.1.2" if name == "wormhole" else "0.1.0"), "Invalid Tentacle metadata")
|
||||
expectedGrants = ["presentation"] + (["interaction"] if name == "wormhole" else [])
|
||||
expectedProgram = "wormhole-tentacle" if name == "wormhole" else name
|
||||
require(manifest["entry-point"] == [f"bin/{expectedProgram}"]
|
||||
@@ -81,11 +81,14 @@ def check_registration(programPath, name):
|
||||
require(registration["id"] == "1" and registration["result"]["session"] == "check",
|
||||
"Invalid registration response")
|
||||
commands = registration["result"]["commands"]
|
||||
require(len(commands) == (7 if name == "wormhole" else 1) and commands[0]["id"] == name
|
||||
require(len(commands) == (9 if name == "wormhole" else 1) and commands[0]["id"] == name
|
||||
and commands[0]["presentation"] is True, "Unexpected commands or grant")
|
||||
require(commands[0]["bindings"] == [
|
||||
{"layout": layout, "scope": "global", "key": ("Cthulhu+Alt+Shift+W" if name == "wormhole" else "Cthulhu+Alt+Shift+H")}
|
||||
{"layout": layout, "scope": "global", "key": ("Cthulhu+Ctrl+Shift+W" if name == "wormhole" else "Cthulhu+Alt+Shift+H")}
|
||||
for layout in ("desktop", "laptop")], "Wrong suggested shortcut")
|
||||
if name == "wormhole":
|
||||
require([command["id"] for command in commands if command.get("settings")]
|
||||
== ["settings"], "Wrong registered settings entry point")
|
||||
process.stdin.close()
|
||||
require(process.wait(timeout=5) == 0, "Tentacle did not stop cleanly on EOF")
|
||||
finally:
|
||||
@@ -109,6 +112,15 @@ def check_host(repoRoot, programPath, name):
|
||||
or value == {"speech": "Magic wormhole is not installed",
|
||||
"braille": "Magic wormhole is not installed", "uninterruptible": True},
|
||||
"Host returned an unexpected Wormhole menu")
|
||||
result = subprocess.run([
|
||||
"go", "run", "./cmd/tentacle-host", "-presentation", "-interaction",
|
||||
"-command", "settings", str(programPath),
|
||||
], cwd=readerRoot, env=environment, capture_output=True, text=True,
|
||||
timeout=60, check=True)
|
||||
value = json.loads(result.stdout)
|
||||
require(value.get("form", {}).get("title") == "Wormhole preferences"
|
||||
and value.get("next") == "save-settings",
|
||||
"Host returned an unexpected Wormhole settings form")
|
||||
return
|
||||
require(json.loads(result.stdout) == {
|
||||
"speech": "Hello world!", "braille": "Hello world!", "uninterruptible": True,
|
||||
@@ -123,7 +135,7 @@ def main():
|
||||
programPath = repoRoot / name / "bin" / binary
|
||||
check_registration(programPath, name)
|
||||
check_host(repoRoot, programPath, name)
|
||||
print("Repository metadata, shortcut registration and actual-host greeting/menu checks passed.")
|
||||
print("Repository metadata, shortcut/settings registration and actual-host greeting/menu/settings checks passed.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user