diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-10-28 08:45:04 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-10-28 08:45:04 (GMT) |
commit | 1ec19ed5a69b8b0e11c81037c270072736f48e40 (patch) | |
tree | 869800a523b46e527d04c9973f36e294dd101978 /tests/auto/qapplication | |
parent | 0444453661df0f56fd034778028c7abdc0b621cc (diff) | |
parent | 1583d643285641bf71e6a107331d788acca9850c (diff) | |
download | Qt-1ec19ed5a69b8b0e11c81037c270072736f48e40.zip Qt-1ec19ed5a69b8b0e11c81037c270072736f48e40.tar.gz Qt-1ec19ed5a69b8b0e11c81037c270072736f48e40.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6-WM_NULL-driven
Diffstat (limited to 'tests/auto/qapplication')
-rw-r--r-- | tests/auto/qapplication/tst_qapplication.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp index 97aa092..675e559 100644 --- a/tests/auto/qapplication/tst_qapplication.cpp +++ b/tests/auto/qapplication/tst_qapplication.cpp @@ -136,6 +136,9 @@ private slots: void windowsCommandLine(); void touchEventPropagation(); + + void symbianNeedForTraps(); + void symbianLeaveThroughMain(); }; class EventSpy : public QObject @@ -2011,6 +2014,66 @@ void tst_QApplication::touchEventPropagation() } } +#ifdef Q_OS_SYMBIAN +class CBaseDummy : public CBase +{ +public: + CBaseDummy(int *numDestroyed) : numDestroyed(numDestroyed) + { + } + ~CBaseDummy() + { + (*numDestroyed)++; + } + +private: + int *numDestroyed; +}; + +static void fakeMain(int *numDestroyed) +{ + // Push a few objects, just so that the cleanup stack has something to clean up. + CleanupStack::PushL(new (ELeave) CBaseDummy(numDestroyed)); + int argc = 0; + QApplication app(argc, 0); + CleanupStack::PushL(new (ELeave) CBaseDummy(numDestroyed)); + + User::Leave(KErrGeneral); // Fake error +} +#endif + +void tst_QApplication::symbianNeedForTraps() +{ +#ifndef Q_OS_SYMBIAN + QSKIP("This is a Symbian-only test", SkipAll); +#else + int argc = 0; + QApplication app(argc, 0); + int numDestroyed = 0; + + // This next part should not require a trap. If it does, the test will crash. + CleanupStack::PushL(new (ELeave) CBaseDummy(&numDestroyed)); + CleanupStack::PopAndDestroy(); + + QCOMPARE(numDestroyed, 1); + + // No other failure condition. The program will crash if it does not pass. +#endif +} + +void tst_QApplication::symbianLeaveThroughMain() +{ +#ifndef Q_OS_SYMBIAN + QSKIP("This is a Symbian-only test", SkipAll); +#else + int numDestroyed = 0; + TInt err; + TRAP(err, fakeMain(&numDestroyed)); + + QCOMPARE(numDestroyed, 2); +#endif +} + //QTEST_APPLESS_MAIN(tst_QApplication) int main(int argc, char *argv[]) { |