fix: register DxDesigner menus from Start and keep the bridge alive

This commit is contained in:
阿白叔 committed 2026-10-10 22:51:29 +08:00
1 parent c8caaf8daf
commit 7a471fec24
22 files changed
+683 -73

No files matched your search

+29
View File
@@ -115,3 +115,32 @@ def test_main_window_wires_settings_page(qtbot):
assert isinstance(window.pages.widget(7), SettingsPage)
assert window.settings_page.version_label.text().startswith("当前版本 0.1.0")
def test_start_button_requests_dxdesigner_menu_installation(qtbot):
window = MainWindow()
qtbot.addWidget(window)
with qtbot.waitSignal(window.start_requested):
qtbot.mouseClick(window.start_button, Qt.MouseButton.LeftButton)
def test_start_button_runs_registration_and_shows_its_result(qtbot):
window = create_main_window()
qtbot.addWidget(window)
window.startup_controller.service = lambda _root: "菜单已加入当前 DxDesigner"
with qtbot.waitSignal(window.startup_controller.completed):
qtbot.mouseClick(window.start_button, Qt.MouseButton.LeftButton)
assert not window.start_button.isEnabled()
assert window.start_button.isEnabled()
assert window.operation_status.text() == "菜单已加入当前 DxDesigner"
def test_portable_executable_uses_its_own_folder_over_stale_environment(monkeypatch, tmp_path):
import sys
from dx_productivity.ui.app import _tool_root
current = tmp_path / "current" / "DxDesignerTools.exe"
monkeypatch.setattr(sys, "frozen", True, raising=False)
monkeypatch.setattr(sys, "executable", str(current))
monkeypatch.setenv("DXTOOLS_HOME", str(tmp_path / "old-release"))
assert _tool_root() == current.parent.resolve()