diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-08-05 12:28:13 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-08-05 12:28:13 (GMT) |
commit | b53192d51cf8064dcb4361b3032d1e39260f4eea (patch) | |
tree | 183bd2a0ade9b580513e03dbde4798f43e33e855 /tests/auto/exceptionsafety_objects | |
parent | 3bd102e7935fcb002867acfd72c34b38247144da (diff) | |
parent | 638edc80e3b224a6830dda0a2bd3097cb82dcb96 (diff) | |
download | Qt-b53192d51cf8064dcb4361b3032d1e39260f4eea.zip Qt-b53192d51cf8064dcb4361b3032d1e39260f4eea.tar.gz Qt-b53192d51cf8064dcb4361b3032d1e39260f4eea.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Diffstat (limited to 'tests/auto/exceptionsafety_objects')
-rw-r--r-- | tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index c867899..c2c0685 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -165,9 +165,9 @@ void tst_ExceptionSafetyObjects::objects_data() // create and destructs an object, and lets each and every allocation // during construction and destruction fail. -static void doOOMTest(AbstractObjectCreator *creator, QObject *parent) +static void doOOMTest(AbstractObjectCreator *creator, QObject *parent, int start=0) { - int currentOOMIndex = 0; + int currentOOMIndex = start; bool caught = false; bool done = false; @@ -278,7 +278,9 @@ void tst_ExceptionSafetyObjects::initTestCase() (void) std::set_new_handler(nh_func); #endif - doOOMTest(new ObjectCreator<SelfTestObject>, 0); + ObjectCreator<SelfTestObject> *selfTest = new ObjectCreator<SelfTestObject>; + doOOMTest(selfTest, 0); + delete selfTest; QCOMPARE(alloc1Failed, 1); QCOMPARE(alloc2Failed, 1); QCOMPARE(alloc3Failed, 2); @@ -292,6 +294,8 @@ void tst_ExceptionSafetyObjects::objects() QFETCH(AbstractObjectCreator *, objectCreator); doOOMTest(objectCreator, 0); + + delete objectCreator; } template <typename T> @@ -391,10 +395,12 @@ void tst_ExceptionSafetyObjects::widgets() { QFETCH(AbstractObjectCreator *, widgetCreator); - doOOMTest(widgetCreator, 0); + doOOMTest(widgetCreator, 0, 00000); QWidget parent; - doOOMTest(widgetCreator, &parent); + doOOMTest(widgetCreator, &parent, 00000); + + delete widgetCreator; // if the test reaches here without crashing, we passed :) QVERIFY(true); |