aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-06 16:39:07 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-06 18:02:03 +0000
commit4ee18ba27bb63f8dd3d7772b67f21c7aa7817e5c (patch)
treea201cb299298c6d2bc37244c749c13214028ff64 /sources/pyside2
parentd81f111a13177f1fc78e770baa645a02125feaac (diff)
Fix some tests
- QOpenGLBuffer has been moved to QtOpenGL - QPrinter no longer has API for the margins taking tuples Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I8cc6661f754f0cda3fecc56a9a7243f7501e56b9 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py30
-rw-r--r--sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py19
2 files changed, 15 insertions, 34 deletions
diff --git a/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py b/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py
index a5d8385c9..5500c7c57 100644
--- a/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py
+++ b/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py
@@ -38,50 +38,50 @@ from init_paths import init_test_paths
init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide2.QtGui import QOpenGLBuffer
-from PySide2 import QtGui
+from PySide2.QtGui import QOffscreenSurface, QOpenGLContext, QSurface, QWindow
+from PySide2.QtOpenGL import QOpenGLBuffer
def createSurface(surfaceClass):
- if surfaceClass == QtGui.QSurface.Window:
- window = QtGui.QWindow()
- window.setSurfaceType(QtGui.QWindow.OpenGLSurface)
+ if surfaceClass == QSurface.Window:
+ window = QWindow()
+ window.setSurfaceType(QWindow.OpenGLSurface)
window.setGeometry(0, 0, 10, 10)
window.create()
return window
- elif surfaceClass == QtGui.QSurface.Offscreen:
+ elif surfaceClass == QSurface.Offscreen:
# Create a window and get the format from that. For example, if an EGL
# implementation provides 565 and 888 configs for PBUFFER_BIT but only
# 888 for WINDOW_BIT, we may end up with a pbuffer surface that is
# incompatible with the context since it could choose the 565 while the
# window and the context uses a config with 888.
- format = QtGui.QSurfaceFormat
+ format = QSurfaceFormat
if format.redBufferSize() == -1:
- window = QtGui.QWindow()
- window.setSurfaceType(QtGui.QWindow.OpenGLSurface)
+ window = QWindow()
+ window.setSurfaceType(QWindow.OpenGLSurface)
window.setGeometry(0, 0, 10, 10)
window.create()
format = window.format()
- offscreenSurface = QtGui.QOffscreenSurface()
+ offscreenSurface = QOffscreenSurface()
offscreenSurface.setFormat(format)
offscreenSurface.create()
return offscreenSurface
return 0
-class QOpenGLBuffer(UsesQApplication):
+class QOpenGLBufferTest(UsesQApplication):
def testBufferCreate(self):
- surface = createSurface(QtGui.QSurface.Window)
- ctx = QtGui.QOpenGLContext()
+ surface = createSurface(QSurface.Window)
+ ctx = QOpenGLContext()
ctx.create()
ctx.makeCurrent(surface)
- buf = QtGui.QOpenGLBuffer()
+ buf = QOpenGLBuffer()
self.assertTrue(not buf.isCreated())
self.assertTrue(buf.create())
self.assertTrue(buf.isCreated())
- self.assertEqual(buf.type(), QtGui.QOpenGLBuffer.VertexBuffer)
+ self.assertEqual(buf.type(), QOpenGLBuffer.VertexBuffer)
buf.bind()
buf.allocate(128)
diff --git a/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py b/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
index 0a3a72fc0..1c9ee918d 100644
--- a/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
+++ b/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
@@ -81,25 +81,6 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication):
obj = QTextCursor()
self.assertEqual(obj.selectedTableCells(), (-1, -1, -1, -1))
- def testQPrinterGetPageMargins(self):
- # Bug #742. Find a printer like PDF/XPS on which arbitrary margins can be set.
- printer = None
- for printerInfo in QPrinterInfo.availablePrinters():
- name = printerInfo.printerName().lower()
- if "xps" in name or "pdf" in name:
- printer = QPrinter(printerInfo)
- break
- if not printer:
- printer = QPrinter()
- printer.setPrinterName("Print to PDF")
- printer.setOutputFormat(QPrinter.PdfFormat)
- # On macOS the minimum margin of a page is ~12, setting something lower than that will
- # actually fail to set all the margins.
- values = (15.0, 16.0, 17.0, 18.0, QPrinter.Point)
- printer.setPageMargins(*values)
- actual = printer.getPageMargins(QPrinter.Point)
- print(printer.printerName(), actual, values[:-1])
- self.assertTrue(self.compareTuples(actual, values[:-1]))
if __name__ == "__main__":
unittest.main()