tst_QStringBuilder: add a check for QBA/QL1SV concatenation
Rvalue QL1S and (const) lvalue QBA combination is ambiguous in qtlottie tests on the latest qt5.git integration round. It was not caugth by the QStringBuilder tests, because the tests never checked op+() with allowed casts to/from ASCII. Add a new test scenario and hide the failing combination under ifdef (cannot use QEXPECT_FAIL as it's a compile-time error). The ifdef will be removed in a follow-up patch that fixes the issue. Task-number: QTBUG-127904 Task-number: QTBUG-127928 Task-number: QTBUG-127931 Change-Id: I92b582f16e850fb34c34b75714d820e65d411265 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
590c85c80b
commit
b7e13a82a7
@ -6,3 +6,4 @@ add_subdirectory(qstringbuilder2)
|
||||
add_subdirectory(qstringbuilder3)
|
||||
add_subdirectory(qstringbuilder4)
|
||||
add_subdirectory(qstringbuilder5)
|
||||
add_subdirectory(qstringbuilder6)
|
||||
|
@ -479,6 +479,18 @@ void runScenario()
|
||||
r = QByteArrayLiteral(LITERAL) P string;
|
||||
QCOMPARE(r, r2);
|
||||
|
||||
#ifndef HAS_QTBUG_127928
|
||||
r = ba P l1string;
|
||||
QCOMPARE(r, r2);
|
||||
r = l1string P ba;
|
||||
QCOMPARE(r, r2);
|
||||
|
||||
r = ba P QLatin1String(l1string);
|
||||
QCOMPARE(r, r2);
|
||||
r = QLatin1String(l1string) P std::as_const(ba);
|
||||
QCOMPARE(r, r2);
|
||||
#endif
|
||||
|
||||
static const char badata[] = LITERAL_EXTRA;
|
||||
ba = QByteArray::fromRawData(badata, LITERAL_LEN);
|
||||
r = ba P string;
|
||||
|
@ -0,0 +1,17 @@
|
||||
# Copyright (C) 2024 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qstringbuilder6 Test:
|
||||
#####################################################################
|
||||
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(tst_qstringbuilder6 LANGUAGES CXX)
|
||||
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
|
||||
endif()
|
||||
|
||||
qt_internal_add_test(tst_qstringbuilder6
|
||||
SOURCES
|
||||
tst_qstringbuilder6.cpp
|
||||
)
|
@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
// SCENARIO 6
|
||||
// We disable QStringBuilder and compile with normal operator+ to verify
|
||||
// that all QSB supported operations are still available when QSB is disabled.
|
||||
// We also allow casts to/from ASCII
|
||||
#undef QT_USE_QSTRINGBUILDER
|
||||
#undef QT_NO_CAST_FROM_ASCII
|
||||
#undef QT_NO_CAST_TO_ASCII
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringBuilder>
|
||||
#include <QtTest/QTest>
|
||||
|
||||
#include <QtCore/q20iterator.h>
|
||||
|
||||
#define LITERAL "some literal"
|
||||
|
||||
#define HAS_QTBUG_127928 1
|
||||
|
||||
namespace {
|
||||
#define P +
|
||||
#include "../qstringbuilder1/stringbuilder.cpp"
|
||||
#undef P
|
||||
} // namespace
|
||||
|
||||
class tst_QStringBuilder6 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void scenario() { runScenario(); }
|
||||
};
|
||||
|
||||
#include "tst_qstringbuilder6.moc"
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QStringBuilder6)
|
Loading…
x
Reference in New Issue
Block a user