WinRT: Fix various test compilations

- Remove irrelevant test subdirs via .pro files
- Follow WinCE codepaths where applicable
- Replace unsupported Win32 APIs with WinRT equivalents

This does not aim to fix any failures in the tests themselves; it only
makes them compile.

Change-Id: Ia82bc0cc402891f8f6238d4c261ee9152b51be80
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Andrew Knight 2013-09-01 19:05:46 +03:00 committed by The Qt Project
parent c097670bf8
commit c6af0a504f
46 changed files with 165 additions and 68 deletions

View File

@ -52,3 +52,9 @@ SUBDIRS=\
win32:!contains(QT_CONFIG, private_tests): SUBDIRS -= \ win32:!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qfilesystementry qfilesystementry
winrt: SUBDIRS -= \
qprocess \
qprocess-noapplication \
qprocessenvironment \
qwinoverlappedionotifier

View File

@ -13,5 +13,5 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \
../Makefile ../forCopying.txt ../forRenaming.txt \ ../Makefile ../forCopying.txt ../forRenaming.txt \
../resources/file1.ext1 ../resources/file1.ext1
win32: LIBS+=-lole32 -luuid win32:!winrt: LIBS+=-lole32 -luuid
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -527,7 +527,7 @@ void tst_QFile::open_data()
<< false << QFile::OpenError; << false << QFile::OpenError;
QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly) QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly)
<< false << QFile::OpenError; << false << QFile::OpenError;
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
//opening devices requires administrative privileges (and elevation). //opening devices requires administrative privileges (and elevation).
HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hTest != INVALID_HANDLE_VALUE) { if (hTest != INVALID_HANDLE_VALUE) {
@ -1057,7 +1057,7 @@ void tst_QFile::ungetChar()
QCOMPARE(buf[2], '4'); QCOMPARE(buf[2], '4');
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QString driveLetters() QString driveLetters()
{ {
wchar_t volumeName[MAX_PATH]; wchar_t volumeName[MAX_PATH];
@ -1094,7 +1094,7 @@ void tst_QFile::invalidFile_data()
#if !defined(Q_OS_WIN) #if !defined(Q_OS_WIN)
QTest::newRow( "x11" ) << QString( "qwe//" ); QTest::newRow( "x11" ) << QString( "qwe//" );
#else #else
#if !defined(Q_OS_WINCE) #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid"); QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid");
#endif #endif
QTest::newRow( "colon3" ) << QString( ":failinvalid" ); QTest::newRow( "colon3" ) << QString( ":failinvalid" );
@ -1338,10 +1338,12 @@ void tst_QFile::copyFallback()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <objbase.h> #include <objbase.h>
#ifndef Q_OS_WINPHONE
#include <shlobj.h> #include <shlobj.h>
#endif #endif
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
static QString getWorkingDirectoryForLink(const QString &linkFileName) static QString getWorkingDirectoryForLink(const QString &linkFileName)
{ {
bool neededCoInit = false; bool neededCoInit = false;
@ -1400,7 +1402,7 @@ void tst_QFile::link()
QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget); QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath());
QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath())); QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath()));
#endif #endif
@ -2690,8 +2692,12 @@ void tst_QFile::nativeHandleLeaks()
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# ifndef Q_OS_WINRT
handle1 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL, handle1 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
# else
handle1 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL);
# endif
QVERIFY( INVALID_HANDLE_VALUE != handle1 ); QVERIFY( INVALID_HANDLE_VALUE != handle1 );
QVERIFY( ::CloseHandle(handle1) ); QVERIFY( ::CloseHandle(handle1) );
#endif #endif
@ -2705,8 +2711,12 @@ void tst_QFile::nativeHandleLeaks()
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# ifndef Q_OS_WINRT
handle2 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL, handle2 = ::CreateFileA("qt_file.tmp", GENERIC_READ, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
# else
handle2 = ::CreateFile2(L"qt_file.tmp", GENERIC_READ, 0, OPEN_ALWAYS, NULL);
# endif
QVERIFY( INVALID_HANDLE_VALUE != handle2 ); QVERIFY( INVALID_HANDLE_VALUE != handle2 );
QVERIFY( ::CloseHandle(handle2) ); QVERIFY( ::CloseHandle(handle2) );
#endif #endif

View File

@ -6,5 +6,5 @@ RESOURCES += qfileinfo.qrc
TESTDATA += qfileinfo.qrc qfileinfo.pro tst_qfileinfo.cpp resources/file1 resources/file1.ext1 resources/file1.ext1.ext2 TESTDATA += qfileinfo.qrc qfileinfo.pro tst_qfileinfo.cpp resources/file1 resources/file1.ext1 resources/file1.ext1.ext2
win32*:!wince*:LIBS += -ladvapi32 -lnetapi32 win32*:!wince*:!winrt:LIBS += -ladvapi32 -lnetapi32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -62,7 +62,7 @@
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> #include <qt_windows.h>
#include <qlibrary.h> #include <qlibrary.h>
#if !defined(Q_OS_WINCE) #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <lm.h> #include <lm.h>
#endif #endif
#endif #endif
@ -176,7 +176,7 @@ private slots:
void refresh(); void refresh();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void ntfsJunctionPointsAndSymlinks_data(); void ntfsJunctionPointsAndSymlinks_data();
void ntfsJunctionPointsAndSymlinks(); void ntfsJunctionPointsAndSymlinks();
void brokenShortcut(); void brokenShortcut();
@ -193,7 +193,7 @@ private slots:
void detachingOperations(); void detachingOperations();
#if !defined(Q_OS_WINCE) #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void owner(); void owner();
#endif #endif
void group(); void group();
@ -1058,7 +1058,7 @@ void tst_QFileInfo::fileTimes()
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default). //In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
//To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate //To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
//is set to 0, in the test machine. //is set to 0, in the test machine.
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
HKEY key; HKEY key;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem", if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem",
0, KEY_READ, &key)) { 0, KEY_READ, &key)) {
@ -1085,8 +1085,8 @@ void tst_QFileInfo::fileTimes()
void tst_QFileInfo::fileTimes_oldFile() void tst_QFileInfo::fileTimes_oldFile()
{ {
// This is not supported on WinCE // This is not supported on WinCE or WinRT
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
// All files are opened in share mode (both read and write). // All files are opened in share mode (both read and write).
DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
@ -1329,7 +1329,7 @@ void tst_QFileInfo::refresh()
QCOMPARE(info2.size(), info.size()); QCOMPARE(info2.size(), info.size());
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
{ {
QTest::addColumn<QString>("path"); QTest::addColumn<QString>("path");
@ -1680,7 +1680,7 @@ void tst_QFileInfo::detachingOperations()
QVERIFY(!info1.caching()); QVERIFY(!info1.caching());
} }
#if !defined(Q_OS_WINCE) #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#if defined (Q_OS_WIN) #if defined (Q_OS_WIN)
BOOL IsUserAdmin() BOOL IsUserAdmin()
{ {

View File

@ -55,6 +55,7 @@ class tst_QFileSystemWatcher : public QObject
public: public:
tst_QFileSystemWatcher(); tst_QFileSystemWatcher();
#ifndef QT_NO_FILESYSTEMWATCHER
private slots: private slots:
void basicTest_data(); void basicTest_data();
void basicTest(); void basicTest();
@ -83,16 +84,20 @@ private slots:
private: private:
QString m_tempDirPattern; QString m_tempDirPattern;
#endif // QT_NO_FILESYSTEMWATCHER
}; };
tst_QFileSystemWatcher::tst_QFileSystemWatcher() tst_QFileSystemWatcher::tst_QFileSystemWatcher()
{ {
#ifndef QT_NO_FILESYSTEMWATCHER
m_tempDirPattern = QDir::tempPath(); m_tempDirPattern = QDir::tempPath();
if (!m_tempDirPattern.endsWith(QLatin1Char('/'))) if (!m_tempDirPattern.endsWith(QLatin1Char('/')))
m_tempDirPattern += QLatin1Char('/'); m_tempDirPattern += QLatin1Char('/');
m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX");
#endif // QT_NO_FILESYSTEMWATCHER
} }
#ifndef QT_NO_FILESYSTEMWATCHER
void tst_QFileSystemWatcher::basicTest_data() void tst_QFileSystemWatcher::basicTest_data()
{ {
QTest::addColumn<QString>("backend"); QTest::addColumn<QString>("backend");
@ -676,6 +681,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
QTRY_COMPARE(changedSpy.count(), 10); QTRY_COMPARE(changedSpy.count(), 10);
} }
#endif // QT_NO_FILESYSTEMWATCHER
QTEST_MAIN(tst_QFileSystemWatcher) QTEST_MAIN(tst_QFileSystemWatcher)
#include "tst_qfilesystemwatcher.moc" #include "tst_qfilesystemwatcher.moc"

View File

@ -118,7 +118,7 @@ private slots:
#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER) #if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
void dontReorderIniKeysNeedlessly(); void dontReorderIniKeysNeedlessly();
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void consistentRegistryStorage(); void consistentRegistryStorage();
#endif #endif
@ -273,7 +273,7 @@ void tst_QSettings::init()
QSettings::setSystemIniPath(settingsPath("__system__")); QSettings::setSystemIniPath(settingsPath("__system__"));
QSettings::setUserIniPath(settingsPath("__user__")); QSettings::setUserIniPath(settingsPath("__user__"));
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear();
QSettings("HKEY_LOCAL_MACHINE\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_LOCAL_MACHINE\\Software\\software.org", QSettings::NativeFormat).clear();
QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear();
@ -1501,7 +1501,7 @@ void tst_QSettings::sync()
// Now "some other app" will change other.software.org.ini // Now "some other app" will change other.software.org.ini
QString userConfDir = settingsPath("__user__") + QDir::separator(); QString userConfDir = settingsPath("__user__") + QDir::separator();
#if !defined(Q_OS_WINCE) #if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
unlink((userConfDir + "other.software.org.ini").toLatin1()); unlink((userConfDir + "other.software.org.ini").toLatin1());
rename((userConfDir + "software.org.ini").toLatin1(), rename((userConfDir + "software.org.ini").toLatin1(),
(userConfDir + "other.software.org.ini").toLatin1()); (userConfDir + "other.software.org.ini").toLatin1());
@ -3189,7 +3189,7 @@ void tst_QSettings::recursionBug()
} }
} }
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
static DWORD readKeyType(HKEY handle, const QString &rSubKey) static DWORD readKeyType(HKEY handle, const QString &rSubKey)
{ {

View File

@ -257,7 +257,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir()
void tst_QTemporaryDir::openOnRootDrives() void tst_QTemporaryDir::openOnRootDrives()
{ {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif #endif
// If it's possible to create a file in the root directory, it // If it's possible to create a file in the root directory, it
@ -271,7 +271,7 @@ void tst_QTemporaryDir::openOnRootDrives()
QVERIFY(dir.isValid()); QVERIFY(dir.isValid());
} }
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
SetErrorMode(lastErrorMode); SetErrorMode(lastErrorMode);
#endif #endif
} }

View File

@ -371,7 +371,7 @@ void tst_QTemporaryFile::resize()
void tst_QTemporaryFile::openOnRootDrives() void tst_QTemporaryFile::openOnRootDrives()
{ {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif #endif
// If it's possible to create a file in the root directory, it // If it's possible to create a file in the root directory, it
@ -385,7 +385,7 @@ void tst_QTemporaryFile::openOnRootDrives()
QVERIFY(file.open()); QVERIFY(file.open());
} }
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
SetErrorMode(lastErrorMode); SetErrorMode(lastErrorMode);
#endif #endif
} }

View File

@ -31,6 +31,6 @@ SUBDIRS=\
qsharedmemory qsharedmemory
# This test is only applicable on Windows # This test is only applicable on Windows
!win32*:SUBDIRS -= qwineventnotifier !win32*|winrt: SUBDIRS -= qwineventnotifier
android|qnx: SUBDIRS -= qsharedmemory qsystemsemaphore android|qnx: SUBDIRS -= qsharedmemory qsystemsemaphore

View File

@ -4,7 +4,7 @@ TARGET = tst_qeventloop
QT = core network testlib core-private QT = core network testlib core-private
SOURCES = $$PWD/tst_qeventloop.cpp SOURCES = $$PWD/tst_qeventloop.cpp
win32:!wince*:LIBS += -luser32 win32:!wince*:!winrt:LIBS += -luser32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB

View File

@ -6,11 +6,11 @@ SOURCES = tst_qmetatype.cpp
TESTDATA=./typeFlags.bin TESTDATA=./typeFlags.bin
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
win32-msvc*|wince { win32-msvc*|wince|winrt {
# Prevents "fatal error C1128: number of sections exceeded object file format limit". # Prevents "fatal error C1128: number of sections exceeded object file format limit".
QMAKE_CXXFLAGS += /bigobj QMAKE_CXXFLAGS += /bigobj
# Reduce compile time # Reduce compile time
win32-msvc2012|wince { win32-msvc2012|wince|winrt {
QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE -= -O2
} }

View File

@ -52,6 +52,8 @@
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
#include <windows.h> #include <windows.h>
#define sleep(X) Sleep(X) #define sleep(X) Sleep(X)
#elif defined(Q_OS_WINRT)
#define sleep(X) WaitForSingleObjectEx(GetCurrentThread(), X, FALSE);
#endif #endif
//on solaris, threads that loop on the release bool variable //on solaris, threads that loop on the release bool variable

View File

@ -232,7 +232,7 @@ void tst_QThreadStorage::adoptedThreads()
const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers); const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers);
QCOMPARE(state, 0); QCOMPARE(state, 0);
pthread_join(thread, 0); pthread_join(thread, 0);
#elif defined Q_OS_WIN #elif defined Q_OS_WIN && !defined(Q_OS_WINRT)
HANDLE thread; HANDLE thread;
#if defined(Q_OS_WINCE) #if defined(Q_OS_WINCE)
thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL); thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL);

View File

@ -546,6 +546,9 @@ void tst_QCommandLineParser::testHelpOption()
void tst_QCommandLineParser::testQuoteEscaping() void tst_QCommandLineParser::testQuoteEscaping()
{ {
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
#else
QCoreApplication app(empty_argc, empty_argv); QCoreApplication app(empty_argc, empty_argv);
QProcess process; QProcess process;
process.start("testhelper/qcommandlineparser_test_helper", QStringList() << process.start("testhelper/qcommandlineparser_test_helper", QStringList() <<
@ -561,6 +564,7 @@ void tst_QCommandLineParser::testQuoteEscaping()
QVERIFY2(output.contains("KEY2=\\\"VALUE2\\\""), qPrintable(output)); QVERIFY2(output.contains("KEY2=\\\"VALUE2\\\""), qPrintable(output));
QVERIFY2(output.contains("QTBUG-15379=C:\\path\\'file.ext"), qPrintable(output)); QVERIFY2(output.contains("QTBUG-15379=C:\\path\\'file.ext"), qPrintable(output));
QVERIFY2(output.contains("QTBUG-30628=C:\\temp\\'file'.ext"), qPrintable(output)); QVERIFY2(output.contains("QTBUG-30628=C:\\temp\\'file'.ext"), qPrintable(output));
#endif // !QT_NO_PROCESS
} }
QTEST_APPLESS_MAIN(tst_QCommandLineParser) QTEST_APPLESS_MAIN(tst_QCommandLineParser)

View File

@ -49,6 +49,9 @@
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include <windows.h> # include <windows.h>
# if defined(Q_OS_WINRT)
# define tzset()
# endif
#endif #endif
class tst_QDateTime : public QObject class tst_QDateTime : public QObject
@ -173,7 +176,7 @@ void tst_QDateTime::init()
{ {
#if defined(Q_OS_WINCE) #if defined(Q_OS_WINCE)
SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN32)
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
#endif #endif
} }

View File

@ -133,7 +133,7 @@ public:
private slots: private slots:
void initTestCase(); void initTestCase();
void cleanupTestCase(); void cleanupTestCase();
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void windowsDefaultLocale(); void windowsDefaultLocale();
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -1472,7 +1472,7 @@ void tst_QLocale::macDefaultLocale()
} }
#endif // Q_OS_MAC #endif // Q_OS_MAC
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
#include <qt_windows.h> #include <qt_windows.h>
static QString getWinLocaleInfo(LCTYPE type) static QString getWinLocaleInfo(LCTYPE type)
@ -1526,7 +1526,7 @@ public:
#endif // Q_OS_WIN #endif // Q_OS_WIN
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QLocale::windowsDefaultLocale() void tst_QLocale::windowsDefaultLocale()
{ {
RestoreLocaleHelper systemLocale; RestoreLocaleHelper systemLocale;

View File

@ -5,7 +5,7 @@ QT += core-private gui-private testlib
qtHaveModule(widgets): QT += widgets widgets-private qtHaveModule(widgets): QT += widgets widgets-private
SOURCES += tst_qpixmap.cpp SOURCES += tst_qpixmap.cpp
!wince* { !wince*:!winrt {
win32:LIBS += -lgdi32 -luser32 win32:LIBS += -lgdi32 -luser32
} }

View File

@ -116,7 +116,7 @@ private slots:
void convertFromImageDetach(); void convertFromImageDetach();
void convertFromImageCacheKey(); void convertFromImageCacheKey();
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void toWinHBITMAP_data(); void toWinHBITMAP_data();
void toWinHBITMAP(); void toWinHBITMAP();
void fromWinHBITMAP_data(); void fromWinHBITMAP_data();
@ -805,7 +805,7 @@ void tst_QPixmap::convertFromImageCacheKey()
QCOMPARE(copy.cacheKey(), pix.cacheKey()); QCOMPARE(copy.cacheKey(), pix.cacheKey());
} }
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap);
@ -1024,7 +1024,7 @@ void tst_QPixmap::fromWinHICON()
#endif // Q_OS_WINCE #endif // Q_OS_WINCE
} }
#endif // Q_OS_WIN #endif // Q_OS_WIN && !Q_OS_WINRT
void tst_QPixmap::onlyNullPixmapsOutsideGuiThread() void tst_QPixmap::onlyNullPixmapsOutsideGuiThread()
{ {

View File

@ -50,6 +50,9 @@
#include <qdatastream.h> #include <qdatastream.h>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include <qt_windows.h> # include <qt_windows.h>
# if defined(Q_OS_WINRT)
# include <winsock2.h>
# endif
#endif #endif
class tst_QHostAddress : public QObject class tst_QHostAddress : public QObject

View File

@ -67,7 +67,7 @@
#include <time.h> #include <time.h>
#include <qlibrary.h> #include <qlibrary.h>
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #if defined(Q_OS_WIN)
#include <windows.h> #include <windows.h>
#else #else
#include <unistd.h> #include <unistd.h>

View File

@ -55,11 +55,14 @@
#include <QtSql/private/qsqldriver_p.h> #include <QtSql/private/qsqldriver_p.h>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#if defined (Q_OS_WIN) || defined (Q_OS_WIN32) #if defined(Q_OS_WIN)
# include <qt_windows.h> # include <qt_windows.h>
# if defined (Q_OS_WINCE) # if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
# include <winsock2.h> # include <winsock2.h>
# endif # endif
# if defined(Q_OS_WINRT) && !defined(Q_OS_WINPHONE)
static inline int gethostname(char *name, int len) { qstrcpy(name, "localhost"); return 9; }
# endif
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -57,7 +57,7 @@ private slots:
void tst_Crashes::crash() void tst_Crashes::crash()
{ {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
//we avoid the error dialogbox to appear on windows //we avoid the error dialogbox to appear on windows
SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
#endif #endif

View File

@ -416,7 +416,14 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
wchar_t nativeHiddenFile[MAX_PATH]; wchar_t nativeHiddenFile[MAX_PATH];
memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile)); memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
hiddenFile.toWCharArray(nativeHiddenFile); hiddenFile.toWCharArray(nativeHiddenFile);
#ifndef Q_OS_WINRT
DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile); DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile);
#else // !Q_OS_WINRT
WIN32_FILE_ATTRIBUTE_DATA attributeData;
if (!::GetFileAttributesEx(nativeHiddenFile, GetFileExInfoStandard, &attributeData))
attributeData.dwFileAttributes = 0xFFFFFFFF;
DWORD currentAttributes = attributeData.dwFileAttributes;
#endif // Q_OS_WINRT
if (currentAttributes == 0xFFFFFFFF) { if (currentAttributes == 0xFFFFFFFF) {
qErrnoWarning("failed to get file attributes: %s", qPrintable(hiddenFile)); qErrnoWarning("failed to get file attributes: %s", qPrintable(hiddenFile));
return false; return false;

View File

@ -5,5 +5,5 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsitem.cpp SOURCES += tst_qgraphicsitem.cpp
DEFINES += QT_NO_CAST_TO_ASCII DEFINES += QT_NO_CAST_TO_ASCII
win32:!wince*: LIBS += -luser32 win32:!wince*:!winrt: LIBS += -luser32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -71,7 +71,7 @@ Q_DECLARE_METATYPE(QPainterPath)
#include "../../../qtest-config.h" #include "../../../qtest-config.h"
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <windows.h> #include <windows.h>
#define Q_CHECK_PAINTEVENTS \ #define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \

View File

@ -4,7 +4,7 @@ QT += widgets widgets-private testlib
QT += core-private gui-private QT += core-private gui-private
SOURCES += tst_qgraphicsscene.cpp SOURCES += tst_qgraphicsscene.cpp
RESOURCES += images.qrc RESOURCES += images.qrc
win32:!wince*: LIBS += -luser32 win32:!wince*:!winrt: LIBS += -luser32
!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\" !wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += QT_NO_CAST_TO_ASCII DEFINES += QT_NO_CAST_TO_ASCII

View File

@ -54,7 +54,7 @@
#include "../../../shared/platforminputcontext.h" #include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h> #include <private/qinputmethod_p.h>
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <windows.h> #include <windows.h>
#define Q_CHECK_PAINTEVENTS \ #define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \

View File

@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate
QT += widgets testlib QT += widgets testlib
SOURCES += tst_qitemdelegate.cpp SOURCES += tst_qitemdelegate.cpp
win32:!wince*: LIBS += -luser32 win32:!wince*:!winrt: LIBS += -luser32

View File

@ -66,7 +66,7 @@
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <windows.h> #include <windows.h>
#define Q_CHECK_PAINTEVENTS \ #define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \

View File

@ -2,4 +2,4 @@ CONFIG += testcase
TARGET = tst_qlistview TARGET = tst_qlistview
QT += widgets gui-private widgets-private core-private testlib QT += widgets gui-private widgets-private core-private testlib
SOURCES += tst_qlistview.cpp SOURCES += tst_qlistview.cpp
win32:!wince*: LIBS += -luser32 win32:!wince*:!winrt: LIBS += -luser32

View File

@ -1484,7 +1484,7 @@ void tst_QListView::wordWrap()
QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true); QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true);
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -1525,7 +1525,7 @@ private:
}; };
#endif #endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && WINVER >= 0x0500
// This test only makes sense on windows 2000 and higher. // This test only makes sense on windows 2000 and higher.
void tst_QListView::setCurrentIndexAfterAppendRowCrash() void tst_QListView::setCurrentIndexAfterAppendRowCrash()
{ {

View File

@ -1891,7 +1891,7 @@ void tst_QApplication::windowsCommandLine_data()
void tst_QApplication::windowsCommandLine() void tst_QApplication::windowsCommandLine()
{ {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QFETCH(QString, args); QFETCH(QString, args);
QFETCH(QString, expected); QFETCH(QString, expected);

View File

@ -20,7 +20,7 @@ x11 {
LIBS += $$QMAKE_LIBS_X11 LIBS += $$QMAKE_LIBS_X11
} }
!wince*:win32: LIBS += -luser32 -lgdi32 !wince*:win32:!winrt: LIBS += -luser32 -lgdi32
mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695 mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695
linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC # QTBUG-30566 linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC # QTBUG-30566

View File

@ -116,11 +116,13 @@ static bool qt_wince_is_platform(const QString &platformString) {
} }
static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); } static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); }
# endif // Q_OS_WINCE_WM # endif // Q_OS_WINCE_WM
# else // Q_OS_WINCE # elif !defined(Q_OS_WINRT) // Q_OS_WINCE
# define Q_CHECK_PAINTEVENTS \ # define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
QSKIP("desktop is not visible, this test would fail"); QSKIP("desktop is not visible, this test would fail");
# endif // !Q_OS_WINCE # else // !Q_OS_WINCE && !Q_OS_WINRT
# define Q_CHECK_PAINTEVENTS
# endif // Q_OS_WINRT
#else // Q_OS_WIN #else // Q_OS_WIN
# define Q_CHECK_PAINTEVENTS # define Q_CHECK_PAINTEVENTS
#endif // else Q_OS_WIN #endif // else Q_OS_WIN
@ -285,7 +287,7 @@ private slots:
void subtractOpaqueSiblings(); void subtractOpaqueSiblings();
#endif #endif
#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void setGeometry_win(); void setGeometry_win();
#endif #endif
@ -355,7 +357,7 @@ private slots:
void quitOnCloseAttribute(); void quitOnCloseAttribute();
void moveRect(); void moveRect();
#if defined (Q_OS_WIN) #if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
void gdiPainting(); void gdiPainting();
void paintOnScreenPossible(); void paintOnScreenPossible();
#endif #endif
@ -572,7 +574,7 @@ void tst_QWidget::getSetCheck()
QCOMPARE(true, obj1.autoFillBackground()); QCOMPARE(true, obj1.autoFillBackground());
var1.reset(); var1.reset();
#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle
QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP); QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP);
@ -1257,7 +1259,7 @@ void tst_QWidget::visible_setWindowOpacity()
testWidget->hide(); testWidget->hide();
QVERIFY( !testWidget->isVisible() ); QVERIFY( !testWidget->isVisible() );
testWidget->setWindowOpacity(0.5); testWidget->setWindowOpacity(0.5);
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QVERIFY(!::IsWindowVisible(winHandleOf(testWidget))); QVERIFY(!::IsWindowVisible(winHandleOf(testWidget)));
#endif #endif
testWidget->setWindowOpacity(1.0); testWidget->setWindowOpacity(1.0);
@ -3597,7 +3599,7 @@ void tst_QWidget::optimizedResize_topLevel()
topLevel.partial = false; topLevel.partial = false;
topLevel.paintedRegion = QRegion(); topLevel.paintedRegion = QRegion();
#ifndef Q_OS_WIN #if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
topLevel.resize(topLevel.size() + QSize(10, 10)); topLevel.resize(topLevel.size() + QSize(10, 10));
#else #else
// Static contents does not work when programmatically resizing // Static contents does not work when programmatically resizing
@ -4529,7 +4531,7 @@ void tst_QWidget::setWindowGeometry()
} }
} }
#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void tst_QWidget::setGeometry_win() void tst_QWidget::setGeometry_win()
{ {
QWidget widget; QWidget widget;
@ -4548,7 +4550,7 @@ void tst_QWidget::setGeometry_win()
QEXPECT_FAIL("", "QTBUG-26424", Continue); QEXPECT_FAIL("", "QTBUG-26424", Continue);
QVERIFY(rt.top <= 0); QVERIFY(rt.top <= 0);
} }
#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) #endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
// Since X11 WindowManager operation are all async, and we have no way to know if the window // Since X11 WindowManager operation are all async, and we have no way to know if the window
// manager has finished playing with the window geometry, this test can't be reliable on X11. // manager has finished playing with the window geometry, this test can't be reliable on X11.
@ -8047,7 +8049,7 @@ void tst_QWidget::moveRect()
child.move(10, 10); // Don't crash. child.move(10, 10); // Don't crash.
} }
#ifdef Q_OS_WIN #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
class GDIWidget : public QDialog class GDIWidget : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -8114,7 +8116,7 @@ void tst_QWidget::paintOnScreenPossible()
w2.setAttribute(Qt::WA_PaintOnScreen); w2.setAttribute(Qt::WA_PaintOnScreen);
QVERIFY(w2.testAttribute(Qt::WA_PaintOnScreen)); QVERIFY(w2.testAttribute(Qt::WA_PaintOnScreen));
} }
#endif // Q_OS_WIN #endif // Q_OS_WIN && !Q_OS_WINRT
void tst_QWidget::reparentStaticWidget() void tst_QWidget::reparentStaticWidget()
{ {

View File

@ -346,7 +346,7 @@ void tst_QDateTimeEdit::cleanupTestCase()
void tst_QDateTimeEdit::init() void tst_QDateTimeEdit::init()
{ {
QLocale::setDefault(QLocale(QLocale::C)); QLocale::setDefault(QLocale(QLocale::C));
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
#endif #endif
testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have

View File

@ -8,4 +8,4 @@ INCLUDEPATH += ../
HEADERS += HEADERS +=
SOURCES += tst_qtabwidget.cpp SOURCES += tst_qtabwidget.cpp
win32:!wince*:LIBS += -luser32 win32:!wince*:!winrt:LIBS += -luser32

View File

@ -48,7 +48,7 @@
#include <qlabel.h> #include <qlabel.h>
#include <QtWidgets/qboxlayout.h> #include <QtWidgets/qboxlayout.h>
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
# include <qt_windows.h> # include <qt_windows.h>
#define Q_CHECK_PAINTEVENTS \ #define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \

View File

@ -76,7 +76,11 @@ const QString PI_PulseTestrBranch(QLS("PulseTestrBranch"));
void BaselineProtocol::sysSleep(int ms) void BaselineProtocol::sysSleep(int ms)
{ {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
# ifndef Q_OS_WINRT
Sleep(DWORD(ms)); Sleep(DWORD(ms));
# else
WaitForSingleObjectEx(GetCurrentThread(), ms, false);
# endif
#else #else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
@ -116,6 +120,7 @@ PlatformInfo PlatformInfo::localHostInfo()
pi.insert(PI_OSName, QLS("Other")); pi.insert(PI_OSName, QLS("Other"));
#endif #endif
#ifndef QT_NO_PROCESS
QProcess git; QProcess git;
QString cmd; QString cmd;
QStringList args; QStringList args;
@ -151,6 +156,7 @@ PlatformInfo PlatformInfo::localHostInfo()
pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb)); pi.insert(PI_PulseGitBranch, QString::fromLatin1(gb));
} }
} }
#endif // !QT_NO_PROCESS
return pi; return pi;
} }

View File

@ -176,7 +176,12 @@ private slots:
wcscat(appendedPath, L"\\*"); wcscat(appendedPath, L"\\*");
WIN32_FIND_DATA fd; WIN32_FIND_DATA fd;
#ifndef Q_OS_WINRT
HANDLE hSearch = FindFirstFileW(appendedPath, &fd); HANDLE hSearch = FindFirstFileW(appendedPath, &fd);
#else
HANDLE hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd,
FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
#endif
QVERIFY(hSearch != INVALID_HANDLE_VALUE); QVERIFY(hSearch != INVALID_HANDLE_VALUE);
QBENCHMARK { QBENCHMARK {

View File

@ -106,7 +106,12 @@ static int posix_helper(const wchar_t *dirpath)
wchar_t appendedPath[MAX_PATH]; wchar_t appendedPath[MAX_PATH];
wcscpy(appendedPath, dirpath); wcscpy(appendedPath, dirpath);
wcscat(appendedPath, L"\\*"); wcscat(appendedPath, L"\\*");
#ifndef Q_OS_WINRT
hSearch = FindFirstFile(appendedPath, &fd); hSearch = FindFirstFile(appendedPath, &fd);
#else
hSearch = FindFirstFileEx(appendedPath, FindExInfoStandard, &fd,
FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
#endif
appendedPath[origDirPathLength] = 0; appendedPath[origDirPathLength] = 0;
if (hSearch == INVALID_HANDLE_VALUE) { if (hSearch == INVALID_HANDLE_VALUE) {

View File

@ -230,7 +230,12 @@ void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path)
wchar_t szSearchPath[MAX_PATH]; wchar_t szSearchPath[MAX_PATH];
QString::fromLatin1(path).toWCharArray(szSearchPath); QString::fromLatin1(path).toWCharArray(szSearchPath);
wcscat(szSearchPath, L"\\*"); wcscat(szSearchPath, L"\\*");
#ifndef Q_OS_WINRT
HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult);
#else
HANDLE dir = FindFirstFileEx(szSearchPath, FindExInfoStandard, &m_fileSearchResult,
FindExSearchLimitToDirectories, NULL, FIND_FIRST_EX_LARGE_FETCH);
#endif
m_bFirstSearchResult = true; m_bFirstSearchResult = true;
#else #else
DIR *dir = ::opendir(path.constData()); DIR *dir = ::opendir(path.constData());

View File

@ -310,7 +310,11 @@ void tst_qfile::readBigFile()
// ensure we don't account string conversion // ensure we don't account string conversion
wchar_t* cfilename = (wchar_t*)filename.utf16(); wchar_t* cfilename = (wchar_t*)filename.utf16();
#ifndef Q_OS_WINRT
hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
#else
hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0);
#endif
Q_ASSERT(hndl); Q_ASSERT(hndl);
wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; wchar_t* nativeBuffer = new wchar_t[BUFSIZE];
DWORD numberOfBytesRead; DWORD numberOfBytesRead;
@ -319,7 +323,12 @@ void tst_qfile::readBigFile()
do { do {
ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL); ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL);
} while(numberOfBytesRead != 0); } while(numberOfBytesRead != 0);
#ifndef Q_OS_WINRT
SetFilePointer(hndl, 0, NULL, FILE_BEGIN); SetFilePointer(hndl, 0, NULL, FILE_BEGIN);
#else
LARGE_INTEGER offset = { 0 };
SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN);
#endif
} }
delete[] nativeBuffer; delete[] nativeBuffer;
CloseHandle(hndl); CloseHandle(hndl);
@ -400,11 +409,20 @@ void tst_qfile::seek()
// ensure we don't account string conversion // ensure we don't account string conversion
wchar_t* cfilename = (wchar_t*)filename.utf16(); wchar_t* cfilename = (wchar_t*)filename.utf16();
#ifndef Q_OS_WINRT
hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
#else
hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0);
#endif
Q_ASSERT(hndl); Q_ASSERT(hndl);
QBENCHMARK { QBENCHMARK {
i=(i+1)%sp_size; i=(i+1)%sp_size;
#ifndef Q_OS_WINRT
SetFilePointer(hndl, seekpos[i], NULL, 0); SetFilePointer(hndl, seekpos[i], NULL, 0);
#else
LARGE_INTEGER offset = { seekpos[i] };
SetFilePointerEx(hndl, offset, NULL, FILE_BEGIN);
#endif
} }
CloseHandle(hndl); CloseHandle(hndl);
#else #else
@ -489,7 +507,11 @@ void tst_qfile::open()
wchar_t* cfilename = (wchar_t*)filename.utf16(); wchar_t* cfilename = (wchar_t*)filename.utf16();
QBENCHMARK { QBENCHMARK {
#ifndef Q_OS_WINRT
hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
#else
hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0);
#endif
Q_ASSERT(hndl); Q_ASSERT(hndl);
CloseHandle(hndl); CloseHandle(hndl);
} }
@ -698,7 +720,11 @@ void tst_qfile::readSmallFiles()
// ensure we don't account string conversion // ensure we don't account string conversion
wchar_t* cfilename = (wchar_t*)filename.utf16(); wchar_t* cfilename = (wchar_t*)filename.utf16();
#ifndef Q_OS_WINRT
hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
#else
hndl = CreateFile2(cfilename, GENERIC_READ, 0, OPEN_EXISTING, 0);
#endif
Q_ASSERT(hndl); Q_ASSERT(hndl);
wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; wchar_t* nativeBuffer = new wchar_t[BUFSIZE];
DWORD numberOfBytesRead; DWORD numberOfBytesRead;

View File

@ -54,7 +54,7 @@ class qfileinfo : public QObject
private slots: private slots:
void existsTemporary(); void existsTemporary();
void existsStatic(); void existsStatic();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void symLinkTargetPerformanceLNK(); void symLinkTargetPerformanceLNK();
void symLinkTargetPerformanceMounpoint(); void symLinkTargetPerformanceMounpoint();
#endif #endif
@ -84,7 +84,7 @@ void qfileinfo::existsStatic()
QBENCHMARK { QFileInfo::exists(appPath); } QBENCHMARK { QFileInfo::exists(appPath); }
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void qfileinfo::symLinkTargetPerformanceLNK() void qfileinfo::symLinkTargetPerformanceLNK()
{ {
QVERIFY(QFile::link("file","link.lnk")); QVERIFY(QFile::link("file","link.lnk"));

View File

@ -93,7 +93,11 @@ void NativeMutexUnlock(NativeMutexType *mutex)
typedef CRITICAL_SECTION NativeMutexType; typedef CRITICAL_SECTION NativeMutexType;
void NativeMutexInitialize(NativeMutexType *mutex) void NativeMutexInitialize(NativeMutexType *mutex)
{ {
#ifndef Q_OS_WINRT
InitializeCriticalSection(mutex); InitializeCriticalSection(mutex);
#else
InitializeCriticalSectionEx(mutex, 0, 0);
#endif
} }
void NativeMutexDestroy(NativeMutexType *mutex) void NativeMutexDestroy(NativeMutexType *mutex)
{ {

View File

@ -92,7 +92,7 @@ public:
return file.isNull() ? qint64(-1) : file->write(relativeFileName.toUtf8()); return file.isNull() ? qint64(-1) : file->write(relativeFileName.toUtf8());
} }
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
static void createNtfsJunction(QString target, QString linkName) static void createNtfsJunction(QString target, QString linkName)
{ {
typedef struct { typedef struct {