Merge pull request #1541 from pijyoi/remove_qt4_qtest_shim

use qWaitForWindowExposed instead of qWaitForWindowShown
This commit is contained in:
Ogi Moore 2021-02-04 16:15:39 -08:00 committed by GitHub
commit f336ac2d91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 12 deletions

View File

@ -213,7 +213,6 @@ elif QT_LIB == PYQT5:
QtSvg = FailedImport(err) QtSvg = FailedImport(err)
try: try:
from PyQt5 import QtTest from PyQt5 import QtTest
QtTest.QTest.qWaitForWindowShown = QtTest.QTest.qWaitForWindowExposed
except ImportError as err: except ImportError as err:
QtTest = FailedImport(err) QtTest = FailedImport(err)
@ -232,7 +231,6 @@ elif QT_LIB == PYQT6:
QtOpenGLWidgets = FailedImport(err) QtOpenGLWidgets = FailedImport(err)
try: try:
from PyQt6 import QtTest from PyQt6 import QtTest
QtTest.QTest.qWaitForWindowShown = QtTest.QTest.qWaitForWindowExposed
except ImportError as err: except ImportError as err:
QtTest = FailedImport(err) QtTest = FailedImport(err)
@ -247,7 +245,6 @@ elif QT_LIB == PYSIDE2:
QtSvg = FailedImport(err) QtSvg = FailedImport(err)
try: try:
from PySide2 import QtTest from PySide2 import QtTest
QtTest.QTest.qWaitForWindowShown = QtTest.QTest.qWaitForWindowExposed
except ImportError as err: except ImportError as err:
QtTest = FailedImport(err) QtTest = FailedImport(err)
@ -273,7 +270,6 @@ elif QT_LIB == PYSIDE6:
QtOpenGLWidgets = FailedImport(err) QtOpenGLWidgets = FailedImport(err)
try: try:
from PySide6 import QtTest from PySide6 import QtTest
QtTest.QTest.qWaitForWindowShown = QtTest.QTest.qWaitForWindowExposed
except ImportError as err: except ImportError as err:
QtTest = FailedImport(err) QtTest = FailedImport(err)

View File

@ -27,7 +27,7 @@ def init_viewbox():
vb.setRange(xRange=[0, 10], yRange=[0, 10], padding=0) vb.setRange(xRange=[0, 10], yRange=[0, 10], padding=0)
# required to make mapFromView work properly. # required to make mapFromView work properly.
qtest.qWaitForWindowShown(win) qtest.qWaitForWindowExposed(win)
g = pg.GridItem() g = pg.GridItem()
vb.addItem(g) vb.addItem(g)

View File

@ -28,7 +28,7 @@ def test_ImageItem(transpose=False):
data[3, :10] = dmax + 13 data[3, :10] = dmax + 13
img.setImage(data) img.setImage(data)
QtTest.QTest.qWaitForWindowShown(w) QtTest.QTest.qWaitForWindowExposed(w)
time.sleep(0.1) time.sleep(0.1)
app.processEvents() app.processEvents()
assertImageApproved(w, 'imageitem/init', 'Init image item. View is auto-scaled, image axis 0 marked by 1 line, axis 1 is marked by 2 lines. Origin in bottom-left.') assertImageApproved(w, 'imageitem/init', 'Init image item. View is auto-scaled, image axis 0 marked by 1 line, axis 1 is marked by 2 lines. Origin in bottom-left.')

View File

@ -16,7 +16,7 @@ def test_InfiniteLine():
plt.resize(600, 600) plt.resize(600, 600)
# seemingly arbitrary requirements; might need longer wait time for some platforms.. # seemingly arbitrary requirements; might need longer wait time for some platforms..
QtTest.QTest.qWaitForWindowShown(plt) QtTest.QTest.qWaitForWindowExposed(plt)
QtTest.QTest.qWait(100) QtTest.QTest.qWait(100)
vline = plt.addLine(x=1) vline = plt.addLine(x=1)

View File

@ -70,7 +70,7 @@ def test_NonUniformImage_lut():
h = image.getHistogram() h = image.getHistogram()
lut.plot.setData(*h) lut.plot.setData(*h)
QtTest.QTest.qWaitForWindowShown(window) QtTest.QTest.qWaitForWindowExposed(window)
QtTest.QTest.qWait(100) QtTest.QTest.qWait(100)
assertImageApproved(window, 'nonuniform_image/lut-3x3') assertImageApproved(window, 'nonuniform_image/lut-3x3')
@ -98,7 +98,7 @@ def test_NonUniformImage_colormap():
viewbox.addItem(image) viewbox.addItem(image)
QtTest.QTest.qWaitForWindowShown(window) QtTest.QTest.qWaitForWindowExposed(window)
QtTest.QTest.qWait(100) QtTest.QTest.qWait(100)
assertImageApproved(window, 'nonuniform_image/colormap-3x3') assertImageApproved(window, 'nonuniform_image/colormap-3x3')

View File

@ -174,7 +174,7 @@ def test_PolyLineROI():
plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly. plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly.
# seemingly arbitrary requirements; might need longer wait time for some platforms.. # seemingly arbitrary requirements; might need longer wait time for some platforms..
QtTest.QTest.qWaitForWindowShown(plt) QtTest.QTest.qWaitForWindowExposed(plt)
QtTest.QTest.qWait(100) QtTest.QTest.qWait(100)
for r, name in rois: for r, name in rois:

View File

@ -10,8 +10,8 @@ def resizeWindow(win, w, h, timeout=2.0):
""" """
QtGui.QApplication.processEvents() QtGui.QApplication.processEvents()
# Sometimes the window size will switch multiple times before settling # Sometimes the window size will switch multiple times before settling
# on its final size. Adding qWaitForWindowShown seems to help with this. # on its final size. Adding qWaitForWindowExposed seems to help with this.
QtTest.QTest.qWaitForWindowShown(win) QtTest.QTest.qWaitForWindowExposed(win)
win.resize(w, h) win.resize(w, h)
start = time.time() start = time.time()
while True: while True: