Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/getthefish/gui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@
</property>
<property name="minimumSize">
<size>
<width>64</width>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<width>120</width>
<height>16777215</height>
</size>
</property>
Expand All @@ -174,13 +174,13 @@
</property>
<property name="minimumSize">
<size>
<width>64</width>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<width>120</width>
<height>16777215</height>
</size>
</property>
Expand Down
8 changes: 4 additions & 4 deletions src/getthefish/gui/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down
14 changes: 9 additions & 5 deletions tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -50,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:
Expand Down
Loading