diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-03-24 13:15:54 +0000 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-05-07 13:48:08 +0000 |
commit | 3e12951c0b35041920989d6089ddb6c2f5c2d3d1 (patch) | |
tree | 6e4d691d4382fbc0b311fdbaf46ccec04ecdfe70 /tests/auto/gui/kernel/qscreen/tst_qscreen.cpp | |
parent | 5dcaa11cc26fabc4f4f1336681ac19217a9e0e91 (diff) |
Remove QScreen::orientationUpdateMask
It simplifies the API and reduces surprise to have rotation working by default.
On Android, the manifest specifies which orientations the application has
been designed to support; on iOS, it is controlled via the
UISupportedInterfaceOrientations property list key.
In addition, QWindow::contentOrientation() is another way to give
a hint to the window manager, or on iOS to directly control whether
the window's rotation is locked or not.
Task-number: QTBUG-35427
Task-number: QTBUG-38576
Task-number: QTBUG-44569
Task-number: QTBUG-51012
Task-number: QTBUG-83055
Change-Id: Ieed818497f686399db23813269af322bfdd237af
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qscreen/tst_qscreen.cpp')
-rw-r--r-- | tests/auto/gui/kernel/qscreen/tst_qscreen.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index c01ebabcf8..9f2a767d60 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -168,38 +168,33 @@ void tst_QScreen::orientationChange() qRegisterMetaType<Qt::ScreenOrientation>("Qt::ScreenOrientation"); QScreen *screen = QGuiApplication::primaryScreen(); - - screen->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation); + QSignalSpy spy(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation))); + int expectedSignalCount = 0; QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); + QCOMPARE(spy.count(), ++expectedSignalCount); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::PortraitOrientation); - - QSignalSpy spy(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation))); + QCOMPARE(spy.count(), ++expectedSignalCount); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedLandscapeOrientation); QWindowSystemInterface::flushWindowSystemEvents(); + QTRY_COMPARE(screen->orientation(), Qt::InvertedLandscapeOrientation); + QCOMPARE(spy.count(), ++expectedSignalCount); + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedPortraitOrientation); QWindowSystemInterface::flushWindowSystemEvents(); - QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); - QWindowSystemInterface::flushWindowSystemEvents(); - - QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(screen->orientation(), Qt::InvertedPortraitOrientation); + QCOMPARE(spy.count(), ++expectedSignalCount); - spy.clear(); - QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedLandscapeOrientation); + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); - QCOMPARE(spy.count(), 0); - - screen->setOrientationUpdateMask(screen->orientationUpdateMask() | Qt::InvertedLandscapeOrientation); - QTRY_COMPARE(screen->orientation(), Qt::InvertedLandscapeOrientation); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.count(), ++expectedSignalCount); } #include <tst_qscreen.moc> |