diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-20 12:34:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-20 12:34:04 +0200 |
| commit | f2bc23df84907a361e7d9fa20bf1bc8f7a916037 (patch) | |
| tree | 60135956d7e3d98397ad80cdafa643446e231f2a /tests | |
| parent | eaeeb7349504d83cd3251daba4c557854c46cd00 (diff) | |
| download | sb-builder-f2bc23df84907a361e7d9fa20bf1bc8f7a916037.tar.gz sb-builder-f2bc23df84907a361e7d9fa20bf1bc8f7a916037.zip | |
Keep column widths, splitters and window size across runs
QSettings in state.conf next to config.toml, saved on close: every table
header (widths, sort column) and splitter of the tabs, and the window
geometry. Tests point it at a temp file, never the user's own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_gui.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_gui.py b/tests/test_gui.py index d5a1128..bd08e7f 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -21,6 +21,7 @@ os.environ["QT_QPA_PLATFORM"] = "offscreen" # never the real display, even if t import importlib.machinery # noqa: E402 import importlib.util # noqa: E402 +import shutil # noqa: E402 import sys # noqa: E402 import tempfile # noqa: E402 import time # noqa: E402 @@ -305,7 +306,11 @@ class SmokeTest(unittest.TestCase): "truncated": True, "mtime": 0, "resource": "peak memory 3308M\n"}, None), **answers}) - w = MainWindow(config.load("/nonexistent")[0], remote, FakeNotifier()) + if not hasattr(self, "state"): + tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, tmp) + self.state = os.path.join(tmp, "state.conf") # never the user's own + w = MainWindow(config.load("/nonexistent")[0], remote, FakeNotifier(), self.state) self.addCleanup(w.deleteLater) self.addCleanup(lambda: w.jobs_tab and w.jobs_tab.stop()) return w, remote @@ -663,6 +668,16 @@ class SmokeTest(unittest.TestCase): self.assertIn(("job-start", "hint-new", "curl", "nuclei"), remote.calls) self.assertIs(w.tabs.currentWidget(), w.hints_tab) # starting a job stays put + def test_view_state_kept_across_runs(self): + w, _ = self.window() + w.packages_tab.table.setColumnWidth(1, 333) + w.close() # saves + w2, _ = self.window() # same state file + self.assertEqual(w2.packages_tab.table.columnWidth(1), 333) + # the size itself can't be checked here: restoreGeometry clamps to offscreen's 800x600 screen + self.assertTrue(w2.state.value("geometry")) + self.assertEqual(w2.hints_tab.table.columnWidth(1), 220) # untouched: code default + def test_tab_shortcuts_wrap(self): w, _ = self.window() w.poll_jobs() |
