zapretgui/tests/test_base_page_subtitle.py
loop-uh ff8a3021e2
All checks were successful
Zapret source guards / validate (push) Successful in 9s
DNS apply no longer hangs ~100 s; DoH switch saved at once; BlockCheck header gap fixed
- local_proxy._wait_answer counted only the 0.5 s pauses, not the up-to-1.5 s probe of
  127.0.0.1, so the 25 s wait took ~100 s (win10 log 2026-11-17: 98728 ms). It now also
  watches the clock, and reads the engine log from the start when it restarted shorter,
  so the engine's 'no server works' line ends the wait after a few seconds.
- reachability: the plain probe also asks google.com, the name the speed test uses, so a
  server the tile shows alive is no longer refused as 'blocked'.
- The DoH switch is written when flipped, not when the apply worker ends.
- Page description (BasePage subtitle) keeps its wrapped-text height instead of taking
  the spare room of a tall window (BlockCheck had a 350 px gap).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 15:42:35 -05:00

44 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Описание страницы не раздувается, когда в странице мало блоков, а окно высокое."""
import os
import unittest
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
from PyQt6.QtWidgets import QApplication
from ui.pages.base_page import BasePage
class BasePageSubtitleTests(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls._app = QApplication.instance() or QApplication([])
def _page(self, width: int, height: int) -> BasePage:
page = BasePage("Заголовок", "Какие сайты открываются, почему не открываются остальные и что с этим делать")
self.addCleanup(page.deleteLater)
page.resize(width, height)
page.show()
self._app.processEvents()
self._app.processEvents()
return page
def test_subtitle_keeps_its_text_height_on_a_tall_window(self) -> None:
# Лишнее место страницы раздавалось описанию (BlockCheck, 2026-11-17: пустота в 350 px).
page = self._page(1300, 900)
label = page.subtitle_label
self.assertEqual(label.height(), label.heightForWidth(label.width()))
self.assertLess(label.height(), 30)
def test_subtitle_still_wraps_on_a_narrow_window(self) -> None:
page = self._page(300, 900)
label = page.subtitle_label
self.assertGreater(label.height(), 40)
self.assertEqual(label.height(), label.heightForWidth(label.width()))
if __name__ == "__main__":
unittest.main()