ui: refine toolbar toggle and expanded panel
This commit is contained in:
1 parent
b203806fd1
commit
b9d7daca0f
6 files changed
+59
-6
No files matched your search
@@ -1,4 +1,5 @@
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QToolButton
|
||||
|
||||
from dx_productivity.ui.main_window import MainWindow
|
||||
|
||||
@@ -48,6 +49,32 @@ def test_status_setters_update_hidden_toolbar_without_showing_panel(qtbot, tmp_p
|
||||
assert not window.isVisible()
|
||||
|
||||
|
||||
def test_panel_toggle_has_explicit_direction_and_text(qtbot):
|
||||
window = MainWindow()
|
||||
qtbot.addWidget(window)
|
||||
|
||||
toggle = window.toolbar.toggle_button
|
||||
assert isinstance(toggle, QToolButton)
|
||||
assert toggle.text() == '展开'
|
||||
assert toggle.arrowType() == Qt.ArrowType.DownArrow
|
||||
assert toggle.accessibleName() == '展开面板'
|
||||
|
||||
window.show_panel(0)
|
||||
assert toggle.text() == '收起'
|
||||
assert toggle.arrowType() == Qt.ArrowType.UpArrow
|
||||
assert toggle.accessibleName() == '收起面板'
|
||||
|
||||
|
||||
def test_expanded_panel_is_a_frameless_tool_card(qtbot):
|
||||
window = MainWindow()
|
||||
qtbot.addWidget(window)
|
||||
|
||||
flags = window.windowFlags()
|
||||
assert flags & Qt.WindowType.FramelessWindowHint
|
||||
assert flags & Qt.WindowType.Tool
|
||||
assert window.centralWidget().objectName() == 'appRoot'
|
||||
|
||||
|
||||
def test_passive_status_keeps_host_focus_and_tracks_background_task(qtbot, qapp, tmp_path, monkeypatch):
|
||||
from types import SimpleNamespace
|
||||
from PySide6.QtWidgets import QWidget
|
||||
|
||||
Reference in new issue
Block a user