From bd79c4e28c307ba87aca02155b845774c7ffec1f Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 9 Aug 2016 13:46:42 +0200 Subject: winrt: Make test functional The adoptedThreads test never spawned any thread causing a test error later on. Hence add a winrt version using __beginthreadex which exists for that platform. Change-Id: I04f980218713df20cb41d804d732e0c99b958489 Reviewed-by: Oliver Wolff --- .../corelib/thread/qthreadstorage/tst_qthreadstorage.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 4e582cc346..49a3b3e4db 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -200,6 +200,13 @@ void testAdoptedThreadStorageWin(void *p) } QObject::connect(QThread::currentThread(), SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); } +#ifdef Q_OS_WINRT +unsigned __stdcall testAdoptedThreadStorageWinRT(void *p) +{ + testAdoptedThreadStorageWin(p); + return 0; +} +#endif void *testAdoptedThreadStorageUnix(void *pointers) { testAdoptedThreadStorageWin(pointers); @@ -217,7 +224,12 @@ void tst_QThreadStorage::adoptedThreads() const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers); QCOMPARE(state, 0); pthread_join(thread, 0); -#elif defined Q_OS_WIN && !defined(Q_OS_WINRT) +#elif defined Q_OS_WINRT + HANDLE thread; + thread = (HANDLE) _beginthreadex(NULL, 0, testAdoptedThreadStorageWinRT, &pointers, 0, 0); + QVERIFY(thread); + WaitForSingleObjectEx(thread, INFINITE, FALSE); +#elif defined Q_OS_WIN HANDLE thread; thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers); QVERIFY(thread); -- cgit v1.2.3