summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp2
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp11
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp4
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp25
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp2
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp2
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp10
-rw-r--r--tests/auto/corelib/time/qtimezone/BLACKLIST12
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp36
-rw-r--r--tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp2
10 files changed, 74 insertions, 32 deletions
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index 1568855032..be75f5b3cc 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -49,7 +49,7 @@ void tst_QFlags::testFlag() const
QVERIFY(btn.testFlag(Qt::LeftButton));
QVERIFY(!btn.testFlag(Qt::MidButton));
- btn = 0;
+ btn = { };
QVERIFY(!btn.testFlag(Qt::LeftButton));
}
diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
index 94f0afa5ed..a661b0388e 100644
--- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
+++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
@@ -430,6 +430,13 @@ void tst_qfloat16::finite()
QVERIFY(!qIsInf(value));
QVERIFY(!qIsNaN(value));
QCOMPARE(qFpClassify(value), mode);
+
+ // *NOT* using QCOMPARE() on finite qfloat16 values, since that uses fuzzy
+ // comparison, and we need exact here.
+ const qfloat16 zero(0), plus(+1), minus(-1);
+ const qfloat16 magnitude = (value < zero) ? -value : value;
+ QVERIFY(value.copySign(plus) == magnitude);
+ QVERIFY(value.copySign(minus) == -magnitude);
}
void tst_qfloat16::properties()
@@ -534,7 +541,9 @@ void tst_qfloat16::limits() // See also: qNaN() and infinity()
QVERIFY(Bounds::denorm_min() / rose == zero);
if (overOptimized)
QEXPECT_FAIL("", "Over-optimized on ARM", Continue);
- QVERIFY(-Bounds::denorm_min() / rose == -zero);
+ const qfloat16 under = (-Bounds::denorm_min()) / rose;
+ QVERIFY(under == -zero);
+ QCOMPARE(qfloat16(1).copySign(under), qfloat16(-1));
}
QTEST_APPLESS_MAIN(tst_qfloat16)
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index b8ae95dd93..16a30af892 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -499,7 +499,7 @@ void tst_QFile::initTestCase()
file.write("b", 1);
file.close();
#ifndef Q_OS_WIN // Not supported on Windows.
- QVERIFY2(file.setPermissions(0), qPrintable(file.errorString()));
+ QVERIFY2(file.setPermissions({ }), qPrintable(file.errorString()));
#else
QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
#endif
@@ -2211,7 +2211,7 @@ public:
QStringList entryList(QDir::Filters, const QStringList &) const { return QStringList(); }
bool caseSensitive() const { return false; }
bool isRelativePath() const { return false; }
- FileFlags fileFlags(FileFlags) const { return 0; }
+ FileFlags fileFlags(FileFlags) const { return { }; }
bool chmod(uint) { return false; }
QString fileName(FileName) const { return name; }
uint ownerId(FileOwner) const { return 0; }
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 744e047c45..ebb9a0a44c 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -1813,19 +1813,22 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
QVERIFY2(creationResult == ERROR_SUCCESS, qPrintable(errorMessage));
QFileInfo fi(path);
- const bool actualIsSymLink = fi.isSymbolicLink();
+ auto guard = qScopeGuard([&fi, this]() {
+ // Ensure that junctions, mountpoints are removed. If this fails, do not remove
+ // temporary directory to prevent it from trashing the system.
+ if (fi.isDir()) {
+ if (!QDir().rmdir(fi.filePath())) {
+ qWarning("Unable to remove NTFS junction '%ls', keeping '%ls'.",
+ qUtf16Printable(fi.fileName()),
+ qUtf16Printable(QDir::toNativeSeparators(m_dir.path())));
+ m_dir.setAutoRemove(false);
+ }
+ }
+ });
const QString actualSymLinkTarget = isSymLink ? fi.symLinkTarget() : QString();
const QString actualCanonicalFilePath = isSymLink ? fi.canonicalFilePath() : QString();
- // Ensure that junctions, mountpoints are removed. If this fails, do not remove
- // temporary directory to prevent it from trashing the system.
- if (fi.isDir()) {
- if (!QDir().rmdir(fi.filePath())) {
- qWarning("Unable to remove NTFS junction '%s'', keeping '%s'.",
- qPrintable(fi.fileName()), qPrintable(QDir::toNativeSeparators(m_dir.path())));
- m_dir.setAutoRemove(false);
- }
- }
- QCOMPARE(actualIsSymLink, isSymLink);
+ QCOMPARE(fi.isJunction(), resource.type == NtfsTestResource::Junction);
+ QCOMPARE(fi.isSymbolicLink(), isSymLink);
if (isSymLink) {
QCOMPARE(actualSymLinkTarget, linkTarget);
QCOMPARE(actualCanonicalFilePath, canonicalFilePath);
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index bcf6d6c32b..5c6e633749 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -848,7 +848,7 @@ void tst_QUrlInternal::correctEncodedMistakes()
QString dataTag = QTest::currentDataTag();
QString output = dataTag;
- if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), 0))
+ if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), { }))
output += input;
QCOMPARE(output, dataTag + expected);
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index c74101928a..ccb6a457a6 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -2059,7 +2059,7 @@ void tst_QItemSelectionModel::unselectable()
QCOMPARE(selectionModel.selectedIndexes().count(), 10);
QCOMPARE(selectionModel.selectedRows().count(), 10);
for (int j = 0; j < 10; ++j)
- model.item(j)->setFlags(0);
+ model.item(j)->setFlags({ });
QCOMPARE(selectionModel.selectedIndexes().count(), 0);
QCOMPARE(selectionModel.selectedRows().count(), 0);
}
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index 3aa3d97dbc..0b2d33dc09 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -595,10 +595,7 @@ void tst_QLocale::emptyCtor_data()
ADD_CTOR_TEST("zz_zz", "C");
ADD_CTOR_TEST("zz...", "C");
ADD_CTOR_TEST("en.bla", "en_US");
-#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer))
- // See QTBUG-69875
ADD_CTOR_TEST("en@bla", "en_US");
-#endif
ADD_CTOR_TEST("en_blaaa", "en_US");
ADD_CTOR_TEST("en_zz", "en_US");
ADD_CTOR_TEST("en_GB.bla", "en_GB");
@@ -607,10 +604,7 @@ void tst_QLocale::emptyCtor_data()
// Empty optional fields, but with punctuators supplied
ADD_CTOR_TEST("en.", "en_US");
-#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer))
- // See QTBUG-69875
ADD_CTOR_TEST("en@", "en_US");
-#endif
ADD_CTOR_TEST("en.@", "en_US");
ADD_CTOR_TEST("en_", "en_US");
ADD_CTOR_TEST("en_.", "en_US");
@@ -1346,7 +1340,7 @@ void tst_QLocale::long_long_conversion()
void tst_QLocale::long_long_conversion_extra()
{
QLocale l(QLocale::C);
- l.setNumberOptions(0);
+ l.setNumberOptions({ });
QCOMPARE(l.toString((qlonglong)1), QString("1"));
QCOMPARE(l.toString((qlonglong)12), QString("12"));
QCOMPARE(l.toString((qlonglong)123), QString("123"));
@@ -2093,7 +2087,7 @@ void tst_QLocale::numberOptions()
QVERIFY(ok);
QCOMPARE(locale.toString(12345), QString("12345"));
- locale.setNumberOptions(0);
+ locale.setNumberOptions({ });
QCOMPARE(locale.numberOptions(), 0);
QCOMPARE(locale.toInt(QString("12,345"), &ok), 12345);
QVERIFY(ok);
diff --git a/tests/auto/corelib/time/qtimezone/BLACKLIST b/tests/auto/corelib/time/qtimezone/BLACKLIST
index 840c3b1181..b820bab3d9 100644
--- a/tests/auto/corelib/time/qtimezone/BLACKLIST
+++ b/tests/auto/corelib/time/qtimezone/BLACKLIST
@@ -2,10 +2,6 @@
[dataStreamTest]
android
-# QTBUG-69128
-[isTimeZoneIdAvailable]
-android
-
# QTBUG-69129
[specificTransition]
android
@@ -75,10 +71,14 @@ android
android
[transitionEachZone:Asia/Chita@1970]
android
+[transitionEachZone:Asia/Choibalsan@1970]
+android
[transitionEachZone:Asia/Dushanbe@1970]
android
[transitionEachZone:Asia/Ho_Chi_Minh@1970]
android
+[transitionEachZone:Asia/Hovd@1970]
+android
[transitionEachZone:Asia/Kathmandu@1970]
android
[transitionEachZone:Asia/Katmandu@1970]
@@ -109,6 +109,10 @@ android
android
[transitionEachZone:Asia/Thimphu@1970]
android
+[transitionEachZone:Asia/Ulaanbaatar@1970]
+android
+[transitionEachZone:Asia/Ulan_Bator@1970]
+android
[transitionEachZone:Asia/Ust-Nera@1970]
android
[transitionEachZone:Atlantic/Cape_Verde@1970]
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
index 5b1bde8ea3..d0ef8023b9 100644
--- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
@@ -818,6 +818,10 @@ void tst_QTimeZone::isValidId_data()
QTest::addColumn<QByteArray>("input");
QTest::addColumn<bool>("valid");
+ // a-z, A-Z, 0-9, '.', '-', '_' are valid chars
+ // Can't start with '-'
+ // Parts separated by '/', each part min 1 and max of 14 chars
+ // (Android has parts with lengths up to 17, so tolerates this as a special case.)
#define TESTSET(name, section, valid) \
QTest::newRow(name " front") << QByteArray(section "/xyz/xyz") << valid; \
QTest::newRow(name " middle") << QByteArray("xyz/" section "/xyz") << valid; \
@@ -828,11 +832,16 @@ void tst_QTimeZone::isValidId_data()
// Parts separated by '/', each part min 1 and max of 14 chars
TESTSET("empty", "", false);
TESTSET("minimal", "m", true);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+ TESTSET("maximal", "East-Saskatchewan", true); // Android actually uses this
+ TESTSET("too long", "North-Saskatchewan", false); // ... but thankfully not this.
+#else
TESTSET("maximal", "12345678901234", true);
TESTSET("maximal twice", "12345678901234/12345678901234", true);
TESTSET("too long", "123456789012345", false);
TESTSET("too-long/maximal", "123456789012345/12345678901234", false);
TESTSET("maximal/too-long", "12345678901234/123456789012345", false);
+#endif
TESTSET("bad hyphen", "-hyphen", false);
TESTSET("good hyphen", "hy-phen", true);
@@ -879,6 +888,31 @@ void tst_QTimeZone::isValidId_data()
TESTSET("invalid char ' '", " ", false);
#undef TESTSET
+
+ QTest::newRow("az alone") << QByteArray("az") << true;
+ QTest::newRow("AZ alone") << QByteArray("AZ") << true;
+ QTest::newRow("09 alone") << QByteArray("09") << true;
+ QTest::newRow("a/z alone") << QByteArray("a/z") << true;
+ QTest::newRow("a.z alone") << QByteArray("a.z") << true;
+ QTest::newRow("a-z alone") << QByteArray("a-z") << true;
+ QTest::newRow("a_z alone") << QByteArray("a_z") << true;
+ QTest::newRow(".z alone") << QByteArray(".z") << true;
+ QTest::newRow("_z alone") << QByteArray("_z") << true;
+ QTest::newRow("a z alone") << QByteArray("a z") << false;
+ QTest::newRow("a\\z alone") << QByteArray("a\\z") << false;
+ QTest::newRow("a,z alone") << QByteArray("a,z") << false;
+ QTest::newRow("/z alone") << QByteArray("/z") << false;
+ QTest::newRow("-z alone") << QByteArray("-z") << false;
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+ QTest::newRow("long alone") << QByteArray("12345678901234567") << true;
+ QTest::newRow("over-long alone") << QByteArray("123456789012345678") << false;
+#else
+ QTest::newRow("long alone") << QByteArray("12345678901234") << true;
+ QTest::newRow("over-long alone") << QByteArray("123456789012345") << false;
+#endif
+
+#else
+ QSKIP("This test requires a Qt -developer-build.");
#endif // QT_BUILD_INTERNAL
}
@@ -889,8 +923,6 @@ void tst_QTimeZone::isValidId()
QFETCH(bool, valid);
QCOMPARE(QTimeZonePrivate::isValidId(input), valid);
-#else
- QSKIP("This test requires a Qt -developer-build.");
#endif
}
diff --git a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
index f95d48f042..01181ce20e 100644
--- a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
+++ b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
@@ -67,7 +67,7 @@ void tst_QScopedGuard::exceptions()
bool caught = false;
QT_TRY
{
- auto cleanup = qScopeGuard([&caught] { s_globalState++; });
+ auto cleanup = qScopeGuard([] { s_globalState++; });
QT_THROW(std::bad_alloc()); //if Qt compiled without exceptions this is noop
s_globalState = 100;
}