summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-07-01 11:05:26 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-07-01 11:05:26 +0200
commit0aa2d318b1524cdab42ab9988270779ddcc1922a (patch)
tree695c70702763ba2c66eb398ae9d545fc712a9e2d /tests/auto/corelib
parent6251d4dafc86bcbec09d1962050af9924249d419 (diff)
parent49049d90470eb3e94bda77d19ab7f7c57a0bd57f (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro2
-rw-r--r--tests/auto/corelib/global/qnumeric/qnumeric.pro2
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp6
-rw-r--r--tests/auto/corelib/io/largefile/largefile.pro2
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp2
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp11
-rw-r--r--tests/auto/corelib/io/qfile/test/test.pro2
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp2
-rw-r--r--tests/auto/corelib/io/qfileinfo/qfileinfo.pro2
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp43
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp26
-rw-r--r--tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro2
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp2
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp2
-rw-r--r--tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp18
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp18
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp12
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp55
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h3
-rw-r--r--tests/auto/corelib/kernel/qeventloop/qeventloop.pro2
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro2
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp7
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/lib.pro2
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro2
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp46
-rw-r--r--tests/auto/corelib/tools/qcollator/tst_qcollator.cpp2
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.pri2
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp2
28 files changed, 173 insertions, 106 deletions
diff --git a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro
index 0bcf067c4f..9f2e4f9c92 100644
--- a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro
+++ b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = test
-!wince*:SUBDIRS += echo
+!wince: SUBDIRS += echo
diff --git a/tests/auto/corelib/global/qnumeric/qnumeric.pro b/tests/auto/corelib/global/qnumeric/qnumeric.pro
index 4cfb3fa7ac..00f3635be9 100644
--- a/tests/auto/corelib/global/qnumeric/qnumeric.pro
+++ b/tests/auto/corelib/global/qnumeric/qnumeric.pro
@@ -3,3 +3,5 @@ TARGET = tst_qnumeric
QT = core testlib
SOURCES = tst_qnumeric.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+intel_icc: QMAKE_CXXFLAGS += -fp-model strict
+intel_icl: QMAKE_CXXFLAGS += /fp:strict
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index 9a50df379c..fdc8bc6aab 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -107,13 +107,7 @@ void tst_QNumeric::qNan()
QVERIFY(qIsInf(-inf));
QVERIFY(qIsInf(2*inf));
QCOMPARE(1/inf, 0.0);
-#ifdef Q_CC_INTEL
- QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue);
-#endif
QVERIFY(qIsNaN(0*nan));
-#ifdef Q_CC_INTEL
- QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue);
-#endif
QVERIFY(qIsNaN(0*inf));
QVERIFY(qFuzzyCompare(1/inf, 0.0));
}
diff --git a/tests/auto/corelib/io/largefile/largefile.pro b/tests/auto/corelib/io/largefile/largefile.pro
index 55878196cd..d9938d07d5 100644
--- a/tests/auto/corelib/io/largefile/largefile.pro
+++ b/tests/auto/corelib/io/largefile/largefile.pro
@@ -3,5 +3,5 @@ TARGET = tst_largefile
QT = core testlib
SOURCES = tst_largefile.cpp
-wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
+wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index 9d29b5401f..2cf93e1c45 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -1837,7 +1837,7 @@ static QRegion qRegionData(int index)
case 12: return QRegion(0, 0, 3, 3, QRegion::Ellipse);
#else
case 7:
- qWarning("Skipping streaming of elliptical regions on embedded, Mac OS X, and X11;"
+ qWarning("Skipping streaming of elliptical regions on embedded, OS X, and X11;"
" our pointarray stuff is not that great at approximating.");
#endif
}
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index e8a7105f6e..45289df398 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1366,6 +1366,9 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("11") << "" << "" << "";
+ QTest::newRow("same path 1") << "/tmp" << "/tmp" << ".";
+ QTest::newRow("same path 2") << "//tmp" << "/tmp/" << ".";
+
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding";
QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong";
@@ -1373,10 +1376,10 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("15") << "C:/foo/bar" << "D:/ding/dong" << "D:/ding/dong";
QTest::newRow("16") << "C:" << "C:/ding/dong" << "ding/dong";
QTest::newRow("17") << "C:/" << "C:/ding/dong" << "ding/dong";
- QTest::newRow("18") << "C:" << "C:" << "";
- QTest::newRow("19") << "C:/" << "C:" << "";
- QTest::newRow("20") << "C:" << "C:/" << "";
- QTest::newRow("21") << "C:/" << "C:/" << "";
+ QTest::newRow("18") << "C:" << "C:" << ".";
+ QTest::newRow("19") << "C:/" << "C:" << ".";
+ QTest::newRow("20") << "C:" << "C:/" << ".";
+ QTest::newRow("21") << "C:/" << "C:/" << ".";
QTest::newRow("22") << "C:" << "C:file.txt" << "file.txt";
QTest::newRow("23") << "C:/" << "C:file.txt" << "file.txt";
QTest::newRow("24") << "C:" << "C:/file.txt" << "file.txt";
diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro
index 03863e9943..9aa4119795 100644
--- a/tests/auto/corelib/io/qfile/test/test.pro
+++ b/tests/auto/corelib/io/qfile/test/test.pro
@@ -7,7 +7,7 @@ else: DEFINES += QT_NO_NETWORK
TARGET = ../tst_qfile
SOURCES = ../tst_qfile.cpp
-wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
+wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 5025dd38db..b423e857d0 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -2192,7 +2192,7 @@ void tst_QFile::removeOpenFile()
bool opened = f.open(QIODevice::ReadOnly);
QVERIFY(opened);
f.readAll();
- // this used to only fail on FreeBSD (and Mac OS X)
+ // this used to only fail on FreeBSD (and OS X)
QVERIFY(f.flush());
bool removed = f.remove(); // remove should both close and remove the file
QVERIFY(removed);
diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
index 0ac7b30abd..571637be37 100644
--- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
+++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
@@ -5,7 +5,7 @@ SOURCES = tst_qfileinfo.cpp
RESOURCES += qfileinfo.qrc \
testdata.qrc
-win32*:!wince*:!winrt:LIBS += -ladvapi32 -lnetapi32
+win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
win32: CONFIG += insignificant_test # Crashes on Windows in release builds
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 62e183f619..2b01cfd7a9 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -263,21 +263,23 @@ private slots:
private:
const QString m_currentDir;
- QString m_dataPath;
QString m_sourceFile;
QString m_proFile;
QString m_resourcesDir;
QTemporaryDir m_dir;
+ QSharedPointer<QTemporaryDir> m_dataDir;
};
void tst_QFileInfo::initTestCase()
{
- m_dataPath = QEXTRACTTESTDATA("/testdata");
- QVERIFY(!m_dataPath.isEmpty());
+ m_dataDir = QEXTRACTTESTDATA("/testdata");
+ QVERIFY(m_dataDir);
+ const QString dataPath = m_dataDir->path();
+ QVERIFY(!dataPath.isEmpty());
- m_sourceFile = m_dataPath + QStringLiteral("/tst_qfileinfo.cpp");
- m_resourcesDir = m_dataPath + QStringLiteral("/resources");
- m_proFile = m_dataPath + QStringLiteral("/tst_qfileinfo.pro");
+ m_sourceFile = dataPath + QLatin1String("/tst_qfileinfo.cpp");
+ m_resourcesDir = dataPath + QLatin1String("/resources");
+ m_proFile = dataPath + QLatin1String("/tst_qfileinfo.pro");
QVERIFY(m_dir.isValid());
QVERIFY(QDir::setCurrent(m_dir.path()));
@@ -286,7 +288,6 @@ void tst_QFileInfo::initTestCase()
void tst_QFileInfo::cleanupTestCase()
{
QDir::setCurrent(m_currentDir); // Release temporary directory so that it can be deleted on Windows
- QDir(m_dataPath).removeRecursively();
}
// Testing get/set functions
@@ -609,6 +610,16 @@ void tst_QFileInfo::canonicalPath()
QCOMPARE(fi.canonicalPath(), QFileInfo(QDir::tempPath()).canonicalFilePath());
}
+class FileDeleter {
+ Q_DISABLE_COPY(FileDeleter)
+public:
+ explicit FileDeleter(const QString fileName) : m_fileName(fileName) {}
+ ~FileDeleter() { QFile::remove(m_fileName); }
+
+private:
+ const QString m_fileName;
+};
+
void tst_QFileInfo::canonicalFilePath()
{
const QString fileName("tmp.canon");
@@ -639,9 +650,13 @@ void tst_QFileInfo::canonicalFilePath()
QCOMPARE(info1.canonicalFilePath(), info2.canonicalFilePath());
}
}
+
+ const QString dirSymLinkName = QLatin1String("tst_qfileinfo")
+ + QDateTime::currentDateTime().toString(QLatin1String("yyMMddhhmmss"));
+ const QString link(QDir::tempPath() + QLatin1Char('/') + dirSymLinkName);
+ FileDeleter dirSymLinkDeleter(link);
+
{
- const QString link(QDir::tempPath() + QDir::separator() + "tst_qfileinfo");
- QFile::remove(link);
QFile file(QDir::currentPath());
if (file.link(link)) {
QFile tempfile("tempfile.txt");
@@ -666,12 +681,12 @@ void tst_QFileInfo::canonicalFilePath()
}
}
{
- QString link(QDir::tempPath() + QDir::separator() + "tst_qfileinfo"
- + QDir::separator() + "link_to_tst_qfileinfo");
+ QString link(QDir::tempPath() + QLatin1Char('/') + dirSymLinkName
+ + "/link_to_tst_qfileinfo");
QFile::remove(link);
- QFile file(QDir::tempPath() + QDir::separator() + "tst_qfileinfo"
- + QDir::separator() + "tst_qfileinfo.cpp");
+ QFile file(QDir::tempPath() + QLatin1Char('/') + dirSymLinkName
+ + "tst_qfileinfo.cpp");
if (file.link(link))
{
QFileInfo info1("tst_qfileinfo.cpp");
@@ -1266,7 +1281,7 @@ void tst_QFileInfo::isHidden_data()
#endif
#if defined(Q_OS_MAC)
- // /bin has the hidden attribute on Mac OS X
+ // /bin has the hidden attribute on OS X
QTest::newRow("/bin/") << QString::fromLatin1("/bin/") << true;
#elif !defined(Q_OS_WIN)
QTest::newRow("/bin/") << QString::fromLatin1("/bin/") << false;
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index b78ff7ed80..a0434aa8ee 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -62,6 +62,7 @@ private slots:
void removePath();
void addPaths();
void removePaths();
+ void removePathsFilesInSameDirectory();
void watchFileAndItsDirectory_data() { basicTest_data(); }
void watchFileAndItsDirectory();
@@ -460,6 +461,31 @@ void tst_QFileSystemWatcher::removePaths()
watcher.removePaths(paths);
}
+void tst_QFileSystemWatcher::removePathsFilesInSameDirectory()
+{
+ // QTBUG-46449/Windows: Check the return values of removePaths().
+ // When adding the 1st file, a thread is started to watch the temp path.
+ // After adding and removing the 2nd file, the thread is still running and
+ // success should be reported.
+ QTemporaryFile file1(m_tempDirPattern);
+ QTemporaryFile file2(m_tempDirPattern);
+ QVERIFY2(file1.open(), qPrintable(file1.errorString()));
+ QVERIFY2(file2.open(), qPrintable(file1.errorString()));
+ const QString path1 = file1.fileName();
+ const QString path2 = file2.fileName();
+ file1.close();
+ file2.close();
+ QFileSystemWatcher watcher;
+ QVERIFY(watcher.addPath(path1));
+ QCOMPARE(watcher.files().size(), 1);
+ QVERIFY(watcher.addPath(path2));
+ QCOMPARE(watcher.files().size(), 2);
+ QVERIFY(watcher.removePath(path1));
+ QCOMPARE(watcher.files().size(), 1);
+ QVERIFY(watcher.removePath(path2));
+ QCOMPARE(watcher.files().size(), 0);
+}
+
static QByteArray msgFileOperationFailed(const char *what, const QFile &f)
{
return what + QByteArrayLiteral(" failed on \"")
diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
index 7f3b8ade3e..b59241851f 100644
--- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
+++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
@@ -1,6 +1,6 @@
win32 {
SOURCES = main_win.cpp
- !wince*:LIBS += -luser32
+ !wince: LIBS += -luser32
}
unix {
SOURCES = main_unix.cpp
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 399e9b9222..0c65ceb0eb 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -1558,7 +1558,7 @@ void tst_QProcess::failToStart()
QVERIFY(finishedSpy.isValid());
QVERIFY(finishedSpy2.isValid());
-// Mac OS X and HP-UX have a really low default process limit (~100), so spawning
+// OS X and HP-UX have a really low default process limit (~100), so spawning
// to many processes here will cause test failures later on.
#if defined Q_OS_HPUX
const int attempts = 15;
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index bc33d5991b..e2e1d99657 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -1476,7 +1476,7 @@ void tst_QSettings::remove()
void tst_QSettings::contains()
{
QSettings settings1(QSettings::UserScope, "software.org", "KillerAPP");
- int initialNumKeys = settings1.allKeys().size(); // 0 on all platforms but Mac OS X.
+ int initialNumKeys = settings1.allKeys().size(); // 0 on all platforms but OS X.
settings1.setValue("alpha/beta/geometry", -7);
settings1.setValue("alpha/beta/geometry/x", 1);
settings1.setValue("alpha/beta/geometry/y", 2);
diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
index 2190c32c01..a7a0cf4ddb 100644
--- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
+++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
@@ -61,9 +61,9 @@ void tst_QStorageInfo::defaultValues()
QVERIFY(!storage.isRoot());
QVERIFY(storage.device().isEmpty());
QVERIFY(storage.fileSystemType().isEmpty());
- QVERIFY(storage.bytesTotal() == 0);
- QVERIFY(storage.bytesFree() == 0);
- QVERIFY(storage.bytesAvailable() == 0);
+ QVERIFY(storage.bytesTotal() == -1);
+ QVERIFY(storage.bytesFree() == -1);
+ QVERIFY(storage.bytesAvailable() == -1);
}
void tst_QStorageInfo::operatorEqual()
@@ -106,9 +106,9 @@ void tst_QStorageInfo::root()
QVERIFY(!storage.device().isEmpty());
QVERIFY(!storage.fileSystemType().isEmpty());
#ifndef Q_OS_HAIKU
- QVERIFY(storage.bytesTotal() > 0);
- QVERIFY(storage.bytesFree() > 0);
- QVERIFY(storage.bytesAvailable() > 0);
+ QVERIFY(storage.bytesTotal() >= 0);
+ QVERIFY(storage.bytesFree() >= 0);
+ QVERIFY(storage.bytesAvailable() >= 0);
#endif
}
@@ -121,9 +121,9 @@ void tst_QStorageInfo::currentStorage()
QVERIFY(appPath.startsWith(storage.rootPath(), Qt::CaseInsensitive));
QVERIFY(!storage.device().isEmpty());
QVERIFY(!storage.fileSystemType().isEmpty());
- QVERIFY(storage.bytesTotal() > 0);
- QVERIFY(storage.bytesFree() > 0);
- QVERIFY(storage.bytesAvailable() > 0);
+ QVERIFY(storage.bytesTotal() >= 0);
+ QVERIFY(storage.bytesFree() >= 0);
+ QVERIFY(storage.bytesAvailable() >= 0);
}
void tst_QStorageInfo::storageList()
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index aa7a3762ce..36da3b8770 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -81,7 +81,7 @@ private slots:
void readLineMaxlen_data();
void readLineMaxlen();
void readLinesFromBufferCRCR();
- void readLineOverload();
+ void readLineInto();
// all
void readAllFromDevice_data();
@@ -612,22 +612,22 @@ protected:
}
};
-void tst_QTextStream::readLineOverload()
+void tst_QTextStream::readLineInto()
{
QByteArray data = "1\n2\n3";
QTextStream ts(&data);
QString line;
- ts.readLine(&line);
+ ts.readLineInto(&line);
QCOMPARE(line, QStringLiteral("1"));
- ts.readLine(Q_NULLPTR, 0); // read the second line, but don't store it
+ ts.readLineInto(Q_NULLPTR, 0); // read the second line, but don't store it
- ts.readLine(&line);
+ ts.readLineInto(&line);
QCOMPARE(line, QStringLiteral("3"));
- QVERIFY(!ts.readLine(&line));
+ QVERIFY(!ts.readLineInto(&line));
QVERIFY(line.isEmpty());
QFile file(m_rfc3261FilePath);
@@ -637,7 +637,7 @@ void tst_QTextStream::readLineOverload()
line.reserve(1);
int maxLineCapacity = line.capacity();
- while (ts.readLine(&line)) {
+ while (ts.readLineInto(&line)) {
QVERIFY(line.capacity() >= maxLineCapacity);
maxLineCapacity = line.capacity();
}
@@ -647,7 +647,7 @@ void tst_QTextStream::readLineOverload()
QVERIFY(errorDevice.open(QIODevice::ReadOnly));
ts.setDevice(&errorDevice);
- QVERIFY(!ts.readLine(&line));
+ QVERIFY(!ts.readLineInto(&line));
QVERIFY(line.isEmpty());
}
@@ -1025,7 +1025,7 @@ void tst_QTextStream::performance()
QTextStream stream2(&file3);
QString line;
- while (stream2.readLine(&line))
+ while (stream2.readLineInto(&line))
++nlines3;
elapsed[2] = stopWatch.elapsed();
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index bd9e858091..0302ae5cbf 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -2529,16 +2529,16 @@ void tst_QSortFilterProxyModel::sortColumnTracking2()
proxyModel.sort(0);
QCOMPARE(proxyModel.sortColumn(), 0);
- QList<QStandardItem *> items;
- QStringList strings;
- strings << "foo" << "bar" << "some" << "others" << "item" << "aa" << "zz";
- foreach (QString s, strings)
- items << new QStandardItem(s);
+ QList<QStandardItem *> items; // Stable sorting: Items with invalid data should move to the end
+ items << new QStandardItem << new QStandardItem("foo") << new QStandardItem("bar")
+ << new QStandardItem("some") << new QStandardItem("others") << new QStandardItem("item")
+ << new QStandardItem("aa") << new QStandardItem("zz") << new QStandardItem;
model.insertColumn(0,items);
QCOMPARE(proxyModel.sortColumn(), 0);
QCOMPARE(proxyModel.data(proxyModel.index(0,0)).toString(),QString::fromLatin1("aa"));
- QCOMPARE(proxyModel.data(proxyModel.index(strings.count()-1,0)).toString(),QString::fromLatin1("zz"));
+ const int zzIndex = items.count() - 3; // 2 invalid at end.
+ QCOMPARE(proxyModel.data(proxyModel.index(zzIndex,0)).toString(),QString::fromLatin1("zz"));
}
void tst_QSortFilterProxyModel::sortStable()
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 924db17c04..efecf31d66 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -60,6 +61,23 @@ public:
}
};
+class ThreadedEventReceiver : public QObject
+{
+ Q_OBJECT
+public:
+ QList<int> recordedEvents;
+ bool event(QEvent *event) Q_DECL_OVERRIDE
+ {
+ if (event->type() != QEvent::Type(QEvent::User + 1))
+ return QObject::event(event);
+ recordedEvents.append(event->type());
+ QThread::currentThread()->quit();
+ QCoreApplication::quit();
+ moveToThread(0);
+ return true;
+ }
+};
+
void tst_QCoreApplication::sendEventsOnProcessEvents()
{
int argc = 1;
@@ -797,6 +815,43 @@ void tst_QCoreApplication::QTBUG31606_QEventDestructorDeadLock()
QVERIFY(spy.recordedEvents.contains(QEvent::User + 2));
}
+// this is almost identical to sendEventsOnProcessEvents
+void tst_QCoreApplication::applicationEventFilters_mainThread()
+{
+ int argc = 1;
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
+ TestApplication app(argc, argv);
+
+ EventSpy spy;
+ app.installEventFilter(&spy);
+
+ QCoreApplication::postEvent(&app, new QEvent(QEvent::Type(QEvent::User + 1)));
+ QTimer::singleShot(10, &app, SLOT(quit()));
+ app.exec();
+ QVERIFY(spy.recordedEvents.contains(QEvent::User + 1));
+}
+
+void tst_QCoreApplication::applicationEventFilters_auxThread()
+{
+ int argc = 1;
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
+ TestApplication app(argc, argv);
+ QThread thread;
+ ThreadedEventReceiver receiver;
+ receiver.moveToThread(&thread);
+
+ EventSpy spy;
+ app.installEventFilter(&spy);
+
+ // this is very similar to sendEventsOnProcessEvents
+ QCoreApplication::postEvent(&receiver, new QEvent(QEvent::Type(QEvent::User + 1)));
+ QTimer::singleShot(1000, &app, SLOT(quit()));
+ thread.start();
+ app.exec();
+ QVERIFY(thread.wait(1000));
+ QVERIFY(receiver.recordedEvents.contains(QEvent::User + 1));
+ QVERIFY(!spy.recordedEvents.contains(QEvent::User + 1));
+}
static void createQObjectOnDestruction()
{
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
index 3dd84482d7..09e15723ac 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -58,6 +59,8 @@ private slots:
void customEventDispatcher();
void testQuitLock();
void QTBUG31606_QEventDestructorDeadLock();
+ void applicationEventFilters_mainThread();
+ void applicationEventFilters_auxThread();
};
#endif // TST_QCOREAPPLICATION_H
diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro
index 5593aa2430..ea4792fc1c 100644
--- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro
+++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro
@@ -4,7 +4,7 @@ TARGET = tst_qeventloop
QT = core network testlib core-private
SOURCES = $$PWD/tst_qeventloop.cpp
-win32:!wince*:!winrt:LIBS += -luser32
+win32:!wince:!winrt: LIBS += -luser32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
index 8823d54590..b08dfb1838 100644
--- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
+++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
@@ -2,7 +2,7 @@ CONFIG -= app_bundle debug_and_release
CONFIG += console
DESTDIR = ./
QT = core
-wince*: {
+wince {
LIBS += coredll.lib
}
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 3ec84b5198..4617ce5e74 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -918,6 +918,8 @@ void tst_QObject::connectDisconnectNotifyPMF()
QMetaObject::Connection conn = connect((SenderObject*)s, &SenderObject::signal1,
(ReceiverObject*)r, &ReceiverObject::slot1);
+ QVERIFY(conn);
+
// Test disconnectNotify when disconnecting by QMetaObject::Connection
QVERIFY(QObject::disconnect(conn));
// disconnectNotify() is not called, but it probably should be.
@@ -5751,7 +5753,6 @@ void tst_QObject::connectFunctorWithContext()
{
int status = 1;
SenderObject obj;
- QMetaObject::Connection handle;
ContextObject *context = new ContextObject;
QEventLoop e;
@@ -6058,8 +6059,12 @@ void tst_QObject::disconnectDoesNotLeakFunctor()
QVERIFY(c2);
QCOMPARE(countedStructObjectsCount, 2);
QVERIFY(QObject::disconnect(c1));
+ QVERIFY(!c1);
+ QVERIFY(!c2);
// functor object has been destroyed
QCOMPARE(countedStructObjectsCount, 1);
+ QVERIFY(!QObject::disconnect(c2));
+ QCOMPARE(countedStructObjectsCount, 1);
}
QCOMPARE(countedStructObjectsCount, 0);
}
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
index a92b4faca5..195e48da93 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
+++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
@@ -6,7 +6,7 @@ TARGET = mylib
DESTDIR = ../
QT = core
-wince*: DEFINES += WIN32_MSVC
+wince: DEFINES += WIN32_MSVC
win32-msvc: DEFINES += WIN32_MSVC
# This project is testdata for tst_qlibrary
diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
index dc6a660c0a..52dd8b9679 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
+++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
@@ -7,7 +7,7 @@ DESTDIR = ../
VERSION = 2
QT = core
-wince*: DEFINES += WIN32_MSVC
+wince: DEFINES += WIN32_MSVC
win32-msvc: DEFINES += WIN32_MSVC
# Force a copy of the library to have an extension that is non-standard.
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 3bc4bb80b8..3230472d5b 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -669,9 +669,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data)
#if defined Q_OS_UNIX
const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this);
Q_UNUSED(state);
-#elif defined(Q_OS_WINRT)
- // creating a new worker from within the GUI thread is not supported
-#elif defined(Q_OS_WINCE)
+#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
#elif defined Q_OS_WIN
unsigned thrdid = 0;
@@ -690,10 +688,12 @@ void NativeThreadWrapper::join()
{
#if defined Q_OS_UNIX
pthread_join(nativeThreadHandle, 0);
-#elif defined Q_OS_WINRT
- // not supported
#elif defined Q_OS_WIN
+#ifndef Q_OS_WINCE
+ WaitForSingleObjectEx(nativeThreadHandle, INFINITE, FALSE);
+#else
WaitForSingleObject(nativeThreadHandle, INFINITE);
+#endif
CloseHandle(nativeThreadHandle);
#endif
}
@@ -747,9 +747,6 @@ void testNativeThreadAdoption(void *)
}
void tst_QThread::nativeThreadAdoption()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
threadAdoptedOk = false;
mainThread = QThread::currentThread();
NativeThreadWrapper nativeThread;
@@ -773,9 +770,6 @@ void adoptedThreadAffinityFunction(void *arg)
void tst_QThread::adoptedThreadAffinity()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
QThread *affinity[2] = { 0, 0 };
NativeThreadWrapper thread;
@@ -788,9 +782,6 @@ void tst_QThread::adoptedThreadAffinity()
void tst_QThread::adoptedThreadSetPriority()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
nativeThread.startAndWait();
@@ -818,9 +809,6 @@ void tst_QThread::adoptedThreadSetPriority()
void tst_QThread::adoptedThreadExit()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
@@ -850,9 +838,6 @@ void adoptedThreadExecFunction(void *)
void tst_QThread::adoptedThreadExec()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.start(adoptedThreadExecFunction);
nativeThread.join();
@@ -863,9 +848,6 @@ void tst_QThread::adoptedThreadExec()
*/
void tst_QThread::adoptedThreadFinished()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
nativeThread.startAndWait();
@@ -876,17 +858,11 @@ void tst_QThread::adoptedThreadFinished()
nativeThread.join();
QTestEventLoop::instance().enterLoop(5);
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
}
void tst_QThread::adoptedThreadExecFinished()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
NativeThreadWrapper nativeThread;
nativeThread.setWaitForStop();
nativeThread.startAndWait(adoptedThreadExecFunction);
@@ -902,9 +878,6 @@ void tst_QThread::adoptedThreadExecFinished()
void tst_QThread::adoptMultipleThreads()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
#if defined(Q_OS_WIN)
// Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
# if defined(Q_OS_WINCE)
@@ -936,18 +909,12 @@ void tst_QThread::adoptMultipleThreads()
}
QTestEventLoop::instance().enterLoop(5);
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(recorder.activationCount.load(), numThreads);
}
void tst_QThread::adoptMultipleThreadsOverlap()
{
-#ifdef Q_OS_WINRT
- QSKIP("Native thread adoption is not supported on WinRT.");
-#endif
#if defined(Q_OS_WIN)
// Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
# if defined(Q_OS_WINCE)
@@ -984,9 +951,6 @@ void tst_QThread::adoptMultipleThreadsOverlap()
}
QTestEventLoop::instance().enterLoop(5);
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "QTBUG-31397: Known not to work on WinRT", Abort);
-#endif
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(recorder.activationCount.load(), numThreads);
}
diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
index e5675397f5..b0135ab6af 100644
--- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
+++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
@@ -103,7 +103,7 @@ void tst_QCollator::compare_data()
It's hard to test English, because it's treated differently
on different platforms. For example, on Linux, it uses the
iso14651_t1 template file, which happens to provide good
- defaults for Swedish. Mac OS X seems to do a pure bytewise
+ defaults for Swedish. OS X seems to do a pure bytewise
comparison of Latin-1 values, although I'm not sure. So I
just test digits to make sure that it's not totally broken.
*/
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.pri b/tests/auto/corelib/tools/qsharedpointer/externaltests.pri
index b3a01f7990..cac94bb522 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.pri
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.pri
@@ -4,4 +4,4 @@ cleanedQMAKESPEC = $$replace(QMAKESPEC, \\\\, /)
DEFINES += DEFAULT_MAKESPEC=\\\"$$cleanedQMAKESPEC\\\"
cross_compile:DEFINES += QTEST_NO_RTTI QTEST_CROSS_COMPILED
-wince*:DEFINES += QTEST_CROSS_COMPILED QTEST_NO_RTTI
+wince: DEFINES += QTEST_CROSS_COMPILED QTEST_NO_RTTI
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index d4b3ba7f15..f8b9d02e1e 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -5246,7 +5246,7 @@ void tst_QString::localeAwareCompare_data()
It's hard to test English, because it's treated differently
on different platforms. For example, on Linux, it uses the
iso14651_t1 template file, which happens to provide good
- defaults for Swedish. Mac OS X seems to do a pure bytewise
+ defaults for Swedish. OS X seems to do a pure bytewise
comparison of Latin-1 values, although I'm not sure. So I
just test digits to make sure that it's not totally broken.
*/