Documenta campi inventario e rende leggibile la legenda A B C X

This commit is contained in:
2026-10-21 15:37:58 +02:00
parent d3941e88cc
commit 588bf6ce73
7 changed files with 325 additions and 5 deletions

View File

@@ -47,6 +47,33 @@ class InventoryGuiTests(unittest.TestCase):
self.assertEqual(self.win.btn_export.cget("state"), "normal")
self.assertIn("31/12/2025", self.win.var_status.get())
def test_legend_is_bold_localized_and_independent_of_report(self):
for component, label in self.win.legend_labels.items():
self.assertEqual(label.cget("text"), component + ":")
self.assertIn("bold", label.cget("font"))
descriptions = [label.cget("text") for label in self.win.legend_descriptions]
self.assertTrue(all(text and not text.startswith("inventory.") for text in descriptions))
self.assertEqual(self.win.var_status.get(), self.win._t("inventory.ready"))
self.assertNotEqual(self.win.var_status.get(), self.win._t("inventory.scope"))
self.win._loaded(self.sample())
self.assertEqual([label.cget("text") for label in self.win.legend_descriptions], descriptions)
with patch("inventario.messagebox.showerror"), patch("inventario.log_exception"):
self.win._error(RuntimeError("Synthetic failure"))
self.assertEqual([label.cget("text") for label in self.win.legend_descriptions], descriptions)
def test_legend_wraps_to_window_width(self):
self.win._resize_legend(Mock(width=900))
self.assertEqual(self.win.legend_descriptions[0].cget("wraplength"), 835)
self.win._resize_legend(Mock(width=1200))
self.assertEqual(self.win.legend_descriptions[0].cget("wraplength"), 1135)
def test_legend_has_both_translations(self):
from locale_text import load_locale_catalog
catalog = load_locale_catalog()
for lang in ("IT", "ENG"):
for suffix in ("ready", "formula", "legend.A", "legend.B", "legend.C", "legend.X"):
self.assertTrue(catalog[lang]["inventory." + suffix])
def test_selection_populates_lot_and_container_details(self):
self.win._loaded(self.sample())
self.win.tree.selection_set("0")