--- a/tests/auto/qapplication/tst_qapplication.cpp Tue Feb 02 00:43:10 2010 +0200
+++ b/tests/auto/qapplication/tst_qapplication.cpp Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,6 +53,9 @@
#ifdef Q_OS_WINCE
#include <windows.h>
#endif
+#ifdef Q_OS_SYMBIAN
+#include <aknenv.h>
+#endif
//TESTED_CLASS=
//TESTED_FILES=
@@ -138,6 +141,8 @@
void touchEventPropagation();
+ void symbianNoApplicationPanes();
+
void symbianNeedForTraps();
void symbianLeaveThroughMain();
};
@@ -2036,6 +2041,89 @@
}
}
+void tst_QApplication::symbianNoApplicationPanes()
+{
+#ifndef Q_OS_SYMBIAN
+ QSKIP("This is a Symbian only test", SkipAll);
+#else
+ QApplication::setAttribute(Qt::AA_S60DontConstructApplicationPanes);
+
+ // Run in a block so that QApplication is destroyed before resetting the attribute.
+ {
+ // Actually I wasn't able to get the forced orientation change to work properly,
+ // but I'll leave the code here for the future in case we manage to test that
+ // later. If someone knows how to force an orientation switch in an autotest, do
+ // feel free to fix this testcase.
+ int argc = 0;
+ QApplication app(argc, 0);
+ QWidget *w;
+
+ w = new QWidget;
+ w->show();
+ QT_TRAP_THROWING(static_cast<CAknAppUi *>(CCoeEnv::Static()->AppUi())
+ ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
+ app.processEvents();
+ delete w;
+
+ w = new QWidget;
+ w->show();
+ QT_TRAP_THROWING(static_cast<CAknAppUi *>(CCoeEnv::Static()->AppUi())
+ ->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait));
+ app.processEvents();
+ delete w;
+
+ w = new QWidget;
+ w->showMaximized();
+ QT_TRAP_THROWING(static_cast<CAknAppUi *>(CCoeEnv::Static()->AppUi())
+ ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
+ app.processEvents();
+ delete w;
+
+ w = new QWidget;
+ w->showMaximized();
+ QT_TRAP_THROWING(static_cast<CAknAppUi *>(CCoeEnv::Static()->AppUi())
+ ->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait));
+ app.processEvents();
+ delete w;
+
+ w = new QWidget;
+ w->showFullScreen();
+ QT_TRAP_THROWING(static_cast<CAknAppUi *>(CCoeEnv::Static()->AppUi())
+ ->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape));
+ app.processEvents();
+ delete w;
+
+ w = new QWidget;
+ w->showFullScreen();
+ QT_TRAP_THROWING(static_cast<CAknAppUi *>(CCoeEnv::Static()->AppUi())
+ ->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait));
+ app.processEvents();
+ delete w;
+
+ // These will have no effect, since there is no status pane, but they shouldn't
+ // crash either.
+ w = new QWidget;
+ w->show();
+ w->setWindowTitle("Testing title");
+ app.processEvents();
+ delete w;
+
+ w = new QWidget;
+ w->show();
+ w->setWindowIcon(QIcon(QPixmap("heart.svg")));
+ app.processEvents();
+ delete w;
+
+ QDesktopWidget desktop;
+ QCOMPARE(desktop.availableGeometry(), desktop.screenGeometry());
+ }
+
+ QApplication::setAttribute(Qt::AA_S60DontConstructApplicationPanes, false);
+
+ // No other error condition. Program will crash if unsuccessful.
+#endif
+}
+
#ifdef Q_OS_SYMBIAN
class CBaseDummy : public CBase
{