# -*- coding: utf-8 -*- """Tests: vier Add-on-Kacheln horizontal in einer Zeile.""" from __future__ import annotations import os import unittest def _addon_src() -> str: path = os.path.join(os.path.dirname(__file__), "aza_addon_shell.py") with open(path, encoding="utf-8") as fh: return fh.read() class TestAddonFourTilesHorizontal(unittest.TestCase): def test_four_tiles_single_row(self): src = _addon_src() self.assertIn(".grid(row=0, column=0", src) self.assertIn(".grid(row=0, column=1", src) self.assertIn(".grid(row=0, column=2", src) self.assertIn(".grid(row=0, column=3", src) self.assertNotIn(".grid(row=1, column=", src) def test_window_wide_enough_for_four_tiles(self): src = _addon_src() self.assertIn("W, H = 920, 350", src) def test_all_titles_present(self): src = _addon_src() for title in ("Diktat", "Chat", "Übersetzer", "Presentation Maker"): self.assertIn(f'title="{title}"', src) def test_presentation_subtitle_and_status(self): src = _addon_src() self.assertIn("Präsentationen erstellen", src) self.assertIn("In Vorbereitung", src) def test_presentation_maker_disabled_no_click(self): block = _addon_src().split("def _make_tile_disabled", 1)[1].split("\ndef ", 1)[0] self.assertNotIn("Button-1", block) def test_active_callbacks_preserved(self): src = _addon_src() self.assertIn('_safe_call(app, "open_diktat_window")', src) self.assertIn('_safe_call(app, "_send_to_empfang")', src) self.assertIn('_safe_call(app, "_open_uebersetzer")', src) def test_four_uniform_columns(self): src = _addon_src() self.assertIn("for col in range(4):", src) self.assertIn('columnconfigure(col, weight=1, uniform="tile")', src) if __name__ == "__main__": unittest.main()