summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-31 20:09:14 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-01 06:02:55 +0100
commita732576a66ff2bbd9c0b41cd5f3505a4d2fbf043 (patch)
treed09875c3543ad837fbfaaf10bd4eef1d3de42941 /tests/auto/gui
parentcd9de59177ccbeb7fdfacf8716af7bb20112c880 (diff)
parent8e20daae9fee5f3b999daffce0d7156015ee974b (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: config.tests/win/msvc_version.cpp configure.pri mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf src/corelib/io/qsettings_mac.cpp src/corelib/json/qjsondocument.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.h src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/qiosintegration.h src/plugins/platforms/minimalegl/qminimaleglintegration.cpp tests/auto/gui/painting/qpainter/tst_qpainter.cpp tools/configure/environment.cpp Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp20
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp19
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp28
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp1
4 files changed, 67 insertions, 1 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index a41c574454..6ec0268d96 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -779,6 +779,24 @@ void tst_QWindow::isActive()
// child has focus
QVERIFY(window.isActive());
+ // test focus back to parent and then back to child (QTBUG-39362)
+ // also verify the cumulative FocusOut and FocusIn counts
+ // activate parent
+ window.requestActivate();
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
+ QVERIFY(window.isActive());
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(child.received(QEvent::FocusOut), 1);
+ QTRY_COMPARE(window.received(QEvent::FocusIn), 2);
+
+ // activate child again
+ child.requestActivate();
+ QTRY_COMPARE(QGuiApplication::focusWindow(), &child);
+ QVERIFY(child.isActive());
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(window.received(QEvent::FocusOut), 2);
+ QTRY_COMPARE(child.received(QEvent::FocusIn), 2);
+
Window dialog;
dialog.setTransientParent(&window);
dialog.setGeometry(QRect(m_availableTopLeft + QPoint(110, 100), m_testWindowSize));
@@ -803,7 +821,7 @@ void tst_QWindow::isActive()
QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
QCoreApplication::processEvents();
QTRY_COMPARE(dialog.received(QEvent::FocusOut), 1);
- QTRY_COMPARE(window.received(QEvent::FocusIn), 2);
+ QTRY_COMPARE(window.received(QEvent::FocusIn), 3);
QVERIFY(window.isActive());
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 8a9c4ca84e..254ab1f8ad 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -298,6 +298,8 @@ private slots:
void rotateImage_data();
void rotateImage();
+ void QTBUG56252();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5120,6 +5122,23 @@ void tst_QPainter::rotateImage()
}
+void tst_QPainter::QTBUG56252()
+{
+ QImage sourceImage(1770, 1477, QImage::Format_RGB32);
+ QImage rotatedImage(1478, 1771, QImage::Format_RGB32);
+ QTransform transformCenter;
+ transformCenter.translate(739.0, 885.5);
+ transformCenter.rotate(270.0);
+ transformCenter.translate(-885.0, -738.5);
+ QPainter painter;
+ painter.begin(&rotatedImage);
+ painter.setTransform(transformCenter);
+ painter.drawImage(QPoint(0, 0),sourceImage);
+ painter.end();
+
+ // If no crash or illegal memory read, all is fine
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index ed48a4978a..44921f68aa 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -109,6 +109,7 @@ private slots:
void vaoCreate();
void bufferCreate();
void bufferMapRange();
+ void defaultQGLCurrentBuffer();
};
struct SharedResourceTracker
@@ -1520,6 +1521,33 @@ void tst_QOpenGL::bufferMapRange()
ctx->doneCurrent();
}
+void tst_QOpenGL::defaultQGLCurrentBuffer()
+{
+ QScopedPointer<QSurface> surface(createSurface(QSurface::Window));
+ QScopedPointer<QOpenGLContext> ctx(new QOpenGLContext);
+ ctx->create();
+ ctx->makeCurrent(surface.data());
+
+ // Bind default FBO on the current context, and record what's the current QGL FBO. It should
+ // be Q_NULLPTR because the default platform OpenGL FBO is not backed by a
+ // QOpenGLFramebufferObject.
+ QOpenGLFramebufferObject::bindDefault();
+ QOpenGLFramebufferObject *defaultQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo;
+
+ // Create new FBO, bind it, and see that the QGL FBO points to the newly created FBO.
+ QScopedPointer<QOpenGLFramebufferObject> obj(new QOpenGLFramebufferObject(128, 128));
+ obj->bind();
+ QOpenGLFramebufferObject *customQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo;
+ QVERIFY(defaultQFBO != customQFBO);
+
+ // Bind the default FBO, and check that the QGL FBO points to the original FBO object.
+ QOpenGLFramebufferObject::bindDefault();
+ QOpenGLFramebufferObject *finalQFBO = QOpenGLContextPrivate::get(ctx.data())->qgl_current_fbo;
+ QCOMPARE(defaultQFBO, finalQFBO);
+
+ ctx->doneCurrent();
+}
+
void tst_QOpenGL::nullTextureInitializtion()
{
QScopedPointer<QSurface> surface(createSurface(QSurface::Window));
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 45cfd6f43a..dbe5bf7cc6 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -844,6 +844,7 @@ void tst_QCssParser::colorValue_data()
QTest::newRow("hsla") << "color: hsva(10, 20, 30, 40)" << QColor::fromHsv(10, 20, 30, 40);
QTest::newRow("invalid1") << "color: rgb(why, does, it, always, rain, on, me)" << QColor();
QTest::newRow("invalid2") << "color: rgba(i, meant, norway)" << QColor();
+ QTest::newRow("invalid3") << "color: rgb(21)" << QColor();
QTest::newRow("role") << "color: palette(base)" << qApp->palette().color(QPalette::Base);
QTest::newRow("role2") << "color: palette( window-text ) " << qApp->palette().color(QPalette::WindowText);
QTest::newRow("transparent") << "color: transparent" << QColor(Qt::transparent);