diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-06-05 14:17:24 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-06 07:41:17 +0200 |
commit | 80653bf4ce8d03f4af2fe8cc2f3751d32bd31d75 (patch) | |
tree | 92c8f2d94a8348e61651391f1aec0fdf2950c359 /tests/auto/gui | |
parent | 09001e72dc527cb50d84c15d7afdfb4b4116c883 (diff) |
Added QScreen::setOrientationUpdateMask().
It might be too expensive to always have an accelerometer sensor
running, so introduce API so that the application has to explictly ask
to get the orientation updates it's interested in.
Change-Id: Ib7dc5ad8807718409f744ebef53f4476aa05175d
Reviewed-by: Ian Monroe <ian.monroe@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/kernel/qscreen/tst_qscreen.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index 475b6ca2a8..e6c28867c6 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -177,13 +177,26 @@ void tst_QScreen::transformBetween() void tst_QScreen::orientationChange() { + qRegisterMetaType<Qt::ScreenOrientation>("Qt::ScreenOrientation"); + QScreen *screen = QGuiApplication::primaryScreen(); + screen->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation); + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation); QTRY_COMPARE(screen->orientation(), Qt::PortraitOrientation); + + QSignalSpy spy(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation))); + + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedLandscapeOrientation); + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedPortraitOrientation); + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); + + QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); + QCOMPARE(spy.count(), 1); } #include <tst_qscreen.moc> |