aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-02-10 15:51:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-25 17:08:02 +0100
commitaaea23708a46259094a8203f73ee0650c362d85f (patch)
tree2d6dda4f7542fd091bca8008f962bc8fcb6ffc41 /tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
parentb9f74e7467f31b63bd0ff2ae9d66bcd61a8b8b6f (diff)
Introduced a few more signals to QQuickWindow.
Also marked the new afterAnimation() signal as \since 5.3 and introduced proper revisioning on the new signals. [Changelog][QtQuick] Added QQuickWindow::afterSynchronizing(), openglContextCreated(), sceneGraphAboutToStop(). Useful for deeper integration with the rendering. Change-Id: I5532b310506c2432325595e55ef9307b8934abee Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp')
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index edde8d2134..73e45fa719 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -295,6 +295,8 @@ private slots:
QWindowSystemInterface::registerTouchDevice(touchDeviceWithVelocity);
}
+ void openglContextCreatedSignal();
+ void aboutToStopSignal();
void constantUpdates();
void constantUpdatesOnWindow_data();
@@ -358,7 +360,38 @@ private:
QTouchDevice *touchDeviceWithVelocity;
};
-//If the item calls update inside updatePaintNode, it should schedule another update
+Q_DECLARE_METATYPE(QOpenGLContext *);
+
+void tst_qquickwindow::openglContextCreatedSignal()
+{
+ qRegisterMetaType<QOpenGLContext *>();
+
+ QQuickWindow window;
+ QSignalSpy spy(&window, SIGNAL(openglContextCreated(QOpenGLContext *)));
+
+ window.show();
+ QTest::qWaitForWindowExposed(&window);
+
+ QVERIFY(spy.size() > 0);
+
+ QVariant ctx = spy.at(0).at(0);
+ QCOMPARE(qVariantValue<QOpenGLContext *>(ctx), window.openglContext());
+}
+
+void tst_qquickwindow::aboutToStopSignal()
+{
+ QQuickWindow window;
+ window.show();
+ QTest::qWaitForWindowExposed(&window);
+
+ QSignalSpy spy(&window, SIGNAL(sceneGraphAboutToStop()));
+
+ window.hide();
+
+ QVERIFY(spy.count() > 0);
+}
+
+//If the item calls update inside updatePaintNode, it should schedule another sync pass
void tst_qquickwindow::constantUpdates()
{
QQuickWindow window;
@@ -366,10 +399,12 @@ void tst_qquickwindow::constantUpdates()
ConstantUpdateItem item(window.contentItem());
window.show();
- QSignalSpy spy(&window, SIGNAL(beforeSynchronizing()));
+ QSignalSpy beforeSpy(&window, SIGNAL(beforeSynchronizing()));
+ QSignalSpy afterSpy(&window, SIGNAL(afterSynchronizing()));
QTRY_VERIFY(item.iterations > 10);
- QTRY_VERIFY(spy.count() > 10);
+ QTRY_VERIFY(beforeSpy.count() > 10);
+ QTRY_VERIFY(afterSpy.count() > 10);
}
void tst_qquickwindow::constantUpdatesOnWindow_data()