Ensure we don't repeat QTBUG-30931 in Qt5
The issue is already fixed in 5.0 but let's be nice and ensure the issue won't be reintroduced later. Task-number: QTBUG-30931 Change-Id: Ia6944acaf6e7217f8d0f1fa75d0e9977db11d892 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
41dbfd8888
commit
e3dadce470
@ -1739,10 +1739,10 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
|
||||
if (from < 0 || s.length() - from < 2)
|
||||
return;
|
||||
|
||||
int starter = 0; // starter position
|
||||
uint stcode = 0; // starter code point
|
||||
int next = -1;
|
||||
int lastCombining = 0;
|
||||
int starter = -1; // starter position
|
||||
int next = -1; // to prevent i == next
|
||||
int lastCombining = 255; // to prevent combining > lastCombining
|
||||
|
||||
int pos = from;
|
||||
while (pos < s.length()) {
|
||||
@ -1766,8 +1766,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
|
||||
}
|
||||
|
||||
int combining = p->combiningClass;
|
||||
if (i == next || combining > lastCombining) {
|
||||
Q_ASSERT(starter >= from);
|
||||
if ((i == next || combining > lastCombining) && starter >= from) {
|
||||
// allowed to form ligature with S
|
||||
uint ligature = ligatureHelper(stcode, uc);
|
||||
if (ligature) {
|
||||
|
@ -909,6 +909,20 @@ void tst_QChar::normalization_manual()
|
||||
QVERIFY(composed.normalized(QString::NormalizationForm_KD) == decomposed);
|
||||
QVERIFY(composed.normalized(QString::NormalizationForm_KC) == decomposed);
|
||||
}
|
||||
{
|
||||
QString composed;
|
||||
composed += QChar(0x0061);
|
||||
composed += QChar(0x00f2);
|
||||
QString decomposed;
|
||||
decomposed += QChar(0x0061);
|
||||
decomposed += QChar(0x006f);
|
||||
decomposed += QChar(0x0300);
|
||||
|
||||
QVERIFY(decomposed.normalized(QString::NormalizationForm_D) == decomposed);
|
||||
QVERIFY(decomposed.normalized(QString::NormalizationForm_C) == composed);
|
||||
QVERIFY(decomposed.normalized(QString::NormalizationForm_KD) == decomposed);
|
||||
QVERIFY(decomposed.normalized(QString::NormalizationForm_KC) == composed);
|
||||
}
|
||||
{ // hangul
|
||||
QString composed;
|
||||
composed += QChar(0xc154);
|
||||
|
Loading…
Reference in New Issue
Block a user