Port testlib from QStringRef to QStringView

Task-number: QTBUG-84319
Change-Id: I780945c8923c0a03e9c0a32d039da0c793f650fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2020-05-27 11:32:39 +02:00
parent 4895ae10c6
commit 5c4f470132
2 changed files with 2 additions and 2 deletions

View File

@ -2133,7 +2133,7 @@ QSharedPointer<QTemporaryDir> QTest::qExtractTestData(const QString &dirName)
QFileInfo fileInfo = it.fileInfo();
if (!fileInfo.isDir()) {
const QString destination = dataPath + QLatin1Char('/') + fileInfo.filePath().midRef(resourcePath.length());
const QString destination = dataPath + QLatin1Char('/') + QStringView{fileInfo.filePath()}.mid(resourcePath.length());
QFileInfo destinationFileInfo(destination);
QDir().mkpath(destinationFileInfo.path());
if (!QFile::copy(fileInfo.filePath(), destination)) {

View File

@ -144,7 +144,7 @@ namespace QTest {
// (the space was added automatically by ~QDebug() until Qt 5.3,
// so autotests still might expect it)
if (expected.endsWith(QLatin1Char(' ')))
return actual == expected.leftRef(expected.length() - 1);
return actual == QStringView{expected}.left(expected.length() - 1);
return false;
}