Replace leaf entry with persistent horizontal toolbar and shared panel state
This commit is contained in:
1 parent
d2501d0112
commit
19361fd1cc
18 files changed
+1010
-454
No files matched your search
@@ -86,3 +86,57 @@ def test_selection_switches_current_sheet_without_overwriting_form(qtbot, fixtur
|
||||
window.selection_watcher._check()
|
||||
assert window.pdf_export_controller.snapshot.current_sheet_name == '2'
|
||||
assert not any(c.current_sheet for c in window.bom_controller.snapshot.components)
|
||||
|
||||
|
||||
def test_hidden_toolbar_selection_disconnect_recovery_and_project_switch(qtbot, fixture_path, tmp_path, monkeypatch):
|
||||
import os
|
||||
import time
|
||||
window, data = setup_window(qtbot, fixture_path, tmp_path, monkeypatch)
|
||||
window.show_toolbar()
|
||||
publish(tmp_path, data, ['uid:uid-c-a'])
|
||||
window.selection_watcher._check()
|
||||
assert 'C1' in window.toolbar.status_label.text()
|
||||
assert 'ROOT / 1' in window.toolbar.status_label.toolTip()
|
||||
width = window.toolbar.width()
|
||||
publish(tmp_path, data, ['uid:uid-r-a', 'uid:uid-c-a'])
|
||||
window.selection_watcher._check()
|
||||
assert '2 个' in window.toolbar.status_label.text()
|
||||
assert 'C1' in window.toolbar.status_label.toolTip()
|
||||
assert window.toolbar.width() == width
|
||||
publish(tmp_path, data, [])
|
||||
window.selection_watcher._check()
|
||||
assert '0' in window.toolbar.status_label.text()
|
||||
heartbeat = tmp_path / 'apply-progress.json'
|
||||
heartbeat.write_text('{}', encoding='utf-8')
|
||||
os.utime(heartbeat, (time.time() - 10, time.time() - 10))
|
||||
window.selection_watcher._check()
|
||||
assert '暂停' in window.toolbar.status_label.text()
|
||||
assert 'C1' not in window.toolbar.status_label.text()
|
||||
assert window.bridge_status.text() == '桥接已断开'
|
||||
heartbeat.unlink()
|
||||
publish(tmp_path, data, ['uid:uid-c-a'])
|
||||
window.selection_watcher._check()
|
||||
assert 'C1' in window.toolbar.status_label.text()
|
||||
publish(tmp_path, data, ['uid:uid-c-a'], design_path='C:/other.prj')
|
||||
window.selection_watcher._check()
|
||||
assert '切换' in window.toolbar.status_label.text()
|
||||
assert 'C1' not in window.toolbar.status_label.text()
|
||||
assert not window.isVisible()
|
||||
|
||||
|
||||
def test_repeated_panel_toggle_keeps_single_watcher_and_page_instances(qtbot, fixture_path, tmp_path, monkeypatch):
|
||||
from PySide6.QtCore import QTimer
|
||||
from dx_productivity.ui.selection_watcher import SelectionWatcher
|
||||
window, data = setup_window(qtbot, fixture_path, tmp_path, monkeypatch)
|
||||
pages = tuple(window.pages.widget(i) for i in range(window.pages.count()))
|
||||
timers = tuple(window.selection_watcher.findChildren(QTimer))
|
||||
for index in range(window.pages.count()):
|
||||
window.show_panel(index)
|
||||
window.hide_panel()
|
||||
publish(tmp_path, data, ['uid:uid-c-a'])
|
||||
window.selection_watcher._check()
|
||||
window.show_panel(1)
|
||||
assert tuple(window.pages.widget(i) for i in range(window.pages.count())) == pages
|
||||
assert tuple(window.selection_watcher.findChildren(QTimer)) == timers
|
||||
assert len(window.findChildren(SelectionWatcher)) == 1
|
||||
assert window.property_change_controller.page.model.item(0, 0).text() == 'C1'
|
||||
Reference in new issue
Block a user