Fix test compilation on WinRT

Tweak a handful of tests which didn't compile on this platform.

Change-Id: I208d9eb289dfb226746c6d0163c3ea752485033b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Andrew Knight 2013-11-26 11:00:31 +02:00 committed by The Qt Project
parent 75a7562491
commit 1c2be58fec
4 changed files with 14 additions and 7 deletions

View File

@ -49,9 +49,13 @@
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #if defined(Q_OS_WIN)
#include <windows.h> # include <qt_windows.h>
#define sleep(X) Sleep(X) # ifndef Q_OS_WINRT
# define sleep(X) Sleep(X)
# else
# define sleep(X) WaitForSingleObjectEx(GetCurrentThread(), X, FALSE);
# endif
#endif #endif
//on solaris, threads that loop on the release bool variable //on solaris, threads that loop on the release bool variable

View File

@ -171,7 +171,7 @@ static inline void centerOnScreen(QWidget *w)
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
static inline void setWindowsAnimationsEnabled(bool enabled) static inline void setWindowsAnimationsEnabled(bool enabled)
{ {
ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled }; ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled };
@ -184,10 +184,10 @@ static inline bool windowsAnimationsEnabled()
SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0); SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0);
return animation.iMinAnimate; return animation.iMinAnimate;
} }
#else // Q_OS_WIN && !Q_OS_WINCE #else // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
inline void setWindowsAnimationsEnabled(bool) {} inline void setWindowsAnimationsEnabled(bool) {}
static inline bool windowsAnimationsEnabled() { return false; } static inline bool windowsAnimationsEnabled() { return false; }
#endif // !Q_OS_WIN || Q_OS_WINCE #endif // !Q_OS_WIN || Q_OS_WINCE || Q_OS_WINRT
class tst_QWidget : public QObject class tst_QWidget : public QObject
{ {

View File

@ -1,5 +1,6 @@
SOURCES = main.cpp SOURCES = main.cpp
CONFIG -= qt app_bundle CONFIG -= qt app_bundle
CONFIG += console CONFIG += console
winrt: QMAKE_LFLAGS += /ENTRY:mainCRTStartup
DESTDIR = ./ DESTDIR = ./
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -88,7 +88,9 @@ void NativeMutexUnlock(NativeMutexType *mutex)
} }
#endif #endif
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
# define _WIN32_WINNT 0x0400 # ifndef Q_OS_WINRT
# define _WIN32_WINNT 0x0400
# endif
# include <windows.h> # include <windows.h>
typedef CRITICAL_SECTION NativeMutexType; typedef CRITICAL_SECTION NativeMutexType;
void NativeMutexInitialize(NativeMutexType *mutex) void NativeMutexInitialize(NativeMutexType *mutex)