summaryrefslogtreecommitdiffstats
path: root/tests/auto/exceptionsafety_objects
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2009-08-04 09:05:45 (GMT)
committermread <qt-info@nokia.com>2009-08-04 09:05:45 (GMT)
commit5e33f94ace72c01802befcdcf0d07fdcbf0aeaf4 (patch)
tree6d2fa7982cb10fd32cb7e67ca1600c45438ebb59 /tests/auto/exceptionsafety_objects
parent95812dd991bdcc63c9a4c10d4cf32811aa0c413b (diff)
downloadQt-5e33f94ace72c01802befcdcf0d07fdcbf0aeaf4.zip
Qt-5e33f94ace72c01802befcdcf0d07fdcbf0aeaf4.tar.gz
Qt-5e33f94ace72c01802befcdcf0d07fdcbf0aeaf4.tar.bz2
deleteing test objects for improved memory leak tracking. added test start parameter for easier tweaking
Diffstat (limited to 'tests/auto/exceptionsafety_objects')
-rw-r--r--tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp16
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);