diff options
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 536d366b63..b8684610a8 100644 --- a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -35,6 +35,7 @@ private slots: void translate(); void createTextItem(); void createTextItemZeroWidth(); + void createTextItemNoLayouting(); }; tst_QGraphicsItem::tst_QGraphicsItem() @@ -235,5 +236,22 @@ void tst_QGraphicsItem::createTextItemZeroWidth() } } +void tst_QGraphicsItem::createTextItemNoLayouting() +{ + // Ensure QFontDatabase loaded the font beforehand + QFontInfo(qApp->font()).family(); + const QString text = "This is some text"; + QBENCHMARK { + QGraphicsTextItem item; + item.document()->setLayoutEnabled(false); + // Prepare everything + item.setPlainText(text); + QTextOption option = item.document()->defaultTextOption(); + option.setAlignment(Qt::AlignHCenter); + item.document()->setDefaultTextOption(option); + // And (in a real app) enable layouting here + } +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" |