diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-10 10:11:10 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-10 10:11:11 +0200 |
commit | f035786021e9f7b1d9512b22774bc15553caaedb (patch) | |
tree | c46a29ed3657944d9f36d8643a99fad469235bc4 /tests/auto/gui/text | |
parent | 72024fd50cdead8d890886dba32fd81ac54ff3ae (diff) | |
parent | 916c9d469bd0df227dc3be97fcca27e3cf58144f (diff) | |
download | qtbase-f035786021e9f7b1d9512b22774bc15553caaedb.tar.gz |
Merge remote-tracking branch 'origin/5.3' into dev
Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
Diffstat (limited to 'tests/auto/gui/text')
-rw-r--r-- | tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 26eaec0470..ec698e5db4 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -139,6 +139,7 @@ private slots: void cursorInLigatureWithMultipleLines(); void xToCursorForLigatures(); void cursorInNonStopChars(); + void nbsp(); private: QFont testFont; @@ -2011,5 +2012,28 @@ void tst_QTextLayout::justifyTrailingSpaces() QVERIFY(qFuzzyIsNull(layout.lineAt(0).cursorToX(0))); } +void tst_QTextLayout::nbsp() +{ + QString s = QString() + QChar(' ') + QChar('a') + QString(10, QChar::Nbsp) + QChar('a') + QChar(' ') + QChar('A'); + QString text = s + s + s + s + s + s + s + s + s + s + s + s + s + s; + QTextLayout layout(text); + layout.setCacheEnabled(true); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + int naturalWidth = qCeil(layout.lineAt(0).naturalTextWidth()); + int lineWidth = naturalWidth; + + layout.beginLayout(); + QTextLine line = layout.createLine(); + while (lineWidth-- > naturalWidth / 2) { + line.setLineWidth(lineWidth); + QVERIFY(text.at(line.textLength()-1).unicode() != QChar::Nbsp); + } + + layout.endLayout(); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" |