zapretgui/tests/test_about_tabs_height.py
loop-uh 704e68ee72
All checks were successful
Zapret source guards / validate (push) Successful in 7s
Windows-сборка / Dev Dev 21.1.6.44 опубликован
О программе: высота вкладок — по открытой вкладке, под «Zapret KVN» больше нет пустоты высотой со «Справку»
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 13:46:38 +03:00

33 lines
937 B
Python

from __future__ import annotations
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
from PyQt6.QtWidgets import QApplication, QWidget
from ui.pages.about_page_tabs_build import build_about_page_tabs
def _app() -> QApplication:
return QApplication.instance() or QApplication([])
def test_stack_height_follows_current_tab_not_tallest() -> None:
_app()
widgets = build_about_page_tabs(tr_fn=lambda _key, default: default, on_switch_tab=lambda _index: None)
tall = QWidget()
tall.setFixedHeight(2000)
widgets.help_layout.addWidget(tall)
short = QWidget()
short.setFixedHeight(100)
widgets.kvn_layout.addWidget(short)
stack = widgets.stacked_widget
stack.setCurrentWidget(widgets.help_tab)
assert stack.sizeHint().height() >= 2000
stack.setCurrentWidget(widgets.kvn_tab)
assert stack.sizeHint().height() < 500
assert stack.minimumSizeHint().height() < 500