diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-07-05 00:14:00 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-07-05 00:19:17 (GMT) |
commit | 0085cfa78a712a7afbbbeb90a3d1149328b4d2fd (patch) | |
tree | 66196b6e9b435ecdce0c7862217fa6795907d350 /tests/benchmarks/gui/text | |
parent | f3c12fedad6b9dd1917c329059b4c05175c03130 (diff) | |
download | Qt-0085cfa78a712a7afbbbeb90a3d1149328b4d2fd.zip Qt-0085cfa78a712a7afbbbeb90a3d1149328b4d2fd.tar.gz Qt-0085cfa78a712a7afbbbeb90a3d1149328b4d2fd.tar.bz2 |
Add styled text layout benchmark.
Diffstat (limited to 'tests/benchmarks/gui/text')
-rw-r--r-- | tests/benchmarks/gui/text/qtext/main.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp index eaa23e9..63daae0 100644 --- a/tests/benchmarks/gui/text/qtext/main.cpp +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -84,9 +84,11 @@ private slots: void newLineReplacement(); void formatManipulation(); + void fontResolution(); void layout_data(); void layout(); + void formattedLayout(); void paintLayoutToPixmap(); void paintLayoutToPixmap_painterFill(); @@ -306,6 +308,18 @@ void tst_QText::formatManipulation() } } +void tst_QText::fontResolution() +{ + QFont font; + QFont font2; + font.setFamily("DejaVu"); + font2.setBold(true); + + QBENCHMARK { + QFont res = font.resolve(font2); + } +} + void tst_QText::layout_data() { QTest::addColumn<bool>("wrap"); @@ -339,6 +353,33 @@ void tst_QText::layout() } }*/ +void tst_QText::formattedLayout() +{ + //set up formatting + QList<QTextLayout::FormatRange> ranges; + { + QTextCharFormat format; + format.setForeground(QColor("steelblue")); + + QTextLayout::FormatRange formatRange; + formatRange.format = format; + formatRange.start = 0; + formatRange.length = 50; + + ranges.append(formatRange); + } + + QTextLayout layout(m_shortLorem); + layout.setAdditionalFormats(ranges); + setupTextLayout(&layout); + + QBENCHMARK { + QTextLayout layout(m_shortLorem); + layout.setAdditionalFormats(ranges); + setupTextLayout(&layout); + } +} + void tst_QText::paintLayoutToPixmap() { QTextLayout layout(m_shortLorem); |