QAnyStringView: check QASV(char) isn't UTF-8

... it is. Filed QTBUG-125730 to track this and discuss how to deal
with it.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-125730
Change-Id: I2c680e1a9e8dda43700468a544ac645e1fa3aa53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3ff55648cee8365fb7825ca7a038596b63757ea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-05-27 07:50:11 +02:00 committed by Qt Cherry-pick Bot
parent dabfdb5f2d
commit 93e39f7b79

View File

@ -370,6 +370,7 @@ private Q_SLOTS:
fromCharacter(QChar::ReplacementCharacter, 1);
fromCharacter(QChar::LastValidCodePoint, 1);
}
void fromCharacterSpecial() const;
void fromChar16TStar() const { fromLiteral(u"Hello, World!"); }
void fromWCharTStar() const { ONLY_WIN(fromLiteral(L"Hello, World!")); }
@ -610,6 +611,14 @@ void tst_QAnyStringView::asciiLiteralIsLatin1() const
}
}
void tst_QAnyStringView::fromCharacterSpecial() const
{
QEXPECT_FAIL("", "QTBUG-125730", Continue);
// Treating 'ä' as a UTF-8 sequence doesn't make sense, as it would be
// invalid. And this is not how legacy Qt APIs handled it, either:
QCOMPARE_NE(QAnyStringView('\xE4').tag(), QAnyStringView::Tag::Utf8);
}
template <typename StringBuilder>
void tst_QAnyStringView::fromQStringBuilder(StringBuilder &&sb, QStringView expected) const
{