QtTestLib: replace remaining uses of QL1String with QL1StringView
Remove unneeded \fn qdoc lines as a drive-by. Task-number: QTBUG-98434 Change-Id: Id93ddbb38b97a8f5a6734bfbc82686ccb3a87aa6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
7baa06fe0c
commit
89225c951e
|
|
@ -93,7 +93,7 @@ qint64 QBenchmarkValgrindUtils::extractResult(const QString &fileName)
|
|||
bool valSeen = false;
|
||||
QRegularExpression rxValue(u"^summary: (\\d+)"_s);
|
||||
while (!file.atEnd()) {
|
||||
const QString line(QLatin1String(file.readLine()));
|
||||
const QString line(QLatin1StringView(file.readLine()));
|
||||
QRegularExpressionMatch match = rxValue.match(line);
|
||||
if (match.hasMatch()) {
|
||||
bool ok;
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description,
|
|||
QString message = match.captured(u"message");
|
||||
QString expected;
|
||||
QString actual;
|
||||
const auto parenthesize = [&match](QLatin1String key) -> QString {
|
||||
const auto parenthesize = [&match](QLatin1StringView key) -> QString {
|
||||
return " ("_L1 % match.captured(key) % u')';
|
||||
};
|
||||
const QString actualExpression = parenthesize("actualexpression"_L1);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ template<> inline char *toString(const QString &str)
|
|||
return toString(QStringView(str));
|
||||
}
|
||||
|
||||
template<> inline char *toString(const QLatin1String &str)
|
||||
template<> inline char *toString(const QLatin1StringView &str)
|
||||
{
|
||||
return toString(QString(str));
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ template<> inline char *toString(const QRectF &s)
|
|||
template<> inline char *toString(const QUrl &uri)
|
||||
{
|
||||
if (!uri.isValid())
|
||||
return qstrdup(qPrintable(QLatin1String("Invalid URL: ") + uri.errorString()));
|
||||
return qstrdup(qPrintable(QLatin1StringView("Invalid URL: ") + uri.errorString()));
|
||||
return qstrdup(uri.toEncoded().constData());
|
||||
}
|
||||
|
||||
|
|
@ -408,14 +408,14 @@ inline char *toString(std::nullptr_t)
|
|||
}
|
||||
|
||||
template<>
|
||||
inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual,
|
||||
const char *expected, const char *file, int line)
|
||||
inline bool qCompare(QString const &t1, QLatin1StringView const &t2, const char *actual,
|
||||
const char *expected, const char *file, int line)
|
||||
{
|
||||
return qCompare(t1, QString(t2), actual, expected, file, line);
|
||||
}
|
||||
template<>
|
||||
inline bool qCompare(QLatin1String const &t1, QString const &t2, const char *actual,
|
||||
const char *expected, const char *file, int line)
|
||||
inline bool qCompare(QLatin1StringView const &t1, QString const &t2, const char *actual,
|
||||
const char *expected, const char *file, int line)
|
||||
{
|
||||
return qCompare(QString(t1), t2, actual, expected, file, line);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ public:
|
|||
static QMetaMethod findMethod(const QObject *obj, const char *signature);
|
||||
|
||||
private:
|
||||
bool invokeTest(int index, QLatin1String tag, WatchDog *watchDog) const;
|
||||
bool invokeTest(int index, QLatin1StringView tag, WatchDog *watchDog) const;
|
||||
void invokeTestOnData(int index) const;
|
||||
|
||||
QMetaMethod m_initTestCaseMethod; // might not exist, check isValid().
|
||||
|
|
@ -449,7 +449,7 @@ static void qPrintTestSlots(FILE *stream, const char *filter = nullptr)
|
|||
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
|
||||
if (isValidSlot(sl)) {
|
||||
const QByteArray signature = sl.methodSignature();
|
||||
if (!filter || QLatin1String(signature).contains(QLatin1String(filter), Qt::CaseInsensitive))
|
||||
if (!filter || QLatin1StringView(signature).contains(QLatin1StringView(filter), Qt::CaseInsensitive))
|
||||
fprintf(stream, "%s\n", signature.constData());
|
||||
}
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ static void qPrintDataTags(FILE *stream)
|
|||
const int dataCount = table.dataCount();
|
||||
localTags.reserve(dataCount);
|
||||
for (int j = 0; j < dataCount; ++j)
|
||||
localTags << QLatin1String(table.testData(j)->dataTag());
|
||||
localTags << QLatin1StringView(table.testData(j)->dataTag());
|
||||
|
||||
// Print all tag combinations:
|
||||
if (gTable->dataCount() == 0) {
|
||||
|
|
@ -964,7 +964,7 @@ void TestMethods::invokeTestOnData(int index) const
|
|||
QBenchmarkTestMethodData::current->result = QBenchmarkResult();
|
||||
QBenchmarkTestMethodData::current->resultAccepted = false;
|
||||
|
||||
QBenchmarkGlobalData::current->context.tag = QLatin1String(
|
||||
QBenchmarkGlobalData::current->context.tag = QLatin1StringView(
|
||||
QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "");
|
||||
|
||||
invokeOk = m_methods[index].invoke(QTest::currentTestObject, Qt::DirectConnection);
|
||||
|
|
@ -1151,13 +1151,13 @@ public:
|
|||
If the function was successfully called, true is returned, otherwise
|
||||
false.
|
||||
*/
|
||||
bool TestMethods::invokeTest(int index, QLatin1String tag, WatchDog *watchDog) const
|
||||
bool TestMethods::invokeTest(int index, QLatin1StringView tag, WatchDog *watchDog) const
|
||||
{
|
||||
QBenchmarkTestMethodData benchmarkData;
|
||||
QBenchmarkTestMethodData::current = &benchmarkData;
|
||||
|
||||
const QByteArray &name = m_methods[index].name();
|
||||
QBenchmarkGlobalData::current->context.slotName = QLatin1String(name) + "()"_L1;
|
||||
QBenchmarkGlobalData::current->context.slotName = QLatin1StringView(name) + "()"_L1;
|
||||
|
||||
char member[512];
|
||||
QTestTable table;
|
||||
|
|
@ -1171,7 +1171,8 @@ bool TestMethods::invokeTest(int index, QLatin1String tag, WatchDog *watchDog) c
|
|||
return globalDataCount ? gTable->testData(index)->dataTag() : nullptr;
|
||||
};
|
||||
|
||||
const auto dataTagMatches = [](QLatin1String tag, QLatin1String local, QLatin1String global) {
|
||||
const auto dataTagMatches = [](QLatin1StringView tag, QLatin1StringView local,
|
||||
QLatin1StringView global) {
|
||||
if (tag.isEmpty()) // No tag specified => run all data sets for this function
|
||||
return true;
|
||||
if (tag == local || tag == global) // Equal to either => run it
|
||||
|
|
@ -1212,8 +1213,8 @@ bool TestMethods::invokeTest(int index, QLatin1String tag, WatchDog *watchDog) c
|
|||
do {
|
||||
QTestResult::setSkipCurrentTest(false);
|
||||
QTestResult::setBlacklistCurrentTest(false);
|
||||
if (dataTagMatches(tag, QLatin1String(dataTag(curDataIndex)),
|
||||
QLatin1String(globalDataTag(curGlobalDataIndex)))) {
|
||||
if (dataTagMatches(tag, QLatin1StringView(dataTag(curDataIndex)),
|
||||
QLatin1StringView(globalDataTag(curGlobalDataIndex)))) {
|
||||
foundFunction = true;
|
||||
|
||||
QTestPrivate::checkBlackLists(name.constData(), dataTag(curDataIndex),
|
||||
|
|
@ -1574,7 +1575,7 @@ void TestMethods::invokeTests(QObject *testObject) const
|
|||
const char *data = nullptr;
|
||||
if (i < QTest::testTags.size() && !QTest::testTags.at(i).isEmpty())
|
||||
data = qstrdup(QTest::testTags.at(i).toLatin1().constData());
|
||||
const bool ok = invokeTest(i, QLatin1String(data), watchDog.data());
|
||||
const bool ok = invokeTest(i, QLatin1StringView(data), watchDog.data());
|
||||
delete [] data;
|
||||
if (!ok)
|
||||
break;
|
||||
|
|
@ -2826,11 +2827,11 @@ bool QTest::qCompare(QStringView t1, QStringView t2, const char *actual, const c
|
|||
t1, t2, actual, expected, file, line);
|
||||
}
|
||||
|
||||
/*! \fn bool QTest::qCompare(QStringView t1, const QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
/*!
|
||||
\internal
|
||||
\since 5.14
|
||||
*/
|
||||
bool QTest::qCompare(QStringView t1, const QLatin1String &t2, const char *actual, const char *expected,
|
||||
bool QTest::qCompare(QStringView t1, const QLatin1StringView &t2, const char *actual, const char *expected,
|
||||
const char *file, int line)
|
||||
{
|
||||
return QTestResult::compare(t1 == t2,
|
||||
|
|
@ -2838,11 +2839,11 @@ bool QTest::qCompare(QStringView t1, const QLatin1String &t2, const char *actual
|
|||
t1, t2, actual, expected, file, line);
|
||||
}
|
||||
|
||||
/*! \fn bool QTest::qCompare(const QLatin1String &t1, QStringView t2, const char *actual, const char *expected, const char *file, int line)
|
||||
/*!
|
||||
\internal
|
||||
\since 5.14
|
||||
*/
|
||||
bool QTest::qCompare(const QLatin1String &t1, QStringView t2, const char *actual, const char *expected,
|
||||
bool QTest::qCompare(const QLatin1StringView &t1, QStringView t2, const char *actual, const char *expected,
|
||||
const char *file, int line)
|
||||
{
|
||||
return QTestResult::compare(t1 == t2,
|
||||
|
|
@ -2855,12 +2856,12 @@ bool QTest::qCompare(const QLatin1String &t1, QStringView t2, const char *actual
|
|||
\since 5.14
|
||||
*/
|
||||
|
||||
/*! \fn bool QTest::qCompare(const QString &t1, const QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
/*! \fn bool QTest::qCompare(const QString &t1, const QLatin1StringView &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
\internal
|
||||
\since 5.14
|
||||
*/
|
||||
|
||||
/*! \fn bool QTest::qCompare(const QLatin1String &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
/*! \fn bool QTest::qCompare(const QLatin1StringView &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
\internal
|
||||
\since 5.14
|
||||
*/
|
||||
|
|
@ -3152,11 +3153,11 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
|
|||
\internal
|
||||
*/
|
||||
|
||||
/*! \fn bool QTest::qCompare(const QString &t1, const QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
/*! \fn bool QTest::qCompare(const QString &t1, const QLatin1StringView &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*! \fn bool QTest::qCompare(const QLatin1String &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
/*! \fn bool QTest::qCompare(const QLatin1StringView &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
|
||||
\internal
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -428,10 +428,10 @@ namespace QTest
|
|||
Q_TESTLIB_EXPORT bool qCompare(QStringView t1, QStringView t2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line);
|
||||
Q_TESTLIB_EXPORT bool qCompare(QStringView t1, const QLatin1String &t2,
|
||||
Q_TESTLIB_EXPORT bool qCompare(QStringView t1, const QLatin1StringView &t2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line);
|
||||
Q_TESTLIB_EXPORT bool qCompare(const QLatin1String &t1, QStringView t2,
|
||||
Q_TESTLIB_EXPORT bool qCompare(const QLatin1StringView &t1, QStringView t2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line);
|
||||
inline bool qCompare(const QString &t1, const QString &t2,
|
||||
|
|
@ -440,13 +440,13 @@ namespace QTest
|
|||
{
|
||||
return qCompare(QStringView(t1), QStringView(t2), actual, expected, file, line);
|
||||
}
|
||||
inline bool qCompare(const QString &t1, const QLatin1String &t2,
|
||||
inline bool qCompare(const QString &t1, const QLatin1StringView &t2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line)
|
||||
{
|
||||
return qCompare(QStringView(t1), t2, actual, expected, file, line);
|
||||
}
|
||||
inline bool qCompare(const QLatin1String &t1, const QString &t2,
|
||||
inline bool qCompare(const QLatin1StringView &t1, const QString &t2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1139,7 +1139,7 @@
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn char *QTest::toString(const QLatin1String &string)
|
||||
\fn char *QTest::toString(const QLatin1StringView &string)
|
||||
\overload
|
||||
|
||||
Returns a textual representation of the given \a string.
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ bool QTestResult::compare(bool success, const char *failureMsg,
|
|||
}
|
||||
|
||||
bool QTestResult::compare(bool success, const char *failureMsg,
|
||||
QStringView val1, const QLatin1String &val2,
|
||||
QStringView val1, const QLatin1StringView &val2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line)
|
||||
{
|
||||
|
|
@ -498,7 +498,7 @@ bool QTestResult::compare(bool success, const char *failureMsg,
|
|||
}
|
||||
|
||||
bool QTestResult::compare(bool success, const char *failureMsg,
|
||||
const QLatin1String & val1, QStringView val2,
|
||||
const QLatin1StringView & val1, QStringView val2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ public:
|
|||
const char *actual, const char *expected,
|
||||
const char *file, int line);
|
||||
static bool compare(bool success, const char *failureMsg,
|
||||
const QLatin1String &val1, QStringView val2,
|
||||
const QLatin1StringView &val1, QStringView val2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line);
|
||||
static bool compare(bool success, const char *failureMsg,
|
||||
QStringView val1, const QLatin1String &val2,
|
||||
QStringView val1, const QLatin1StringView &val2,
|
||||
const char *actual, const char *expected,
|
||||
const char *file, int line);
|
||||
static void setCurrentGlobalTestData(QTestData *data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue