summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp13
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp4
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/char/char.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/int/int.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/long/long.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri19
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro39
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/schar/schar.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/short/short.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp24
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/uint/uint.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro1
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro1
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp53
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp9
56 files changed, 199 insertions, 23 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 93a6daa6b9..ff4963a960 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -102,10 +102,15 @@ void tst_QCoreApplication::qAppName()
const char* appName = "tst_qcoreapplication";
#endif
- int argc = 1;
- char *argv[] = { const_cast<char*>(appName) };
- TestApplication app(argc, argv);
- QCOMPARE(::qAppName(), QString::fromLatin1(appName));
+ {
+ int argc = 1;
+ char *argv[] = { const_cast<char*>(appName) };
+ TestApplication app(argc, argv);
+ QCOMPARE(::qAppName(), QString::fromLatin1(appName));
+ QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1(appName));
+ }
+ // The application name should still be available after destruction;
+ // global statics often rely on this.
QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1(appName));
}
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 717a7633f5..88b1bebb29 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -661,6 +661,9 @@ template<> struct TestValueFactory<QMetaType::QUuid> {
template<> struct TestValueFactory<QMetaType::QModelIndex> {
static QModelIndex *create() { return new QModelIndex(); }
};
+template<> struct TestValueFactory<QMetaType::QPersistentModelIndex> {
+ static QPersistentModelIndex *create() { return new QPersistentModelIndex(); }
+};
template<> struct TestValueFactory<QMetaType::QRegExp> {
static QRegExp *create()
{
@@ -1735,6 +1738,7 @@ struct StreamingTraits
DECLARE_NONSTREAMABLE(void)
DECLARE_NONSTREAMABLE(void*)
DECLARE_NONSTREAMABLE(QModelIndex)
+DECLARE_NONSTREAMABLE(QPersistentModelIndex)
DECLARE_NONSTREAMABLE(QJsonValue)
DECLARE_NONSTREAMABLE(QJsonObject)
DECLARE_NONSTREAMABLE(QJsonArray)
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 32674c587c..1f5132d369 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -248,6 +248,7 @@ private slots:
void movabilityTest();
void variantInVariant();
void userConversion();
+ void modelIndexConversion();
void forwardDeclare();
void debugStream_data();
@@ -3846,6 +3847,17 @@ void tst_QVariant::userConversion()
}
}
+void tst_QVariant::modelIndexConversion()
+{
+ QVariant modelIndexVariant = QModelIndex();
+ QVERIFY(modelIndexVariant.canConvert(QMetaType::QPersistentModelIndex));
+ QVERIFY(modelIndexVariant.convert(QMetaType::QPersistentModelIndex));
+ QCOMPARE(modelIndexVariant.type(), QVariant::PersistentModelIndex);
+ QVERIFY(modelIndexVariant.canConvert(QMetaType::QModelIndex));
+ QVERIFY(modelIndexVariant.convert(QMetaType::QModelIndex));
+ QCOMPARE(modelIndexVariant.type(), QVariant::ModelIndex);
+}
+
class Forward;
Q_DECLARE_OPAQUE_POINTER(Forward*)
Q_DECLARE_METATYPE(Forward*)
@@ -4073,6 +4085,7 @@ void tst_QVariant::implicitConstruction()
F(EasingCurve) \
F(Uuid) \
F(ModelIndex) \
+ F(PersistentModelIndex) \
F(RegularExpression) \
F(JsonValue) \
F(JsonObject) \
diff --git a/tests/auto/corelib/thread/qatomicinteger/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/char/char.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/char/char.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/char/char.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro
new file mode 100644
index 0000000000..64401f0229
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro
@@ -0,0 +1 @@
+include(../../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/int/int.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/int/int.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/int/int.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/long/long.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/long/long.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/long/long.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri
index dc7cc8bcec..d9ebe64d5b 100644
--- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri
+++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri
@@ -1,7 +1,20 @@
-isEmpty(TYPE): error("Project must define TYPE variable")
+# Get our build type from the directory name
+TYPE = $$basename(_PRO_FILE_PWD_)
+dn = $$dirname(_PRO_FILE_PWD_)
+FORCE = $$basename(dn)
+
+equals(FORCE, cxx11) {
+ suffix = Cxx11_$$TYPE
+ DEFINES += QT_ATOMIC_FORCE_CXX11
+} else: equals(FORCE, gcc) {
+ suffix = Gcc_$$TYPE
+ DEFINES += QT_ATOMIC_FORCE_GCC
+} else {
+ suffix = $$TYPE
+}
CONFIG += testcase parallel_test
QT = core testlib
-TARGET = tst_qatomicinteger_$$TYPE
+TARGET = tst_qatomicinteger_$$lower($$suffix)
SOURCES = $$PWD/tst_qatomicinteger.cpp
-DEFINES += QATOMIC_TEST_TYPE=$$TYPE tst_QAtomicIntegerXX=tst_QAtomicInteger_$$TYPE
+DEFINES += QATOMIC_TEST_TYPE=$$TYPE tst_QAtomicIntegerXX=tst_QAtomicInteger_$$suffix
diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro
index 373e8801a4..58e5b157bd 100644
--- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro
@@ -17,3 +17,42 @@ SUBDIRS=\
ushort \
wchar_t \
+
+contains(QT_CONFIG, c++11)|msvc: SUBDIRS +=\
+ cxx11/char \
+ cxx11/char16_t \
+ cxx11/char32_t \
+ cxx11/int \
+ cxx11/long \
+ cxx11/qlonglong \
+ cxx11/qptrdiff \
+ cxx11/quintptr \
+ cxx11/qulonglong \
+ cxx11/schar \
+ cxx11/short \
+ cxx11/uchar \
+ cxx11/uint \
+ cxx11/ulong \
+ cxx11/ushort \
+ cxx11/wchar_t \
+
+
+# The GCC-style atomics only support 32-bit and pointer-sized but add
+# them all anyway so we ensure the macros are properly defined
+gcc: SUBDIRS +=\
+ gcc/char \
+ gcc/char16_t \
+ gcc/char32_t \
+ gcc/int \
+ gcc/long \
+ gcc/qlonglong \
+ gcc/qptrdiff \
+ gcc/quintptr \
+ gcc/qulonglong \
+ gcc/schar \
+ gcc/short \
+ gcc/uchar \
+ gcc/uint \
+ gcc/ulong \
+ gcc/ushort \
+ gcc/wchar_t \
diff --git a/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/short/short.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/short/short.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/short/short.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
index cb01237b85..d3c85c54a7 100644
--- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
+++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp
@@ -31,6 +31,30 @@
**
****************************************************************************/
+#ifdef QT_ATOMIC_FORCE_CXX11
+// We need to check if this compiler has C++11 atomics and constexpr support.
+// We can't rely on qcompilerdetection.h because it forces all of qglobal.h to
+// be included, which causes qbasicatomic.h to be included too.
+// Incomplete, but ok
+# if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1500 && (__cplusplus >= 201103L || defined(__INTEL_CXX11_MODE__))
+# elif defined(__clang__) && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__))
+# if !__has_feature(cxx_constexpr) || !__has_feature(cxx_atomic) || !__has_include(<atomic>)
+# undef QT_ATOMIC_FORCE_CXX11
+# endif
+# elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__))
+# elif defined(_MSC_VER) && _MSC_VER >= 1900
+ // We need MSVC 2015 because of: atomics (2012), constexpr (2015), and unrestricted unions (2015).
+ // Support for constexpr is not working completely on MSVC 2015 but it's enough for the test.
+# else
+# undef QT_ATOMIC_FORCE_CXX11
+# endif
+
+# ifndef QT_ATOMIC_FORCE_CXX11
+# undef QATOMIC_TEST_TYPE
+# define QATOMIC_TEST_TYPE unsupported
+# endif
+#endif
+
#include <QtTest>
#include <QAtomicInt>
diff --git a/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro
index 51ef1add8f..1e97d5cbae 100644
--- a/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro
+++ b/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro
@@ -1,2 +1 @@
-TYPE = $$basename(PWD)
include(../qatomicinteger.pri)
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index c6806086d3..446e56e936 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -142,6 +142,9 @@ private slots:
void isDaylightTime() const;
void daylightTransitions() const;
void timeZones() const;
+#if defined(Q_OS_UNIX)
+ void systemTimeZoneChange() const;
+#endif
void invalid() const;
@@ -2984,6 +2987,56 @@ void tst_QDateTime::timeZones() const
QCOMPARE(future.offsetFromUtc(), 28800);
}
+#if defined(Q_OS_UNIX)
+// Currently disabled on Windows as adjusting the timezone
+// requires additional privileges that aren't normally
+// enabled for a process. This can be achieved by calling
+// AdjustTokenPrivileges() and then SetTimeZoneInformation(),
+// which will require linking to a different library to access that API.
+static void setTimeZone(const QByteArray &tz)
+{
+ qputenv("TZ", tz);
+ ::tzset();
+
+// following left for future reference, see comment above
+// #if defined(Q_OS_WIN32)
+// ::_tzset();
+// #endif
+}
+
+void tst_QDateTime::systemTimeZoneChange() const
+{
+ struct ResetTZ {
+ QByteArray original;
+ ResetTZ() : original(qgetenv("TZ")) {}
+ ~ResetTZ() { setTimeZone(original); }
+ } scopedReset;
+
+ // Set the timezone to Brisbane time
+ setTimeZone(QByteArray("AEST-10:00"));
+
+ QDateTime localDate = QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime);
+ QDateTime utcDate = QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC);
+ QDateTime tzDate = QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), QTimeZone("Australia/Brisbane"));
+ qint64 localMsecs = localDate.toMSecsSinceEpoch();
+ qint64 utcMsecs = utcDate.toMSecsSinceEpoch();
+ qint64 tzMsecs = tzDate.toMSecsSinceEpoch();
+
+ // check that Australia/Brisbane is known
+ QVERIFY(tzDate.timeZone().isValid());
+
+ // Change to Indian time
+ setTimeZone(QByteArray("IST-05:30"));
+
+ QCOMPARE(localDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::LocalTime));
+ QVERIFY(localMsecs != localDate.toMSecsSinceEpoch());
+ QCOMPARE(utcDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), Qt::UTC));
+ QCOMPARE(utcDate.toMSecsSinceEpoch(), utcMsecs);
+ QCOMPARE(tzDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), QTimeZone("Australia/Brisbane")));
+ QCOMPARE(tzDate.toMSecsSinceEpoch(), tzMsecs);
+}
+#endif
+
void tst_QDateTime::invalid() const
{
QDateTime invalidDate = QDateTime(QDate(0, 0, 0), QTime(-1, -1, -1));
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 52c3e65a24..8cd9610542 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -2040,6 +2040,9 @@ void tst_QString::simplified()
QFETCH(QString, full);
QFETCH(QString, simple);
+ QString orig_full = full;
+ orig_full.data(); // forces a detach
+
QString result = full.simplified();
if (simple.isNull()) {
QVERIFY2(result.isNull(), qPrintable("'" + full + "' did not yield null: " + result));
@@ -2048,6 +2051,12 @@ void tst_QString::simplified()
} else {
QCOMPARE(result, simple);
}
+ QCOMPARE(full, orig_full);
+
+ // without detaching:
+ QString copy1 = full;
+ QCOMPARE(qMove(full).simplified(), simple);
+ QCOMPARE(full, orig_full);
// force a detach
if (!full.isEmpty())