summaryrefslogtreecommitdiffstats
path: root/tests/auto/qthread/tst_qthread.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-25 18:19:02 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-25 18:19:02 (GMT)
commit8deaf82914c5ec8da7bc49f913d03a3754e1af0c (patch)
treebd365a42b8398513432ad09e263b7592f258d395 /tests/auto/qthread/tst_qthread.cpp
parent6f5ed5836bd96b69d47aa3260118b3b49dddc82f (diff)
parent5c32919fdf549892d806c7f98bd4d9f82c771ca5 (diff)
downloadQt-8deaf82914c5ec8da7bc49f913d03a3754e1af0c.zip
Qt-8deaf82914c5ec8da7bc49f913d03a3754e1af0c.tar.gz
Qt-8deaf82914c5ec8da7bc49f913d03a3754e1af0c.tar.bz2
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (102 commits) fix inf loop bug Enable the no-undefined flag on the linker for icc Fixed tst_qwidget::winIdChangeEvent Prevent compilers optimizing eval timebomb code out of existence. Fix incorrect example for Qt.rgba() Flickable and MouseArea were too eager to take/keep mouse grab. Allow javascript date and regexp objects in WorkerScript messages Fix compliation of ALSA audio backend when checking for surround support. Avoid lockup in ListView when animating delegates. Fix asynchronous reload call in test, broken by previous submit Use parent class function to generate Makefile headers in Symbian Fix spaces Fix QPixmap::fromImage() in the OpenVG pixmap backend. Update QtGui emulator def file for bug QT-3971 Native color dialog on symbian Fix non-stroked filled paths in OpenVG paint engine. Ignore .pc/ Ensure WebView press delay timer is cancelled when grab is taken. Prevent crash when calling reload() from within a .qml Doc: Fixing typo ...
Diffstat (limited to 'tests/auto/qthread/tst_qthread.cpp')
-rw-r--r--tests/auto/qthread/tst_qthread.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index 01f080f..1e3fc28 100644
--- a/tests/auto/qthread/tst_qthread.cpp
+++ b/tests/auto/qthread/tst_qthread.cpp
@@ -106,6 +106,8 @@ private slots:
void adoptMultipleThreads();
void QTBUG13810_exitAndStart();
+ void QTBUG15378_exitAndExec();
+
void connectThreadFinishedSignalToObjectDeleteLaterSlot();
void wait2();
void wait3_slowDestructor();
@@ -980,6 +982,43 @@ void tst_QThread::QTBUG13810_exitAndStart()
QCOMPARE(sync1.m_prop, 89);
}
+void tst_QThread::QTBUG15378_exitAndExec()
+{
+ class Thread : public QThread {
+ public:
+ QSemaphore sem1;
+ QSemaphore sem2;
+ volatile int value;
+ void run() {
+ sem1.acquire();
+ value = exec(); //First entrence
+ sem2.release();
+ value = exec(); // Second loop
+ }
+ };
+ Thread thread;
+ thread.value = 0;
+ thread.start();
+ thread.exit(556);
+ thread.sem1.release(); //should exit the first loop
+ thread.sem2.acquire();
+ int v = thread.value;
+ QCOMPARE(v, 556);
+
+ //test that the thread is running by executing queued connected signal there
+ Syncronizer sync1;
+ sync1.moveToThread(&thread);
+ Syncronizer sync2;
+ sync2.moveToThread(&thread);
+ connect(&sync2, SIGNAL(propChanged(int)), &sync1, SLOT(setProp(int)), Qt::QueuedConnection);
+ connect(&sync1, SIGNAL(propChanged(int)), &thread, SLOT(quit()), Qt::QueuedConnection);
+ QMetaObject::invokeMethod(&sync2, "setProp", Qt::QueuedConnection , Q_ARG(int, 89));
+ QTest::qWait(50);
+ while(!thread.wait(10))
+ QTest::qWait(10);
+ QCOMPARE(sync2.m_prop, 89);
+ QCOMPARE(sync1.m_prop, 89);
+}
void tst_QThread::connectThreadFinishedSignalToObjectDeleteLaterSlot()
{
@@ -1111,7 +1150,5 @@ void tst_QThread::startFinishRace()
}
}
-
-
QTEST_MAIN(tst_QThread)
#include "tst_qthread.moc"