summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp16
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp24
-rw-r--r--tests/auto/shared/resources/test.ttfbin2128 -> 2196 bytes
3 files changed, 31 insertions, 9 deletions
diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
index efd590a730..9660d829b8 100644
--- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
@@ -42,6 +42,7 @@ private slots:
void stringIndexes();
void retrievalFlags_data();
void retrievalFlags();
+ void objectReplacementCharacter();
private:
int m_testFontId;
@@ -954,6 +955,21 @@ void tst_QGlyphRun::retrievalFlags()
QCOMPARE(firstGlyphRun.positions().isEmpty(), !expectedGlyphPositions);
}
+void tst_QGlyphRun::objectReplacementCharacter()
+{
+ QTextLayout layout;
+ layout.setFont(m_testFont);
+ layout.setText(QStringLiteral("\uFFFC"));
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QList<QGlyphRun> glyphRuns = layout.glyphRuns();
+ QCOMPARE(glyphRuns.size(), 1);
+ QCOMPARE(glyphRuns.first().glyphIndexes().size(), 1);
+ QCOMPARE(glyphRuns.first().glyphIndexes().first(), 5);
+}
+
#endif // QT_NO_RAWFONT
QTEST_MAIN(tst_QGlyphRun)
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 3958e2a01c..9e6daf81b1 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -512,18 +512,24 @@ void tst_QTextLayout::noWrap()
void tst_QTextLayout::cursorToXForInlineObjects()
{
- QChar ch(QChar::ObjectReplacementCharacter);
- QString text(ch);
- QTextLayout layout(text, testFont);
- layout.beginLayout();
+ QString text = QStringLiteral("<html><body><img src=\"\" width=\"32\" height=\"32\" /></body></html>");
- QTextEngine *engine = layout.engine();
- const int item = engine->findItem(0);
- engine->layoutData->items[item].width = 32;
+ QTextDocument document;
+ document.setHtml(text);
+ QCOMPARE(document.blockCount(), 1);
- QTextLine line = layout.createLine();
- line.setLineWidth(0x10000);
+ // Trigger layout
+ {
+ QImage img(1, 1, QImage::Format_ARGB32_Premultiplied);
+ QPainter p(&img);
+ document.drawContents(&p);
+ }
+
+ QTextLayout *layout = document.firstBlock().layout();
+ QVERIFY(layout != nullptr);
+ QCOMPARE(layout->lineCount(), 1);
+ QTextLine line = layout->lineAt(0);
QCOMPARE(line.cursorToX(0), qreal(0));
QCOMPARE(line.cursorToX(1), qreal(32));
}
diff --git a/tests/auto/shared/resources/test.ttf b/tests/auto/shared/resources/test.ttf
index b2bb6cd036..8b56c046d4 100644
--- a/tests/auto/shared/resources/test.ttf
+++ b/tests/auto/shared/resources/test.ttf
Binary files differ