44 lines
1.9 KiB
Python
44 lines
1.9 KiB
Python
from PySide6.QtCore import Qt
|
|
|
|
|
|
def test_three_horizontal_sections_keep_one_catalog_and_only_their_actions(qtbot, tmp_path, monkeypatch):
|
|
from test_ui_filters import load_window
|
|
window = load_window(qtbot, tmp_path, monkeypatch)
|
|
window.show()
|
|
assert [window.section_tabs.tabText(i) for i in range(window.section_tabs.count())] == [
|
|
'检验', 'ICDB 维护', '中心库管理']
|
|
window.search_edit.setText('Beta')
|
|
window.select_visible_button.click()
|
|
for index, visible, hidden in (
|
|
(0, window.batch_button, window.icdb_repair_button),
|
|
(1, window.icdb_repair_button, window.add_button),
|
|
(2, window.add_button, window.batch_button),
|
|
):
|
|
window.section_tabs.setCurrentIndex(index)
|
|
assert visible.isVisible() and not hidden.isVisible()
|
|
assert window.cbb_table.isVisible()
|
|
assert window.search_edit.text() == 'Beta'
|
|
assert [record.name for record in window.selected_records()] == ['Beta']
|
|
assert window.minimumSizeHint().height() <= 650
|
|
|
|
|
|
def test_long_status_does_not_expand_the_window(qtbot, tmp_path):
|
|
from cbb_refresh_verify.ui.main_window import MainWindow
|
|
window = MainWindow(data_root=tmp_path)
|
|
qtbot.addWidget(window)
|
|
window.resize(1000, 650); window.show()
|
|
window.status_label.setText('错误说明\n' * 80)
|
|
qtbot.wait(20)
|
|
assert window.height() <= 650
|
|
assert window.status_label.height() <= window.status_label.fontMetrics().lineSpacing() * 3 + 4
|
|
|
|
|
|
def test_failure_detail_keeps_catalog_name_readable(qtbot, tmp_path, monkeypatch):
|
|
from test_ui_filters import load_window
|
|
window = load_window(qtbot, tmp_path, monkeypatch)
|
|
window.resize(1000, 650); window.show()
|
|
window.cbb_table.item(0, 3).setText('BackAnnotate: ' + 'long exception ' * 100)
|
|
qtbot.wait(20)
|
|
assert window.cbb_table.columnWidth(0) >= 200
|
|
assert window.cbb_table.horizontalHeader().length() <= window.cbb_table.viewport().width()
|