diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-09-27 19:53:01 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-29 06:41:42 +0200 |
commit | 95cebd34ebc5b4d39b11dc91610309a35e488663 (patch) | |
tree | 90ceffef5acea093dd2b8f8f7e8c30593023b85a /tests/auto/exceptionsafety_objects | |
parent | ab061e3e436fab35eac8666f3e950e98f66c4d3e (diff) |
Remove Symbian-specific code from tests.
Symbian is not a supported platform for Qt5, so this code is no longer
required.
Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa
Reviewed-on: http://codereview.qt-project.org/5657
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/exceptionsafety_objects')
-rw-r--r-- | tests/auto/exceptionsafety_objects/oomsimulator.h | 84 | ||||
-rw-r--r-- | tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 18 |
2 files changed, 2 insertions, 100 deletions
diff --git a/tests/auto/exceptionsafety_objects/oomsimulator.h b/tests/auto/exceptionsafety_objects/oomsimulator.h index 3de181b57a..ed4bb53922 100644 --- a/tests/auto/exceptionsafety_objects/oomsimulator.h +++ b/tests/auto/exceptionsafety_objects/oomsimulator.h @@ -39,14 +39,12 @@ ** ****************************************************************************/ -#ifndef Q_OS_SYMBIAN #include <malloc.h> -#endif #include <limits.h> #include <stdio.h> #include <exception> -#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_OS_WIN) # include "3rdparty/memcheck.h" #endif @@ -197,82 +195,6 @@ static struct QCrtDebugRegistrator } crtDebugRegistrator; -#elif defined(Q_OS_SYMBIAN) - -struct QAllocFailAllocator : public RAllocator -{ - QAllocFailAllocator() : allocator(User::Allocator()) - { - User::SwitchAllocator(this); - } - - ~QAllocFailAllocator() - { - User::SwitchAllocator(&allocator); - } - - RAllocator& allocator; - - // from MAllocator - TAny* Alloc(TInt aSize) - { - ++mallocCount; - if (mallocFailActive && --mallocFailIndex < 0) - return 0; // simulate OOM - return allocator.Alloc(aSize); - } - - void Free(TAny* aPtr) - { - allocator.Free(aPtr); - } - - TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode) - { - ++mallocCount; - if (mallocFailActive && --mallocFailIndex < 0) - return 0; // simulate OOM - return allocator.ReAlloc(aPtr, aSize, aMode); - } - - TInt AllocLen(const TAny* aCell) const - { - return allocator.AllocLen(aCell); - } - - TInt Compress() - { - return allocator.Compress(); - } - - void Reset() - { - allocator.Reset(); - } - - TInt AllocSize(TInt& aTotalAllocSize) const - { - return allocator.AllocSize(aTotalAllocSize); - } - - TInt Available(TInt& aBiggestBlock) const - { - return allocator.Available(aBiggestBlock); - } - - TInt DebugFunction(TInt aFunc, TAny* a1, TAny* a2) - { - return allocator.DebugFunction(aFunc, a1, a2); - } - - TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1) - { - return ((MAllocator&)allocator).Extension_(aExtensionId, a0, a1); - } -}; - -QAllocFailAllocator symbianTestAllocator; - #endif struct AllocFailer @@ -327,8 +249,6 @@ struct AllocFailer } }; -#ifndef Q_OS_SYMBIAN - static void *new_helper(std::size_t size) { void *ptr = malloc(size); @@ -358,8 +278,6 @@ void operator delete[](void *ptr, const std::nothrow_t&) throw() { if (ptr) free # pragma warning(pop) #endif -#endif - // ignore placement new and placement delete - those don't allocate. diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index 7d497573b7..e8acc6fcff 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -51,15 +51,12 @@ QT_USE_NAMESPACE // this test only works with // * GLIBC // * MSVC - only debug builds (we need the crtdbg.h helpers) -// * SYMBIAN -#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && !defined(Q_OS_SYMBIAN))) && !defined(Q_MOC_RUN) +#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC))) && !defined(Q_MOC_RUN) QTEST_NOOP_MAIN #else #include "oomsimulator.h" -#if !defined(Q_OS_SYMBIAN) #include "3rdparty/memcheck.h" -#endif class tst_ExceptionSafety_Objects: public QObject { @@ -328,12 +325,6 @@ void tst_ExceptionSafety_Objects::initTestCase() free(buf); QVERIFY(!buf2); -#ifdef Q_OS_SYMBIAN - // temporary workaround for INC138398 - std::new_handler nh_func = std::set_new_handler(0); - (void) std::set_new_handler(nh_func); -#endif - ObjectCreator<SelfTestObject> *selfTest = new ObjectCreator<SelfTestObject>; doOOMTest(*selfTest, 0); delete selfTest; @@ -401,13 +392,6 @@ template <> struct WidgetCreator<QDesktopWidget> : public AbstractTester }; void tst_ExceptionSafety_Objects::widgets_data() { -#ifdef Q_OS_SYMBIAN - // Initialise the S60 rasteriser, which crashes if started while out of memory - QImage image(20, 20, QImage::Format_RGB32); - QPainter p(&image); - p.drawText(0, 15, "foo"); -#endif - QTest::addColumn<AbstractTester *>("widgetCreator"); #undef NEWROW |