diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-12-16 13:23:51 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-12-16 13:31:00 (GMT) |
commit | f0347c8c0c37bd90dcaefb8f4b669096f7eb66b5 (patch) | |
tree | 31bc5c353ef4a7314c55df3c87f22d8f54641ba3 | |
parent | ab8a9e77d877fd53eaec8dca1eeca619a4ba81d6 (diff) | |
download | Qt-f0347c8c0c37bd90dcaefb8f4b669096f7eb66b5.zip Qt-f0347c8c0c37bd90dcaefb8f4b669096f7eb66b5.tar.gz Qt-f0347c8c0c37bd90dcaefb8f4b669096f7eb66b5.tar.bz2 |
Improved orientation change autotest
The test wasn't even compiling anymore, so fixed that. Also added
additional orientation change and an available geometry check after
each orientation change.
Reviewed-by: Sami Merila
-rw-r--r-- | tests/auto/symbian/orientationchange/orientationchange.pro | 1 | ||||
-rw-r--r-- | tests/auto/symbian/orientationchange/tst_orientationchange.cpp | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/symbian/orientationchange/orientationchange.pro b/tests/auto/symbian/orientationchange/orientationchange.pro index 08b34f9..98aa2ad 100644 --- a/tests/auto/symbian/orientationchange/orientationchange.pro +++ b/tests/auto/symbian/orientationchange/orientationchange.pro @@ -4,4 +4,5 @@ SOURCES += tst_orientationchange.cpp symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + LIBS += -lcone -leikcore -lavkon # Screen orientation } diff --git a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp index eb3709d..2ac2f7f 100644 --- a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp +++ b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp @@ -45,6 +45,8 @@ #include <eikenv.h> #include <aknappui.h> +#include <private/qcore_symbian_p.h> +#include <QDesktopWidget> class tst_orientationchange : public QObject { @@ -151,6 +153,47 @@ void tst_orientationchange::resizeEventOnOrientationChange() } QCOMPARE(normalWidget->resizeEventCount, 0); + QDesktopWidget desktop; + QRect qtAvail = desktop.availableGeometry(normalWidget); + TRect clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect(); + QRect symbianAvail = qt_TRect2QRect(clientRect); + QCOMPARE(qtAvail, symbianAvail); + + // Switch orientation back to original + orientation = orientation == CAknAppUi::EAppUiOrientationPortrait + ? CAknAppUi::EAppUiOrientationLandscape + : CAknAppUi::EAppUiOrientationPortrait; + + + fullScreenWidget->reset(); + maximizedWidget->reset(); + normalWidget->reset(); + + TRAP(err, appUi->SetOrientationL(orientation)); + + QCoreApplication::sendPostedEvents(); + QCoreApplication::sendPostedEvents(); + + // setOrientationL is not guaranteed to change orientation + // (if emulator configured to support just portrait or landscape, then + // setOrientationL call shouldn't do anything). + // So let's ensure that we do not get resize event twice. + + QVERIFY(fullScreenWidget->resizeEventCount <= 1); + if (fullScreenWidget->resizeEventCount) { + QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); + } + QVERIFY(maximizedWidget->resizeEventCount <= 1); + if (fullScreenWidget->resizeEventCount) { + QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); + } + QCOMPARE(normalWidget->resizeEventCount, 0); + + qtAvail = desktop.availableGeometry(normalWidget); + clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect(); + symbianAvail = qt_TRect2QRect(clientRect); + QCOMPARE(qtAvail, symbianAvail); + TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified)); delete normalWidget; |