aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_gui.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gui.py')
-rw-r--r--tests/test_gui.py17
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()