summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtimer
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-01-17 09:35:23 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-01-17 09:35:23 (GMT)
commit1e179f6c0279adefc20924731b6e8378a89131de (patch)
tree1ce899307c51f03a73c7093477e829ae4091da78 /tests/auto/qtimer
parent6c52715202ad8fd3c3f4bb94207cb7627c12f995 (diff)
parent4631d297781b8ad4eba0735b7023265d4872c1cb (diff)
downloadQt-1e179f6c0279adefc20924731b6e8378a89131de.zip
Qt-1e179f6c0279adefc20924731b6e8378a89131de.tar.gz
Qt-1e179f6c0279adefc20924731b6e8378a89131de.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
Diffstat (limited to 'tests/auto/qtimer')
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index 102308e..6cff7c53 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -90,6 +90,9 @@ private slots:
void QTBUG13633_dontBlockEvents();
void postedEventsShouldNotStarveTimers();
+#ifdef Q_OS_SYMBIAN
+ void handleLeaks();
+#endif
};
class TimerHelper : public QObject
@@ -750,5 +753,40 @@ void tst_QTimer::postedEventsShouldNotStarveTimers()
QVERIFY(timerHelper.count > 5);
}
+#ifdef Q_OS_SYMBIAN
+void tst_QTimer::handleLeaks()
+{
+ const int timercount = 5;
+ int processhandles_start;
+ int threadhandles_start;
+ RThread().HandleCount(processhandles_start, threadhandles_start);
+ {
+ TimerHelper timerHelper;
+ QList<QTimer*> timers;
+ for (int i=0;i<timercount;i++) {
+ QTimer* timer = new QTimer;
+ timers.append(timer);
+ connect(timer, SIGNAL(timeout()), &timerHelper, SLOT(timeout()));
+ timer->setSingleShot(true);
+ timer->start(i); //test both zero and normal timeouts
+ }
+ int processhandles_mid;
+ int threadhandles_mid;
+ RThread().HandleCount(processhandles_mid, threadhandles_mid);
+ qDebug() << threadhandles_mid - threadhandles_start << "new thread owned handles";
+ QTest::qWait(100);
+ QCOMPARE(timerHelper.count, timercount);
+ qDeleteAll(timers);
+ }
+ int processhandles_end;
+ int threadhandles_end;
+ RThread().HandleCount(processhandles_end, threadhandles_end);
+ QCOMPARE(threadhandles_end, threadhandles_start); //RTimer::CreateLocal creates a thread owned handle
+ //Can not verify process handles because QObject::connect may create up to 2 mutexes
+ //from a QMutexPool (4 process owned handles with open C imp.)
+ //QCOMPARE(processhandles_end, processhandles_start);
+}
+#endif
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"