summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-06-06 18:00:21 +0300
committerQt by Nokia <qt-info@nokia.com>2012-06-07 21:18:36 +0200
commit88e735c9c92487f7ff51a06cfd66746afa655b2d (patch)
treec7cf46412839749e4a9af5413dc17a7a810d0029 /tests/auto/gui
parent8aac04f705c8f9e4193444b904f9819aea85b326 (diff)
Shift positions for lineBreakType
to keep them consistent with positions for all other flags. This changes the internal behavior so that attributes[0].lineBreakType now means "break opportunity at start of the text (before the first character in the string)" and is always assigned with HB_NoBreak to conform rule LB2 (see http://www.unicode.org/reports/tr14/#LB2). The current implementation is based on the sample implementation from tr14 that aimed to be as simple as possible rather than to be optimal. From now, we can use pieces of the attributes array "as is" without having to adjust some positions. Or we can analize some long text by chunks (e.g. paragraph by paragraph) and consume less memory. This introduces a minor overhead that will be eliminated shortly. Change-Id: Ic873a05a9d5203b1c3d5aff2e4445a3f034c4bd2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index d20fe83f2f..62cbc1fa5f 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -274,15 +274,15 @@ void tst_QTextLayout::lineBreaking()
QString str = QString::fromUtf8(b->utf8);
QTextEngine engine(str, QFont());
const HB_CharAttributes *attrs = engine.attributes();
+ QVERIFY(attrs[0].lineBreakType == HB_NoBreak);
int i;
for (i = 0; i < (int)str.length() - 1; ++i) {
QVERIFY(b->breaks[i] != 0xff);
- if ( (attrs[i].lineBreakType != HB_NoBreak) != (bool)b->breaks[i] ) {
- qDebug("test case \"%s\" failed at char %d; break type: %d", b->utf8, i, attrs[i].lineBreakType);
- QCOMPARE( (attrs[i].lineBreakType != HB_NoBreak), (bool)b->breaks[i] );
+ if ( (attrs[i + 1].lineBreakType != HB_NoBreak) != (bool)b->breaks[i] ) {
+ qDebug("test case \"%s\" failed at char %d; break type: %d", b->utf8, i, attrs[i + 1].lineBreakType);
+ QCOMPARE( (attrs[i + 1].lineBreakType != HB_NoBreak), (bool)b->breaks[i] );
}
}
- QVERIFY(attrs[i].lineBreakType == HB_ForcedBreak);
QCOMPARE(b->breaks[i], (uchar)0xff);
++b;
}