From aaea23708a46259094a8203f73ee0650c362d85f Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 10 Feb 2014 15:51:16 +0100 Subject: 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 --- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 41 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp') 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(); + + 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(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() -- cgit v1.2.3