summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp4
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp12
-rw-r--r--tests/auto/corelib/io/qsettings/bom.ini4
-rw-r--r--tests/auto/corelib/io/qsettings/qsettings.qrc17
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp10
-rw-r--r--tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp10
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp9
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp130
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp52
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp19
-rw-r--r--tests/auto/corelib/kernel/qvariant/qvariant.pro1
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp12
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp22
-rw-r--r--tests/auto/corelib/tools/qversionnumber/qversionnumber.pro2
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp2
15 files changed, 270 insertions, 36 deletions
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 4e3d5c64bc..df2f97ce0e 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -1996,6 +1996,10 @@ void tst_QTextCodec::codecForHtml_data()
"auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: "
"none;\">&#x37b</span>\000";
QTest::newRow("greek text UTF-8") << html << 106 << 106;
+
+ html = "<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=unicode\">"
+ "<head/><body><p>bla</p></body></html>"; // QTBUG-41998, ICU will return UTF-16.
+ QTest::newRow("legacy unicode UTF-8") << html << 106 << 106;
}
void tst_QTextCodec::codecForHtml()
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 35bd518b3a..0a55da5b7e 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -886,25 +886,25 @@ void tst_qmessagehandler::formatLogMessage_data()
#define BA QByteArrayLiteral
QTest::newRow("basic") << "%{type} %{file} %{line} %{function} %{message}"
- << "debug main.cpp 1 func msg\n"
+ << "debug main.cpp 1 func msg"
<< QtDebugMsg << BA("main.cpp") << 1 << BA("func") << BA("") << "msg";
// test the if conditions
QString format = "[%{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{if-category}%{category}: %{endif}%{message}";
QTest::newRow("if-debug")
- << format << "[D] msg\n"
+ << format << "[D] msg"
<< QtDebugMsg << BA("") << 0 << BA("func") << QByteArray() << "msg";
QTest::newRow("if_warning")
- << format << "[W] msg\n"
+ << format << "[W] msg"
<< QtWarningMsg << BA("") << 0 << BA("func") << QByteArray() << "msg";
QTest::newRow("if_critical")
- << format << "[C] msg\n"
+ << format << "[C] msg"
<< QtCriticalMsg << BA("") << 0 << BA("func") << QByteArray() << "msg";
QTest::newRow("if_fatal")
- << format << "[F] msg\n"
+ << format << "[F] msg"
<< QtFatalMsg << BA("") << 0 << BA("func") << QByteArray() << "msg";
QTest::newRow("if_cat")
- << format << "[F] cat: msg\n"
+ << format << "[F] cat: msg"
<< QtFatalMsg << BA("") << 0 << BA("func") << BA("cat") << "msg";
}
diff --git a/tests/auto/corelib/io/qsettings/bom.ini b/tests/auto/corelib/io/qsettings/bom.ini
new file mode 100644
index 0000000000..8d46ee8d91
--- /dev/null
+++ b/tests/auto/corelib/io/qsettings/bom.ini
@@ -0,0 +1,4 @@
+[section1]
+foo1=bar1
+[section2]
+foo2=bar2
diff --git a/tests/auto/corelib/io/qsettings/qsettings.qrc b/tests/auto/corelib/io/qsettings/qsettings.qrc
index 587c22ebe3..c0be7e013f 100644
--- a/tests/auto/corelib/io/qsettings/qsettings.qrc
+++ b/tests/auto/corelib/io/qsettings/qsettings.qrc
@@ -1,9 +1,10 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>resourcefile.ini</file>
- <file>resourcefile2.ini</file>
- <file>resourcefile3.ini</file>
- <file>resourcefile4.ini</file>
- <file>resourcefile5.ini</file>
-</qresource>
+<RCC>
+ <qresource prefix="/">
+ <file>resourcefile.ini</file>
+ <file>resourcefile2.ini</file>
+ <file>resourcefile3.ini</file>
+ <file>resourcefile4.ini</file>
+ <file>resourcefile5.ini</file>
+ <file>bom.ini</file>
+ </qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 3e68e4859f..c89923f159 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -161,6 +161,7 @@ private slots:
void testByteArray_data();
void testByteArray();
void iniCodec();
+ void bom();
private:
const bool m_canWriteNativeSystemSettings;
@@ -730,6 +731,15 @@ void tst_QSettings::iniCodec()
}
+void tst_QSettings::bom()
+{
+ QSettings s(":/bom.ini", QSettings::IniFormat);
+ QStringList allkeys = s.allKeys();
+ QCOMPARE(allkeys.size(), 2);
+ QVERIFY(allkeys.contains("section1/foo1"));
+ QVERIFY(allkeys.contains("section2/foo2"));
+}
+
void tst_QSettings::testErrorHandling_data()
{
QTest::addColumn<int>("filePerms"); // -1 means file should not exist
diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
index e07dda250f..3abbb71960 100644
--- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
+++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
@@ -154,6 +154,11 @@ void tst_QStorageInfo::tempFile()
QVERIFY(file.open());
QStorageInfo storage1(file.fileName());
+#ifdef Q_OS_LINUX
+ if (storage1.fileSystemType() == "btrfs")
+ QSKIP("This test doesn't work on btrfs, probably due to a btrfs bug");
+#endif
+
qint64 free = storage1.bytesFree();
file.write(QByteArray(1024*1024, '1'));
@@ -170,6 +175,11 @@ void tst_QStorageInfo::caching()
QVERIFY(file.open());
QStorageInfo storage1(file.fileName());
+#ifdef Q_OS_LINUX
+ if (storage1.fileSystemType() == "btrfs")
+ QSKIP("This test doesn't work on btrfs, probably due to a btrfs bug");
+#endif
+
qint64 free = storage1.bytesFree();
QStorageInfo storage2(storage1);
QVERIFY(free == storage2.bytesFree());
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 5b5161e24a..6d801f75c1 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1179,6 +1179,12 @@ void tst_QUrl::toLocalFile_data()
QTest::newRow("data0") << QString::fromLatin1("file:/a.txt") << QString::fromLatin1("/a.txt");
QTest::newRow("data4") << QString::fromLatin1("file:///a.txt") << QString::fromLatin1("/a.txt");
+ QTest::newRow("data4a") << QString::fromLatin1("webdavs://somewebdavhost/somedir/somefile")
+#ifdef Q_OS_WIN // QTBUG-42346, WebDAV is visible as local file on Windows only.
+ << QString::fromLatin1("//somewebdavhost@SSL/somedir/somefile");
+#else
+ << QString();
+#endif
#ifdef Q_OS_WIN
QTest::newRow("data5") << QString::fromLatin1("file:///c:/a.txt") << QString::fromLatin1("c:/a.txt");
#else
@@ -1227,6 +1233,9 @@ void tst_QUrl::fromLocalFile_data()
QTest::newRow("data3") << QString::fromLatin1("c:/a.txt") << QString::fromLatin1("file:///c:/a.txt") << QString::fromLatin1("/c:/a.txt");
QTest::newRow("data4") << QString::fromLatin1("//somehost/somedir/somefile") << QString::fromLatin1("file://somehost/somedir/somefile")
<< QString::fromLatin1("/somedir/somefile");
+ QTest::newRow("data4a") << QString::fromLatin1("//somewebdavhost@SSL/somedir/somefile")
+ << QString::fromLatin1("webdavs://somewebdavhost/somedir/somefile")
+ << QString::fromLatin1("/somedir/somefile");
QTest::newRow("data5") << QString::fromLatin1("//somehost") << QString::fromLatin1("file://somehost")
<< QString::fromLatin1("");
QTest::newRow("data6") << QString::fromLatin1("//somehost/") << QString::fromLatin1("file://somehost/")
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index ed84c111c6..d05ed6c20f 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -95,6 +95,7 @@ private slots:
void changeFilter();
void changeSourceData_data();
void changeSourceData();
+ void changeSourceDataKeepsStableSorting_qtbug1548();
void sortFilterRole();
void selectionFilteredOut();
void match_data();
@@ -143,6 +144,7 @@ private slots:
void noMapAfterSourceDelete();
void forwardDropApi();
+ void canDropMimeData();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -2009,6 +2011,79 @@ void tst_QSortFilterProxyModel::changeSourceData()
}
}
+// Checks that the model is a table, and that each and every row is like this:
+// i-th row: ( rows.at(i), i )
+static void checkSortedTableModel(const QAbstractItemModel *model, const QStringList &rows)
+{
+ QCOMPARE(model->rowCount(), rows.length());
+ QCOMPARE(model->columnCount(), 2);
+
+ for (int row = 0; row < model->rowCount(); ++row) {
+ const QString column0 = model->index(row, 0).data().toString();
+ const int column1 = model->index(row, 1).data().toString().toInt();
+
+ QCOMPARE(column0, rows.at(row));
+ QCOMPARE(column1, row);
+ }
+}
+
+void tst_QSortFilterProxyModel::changeSourceDataKeepsStableSorting_qtbug1548()
+{
+ // Check that emitting dataChanged from the source model
+ // for a change of a role which is not the sorting role
+ // doesn't alter the sorting. In this case, we sort on the DisplayRole,
+ // and play with other roles.
+
+ static const QStringList rows
+ = QStringList() << "a" << "b" << "b" << "b" << "c" << "c" << "x";
+
+ // Build a table of pairs (string, #row) in each row
+ QStandardItemModel model(0, 2);
+
+ for (int rowNumber = 0; rowNumber < rows.length(); ++rowNumber) {
+ QStandardItem *column0 = new QStandardItem(rows.at(rowNumber));
+ column0->setCheckable(true);
+ column0->setCheckState(Qt::Unchecked);
+
+ QStandardItem *column1 = new QStandardItem(QString::number(rowNumber));
+
+ const QList<QStandardItem *> row
+ = QList<QStandardItem *>() << column0 << column1;
+
+ model.appendRow(row);
+ }
+
+ checkSortedTableModel(&model, rows);
+
+ // Build the proxy model
+ QSortFilterProxyModel proxy;
+ proxy.setSourceModel(&model);
+ proxy.setDynamicSortFilter(true);
+ proxy.sort(0);
+
+ // The proxy is now sorted by the first column, check that the sorting
+ // * is correct (the input is already sorted, so it must not have changed)
+ // * was stable (by looking at the second column)
+ checkSortedTableModel(&model, rows);
+
+ // Change the check status of an item. That must not break the stable sorting
+ // changes the middle "b"
+ model.item(2)->setCheckState(Qt::Checked);
+ checkSortedTableModel(&model, rows);
+
+ // changes the starting "a"
+ model.item(0)->setCheckState(Qt::Checked);
+ checkSortedTableModel(&model, rows);
+
+ // change the background color of the first "c"
+ model.item(4)->setBackground(Qt::red);
+ checkSortedTableModel(&model, rows);
+
+ // change the background color of the second "c"
+ model.item(5)->setBackground(Qt::red);
+ checkSortedTableModel(&model, rows);
+}
+
void tst_QSortFilterProxyModel::sortFilterRole()
{
QStandardItemModel model;
@@ -3835,6 +3910,36 @@ void tst_QSortFilterProxyModel::chainedProxyModelRoleNames()
QVERIFY(proxy2.roleNames().value(Qt::UserRole + 1) == "custom");
}
+// A source model with ABABAB rows, where only A rows accept drops.
+// It will then be sorted by a QSFPM.
+class DropOnOddRows : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ DropOnOddRows(QObject *parent = 0) : QAbstractListModel(parent) {}
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
+ {
+ if (role == Qt::DisplayRole)
+ return (index.row() % 2 == 0) ? "A" : "B";
+ return QVariant();
+ }
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const
+ {
+ Q_UNUSED(parent);
+ return 10;
+ }
+
+ bool canDropMimeData(const QMimeData *, Qt::DropAction,
+ int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(row);
+ Q_UNUSED(column);
+ return parent.row() % 2 == 0;
+ }
+};
+
class SourceAssertion : public QSortFilterProxyModel
{
Q_OBJECT
@@ -3899,5 +4004,30 @@ void tst_QSortFilterProxyModel::forwardDropApi()
QVERIFY(model.dropMimeData(0, Qt::CopyAction, 0, 0, QModelIndex()));
}
+static QString rowTexts(QAbstractItemModel *model) {
+ QString str;
+ for (int row = 0 ; row < model->rowCount(); ++row)
+ str += model->index(row, 0).data().toString();
+ return str;
+}
+
+void tst_QSortFilterProxyModel::canDropMimeData()
+{
+ // Given a source model which only supports dropping on even rows
+ DropOnOddRows sourceModel;
+ QCOMPARE(rowTexts(&sourceModel), QString("ABABABABAB"));
+
+ // and a proxy model that sorts the rows
+ QSortFilterProxyModel proxy;
+ proxy.setSourceModel(&sourceModel);
+ proxy.sort(0, Qt::AscendingOrder);
+ QCOMPARE(rowTexts(&proxy), QString("AAAAABBBBB"));
+
+ // the proxy should correctly map canDropMimeData to the source model,
+ // i.e. accept drops on the first 5 rows and refuse drops on the next 5.
+ for (int row = 0; row < proxy.rowCount(); ++row)
+ QCOMPARE(proxy.canDropMimeData(0, Qt::CopyAction, -1, -1, proxy.index(row, 0)), row < 5);
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index 5cfbce0d7a..befd45018a 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -40,6 +40,7 @@
#include <private/qeventloop_p.h>
#if defined(Q_OS_UNIX)
#include <private/qeventdispatcher_unix_p.h>
+ #include <QtCore/private/qcore_unix_p.h>
#if defined(HAVE_GLIB)
#include <private/qeventdispatcher_glib_p.h>
#endif
@@ -172,7 +173,9 @@ private slots:
void execAfterExit();
void wakeUp();
void quit();
+#if defined(Q_OS_UNIX)
void processEventsExcludeSocket();
+#endif
void processEventsExcludeTimers();
void deliverInDefinedOrder();
@@ -383,6 +386,7 @@ void tst_QEventLoop::customEvent(QEvent *e)
}
}
+#if defined(Q_OS_UNIX)
class SocketEventsTester: public QObject
{
Q_OBJECT
@@ -391,8 +395,10 @@ public:
{
socket = 0;
server = 0;
- dataArrived = false;
+ dataSent = false;
+ dataReadable = false;
testResult = false;
+ dataArrived = false;
}
~SocketEventsTester()
{
@@ -415,8 +421,10 @@ public:
QTcpSocket *socket;
QTcpServer *server;
- bool dataArrived;
+ bool dataSent;
+ bool dataReadable;
bool testResult;
+ bool dataArrived;
public slots:
void sendAck()
{
@@ -428,12 +436,26 @@ public slots:
qint64 size = sizeof(data);
QTcpSocket *serverSocket = server->nextPendingConnection();
+ QCoreApplication::processEvents();
serverSocket->write(data, size);
- serverSocket->flush();
- QTest::qSleep(200); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read
- QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
- testResult = dataArrived;
- QCoreApplication::processEvents(); //check the deferred event is processed
+ dataSent = serverSocket->waitForBytesWritten(-1);
+
+ if (dataSent) {
+ fd_set fdread;
+ int fd = socket->socketDescriptor();
+ FD_ZERO(&fdread);
+ FD_SET(fd, &fdread);
+ dataReadable = (1 == qt_safe_select(fd + 1, &fdread, 0, 0, 0));
+ }
+
+ if (!dataReadable) {
+ testResult = dataArrived;
+ } else {
+ QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
+ testResult = dataArrived;
+ // to check if the deferred event is processed
+ QCoreApplication::processEvents();
+ }
serverSocket->close();
QThread::currentThread()->exit(0);
}
@@ -449,12 +471,16 @@ public:
SocketEventsTester *tester = new SocketEventsTester();
if (tester->init())
exec();
+ dataSent = tester->dataSent;
+ dataReadable = tester->dataReadable;
testResult = tester->testResult;
dataArrived = tester->dataArrived;
delete tester;
}
- bool testResult;
- bool dataArrived;
+ bool dataSent;
+ bool dataReadable;
+ bool testResult;
+ bool dataArrived;
};
void tst_QEventLoop::processEventsExcludeSocket()
@@ -462,9 +488,17 @@ void tst_QEventLoop::processEventsExcludeSocket()
SocketTestThread thread;
thread.start();
QVERIFY(thread.wait());
+ QVERIFY(thread.dataSent);
+ QVERIFY(thread.dataReadable);
+ #if defined(HAVE_GLIB)
+ QAbstractEventDispatcher *eventDispatcher = QCoreApplication::eventDispatcher();
+ if (qobject_cast<QEventDispatcherGlib *>(eventDispatcher))
+ QEXPECT_FAIL("", "ExcludeSocketNotifiers is currently broken in the Glib dispatchers", Continue);
+ #endif
QVERIFY(!thread.testResult);
QVERIFY(thread.dataArrived);
}
+#endif
class TimerReceiver : public QObject
{
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 78c75b44e8..5833123dfe 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -642,18 +642,25 @@ struct CountedStruct
QThread *thread;
};
-static QEventLoop _e;
+static QScopedPointer<QEventLoop> _e;
static QThread *_t = Q_NULLPTR;
class StaticEventLoop
{
public:
- static void quitEventLoop() { _e.quit(); if (_t) QCOMPARE(QThread::currentThread(), _t); }
+ static void quitEventLoop()
+ {
+ QVERIFY(!_e.isNull());
+ _e->quit();
+ if (_t)
+ QCOMPARE(QThread::currentThread(), _t);
+ }
};
void tst_QTimer::singleShotToFunctors()
{
int count = 0;
+ _e.reset(new QEventLoop);
QEventLoop e;
QTimer::singleShot(0, CountedStruct(&count));
@@ -661,7 +668,7 @@ void tst_QTimer::singleShotToFunctors()
QCOMPARE(count, 1);
QTimer::singleShot(0, &StaticEventLoop::quitEventLoop);
- QCOMPARE(_e.exec(), 0);
+ QCOMPARE(_e->exec(), 0);
QThread t1;
QObject c1;
@@ -687,7 +694,7 @@ void tst_QTimer::singleShotToFunctors()
QCOMPARE(e.exec(), 0);
QTimer::singleShot(0, &c2, &StaticEventLoop::quitEventLoop);
- QCOMPARE(_e.exec(), 0);
+ QCOMPARE(_e->exec(), 0);
_t->quit();
_t->wait();
@@ -721,8 +728,10 @@ void tst_QTimer::singleShotToFunctors()
thread.quit();
thread.wait();
#endif
-}
+ _e.reset();
+ _t = Q_NULLPTR;
+}
class DontBlockEvents : public QObject
{
diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro
index f8d054f70c..39178ba9e6 100644
--- a/tests/auto/corelib/kernel/qvariant/qvariant.pro
+++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro
@@ -6,3 +6,4 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qvariant.cpp
RESOURCES += qvariant.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+contains(QT_CONFIG, c++11): CONFIG += c++11
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index eae6311854..301db37233 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -3840,11 +3840,10 @@ struct ContainerAPI<Container, QByteArray>
}
};
-// We have no built-in defines to check the stdlib features.
-// #define TEST_FORWARD_LIST
-
-#ifdef TEST_FORWARD_LIST
-#include <forward_list>
+#ifdef __has_include
+# if __has_include(<forward_list>)
+# define TEST_FORWARD_LIST
+# include <forward_list>
Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(std::forward_list)
@@ -3898,7 +3897,8 @@ struct ContainerAPI<std::forward_list<QString> >
return variant == value;
}
};
-#endif
+# endif // __has_include(<forward_list>)
+#endif // __has_include
template<typename Container>
struct KeyGetter
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 57473021aa..e001440045 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -4447,6 +4447,28 @@ void tst_QString::section_data()
<< QString("o") << 1 << 2
<< int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep)
<< QString("o1o2o") << false;
+ QTest::newRow( "range1" ) << QString("o1o2o")
+ << QString("o") << -5 << -5
+ << int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep)
+ << QString() << false;
+ QTest::newRow( "range2" ) << QString("oo1o2o")
+ << QString("o") << -5 << 1
+ << int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep
+ |QString::SectionSkipEmpty)
+ << QString("oo1o2o") << false;
+ QTest::newRow( "range3" ) << QString("o1o2o")
+ << QString("o") << 2 << 1
+ << int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep)
+ << QString() << false;
+ QTest::newRow( "range4" ) << QString("o1o2o")
+ << QString("o") << 4 << 4
+ << int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep)
+ << QString() << false;
+ QTest::newRow( "range5" ) << QString("o1oo2o")
+ << QString("o") << -2 << -1
+ << int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep
+ |QString::SectionSkipEmpty)
+ << QString("o1oo2o") << false;
QTest::newRow( "rx1" ) << QString("o1o2o")
<< QString("[a-z]") << 0 << 0
<< int(QString::SectionIncludeLeadingSep|QString::SectionIncludeTrailingSep)
diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
index 08ee0dd3d9..1e74d42bbd 100644
--- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
+++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
@@ -1,4 +1,4 @@
CONFIG += testcase parallel_test
TARGET = tst_qversionnumber
-QT = core testlib
+QT = core-private testlib
SOURCES = tst_qversionnumber.cpp
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index 18bc86620a..f97b8a4df8 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -33,7 +33,7 @@
****************************************************************************/
#include <QtTest/QtTest>
-#include <qversionnumber.h>
+#include <private/qversionnumber_p.h>
class tst_QVersionNumber : public QObject
{