pyqtgraph/tests/widgets/test_busycursor.py
Martin Chase 2fb04b754c
Fix BusyCursor to use internal stack provided by setOverrideCursor/restoreOverrideCursor (#1827)
* un-busy as many times as needed

* lint

* add test to prove cursor behavior

* tentative change in the hopes that all supported qt versions behave properly

* remove unnecessary code

* use contextmanager decorator instead of class

* use full path to WaitCursor

* restore docstring; refactor variable for clarity

* fix docstring whitespace

* break up long lines

* use variable to shorten instead
2021-06-09 13:32:24 -07:00

14 lines
549 B
Python

# -*- coding: utf-8 -*-
import pyqtgraph as pg
pg.mkQApp()
def test_nested_busy_cursors_clear_after_all_exit():
with pg.BusyCursor():
wait_cursor = pg.Qt.QtCore.Qt.CursorShape.WaitCursor
with pg.BusyCursor():
assert pg.Qt.QtGui.QApplication.overrideCursor().shape() == wait_cursor, "Cursor should be waiting"
assert pg.Qt.QtGui.QApplication.overrideCursor().shape() == wait_cursor, "Cursor should be waiting"
assert pg.Qt.QtGui.QApplication.overrideCursor() is None, "No override cursor should be set"