From 16c2622fe7e8e43bdb6447399c816cd22c3c2f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 11 Jan 2012 13:16:24 +0100 Subject: Made it possible to report screen changes through QWindowSystemInterface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it possible for platform plugin independent code (such as generic plugins) to report changes to screen properties. An example would be an accelerometer plugin that reports orientation changes without knowing anything about the windowing system. Change-Id: I984984b6d064327772c264bc942269422451da37 Reviewed-by: Jørgen Lind --- tests/auto/gui/kernel/qscreen/tst_qscreen.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/gui/kernel/qscreen/tst_qscreen.cpp') diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index a168203bdd..ab798a7351 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -52,6 +52,7 @@ private slots: void angleBetween(); void transformBetween_data(); void transformBetween(); + void orientationChange(); }; void tst_QScreen::angleBetween_data() @@ -163,5 +164,16 @@ void tst_QScreen::transformBetween() QCOMPARE(QScreen::transformBetween(a, b, rect), expected); } +void tst_QScreen::orientationChange() +{ + QScreen *screen = QGuiApplication::primaryScreen(); + + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); + QTRY_COMPARE(screen->currentOrientation(), Qt::LandscapeOrientation); + + QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation); + QTRY_COMPARE(screen->currentOrientation(), Qt::PortraitOrientation); +} + #include QTEST_MAIN(tst_QScreen); -- cgit v1.2.3