diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-05 18:52:38 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-05 18:52:38 +0100 |
commit | f6dbdd9c16166f345fd5743886229192c97c2c4f (patch) | |
tree | 05e5e7b806dd627be4e3ba6fc9a32f115847acb0 /tests/auto/gui | |
parent | b8084618545570a8832d344a2e9586e1226cc697 (diff) | |
parent | 47efa9213d92a4366e03bd6d056837cd5bbadb1e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/sql/drivers/sqlite/qsql_sqlite.cpp
Change-Id: Ia7cffd2c99ae3d5eea6b5740683c06e921336dcd
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp index 2d122125e0..3c5ba884f7 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp +++ b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp @@ -74,6 +74,7 @@ private slots: void inlineImage(); void clippedTableCell(); void floatingTablePageBreak(); + void imageAtRightAlignedTab(); private: QTextDocument *doc; @@ -283,6 +284,41 @@ void tst_QTextDocumentLayout::floatingTablePageBreak() QCOMPARE(doc->pageCount(), 2); } +void tst_QTextDocumentLayout::imageAtRightAlignedTab() +{ + doc->clear(); + + QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); + fmt.setMargin(0); + doc->rootFrame()->setFrameFormat(fmt); + + QTextCursor cursor(doc); + QTextBlockFormat blockFormat; + QList<QTextOption::Tab> tabs; + QTextOption::Tab tab; + tab.position = 300; + tab.type = QTextOption::RightTab; + tabs.append(tab); + blockFormat.setTabPositions(tabs); + + // First block: text, some of it right-aligned + cursor.insertBlock(blockFormat); + cursor.insertText("first line\t"); + cursor.insertText("right-aligned text"); + + // Second block: text, then right-aligned image + cursor.insertBlock(blockFormat); + cursor.insertText("second line\t"); + QImage img(48, 48, QImage::Format_RGB32); + const QString name = QString::fromLatin1("image"); + doc->addResource(QTextDocument::ImageResource, QUrl(name), img); + QTextImageFormat imgFormat; + imgFormat.setName(name); + cursor.insertImage(imgFormat); + + // Everything should fit into the 300 pixels + QCOMPARE(doc->idealWidth(), 300.0); +} QTEST_MAIN(tst_QTextDocumentLayout) #include "tst_qtextdocumentlayout.moc" |