fix: restore async task selection and bound read-only close waiting
Core regression / Python core, intervention UI and release configuration (push) Failing after 4m20s
Core regression / JavaScript syntax (push) Successful in 8s
Core regression / Python core, intervention UI and release configuration (pull_request) Failing after 4m20s
Core regression / JavaScript syntax (pull_request) Successful in 8s
Core regression / Python core, intervention UI and release configuration (push) Failing after 4m20s
Core regression / JavaScript syntax (push) Successful in 8s
Core regression / Python core, intervention UI and release configuration (pull_request) Failing after 4m20s
Core regression / JavaScript syntax (pull_request) Successful in 8s
This commit is contained in:
1 parent
471401db7d
commit
902ce15fb7
4 files changed
+153
-7
No files matched your search
@@ -0,0 +1,87 @@
|
||||
"""Explicit selection intent must survive asynchronous task-list population."""
|
||||
from dataclasses import replace
|
||||
from threading import Event
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from PySide6.QtCore import QSize, Qt
|
||||
|
||||
from tests.ui.test_issue45_access_keys import navigation
|
||||
|
||||
|
||||
@pytest.mark.parametrize('entry', ['populate', 'navigate'])
|
||||
def test_pending_task_navigation_is_selected_when_its_rows_arrive(navigation, entry):
|
||||
panel, tasks = navigation
|
||||
incoming = 'arriving-task'
|
||||
task = replace(tasks[0], task_id=incoming)
|
||||
if entry == 'populate':
|
||||
panel.populate((), selected_task_id=incoming)
|
||||
else:
|
||||
panel.select_task(incoming)
|
||||
assert panel.selected_task_ids() == ()
|
||||
panel.populate((task,), selected_task_id=incoming)
|
||||
assert panel.current_task_id() == incoming
|
||||
assert panel.selected_task_ids() == (incoming,)
|
||||
|
||||
|
||||
def test_filter_empty_selection_does_not_suppress_new_navigation(navigation):
|
||||
panel, tasks = navigation
|
||||
panel.select_all_tasks()
|
||||
panel.search.setText('missing-task')
|
||||
panel.search.clear()
|
||||
assert panel.selected_task_ids() == ()
|
||||
panel.select_task(tasks[1].task_id)
|
||||
assert panel.selected_task_ids() == (tasks[1].task_id,)
|
||||
|
||||
|
||||
def test_explicit_ctrl_deselection_is_retained_when_tasks_are_refreshed(navigation, qtbot):
|
||||
panel, tasks = navigation
|
||||
item = panel.list.currentItem()
|
||||
qtbot.mouseClick(panel.list.viewport(), Qt.MouseButton.LeftButton, Qt.KeyboardModifier.ControlModifier,
|
||||
panel.list.visualItemRect(item).center())
|
||||
panel.populate(tasks, selected_task_id=tasks[0].task_id)
|
||||
assert not panel.selected_task_ids()
|
||||
|
||||
|
||||
def test_unresponsive_read_cancels_close_and_restores_a_usable_window(ui, qtbot, monkeypatch):
|
||||
window = ui.window
|
||||
started, release = Event(), Event()
|
||||
original = ui.service.task_context
|
||||
def slow_first(task_id, *, read_control=None):
|
||||
if not started.is_set():
|
||||
started.set()
|
||||
assert release.wait(5)
|
||||
read_control.checkpoint()
|
||||
return original(task_id, read_control=read_control)
|
||||
monkeypatch.setattr(ui.service, 'task_context', slow_first)
|
||||
window.archive_on_close_check.setChecked(False)
|
||||
window._load_task_data()
|
||||
qtbot.waitUntil(started.is_set)
|
||||
try:
|
||||
window.close()
|
||||
assert not window._closed
|
||||
window._read_close_started = time.monotonic() - 11
|
||||
window.close()
|
||||
assert window.isEnabled() and not window._closed
|
||||
assert not window._close_pending
|
||||
assert '关闭已取消' in window.run_panel.operator_band.text()
|
||||
qtbot.waitUntil(lambda: window._context is not None)
|
||||
qtbot.wait(150)
|
||||
assert window.isEnabled() and not window._closed
|
||||
finally:
|
||||
release.set()
|
||||
ui.settle()
|
||||
assert window._context.task.task_id == ui.tasks[0].task_id
|
||||
|
||||
|
||||
def test_returning_to_task_center_resets_other_pages_minimum_size(ui, qtbot):
|
||||
window = ui.window
|
||||
for page in (window.history_panel, window.verification_panel):
|
||||
window.content_stack.setCurrentWidget(page)
|
||||
assert window.content_stack.minimumSize().width() >= 900
|
||||
window.task_center_action.trigger()
|
||||
assert window.content_stack.minimumSize() == QSize(900, 600)
|
||||
window.resize(980, 700)
|
||||
qtbot.wait(30)
|
||||
for button in (window.plan_panel.save_button, window.run_panel.quick_run_button):
|
||||
assert window.rect().contains(button.mapTo(window, button.rect().bottomRight()))
|
||||
Reference in new issue
Block a user