1 Star 0 Fork 19

Yukizhu001/qt5-qtbase

forked from src-anolis-os/qt5-qtbase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
QTBUG-89184-QInputControl-accept-surrogate-category-character.patch 3.74 KB
一键复制 编辑 原始数据 按行查看 历史
xingwei-liu 提交于 2022-10-13 02:47 . !8 feature: add patchs for DDE
From: Tang Haixiang <[email protected]>
Date: Tue Apr 06 16:08:13 2021 +0800
Subject: QInputControl: accept surrogate category character
Upstream: https://codereview.qt-project.org/c/qt/qtbase/+/327425
---
Index: qtbase-opensource-src/src/gui/text/qinputcontrol.cpp
===================================================================
--- qtbase-opensource-src.orig/src/gui/text/qinputcontrol.cpp
+++ qtbase-opensource-src/src/gui/text/qinputcontrol.cpp
@@ -79,6 +79,9 @@ bool QInputControl::isAcceptableInput(co
if (c.category() == QChar::Other_PrivateUse)
return true;
+ if (c.isHighSurrogate() && text.length() > 1 && text.at(1).isLowSurrogate())
+ return true;
+
if (m_type == TextEdit && c == QLatin1Char('\t'))
return true;
Index: qtbase-opensource-src/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
===================================================================
--- qtbase-opensource-src.orig/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
+++ qtbase-opensource-src/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
@@ -58,6 +58,52 @@ void tst_QInputControl::isAcceptableInpu
QTest::newRow("printable-latin-with-ctrl-shift") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << false;
QTest::newRow("printable-hebrew") << QString(QChar(0x2135)) << Qt::KeyboardModifiers() << true;
QTest::newRow("private-use-area") << QString(QChar(0xE832)) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("good-surrogate-0") << QString::fromUtf16(u"\U0001F44D") << Qt::KeyboardModifiers() << true;
+ {
+ const QChar data[] = { QChar(0xD800), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-1") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xD800), QChar(0xDFFF) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-2") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xDBFF), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-3") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xDBFF), QChar(0xDFFF) };
+ const QString str = QString(data, 2);
+ QTest::newRow("good-surrogate-4") << str << Qt::KeyboardModifiers() << true;
+ }
+ {
+ const QChar data[] = { QChar(0xD7FF), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-1") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xD7FF), QChar(0xDFFF) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-2") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xDC00), QChar(0xDC00) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-3") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xD800), QChar(0xE000) };
+ const QString str = QString(data, 2);
+ QTest::newRow("bad-surrogate-4") << str << Qt::KeyboardModifiers() << false;
+ }
+ {
+ const QChar data[] = { QChar(0xD800) };
+ const QString str = QString(data, 1);
+ QTest::newRow("bad-surrogate-5") << str << Qt::KeyboardModifiers() << false;
+ }
QTest::newRow("multiple-printable") << QStringLiteral("foobar") << Qt::KeyboardModifiers() << true;
QTest::newRow("rlm") << QString(QChar(0x200F)) << Qt::KeyboardModifiers() << true;
QTest::newRow("rlm-with-ctrl") << QString(QChar(0x200F)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhuzhustu/qt5-qtbase.git
[email protected]:zhuzhustu/qt5-qtbase.git
zhuzhustu
qt5-qtbase
qt5-qtbase
a8

搜索帮助