summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextlayout/tst_qtextlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtextlayout/tst_qtextlayout.cpp')
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index 0f1ff66259..2d1556631f 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -124,6 +124,7 @@ private slots:
void lineWidthFromBOM();
void textWidthVsWIdth();
void textWidthWithStackedTextEngine();
+ void textWidthWithLineSeparator();
private:
QFont testFont;
@@ -1399,5 +1400,21 @@ void tst_QTextLayout::textWidthWithStackedTextEngine()
QCOMPARE(line.naturalTextWidth(), fm.width(text));
}
+void tst_QTextLayout::textWidthWithLineSeparator()
+{
+ QString s1("Save Project"), s2("Save Project\ntest");
+ s2.replace('\n', QChar::LineSeparator);
+
+ QTextLayout layout1(s1), layout2(s2);
+ layout1.beginLayout();
+ layout2.beginLayout();
+
+ QTextLine line1 = layout1.createLine();
+ QTextLine line2 = layout2.createLine();
+ line1.setLineWidth(0x1000);
+ line2.setLineWidth(0x1000);
+ QCOMPARE(line1.naturalTextWidth(), line2.naturalTextWidth());
+}
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"