summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp26
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp2
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp2
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp22
-rw-r--r--tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp9
-rw-r--r--tests/auto/corelib/kernel/qtimer/BLACKLIST2
-rw-r--r--tests/auto/corelib/thread/qsemaphore/BLACKLIST1
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp19
8 files changed, 81 insertions, 2 deletions
diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
index 66fc578d5f..09abb953ba 100644
--- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
+++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
@@ -97,17 +97,33 @@ void tst_QGetPutEnv::intValue_data()
QTest::addColumn<int>("expected");
QTest::addColumn<bool>("ok");
- // most non-success cases already tested in getSetCheck()
+ // some repetition from what is tested in getSetCheck()
+ QTest::newRow("empty") << QByteArray() << 0 << false;
+ QTest::newRow("spaces-heading") << QByteArray(" 1") << 1 << true;
+ QTest::newRow("spaces-trailing") << QByteArray("1 ") << 0 << false;
#define ROW(x, i, b) \
QTest::newRow(#x) << QByteArray(#x) << (i) << (b)
ROW(auto, 0, false);
+ ROW(1auto, 0, false);
ROW(0, 0, true);
+ ROW(+0, 0, true);
ROW(1, 1, true);
+ ROW(+1, 1, true);
+ ROW(09, 0, false);
ROW(010, 8, true);
ROW(0x10, 16, true);
+ ROW(0x, 0, false);
+ ROW(0xg, 0, false);
+ ROW(0x1g, 0, false);
+ ROW(000000000000000000000000000000000000000000000000001, 0, false);
+ ROW(+000000000000000000000000000000000000000000000000001, 0, false);
+ ROW(000000000000000000000000000000000000000000000000001g, 0, false);
+ ROW(-0, 0, true);
ROW(-1, -1, true);
ROW(-010, -8, true);
+ ROW(-000000000000000000000000000000000000000000000000001, 0, false);
+ ROW(2147483648, 0, false);
// ROW(0xffffffff, -1, true); // could be expected, but not how QByteArray::toInt() works
ROW(0xffffffff, 0, false);
const int bases[] = {10, 8, 16};
@@ -125,6 +141,7 @@ void tst_QGetPutEnv::intValue_data()
void tst_QGetPutEnv::intValue()
{
+ const int maxlen = (sizeof(int) * CHAR_BIT + 2) / 3;
const char varName[] = "should_not_exist";
QFETCH(QByteArray, value);
@@ -133,6 +150,13 @@ void tst_QGetPutEnv::intValue()
bool actualOk = !ok;
+ // Self-test: confirm that it was like the docs said it should be
+ if (value.length() < maxlen) {
+ QCOMPARE(value.toInt(&actualOk, 0), expected);
+ QCOMPARE(actualOk, ok);
+ }
+
+ actualOk = !ok;
QVERIFY(qputenv(varName, value));
QCOMPARE(qEnvironmentVariableIntValue(varName), expected);
QCOMPARE(qEnvironmentVariableIntValue(varName, &actualOk), expected);
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index bb8bb6cc21..3465385ba7 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -100,11 +100,11 @@ tst_qmessagehandler::tst_qmessagehandler()
void tst_qmessagehandler::initTestCase()
{
+#if QT_CONFIG(process)
m_appDir = QFINDTESTDATA("app");
QVERIFY2(!m_appDir.isEmpty(), qPrintable(
QString::fromLatin1("Couldn't find helper app dir starting from %1.").arg(QDir::currentPath())));
-#if QT_CONFIG(process)
m_baseEnvironment = QProcess::systemEnvironment();
for (int i = 0; i < m_baseEnvironment.count(); ++i) {
if (m_baseEnvironment.at(i).startsWith("QT_MESSAGE_PATTERN=")) {
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 9b12aa9616..f97501e8a6 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -412,8 +412,10 @@ static QByteArray msgFileDoesNotExist(const QString &name)
void tst_QFile::initTestCase()
{
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
+#if QT_CONFIG(process)
m_stdinProcessDir = QFINDTESTDATA("stdinprocess");
QVERIFY(!m_stdinProcessDir.isEmpty());
+#endif
m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp");
QVERIFY(!m_testSourceFile.isEmpty());
m_testLogFile = QFINDTESTDATA("testlog.txt");
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
index dcd9eda4bb..9f67ccd9c9 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -101,6 +101,7 @@ private slots:
void testRoleNames();
void testDragActions();
+ void dragActionsFallsBackToDropActions();
void testFunctionPointerSignalConnection();
@@ -2157,6 +2158,27 @@ void tst_QAbstractItemModel::testDragActions()
QVERIFY(actions & Qt::MoveAction);
}
+class OverrideDropActions : public QStringListModel
+{
+ Q_OBJECT
+public:
+ OverrideDropActions(QObject *parent = 0)
+ : QStringListModel(parent)
+ {
+ }
+ Qt::DropActions supportedDropActions() const override
+ {
+ return Qt::MoveAction;
+ }
+};
+
+void tst_QAbstractItemModel::dragActionsFallsBackToDropActions()
+{
+ QAbstractItemModel *model = new OverrideDropActions(this);
+ QCOMPARE(model->supportedDragActions(), Qt::MoveAction);
+ QCOMPARE(model->supportedDropActions(), Qt::MoveAction);
+}
+
class SignalConnectionTester : public QObject
{
Q_OBJECT
diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
index f99241da3b..adc8c59bf7 100644
--- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
@@ -80,6 +80,8 @@ private slots:
void setData_emits_both_roles_data();
void setData_emits_both_roles();
+
+ void supportedDragDropActions();
};
void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved_data()
@@ -250,5 +252,12 @@ void tst_QStringListModel::setData_emits_both_roles()
expected);
}
+void tst_QStringListModel::supportedDragDropActions()
+{
+ QStringListModel model;
+ QCOMPARE(model.supportedDragActions(), Qt::CopyAction | Qt::MoveAction);
+ QCOMPARE(model.supportedDropActions(), Qt::CopyAction | Qt::MoveAction);
+}
+
QTEST_MAIN(tst_QStringListModel)
#include "tst_qstringlistmodel.moc"
diff --git a/tests/auto/corelib/kernel/qtimer/BLACKLIST b/tests/auto/corelib/kernel/qtimer/BLACKLIST
index e5136624d8..b355bc22c2 100644
--- a/tests/auto/corelib/kernel/qtimer/BLACKLIST
+++ b/tests/auto/corelib/kernel/qtimer/BLACKLIST
@@ -1,3 +1,5 @@
[remainingTime]
windows
osx
+[basic_chrono]
+osx ci
diff --git a/tests/auto/corelib/thread/qsemaphore/BLACKLIST b/tests/auto/corelib/thread/qsemaphore/BLACKLIST
index c198b90253..eb83b03556 100644
--- a/tests/auto/corelib/thread/qsemaphore/BLACKLIST
+++ b/tests/auto/corelib/thread/qsemaphore/BLACKLIST
@@ -3,3 +3,4 @@ windows
osx-10.12
[tryAcquireWithTimeout:2s]
windows
+osx-10.12
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 7850478602..442d4d089c 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -43,6 +43,10 @@
#include <stdlib.h>
#include <time.h>
+#ifdef Q_OS_UNIX
+#include <sys/resource.h>
+#endif
+
QT_BEGIN_NAMESPACE
namespace QtSharedPointer {
Q_CORE_EXPORT void internalSafetyCheckCleanCheck();
@@ -54,6 +58,7 @@ class tst_QSharedPointer: public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void basics_data();
void basics();
void operators();
@@ -118,6 +123,20 @@ public:
}
};
+void tst_QSharedPointer::initTestCase()
+{
+#if defined(Q_OS_UNIX)
+ // The tests create a lot of threads, which require file descriptors. On systems like
+ // OS X low defaults such as 256 as the limit for the number of simultaneously
+ // open files is not sufficient.
+ struct rlimit numFiles;
+ if (getrlimit(RLIMIT_NOFILE, &numFiles) == 0 && numFiles.rlim_cur < 1024) {
+ numFiles.rlim_cur = qMin(rlim_t(1024), numFiles.rlim_max);
+ setrlimit(RLIMIT_NOFILE, &numFiles);
+ }
+#endif
+}
+
template<typename T> static inline
QtSharedPointer::ExternalRefCountData *refCountData(const QSharedPointer<T> &b)
{