Skip to content

Commit

Permalink
Remove HoverMove and reference issue about test failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntoll committed Feb 28, 2020
1 parent ba93459 commit d52cbe8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
12 changes: 3 additions & 9 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,15 +1991,9 @@ def eventFilter(self, obj, event):
if t == QEvent.MouseButtonPress:
if event.button() == Qt.LeftButton:
self._on_left_click()
# HERE BE DRAGONS.
# The checks for "not self.downloading" in the following lines of code
# probably look strange. The obvious thing to do is to wrap such a
# check as a conditional. However, for reasons that are not entirely
# clear, this regularly caused random crashes when running the test
# suite (on Ubuntu 18.04, Python3.7). The following code expresses the
# same logic but without causing the random the crash of the test
# suite.
if (t == QEvent.HoverEnter or t == QEvent.HoverMove) and not self.downloading:
# See https://github.com/freedomofpress/securedrop-client/issues/835
# for context on code below.
if t == QEvent.HoverEnter and not self.downloading:
self.download_button.setIcon(load_icon('download_file_hover.svg'))
elif t == QEvent.HoverLeave and not self.downloading:
self.download_button.setIcon(load_icon('download_file.svg'))
Expand Down
5 changes: 0 additions & 5 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,11 +1500,6 @@ def test_FileWidget_event_handler_hover(mocker, session, source):
fw.eventFilter(fw, test_event)
assert fw.download_button.setIcon.call_count == 1
fw.download_button.setIcon.reset_mock()
# Hover move
test_event = QEvent(QEvent.HoverMove)
fw.eventFilter(fw, test_event)
assert fw.download_button.setIcon.call_count == 1
fw.download_button.setIcon.reset_mock()
# Hover leave
test_event = QEvent(QEvent.HoverLeave)
fw.eventFilter(fw, test_event)
Expand Down

0 comments on commit d52cbe8

Please sign in to comment.