Merge remote-tracking branch 'origin/5.11' into 5.12
Change-Id: I12bcee17e349edd0dd4fd08da76361d1ffb1a727
This commit is contained in:
commit
1b5bbacdb0
@ -4114,7 +4114,8 @@ ushort QByteArray::toUShort(bool *ok, int base) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the byte array converted to a \c double value.
|
Returns the byte array converted to a \c double value.
|
||||||
|
|
||||||
Returns 0.0 if the conversion fails.
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for other reasons (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -4149,7 +4150,8 @@ double QByteArray::toDouble(bool *ok) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the byte array converted to a \c float value.
|
Returns the byte array converted to a \c float value.
|
||||||
|
|
||||||
Returns 0.0 if the conversion fails.
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for other reasons (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
|
@ -1366,8 +1366,10 @@ qulonglong QLocale::toULongLong(const QString &s, bool *ok) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the float represented by the localized string \a s, or 0.0
|
Returns the float represented by the localized string \a s.
|
||||||
if the conversion failed.
|
|
||||||
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for any other reason (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -1386,8 +1388,10 @@ float QLocale::toFloat(const QString &s, bool *ok) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the double represented by the localized string \a s, or
|
Returns the double represented by the localized string \a s.
|
||||||
0.0 if the conversion failed.
|
|
||||||
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for any other reason (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -1533,8 +1537,10 @@ qulonglong QLocale::toULongLong(const QStringRef &s, bool *ok) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the float represented by the localized string \a s, or 0.0
|
Returns the float represented by the localized string \a s.
|
||||||
if the conversion failed.
|
|
||||||
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for any other reason (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -1555,8 +1561,10 @@ float QLocale::toFloat(const QStringRef &s, bool *ok) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the double represented by the localized string \a s, or
|
Returns the double represented by the localized string \a s.
|
||||||
0.0 if the conversion failed.
|
|
||||||
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for any other reason (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -1705,8 +1713,10 @@ qulonglong QLocale::toULongLong(QStringView s, bool *ok) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the float represented by the localized string \a s, or 0.0
|
Returns the float represented by the localized string \a s.
|
||||||
if the conversion failed.
|
|
||||||
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for any other reason (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -1724,8 +1734,10 @@ float QLocale::toFloat(QStringView s, bool *ok) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the double represented by the localized string \a s, or
|
Returns the double represented by the localized string \a s.
|
||||||
0.0 if the conversion failed.
|
|
||||||
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for any other reason (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
|
@ -249,7 +249,16 @@ public:
|
|||||||
if (std::fabs(d) > std::numeric_limits<float>::max()) {
|
if (std::fabs(d) > std::numeric_limits<float>::max()) {
|
||||||
if (ok != 0)
|
if (ok != 0)
|
||||||
*ok = false;
|
*ok = false;
|
||||||
return 0.0f;
|
const float huge = std::numeric_limits<float>::infinity();
|
||||||
|
return d < 0 ? -huge : huge;
|
||||||
|
}
|
||||||
|
if (std::fabs(d) >= std::numeric_limits<double>::min() // i.e. d != 0
|
||||||
|
&& std::fabs(d) < std::numeric_limits<float>::min()) {
|
||||||
|
// Values smaller than std::numeric_limits<double>::min() have
|
||||||
|
// failed already; match them.
|
||||||
|
if (ok != 0)
|
||||||
|
*ok = false;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return float(d);
|
return float(d);
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ double qt_asciiToDouble(const char *num, int numLen, bool &ok, int &processed,
|
|||||||
ok = false;
|
ok = false;
|
||||||
for (int i = 0; i < processed; ++i) {
|
for (int i = 0; i < processed; ++i) {
|
||||||
char c = num[i];
|
char c = num[i];
|
||||||
if ((c < '0' || c > '9') && c != '.' && c != '-' && c != '+' && c != 'e') {
|
if ((c < '0' || c > '9') && c != '.' && c != '-' && c != '+' && c != 'e' && c != 'E') {
|
||||||
// Garbage found
|
// Garbage found
|
||||||
processed = 0;
|
processed = 0;
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@ -7401,7 +7401,8 @@ ushort QString::toUShort(bool *ok, int base) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the string converted to a \c double value.
|
Returns the string converted to a \c double value.
|
||||||
|
|
||||||
Returns 0.0 if the conversion fails.
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for other reasons (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -7439,7 +7440,8 @@ double QString::toDouble(bool *ok) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the string converted to a \c float value.
|
Returns the string converted to a \c float value.
|
||||||
|
|
||||||
Returns 0.0 if the conversion fails.
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for other reasons (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -12008,7 +12010,8 @@ ushort QStringRef::toUShort(bool *ok, int base) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the string converted to a \c double value.
|
Returns the string converted to a \c double value.
|
||||||
|
|
||||||
Returns 0.0 if the conversion fails.
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for other reasons (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
@ -12033,7 +12036,8 @@ double QStringRef::toDouble(bool *ok) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the string converted to a \c float value.
|
Returns the string converted to a \c float value.
|
||||||
|
|
||||||
Returns 0.0 if the conversion fails.
|
Returns an infinity if the conversion overflows or 0.0 if the
|
||||||
|
conversion fails for other reasons (e.g. underflow).
|
||||||
|
|
||||||
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
|
||||||
to \c false, and success by setting *\a{ok} to \c true.
|
to \c false, and success by setting *\a{ok} to \c true.
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "qcocoahelpers.h"
|
#include "qcocoahelpers.h"
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -61,6 +62,23 @@ QT_BEGIN_NAMESPACE
|
|||||||
QMacPasteboard code
|
QMacPasteboard code
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
OSStatus PasteboardGetItemCountSafe(PasteboardRef paste, ItemCount *cnt)
|
||||||
|
{
|
||||||
|
Q_ASSERT(paste);
|
||||||
|
Q_ASSERT(cnt);
|
||||||
|
const OSStatus result = PasteboardGetItemCount(paste, cnt);
|
||||||
|
// Despite being declared unsigned, this API can return -1
|
||||||
|
if (std::make_signed<ItemCount>::type(*cnt) < 0)
|
||||||
|
*cnt = 0;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
// Ensure we don't call the broken one later on
|
||||||
|
#define PasteboardGetItemCount
|
||||||
|
|
||||||
class QMacMimeData : public QMimeData
|
class QMacMimeData : public QMimeData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -210,7 +228,7 @@ QMacPasteboard::hasOSType(int c_flavor) const
|
|||||||
sync();
|
sync();
|
||||||
|
|
||||||
ItemCount cnt = 0;
|
ItemCount cnt = 0;
|
||||||
if (PasteboardGetItemCount(paste, &cnt) || !cnt)
|
if (PasteboardGetItemCountSafe(paste, &cnt) || !cnt)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef DEBUG_PASTEBOARD
|
#ifdef DEBUG_PASTEBOARD
|
||||||
@ -257,7 +275,7 @@ QMacPasteboard::hasFlavor(QString c_flavor) const
|
|||||||
sync();
|
sync();
|
||||||
|
|
||||||
ItemCount cnt = 0;
|
ItemCount cnt = 0;
|
||||||
if (PasteboardGetItemCount(paste, &cnt) || !cnt)
|
if (PasteboardGetItemCountSafe(paste, &cnt) || !cnt)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef DEBUG_PASTEBOARD
|
#ifdef DEBUG_PASTEBOARD
|
||||||
@ -374,7 +392,7 @@ QMacPasteboard::formats() const
|
|||||||
|
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
ItemCount cnt = 0;
|
ItemCount cnt = 0;
|
||||||
if (PasteboardGetItemCount(paste, &cnt) || !cnt)
|
if (PasteboardGetItemCountSafe(paste, &cnt) || !cnt)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#ifdef DEBUG_PASTEBOARD
|
#ifdef DEBUG_PASTEBOARD
|
||||||
@ -417,7 +435,7 @@ QMacPasteboard::hasFormat(const QString &format) const
|
|||||||
sync();
|
sync();
|
||||||
|
|
||||||
ItemCount cnt = 0;
|
ItemCount cnt = 0;
|
||||||
if (PasteboardGetItemCount(paste, &cnt) || !cnt)
|
if (PasteboardGetItemCountSafe(paste, &cnt) || !cnt)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef DEBUG_PASTEBOARD
|
#ifdef DEBUG_PASTEBOARD
|
||||||
@ -460,7 +478,7 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
|
|||||||
sync();
|
sync();
|
||||||
|
|
||||||
ItemCount cnt = 0;
|
ItemCount cnt = 0;
|
||||||
if (PasteboardGetItemCount(paste, &cnt) || !cnt)
|
if (PasteboardGetItemCountSafe(paste, &cnt) || !cnt)
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
#ifdef DEBUG_PASTEBOARD
|
#ifdef DEBUG_PASTEBOARD
|
||||||
|
@ -2484,7 +2484,16 @@ bool QTest::compare_helper(bool success, const char *failureMsg,
|
|||||||
bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const char *expected,
|
bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const char *expected,
|
||||||
const char *file, int line)
|
const char *file, int line)
|
||||||
{
|
{
|
||||||
return compare_helper(qFuzzyCompare(t1, t2), "Compared floats are not the same (fuzzy compare)",
|
bool equal = false;
|
||||||
|
int cl1 = std::fpclassify(t1);
|
||||||
|
int cl2 = std::fpclassify(t2);
|
||||||
|
if (cl1 == FP_INFINITE)
|
||||||
|
equal = ((t1 < 0) == (t2 < 0)) && cl2 == FP_INFINITE;
|
||||||
|
else if (cl1 == FP_NAN)
|
||||||
|
equal = (cl2 == FP_NAN);
|
||||||
|
else
|
||||||
|
equal = qFuzzyCompare(t1, t2);
|
||||||
|
return compare_helper(equal, "Compared floats are not the same (fuzzy compare)",
|
||||||
toString(t1), toString(t2), actual, expected, file, line);
|
toString(t1), toString(t2), actual, expected, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
[qMessagePattern:backtrace]
|
||||||
|
# QTBUG-63915
|
||||||
|
b2qt 64bit
|
||||||
|
|
||||||
[qMessagePattern:backtrace depth,separator]
|
[qMessagePattern:backtrace depth,separator]
|
||||||
# QTBUG-63915
|
# QTBUG-63915
|
||||||
b2qt 64bit
|
b2qt 64bit
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
[testFindExecutable]
|
|
||||||
# QTBUG-64404
|
|
||||||
b2qt 64bit
|
|
@ -5,3 +5,6 @@ INCLUDEPATH += ../../../../shared/
|
|||||||
HEADERS += ../../../../shared/emulationdetector.h
|
HEADERS += ../../../../shared/emulationdetector.h
|
||||||
SOURCES = tst_qstandardpaths.cpp
|
SOURCES = tst_qstandardpaths.cpp
|
||||||
TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro
|
TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro
|
||||||
|
|
||||||
|
# QTBUG-64404
|
||||||
|
boot2qt: DEFINES+=SKIP_FINDEXECUTABLE
|
||||||
|
@ -371,6 +371,12 @@ static inline QFileInfo findSh()
|
|||||||
|
|
||||||
void tst_qstandardpaths::testFindExecutable_data()
|
void tst_qstandardpaths::testFindExecutable_data()
|
||||||
{
|
{
|
||||||
|
#ifdef SKIP_FINDEXECUTABLE
|
||||||
|
// Test needs to be skipped or Q_ASSERT below will cancel the test
|
||||||
|
// and report FAIL regardless of BLACKLIST contents
|
||||||
|
QSKIP("QTBUG-64404");
|
||||||
|
#endif
|
||||||
|
|
||||||
QTest::addColumn<QString>("directory");
|
QTest::addColumn<QString>("directory");
|
||||||
QTest::addColumn<QString>("needle");
|
QTest::addColumn<QString>("needle");
|
||||||
QTest::addColumn<QString>("expected");
|
QTest::addColumn<QString>("expected");
|
||||||
|
@ -3,6 +3,8 @@ TARGET = ../tst_qtextstream
|
|||||||
QT = core network testlib
|
QT = core network testlib
|
||||||
SOURCES = ../tst_qtextstream.cpp
|
SOURCES = ../tst_qtextstream.cpp
|
||||||
RESOURCES += ../qtextstream.qrc
|
RESOURCES += ../qtextstream.qrc
|
||||||
|
INCLUDEPATH += ../../../../../shared/
|
||||||
|
HEADERS += ../../../../../shared/emulationdetector.h
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
# include <QProcess>
|
# include <QProcess>
|
||||||
#endif
|
#endif
|
||||||
#include "../../../network-settings.h"
|
#include "../../../network-settings.h"
|
||||||
|
#include "emulationdetector.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
template<> struct QMetaTypeId<QIODevice::OpenModeFlag>
|
template<> struct QMetaTypeId<QIODevice::OpenModeFlag>
|
||||||
@ -1460,6 +1460,9 @@ void tst_QTextStream::pos2()
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
void tst_QTextStream::pos3LargeFile()
|
void tst_QTextStream::pos3LargeFile()
|
||||||
{
|
{
|
||||||
|
if (EmulationDetector::isRunningArmOnX86())
|
||||||
|
QSKIP("Running QTextStream::pos() in tight loop is too slow on emulator");
|
||||||
|
|
||||||
{
|
{
|
||||||
QFile file(testFileName);
|
QFile file(testFileName);
|
||||||
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
@ -84,6 +84,8 @@ private slots:
|
|||||||
void matchingLocales();
|
void matchingLocales();
|
||||||
void stringToDouble_data();
|
void stringToDouble_data();
|
||||||
void stringToDouble();
|
void stringToDouble();
|
||||||
|
void stringToFloat_data();
|
||||||
|
void stringToFloat();
|
||||||
void doubleToString_data();
|
void doubleToString_data();
|
||||||
void doubleToString();
|
void doubleToString();
|
||||||
void strtod_data();
|
void strtod_data();
|
||||||
@ -160,6 +162,17 @@ private:
|
|||||||
QString m_sysapp;
|
QString m_sysapp;
|
||||||
QStringList cleanEnv;
|
QStringList cleanEnv;
|
||||||
bool europeanTimeZone;
|
bool europeanTimeZone;
|
||||||
|
void toReal_data();
|
||||||
|
|
||||||
|
class TransientLocale
|
||||||
|
{
|
||||||
|
const int m_category;
|
||||||
|
const char *const m_prior;
|
||||||
|
public:
|
||||||
|
TransientLocale(int category, const char *locale)
|
||||||
|
: m_category(category), m_prior(setlocale(category, locale)) {}
|
||||||
|
~TransientLocale() { setlocale(m_category, m_prior); }
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
tst_QLocale::tst_QLocale()
|
tst_QLocale::tst_QLocale()
|
||||||
@ -741,7 +754,7 @@ void tst_QLocale::unixLocaleName()
|
|||||||
QCOMPARE(locale.name(), expect);
|
QCOMPARE(locale.name(), expect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QLocale::stringToDouble_data()
|
void tst_QLocale::toReal_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("locale_name");
|
QTest::addColumn<QString>("locale_name");
|
||||||
QTest::addColumn<QString>("num_str");
|
QTest::addColumn<QString>("num_str");
|
||||||
@ -754,6 +767,8 @@ void tst_QLocale::stringToDouble_data()
|
|||||||
QTest::newRow("C 1.234e-10") << QString("C") << QString("1.234e-10") << true << 1.234e-10;
|
QTest::newRow("C 1.234e-10") << QString("C") << QString("1.234e-10") << true << 1.234e-10;
|
||||||
QTest::newRow("C 1.234E10") << QString("C") << QString("1.234E10") << true << 1.234e10;
|
QTest::newRow("C 1.234E10") << QString("C") << QString("1.234E10") << true << 1.234e10;
|
||||||
QTest::newRow("C 1e10") << QString("C") << QString("1e10") << true << 1.0e10;
|
QTest::newRow("C 1e10") << QString("C") << QString("1e10") << true << 1.0e10;
|
||||||
|
QTest::newRow("C 1e310") << QString("C") << QString("1e310") << false << std::numeric_limits<double>::infinity();
|
||||||
|
QTest::newRow("C 1E310") << QString("C") << QString("1E310") << false << std::numeric_limits<double>::infinity();
|
||||||
QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
|
QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
|
||||||
QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
|
QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
|
||||||
QTest::newRow("C 1 ") << QString("C") << QString("1 ") << true << 1.0;
|
QTest::newRow("C 1 ") << QString("C") << QString("1 ") << true << 1.0;
|
||||||
@ -863,9 +878,35 @@ void tst_QLocale::stringToDouble_data()
|
|||||||
QTest::newRow("de_DE 9.876543,0e--2") << QString("de_DE") << QString("9.876543,0e")+QChar(8722)+QString("2") << false << 0.0;
|
QTest::newRow("de_DE 9.876543,0e--2") << QString("de_DE") << QString("9.876543,0e")+QChar(8722)+QString("2") << false << 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QLocale::stringToDouble_data()
|
||||||
|
{
|
||||||
|
toReal_data();
|
||||||
|
if (std::numeric_limits<double>::has_infinity) {
|
||||||
|
double huge = std::numeric_limits<double>::infinity();
|
||||||
|
QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge;
|
||||||
|
QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge;
|
||||||
|
QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge;
|
||||||
|
// Overflow:
|
||||||
|
QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge;
|
||||||
|
QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge;
|
||||||
|
}
|
||||||
|
if (std::numeric_limits<double>::has_quiet_NaN)
|
||||||
|
QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << std::numeric_limits<double>::quiet_NaN();
|
||||||
|
|
||||||
|
// In range (but outside float's range):
|
||||||
|
QTest::newRow("C big") << QString("C") << QString("3.5e38") << true << 3.5e38;
|
||||||
|
QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << true << -3.5e38;
|
||||||
|
QTest::newRow("C small") << QString("C") << QString("1e-45") << true << 1e-45;
|
||||||
|
QTest::newRow("C -small") << QString("C") << QString("-1e-45") << true << -1e-45;
|
||||||
|
|
||||||
|
// Underflow:
|
||||||
|
QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.;
|
||||||
|
QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.;
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QLocale::stringToDouble()
|
void tst_QLocale::stringToDouble()
|
||||||
{
|
{
|
||||||
#define MY_DOUBLE_EPSILON (2.22045e-16)
|
#define MY_DOUBLE_EPSILON (2.22045e-16) // 1/2^{52}; double has a 53-bit mantissa
|
||||||
|
|
||||||
QFETCH(QString, locale_name);
|
QFETCH(QString, locale_name);
|
||||||
QFETCH(QString, num_str);
|
QFETCH(QString, num_str);
|
||||||
@ -880,28 +921,108 @@ void tst_QLocale::stringToDouble()
|
|||||||
double d = locale.toDouble(num_str, &ok);
|
double d = locale.toDouble(num_str, &ok);
|
||||||
QCOMPARE(ok, good);
|
QCOMPARE(ok, good);
|
||||||
|
|
||||||
char *currentLocale = setlocale(LC_ALL, "de_DE");
|
{
|
||||||
QCOMPARE(locale.toDouble(num_str, &ok), d); // make sure result is independent of locale
|
// Make sure result is independent of locale:
|
||||||
|
TransientLocale ignoreme(LC_ALL, "ar_SA");
|
||||||
|
QCOMPARE(locale.toDouble(num_str, &ok), d);
|
||||||
QCOMPARE(ok, good);
|
QCOMPARE(ok, good);
|
||||||
setlocale(LC_ALL, currentLocale);
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok || std::isinf(num)) {
|
||||||
double diff = d - num;
|
// First use fuzzy-compare, then a more precise check:
|
||||||
if (diff < 0)
|
QCOMPARE(d, num);
|
||||||
diff = -diff;
|
if (std::isfinite(num)) {
|
||||||
|
double diff = d > num ? d - num : num - d;
|
||||||
QVERIFY(diff <= MY_DOUBLE_EPSILON);
|
QVERIFY(diff <= MY_DOUBLE_EPSILON);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d = locale.toDouble(num_strRef, &ok);
|
d = locale.toDouble(num_strRef, &ok);
|
||||||
QCOMPARE(ok, good);
|
QCOMPARE(ok, good);
|
||||||
|
|
||||||
if (ok) {
|
if (ok || std::isinf(num)) {
|
||||||
double diff = d - num;
|
QCOMPARE(d, num);
|
||||||
if (diff < 0)
|
if (std::isfinite(num)) {
|
||||||
diff = -diff;
|
double diff = d > num ? d - num : num - d;
|
||||||
QVERIFY(diff <= MY_DOUBLE_EPSILON);
|
QVERIFY(diff <= MY_DOUBLE_EPSILON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#undef MY_DOUBLE_EPSILON
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QLocale::stringToFloat_data()
|
||||||
|
{
|
||||||
|
toReal_data();
|
||||||
|
if (std::numeric_limits<float>::has_infinity) {
|
||||||
|
double huge = std::numeric_limits<float>::infinity();
|
||||||
|
QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge;
|
||||||
|
QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge;
|
||||||
|
QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge;
|
||||||
|
// Overflow float, but not double:
|
||||||
|
QTest::newRow("C big") << QString("C") << QString("3.5e38") << false << huge;
|
||||||
|
QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << false << -huge;
|
||||||
|
// Overflow double, too:
|
||||||
|
QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge;
|
||||||
|
QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge;
|
||||||
|
}
|
||||||
|
if (std::numeric_limits<float>::has_quiet_NaN)
|
||||||
|
QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << double(std::numeric_limits<float>::quiet_NaN());
|
||||||
|
|
||||||
|
// Underflow float, but not double:
|
||||||
|
QTest::newRow("C small") << QString("C") << QString("1e-45") << false << 0.;
|
||||||
|
QTest::newRow("C -small") << QString("C") << QString("-1e-45") << false << 0.;
|
||||||
|
|
||||||
|
// Underflow double, too:
|
||||||
|
QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.;
|
||||||
|
QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QLocale::stringToFloat()
|
||||||
|
{
|
||||||
|
#define MY_FLOAT_EPSILON (2.384e-7) // 1/2^{22}; float has a 23-bit mantissa
|
||||||
|
|
||||||
|
QFETCH(QString, locale_name);
|
||||||
|
QFETCH(QString, num_str);
|
||||||
|
QFETCH(bool, good);
|
||||||
|
QFETCH(double, num);
|
||||||
|
QStringRef num_strRef = num_str.leftRef(-1);
|
||||||
|
float fnum = num;
|
||||||
|
|
||||||
|
QLocale locale(locale_name);
|
||||||
|
QCOMPARE(locale.name(), locale_name);
|
||||||
|
|
||||||
|
bool ok;
|
||||||
|
float f = locale.toFloat(num_str, &ok);
|
||||||
|
QCOMPARE(ok, good);
|
||||||
|
|
||||||
|
{
|
||||||
|
// Make sure result is independent of locale:
|
||||||
|
TransientLocale ignoreme(LC_ALL, "ar_SA");
|
||||||
|
QCOMPARE(locale.toFloat(num_str, &ok), f);
|
||||||
|
QCOMPARE(ok, good);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok || std::isinf(fnum)) {
|
||||||
|
// First use fuzzy-compare, then a more precise check:
|
||||||
|
QCOMPARE(f, fnum);
|
||||||
|
if (std::isfinite(fnum)) {
|
||||||
|
float diff = f > fnum ? f - fnum : fnum - f;
|
||||||
|
QVERIFY(diff <= MY_FLOAT_EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f = locale.toFloat(num_strRef, &ok);
|
||||||
|
QCOMPARE(ok, good);
|
||||||
|
|
||||||
|
if (ok || std::isinf(fnum)) {
|
||||||
|
QCOMPARE(f, fnum);
|
||||||
|
if (std::isfinite(fnum)) {
|
||||||
|
float diff = f > fnum ? f - fnum : fnum - f;
|
||||||
|
QVERIFY(diff <= MY_FLOAT_EPSILON);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#undef MY_FLOAT_EPSILON
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QLocale::doubleToString_data()
|
void tst_QLocale::doubleToString_data()
|
||||||
{
|
{
|
||||||
@ -1013,9 +1134,8 @@ void tst_QLocale::doubleToString()
|
|||||||
const QLocale locale(locale_name);
|
const QLocale locale(locale_name);
|
||||||
QCOMPARE(locale.toString(num, mode, precision), num_str);
|
QCOMPARE(locale.toString(num, mode, precision), num_str);
|
||||||
|
|
||||||
char *currentLocale = setlocale(LC_ALL, "de_DE");
|
TransientLocale ignoreme(LC_ALL, "de_DE");
|
||||||
QCOMPARE(locale.toString(num, mode, precision), num_str);
|
QCOMPARE(locale.toString(num, mode, precision), num_str);
|
||||||
setlocale(LC_ALL, currentLocale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QLocale::strtod_data()
|
void tst_QLocale::strtod_data()
|
||||||
|
@ -2,7 +2,8 @@ QT = core core-private network network-private testlib
|
|||||||
|
|
||||||
CONFIG += testcase parallel_test c++11
|
CONFIG += testcase parallel_test c++11
|
||||||
TARGET = tst_http2
|
TARGET = tst_http2
|
||||||
HEADERS += http2srv.h
|
INCLUDEPATH += ../../../../shared/
|
||||||
|
HEADERS += http2srv.h ../../../../shared/emulationdetector.h
|
||||||
SOURCES += tst_http2.cpp http2srv.cpp
|
SOURCES += tst_http2.cpp http2srv.cpp
|
||||||
|
|
||||||
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "emulationdetector.h"
|
||||||
|
|
||||||
#if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)
|
#if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)
|
||||||
// HTTP/2 over TLS requires ALPN/NPN to negotiate the protocol version.
|
// HTTP/2 over TLS requires ALPN/NPN to negotiate the protocol version.
|
||||||
const bool clearTextHTTP2 = false;
|
const bool clearTextHTTP2 = false;
|
||||||
@ -288,6 +290,9 @@ void tst_Http2::flowControlServerSide()
|
|||||||
// to let all replies finish without any error.
|
// to let all replies finish without any error.
|
||||||
using namespace Http2;
|
using namespace Http2;
|
||||||
|
|
||||||
|
if (EmulationDetector::isRunningArmOnX86())
|
||||||
|
QSKIP("Test is too slow to run on emulator");
|
||||||
|
|
||||||
clearHTTP2State();
|
clearHTTP2State();
|
||||||
|
|
||||||
serverPort = 0;
|
serverPort = 0;
|
||||||
|
@ -2429,7 +2429,17 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
|
|||||||
QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString())));
|
QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString())));
|
||||||
while (!serverProcess.canReadLine())
|
while (!serverProcess.canReadLine())
|
||||||
QVERIFY(serverProcess.waitForReadyRead(10000));
|
QVERIFY(serverProcess.waitForReadyRead(10000));
|
||||||
QCOMPARE(serverProcess.readLine().data(), QByteArray(server.toLatin1() + "\n").data());
|
|
||||||
|
QByteArray line = serverProcess.readLine();
|
||||||
|
|
||||||
|
// Ignore following print, happens on Qemu:
|
||||||
|
if (line == "getsockopt level=41 optname=26 not yet supported\n") {
|
||||||
|
while (!serverProcess.canReadLine())
|
||||||
|
QVERIFY(serverProcess.waitForReadyRead(10000));
|
||||||
|
line = serverProcess.readLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
QCOMPARE(line.data(), QByteArray(server.toLatin1() + "\n").data());
|
||||||
|
|
||||||
// Start client
|
// Start client
|
||||||
QProcess clientProcess;
|
QProcess clientProcess;
|
||||||
|
@ -2,3 +2,6 @@ CONFIG += testcase
|
|||||||
SOURCES += tst_qobjectrace.cpp
|
SOURCES += tst_qobjectrace.cpp
|
||||||
QT = core testlib
|
QT = core testlib
|
||||||
|
|
||||||
|
INCLUDEPATH += ../../../shared/
|
||||||
|
HEADERS += ../../../shared/emulationdetector.h
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
#include "emulationdetector.h"
|
||||||
|
|
||||||
enum { OneMinute = 60 * 1000,
|
enum { OneMinute = 60 * 1000,
|
||||||
TwoMinutes = OneMinute * 2 };
|
TwoMinutes = OneMinute * 2 };
|
||||||
@ -256,6 +257,9 @@ public:
|
|||||||
|
|
||||||
void tst_QObjectRace::destroyRace()
|
void tst_QObjectRace::destroyRace()
|
||||||
{
|
{
|
||||||
|
if (EmulationDetector::isRunningArmOnX86())
|
||||||
|
QSKIP("Test is too slow to run on emulator");
|
||||||
|
|
||||||
enum { ThreadCount = 10, ObjectCountPerThread = 2777,
|
enum { ThreadCount = 10, ObjectCountPerThread = 2777,
|
||||||
ObjectCount = ThreadCount * ObjectCountPerThread };
|
ObjectCount = ThreadCount * ObjectCountPerThread };
|
||||||
|
|
||||||
|
@ -674,6 +674,9 @@ static inline QByteArray msgProcessError(const QString &binary, const QStringLis
|
|||||||
|
|
||||||
void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes)
|
void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes)
|
||||||
{
|
{
|
||||||
|
if (EmulationDetector::isRunningArmOnX86() && (subdir == "crashes"))
|
||||||
|
QSKIP("Skipping \"crashes\" due to QTBUG-71915");
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX)
|
#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX)
|
||||||
if (arguments.contains("-callgrind")) {
|
if (arguments.contains("-callgrind")) {
|
||||||
QProcess checkProcess;
|
QProcess checkProcess;
|
||||||
|
@ -1671,6 +1671,13 @@ void tst_QComboBox::setCustomModelAndView()
|
|||||||
QTRY_VERIFY(combo.view()->isVisible());
|
QTRY_VERIFY(combo.view()->isVisible());
|
||||||
const QRect subItemRect = view->visualRect(model->indexFromItem(subItem));
|
const QRect subItemRect = view->visualRect(model->indexFromItem(subItem));
|
||||||
QWidget *window = view->window();
|
QWidget *window = view->window();
|
||||||
|
|
||||||
|
// QComboBox sometimes ignores the mouse click event for doubleClickInterval
|
||||||
|
// depending on which tests have been run previously. On arm this happens
|
||||||
|
// more often than on x86. Search for maybeIgnoreMouseButtonRelease to see
|
||||||
|
// why this happens.
|
||||||
|
QTest::qWait(QApplication::doubleClickInterval());
|
||||||
|
|
||||||
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center()));
|
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center()));
|
||||||
#ifdef Q_OS_WINRT
|
#ifdef Q_OS_WINRT
|
||||||
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
|
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
|
||||||
@ -3421,6 +3428,11 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex()
|
|||||||
model->setFilterFixedString("foobar1");
|
model->setFilterFixedString("foobar1");
|
||||||
completer->setModel(model);
|
completer->setModel(model);
|
||||||
|
|
||||||
|
if (QGuiApplication::platformName() == "offscreen") {
|
||||||
|
QWARN("Offscreen platform requires explicit activateWindow()");
|
||||||
|
cbox.activateWindow();
|
||||||
|
}
|
||||||
|
|
||||||
QApplication::setActiveWindow(&cbox);
|
QApplication::setActiveWindow(&cbox);
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&cbox));
|
QVERIFY(QTest::qWaitForWindowActive(&cbox));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user