feat: add complete yiyezhqiu productivity suite
This commit is contained in:
commit
e422ca8b2a
155 files changed
+18959
No files matched your search
@@ -0,0 +1,64 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from dx_productivity.bridge.probe_host import main, write_probe_marker
|
||||
|
||||
|
||||
def test_probe_marker_is_versioned_json(tmp_path: Path) -> None:
|
||||
output = tmp_path / "compatibility.json"
|
||||
|
||||
write_probe_marker(output, "named", {"selected_query": True})
|
||||
|
||||
assert output.read_text(encoding="utf-8") == (
|
||||
'{"format_version":1,"route":"named","selected_query":true}\n'
|
||||
)
|
||||
|
||||
|
||||
def test_probe_cli_merges_capability_payload(tmp_path: Path) -> None:
|
||||
output = tmp_path / "compatibility.json"
|
||||
|
||||
exit_code = main(
|
||||
[
|
||||
"--output",
|
||||
str(output),
|
||||
"--route",
|
||||
"named",
|
||||
"--payload-json",
|
||||
'{"yield_method":"Scripting.DoEvents","retained_reference":true}',
|
||||
]
|
||||
)
|
||||
|
||||
assert exit_code == 0
|
||||
assert json.loads(output.read_text(encoding="utf-8"))["yield_method"] == (
|
||||
"Scripting.DoEvents"
|
||||
)
|
||||
|
||||
|
||||
def test_probe_cli_rejects_non_object_payload(tmp_path: Path) -> None:
|
||||
with pytest.raises(ValueError, match="JSON object"):
|
||||
main(
|
||||
[
|
||||
"--output",
|
||||
str(tmp_path / "compatibility.json"),
|
||||
"--route",
|
||||
"named",
|
||||
"--payload-json",
|
||||
"[]",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def test_startup_probe_uses_packaged_executable_and_records_portable_path() -> None:
|
||||
text = Path("integration/dxdesigner795/CompatibilityProbe.vbs").read_text(
|
||||
encoding="ascii"
|
||||
)
|
||||
|
||||
assert "DxDesignerTools.exe" in text
|
||||
assert '"script_path_source"' in text
|
||||
assert '"portable_root_valid"' in text
|
||||
assert "DXTOOLS_HOME" not in text
|
||||
assert "py -3.12" not in text
|
||||
assert "D:\\NET_CHECK" not in text
|
||||
assert text.isascii()
|
||||
@@ -0,0 +1,62 @@
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
|
||||
INTEGRATION_ROOT = Path("integration/dxdesigner795")
|
||||
|
||||
|
||||
def test_menu_is_ascii_portable_and_uses_795_menu_bar() -> None:
|
||||
text = (INTEGRATION_ROOT / "MenuAdd.vbs").read_text(encoding="ascii")
|
||||
|
||||
assert 'CommandBars("Sheet Menu Bar")' in text
|
||||
assert "DxToolsResolveRoot" in text
|
||||
assert "WScript.ScriptFullName" in text
|
||||
assert "Scripting.CurrentScriptFullName" in text
|
||||
assert "Scripting.ScriptFullName" in text
|
||||
assert "DxDesignerTools.exe" in text
|
||||
assert "DXTOOLS_HOME" not in text
|
||||
assert "D:\\" not in text
|
||||
assert text.isascii()
|
||||
|
||||
|
||||
def test_menu_exposes_named_in_process_feature_actions() -> None:
|
||||
text = (INTEGRATION_ROOT / "MenuAdd.vbs").read_text(encoding="ascii")
|
||||
|
||||
for action in (
|
||||
"DxToolsOpenRefDes",
|
||||
"DxToolsOpenPropertyChange",
|
||||
"DxToolsOpenPropertyVisibility",
|
||||
"DxToolsOpenInspection",
|
||||
"DxToolsOpenBom",
|
||||
"DxToolsOpenCompatibility",
|
||||
"DxToolsOpenGuide",
|
||||
):
|
||||
assert f'OnAction = "{action}"' in text
|
||||
assert "ExecuteGlobal" in text
|
||||
assert "DxToolsStartFeature" in text
|
||||
assert "LegacyMenu" not in text
|
||||
|
||||
|
||||
def test_feature_menu_routes_through_design_bridge_entry() -> None:
|
||||
text = (INTEGRATION_ROOT / "DesignBridge.vbs").read_text(encoding="ascii")
|
||||
|
||||
assert "DxToolsRunDesignBridge" in text
|
||||
assert "DxToolsDesignBridgeStart" in text
|
||||
assert "Snapshot.vbs" in text
|
||||
assert "Transaction.vbs" in text
|
||||
assert "Mailbox.vbs" in text
|
||||
assert text.isascii()
|
||||
|
||||
|
||||
def test_release_vbs_sources_are_ascii_only() -> None:
|
||||
names = (
|
||||
"MenuAdd.vbs",
|
||||
"DesignBridge.vbs",
|
||||
"BridgeCommon.vbs",
|
||||
"CompatibilityProbe.vbs",
|
||||
"core/Snapshot.vbs",
|
||||
"core/Transaction.vbs",
|
||||
"core/Mailbox.vbs",
|
||||
)
|
||||
for name in names:
|
||||
assert (INTEGRATION_ROOT / name).read_bytes().isascii(), name
|
||||
@@ -0,0 +1,91 @@
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
|
||||
INTEGRATION_ROOT = Path("integration/dxdesigner795")
|
||||
|
||||
|
||||
def test_bridge_core_is_ascii_and_contains_transaction_stages() -> None:
|
||||
common = (INTEGRATION_ROOT / "BridgeCommon.vbs").read_text(encoding="ascii")
|
||||
transaction = (INTEGRATION_ROOT / "core" / "Transaction.vbs").read_text(
|
||||
encoding="ascii"
|
||||
)
|
||||
snapshot = (INTEGRATION_ROOT / "core" / "Snapshot.vbs").read_text(
|
||||
encoding="ascii"
|
||||
)
|
||||
mailbox = (INTEGRATION_ROOT / "core" / "Mailbox.vbs").read_text(
|
||||
encoding="ascii"
|
||||
)
|
||||
entry = (INTEGRATION_ROOT / "DesignBridge.vbs").read_text(encoding="ascii")
|
||||
|
||||
assert "DxToolsParseScheduleRow" in common
|
||||
assert "DxBridgeIdleWait" in common
|
||||
for name in (
|
||||
"DxExportSnapshot",
|
||||
"DxRefreshSnapshot",
|
||||
):
|
||||
assert f"Function {name}" in snapshot
|
||||
for name in (
|
||||
"DxProcessApply",
|
||||
"DxPreflightApply",
|
||||
"DxApplySchedule",
|
||||
"DxRollback",
|
||||
):
|
||||
assert f"Function {name}" in transaction
|
||||
assert "DxBridgeMailboxLoop" in mailbox
|
||||
assert "DxToolsRunDesignBridge" in entry
|
||||
for text in (common, transaction, snapshot, mailbox, entry):
|
||||
assert "ViewDraw.Application" not in text
|
||||
assert "GetActiveObject" not in text
|
||||
assert "DXTOOLS_HOME" not in text
|
||||
assert text.isascii()
|
||||
|
||||
|
||||
def test_real_vbs_bridge_transaction_harness_passes() -> None:
|
||||
result = subprocess.run(
|
||||
["cscript", "//nologo", "tests/vbs/test_refdes_bridge.vbs"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
check=False,
|
||||
timeout=30,
|
||||
)
|
||||
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
assert "DesignBridge transaction assertions passed" in result.stdout
|
||||
|
||||
|
||||
def test_real_vbs_snapshot_export_harness_passes() -> None:
|
||||
result = subprocess.run(
|
||||
["cscript", "//nologo", "tests/vbs/test_refdes_export.vbs"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
check=False,
|
||||
timeout=30,
|
||||
)
|
||||
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
assert "RefDes export assertions passed" in result.stdout
|
||||
|
||||
|
||||
def test_snapshot_export_uses_v2_protocol_fields() -> None:
|
||||
snapshot = (INTEGRATION_ROOT / "core" / "Snapshot.vbs").read_text(
|
||||
encoding="ascii"
|
||||
)
|
||||
|
||||
assert '"format_version"": 2' in snapshot
|
||||
assert '"attributes"' in snapshot
|
||||
assert '"nets"' in snapshot
|
||||
assert '"selected_nets"' in snapshot
|
||||
assert '"locked"' in snapshot
|
||||
|
||||
|
||||
def test_transaction_supports_property_operations() -> None:
|
||||
transaction = (INTEGRATION_ROOT / "core" / "Transaction.vbs").read_text(
|
||||
encoding="ascii"
|
||||
)
|
||||
|
||||
assert 'Attributes.Item(' in transaction
|
||||
assert '.Visible =' in transaction
|
||||
assert 'DxBridgeNormalizeVisible' in transaction
|
||||
Reference in new issue
Block a user