summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-16 15:52:47 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-16 15:52:47 (GMT)
commit51bf60d7c79f94cee293aa9dbdc33da60327aaf7 (patch)
tree354edf664d8f26945da7a04847c296c1ae01fa40
parenta211d4cdeea830949e4de647f5ec850bb030212e (diff)
parentf0347c8c0c37bd90dcaefb8f4b669096f7eb66b5 (diff)
downloadQt-51bf60d7c79f94cee293aa9dbdc33da60327aaf7.zip
Qt-51bf60d7c79f94cee293aa9dbdc33da60327aaf7.tar.gz
Qt-51bf60d7c79f94cee293aa9dbdc33da60327aaf7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public: Improved orientation change autotest Avoid duplicate resize event
-rw-r--r--src/gui/kernel/qapplication_s60.cpp6
-rw-r--r--tests/auto/symbian/orientationchange/orientationchange.pro1
-rw-r--r--tests/auto/symbian/orientationchange/tst_orientationchange.cpp43
3 files changed, 48 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 6db1fa8..181fcc7 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1174,8 +1174,10 @@ void QSymbianControl::SizeChanged()
if (!slowResize && tlwExtra)
tlwExtra->inTopLevelResize = false;
} else {
- QResizeEvent *e = new QResizeEvent(newSize, oldSize);
- QApplication::postEvent(qwidget, e);
+ if (!qwidget->testAttribute(Qt::WA_PendingResizeEvent)) {
+ QResizeEvent *e = new QResizeEvent(newSize, oldSize);
+ QApplication::postEvent(qwidget, e);
+ }
}
}
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;