Skip to content

Commit

Permalink
Fixed arc gauge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
e100 committed Jun 21, 2024
1 parent c7ce18b commit 1eabaab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pyefis/instruments/gauges/arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def resizeEvent(self, event):
elif self.name_location == 'right':
self.nameFontSize = helpers.fit_to_mask(self.r_width / 2.1, (self.r_height / 2.8)/2, self.name_font_mask, self.font_family)
else:
raise SyntaxError(f"Unknown location: {self.name_location}")
# Should we throw exception or log error here?
pass

def paintEvent(self, e):
start = self.startAngle
Expand Down Expand Up @@ -243,7 +244,8 @@ def paintEvent(self, e):
else:
p.drawText(QPointF( self.lrcx - x, self.lrcy - (y/1.1) ), self.name)
else:
raise SyntaxError(f"Unknown location: {self.name_location}")
# Should we throw exception or log error here?
pass
# Main value text
if self.font_mask:
opt = QTextOption(Qt.AlignRight)
Expand Down
14 changes: 14 additions & 0 deletions tests/instruments/gauges/test_arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,17 @@ def test_arc_gauge_branches(fix,qtbot):
widget.show()
qtbot.waitExposed(widget)
qtbot.wait(2000)


def test_unknown_location(fix,qtbot):
widget = gauges.ArcGauge(min_size=False)
assert widget.getRatio() == 2
widget.setDbkey("NUM")
widget.setupGauge()
qtbot.addWidget(widget)
widget.name_location = 'unknown'
widget.name_font_mask = "XXX"
hmi.initialize({})
widget.resize(100,100)
widget.show()
widget.paintEvent(None)

0 comments on commit 1eabaab

Please sign in to comment.