summaryrefslogtreecommitdiffstats
path: root/tests/auto/symbian
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/symbian')
-rw-r--r--tests/auto/symbian/orientationchange/orientationchange.pro1
-rw-r--r--tests/auto/symbian/orientationchange/tst_orientationchange.cpp43
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;