Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Fix test_overlay #299

Merged
merged 2 commits into from
May 24, 2024
Merged
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
9 changes: 5 additions & 4 deletions orangecanvas/utils/tests/test_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import unittest.mock

from AnyQt.QtCore import Qt, QEvent
from AnyQt.QtTest import QTest
from AnyQt.QtTest import QTest, QSignalSpy
from AnyQt.QtWidgets import QWidget, QApplication

from orangecanvas.gui.test import QAppTestCase
Expand All @@ -13,6 +13,7 @@

class TestOverlay(QAppTestCase):
def setUp(self) -> None:
super().setUp()
self.container = QWidget()
self.overlay = NotificationOverlay(self.container)
self.server = NotificationServer()
Expand All @@ -30,6 +31,7 @@ def tearDown(self) -> None:
self.overlay = None
self.notif = None
self.server = None
super().tearDown()

def test_notification_widget(self):
stdb = NotificationWidget.Ok | NotificationWidget.Close
Expand Down Expand Up @@ -77,8 +79,7 @@ def test_two_overlays(self):
self.server.newNotification.connect(overlay2.addNotification)
self.server.nextNotification.connect(overlay2.nextWidget)

mock = unittest.mock.MagicMock()
self.notif.accepted.connect(mock)
spy = QSignalSpy(self.notif.accepted)

self.server.registerNotification(self.notif)

Expand All @@ -94,7 +95,7 @@ def test_two_overlays(self):
button = w2.button(NotificationWidget.Ok)
QTest.mouseClick(button, Qt.LeftButton)

mock.assert_called_once_with()
self.assertSequenceEqual(list(spy), [[]])

self.assertFalse(w1.isVisible())
self.assertFalse(w2.isVisible())
Expand Down
Loading