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.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index 83c7094..9f79420 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -127,6 +127,7 @@ private slots:
void textWithSurrogates_qtbug15679();
void textWidthWithStackedTextEngine();
void textWidthWithLineSeparator();
+ void textWithSurrogates_qtbug15679();
private:
QFont testFont;
@@ -1460,5 +1461,24 @@ void tst_QTextLayout::textWidthWithLineSeparator()
QCOMPARE(line1.naturalTextWidth(), line2.naturalTextWidth());
}
+void tst_QTextLayout::textWithSurrogates_qtbug15679()
+{
+ QString str = QString::fromUtf8("🀀a🀀");
+ QTextLayout layout(str);
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ qreal x[6];
+ for (int i = 0; i < 6; i++)
+ x[i] = line.cursorToX(i);
+
+ // If the first and third character are using the same
+ // font, they must have the same advance (since they
+ // are surrogate pairs, we need to add two for each
+ // character)
+ QCOMPARE(x[2] - x[0], x[5] - x[3]);
+}
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"