From 568b0a2630fc7941d898fbf56e40fc43ae45228e Mon Sep 17 00:00:00 2001 From: Baumfaust Date: Sat, 17 Oct 2026 20:55:35 +0000 Subject: [PATCH 1/2] Make threshold inputs readable --- src/getthefish/gui/main.ui | 8 ++++---- src/getthefish/gui/ui_main.py | 8 ++++---- tests/test_gui.py | 12 ++++++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/getthefish/gui/main.ui b/src/getthefish/gui/main.ui index 2f4b466..18c3a54 100644 --- a/src/getthefish/gui/main.ui +++ b/src/getthefish/gui/main.ui @@ -145,13 +145,13 @@ - 64 + 120 0 - 64 + 120 16777215 @@ -174,13 +174,13 @@ - 64 + 120 0 - 64 + 120 16777215 diff --git a/src/getthefish/gui/ui_main.py b/src/getthefish/gui/ui_main.py index c851b68..7e931f4 100644 --- a/src/getthefish/gui/ui_main.py +++ b/src/getthefish/gui/ui_main.py @@ -105,8 +105,8 @@ def setupUi(self, MainWindow): self.thresholdBobberSpinBox.setObjectName(u"thresholdBobberSpinBox") sizePolicy.setHeightForWidth(self.thresholdBobberSpinBox.sizePolicy().hasHeightForWidth()) self.thresholdBobberSpinBox.setSizePolicy(sizePolicy) - self.thresholdBobberSpinBox.setMinimumSize(QSize(64, 0)) - self.thresholdBobberSpinBox.setMaximumSize(QSize(64, 16777215)) + self.thresholdBobberSpinBox.setMinimumSize(QSize(120, 0)) + self.thresholdBobberSpinBox.setMaximumSize(QSize(120, 16777215)) self.verticalLayout_2.addWidget(self.thresholdBobberSpinBox) @@ -119,8 +119,8 @@ def setupUi(self, MainWindow): self.thresholdCatchSpinBox.setObjectName(u"thresholdCatchSpinBox") sizePolicy.setHeightForWidth(self.thresholdCatchSpinBox.sizePolicy().hasHeightForWidth()) self.thresholdCatchSpinBox.setSizePolicy(sizePolicy) - self.thresholdCatchSpinBox.setMinimumSize(QSize(64, 0)) - self.thresholdCatchSpinBox.setMaximumSize(QSize(64, 16777215)) + self.thresholdCatchSpinBox.setMinimumSize(QSize(120, 0)) + self.thresholdCatchSpinBox.setMaximumSize(QSize(120, 16777215)) self.verticalLayout_2.addWidget(self.thresholdCatchSpinBox) diff --git a/tests/test_gui.py b/tests/test_gui.py index 1a3c546..c870712 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -10,7 +10,7 @@ pytest.importorskip("pytestqt") from PySide6.QtCore import QPoint, Qt, QUrl -from PySide6.QtGui import QColor, QDesktopServices, QPixmap +from PySide6.QtGui import QColor, QDesktopServices, QFontMetrics, QPixmap from pytestqt.qtbot import QtBot from getthefish.bot import GetTheFish @@ -31,11 +31,15 @@ def window(qtbot: QtBot, tmp_path: Path) -> MainWindow: return w -def test_shows_config(window: MainWindow) -> None: +def test_shows_config(window: MainWindow, qtbot: QtBot) -> None: + window.show() + qtbot.waitExposed(window) assert window.ui.thresholdBobberSpinBox.value() == 18 assert window.ui.thresholdCatchSpinBox.value() == 60 - assert window.ui.thresholdBobberSpinBox.minimumWidth() >= 64 - assert window.ui.thresholdCatchSpinBox.minimumWidth() >= 64 + for spin in (window.ui.thresholdBobberSpinBox, window.ui.thresholdCatchSpinBox): + required_text_width = QFontMetrics(spin.lineEdit().font()).horizontalAdvance("255") + 12 + assert spin.width() >= 120 + assert spin.lineEdit().width() >= required_text_width assert window.ui.posStartLabel.text() == "200, 50" assert window.ui.posEndLabel.text() == "1100, 400" assert window.ui.hexColorLabel.text() == "#48290c" From 30bc0332a1d9f0f4ea299744749de555b38b4858 Mon Sep 17 00:00:00 2001 From: Baumfaust Date: Sat, 17 Oct 2026 21:02:55 +0000 Subject: [PATCH 2/2] Make config folder test platform independent --- tests/test_gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_gui.py b/tests/test_gui.py index c870712..3bb4b2d 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -54,7 +54,7 @@ def open_url(url: QUrl) -> bool: monkeypatch.setattr(QDesktopServices, "openUrl", open_url) window.ui.openConfigFolderButton.click() - assert opened == [str(window.config_path.parent.resolve())] + assert Path(opened[0]) == window.config_path.parent.resolve() def enter_cast_key(window: MainWindow, text: str) -> None: