aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-07-05 10:18:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-09 09:05:32 +0200
commit4598939ee2fad1238609ca43717199fd4e98c75f (patch)
tree9ffdcf451ad585f14b1eda8050e48d3298dec7f2 /tests
parent19c0a31319148d4ac716f7cb3295891b5a3b20d9 (diff)
Speed up TextEdit construction time.
Defer setting content on the QTextDocument until componentComplete() to avoid unnecessary layouts and move one time setup for the text document from setContent to the constructor. Reduces the construction time of a TextEdit with RichText textFormat by about a third. Change-Id: Idde0772063bf769cde984efddd68589c55a7431a Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index 1e063cbaa0..c911715b44 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -2417,7 +2417,8 @@ void tst_qquicktextedit::canPaste() {
QVERIFY(textEdit != 0);
// check initial value - QTBUG-17765
- QQuickTextControl tc(0);
+ QTextDocument document;
+ QQuickTextControl tc(&document);
QCOMPARE(textEdit->canPaste(), tc.canPaste());
#endif
@@ -2435,7 +2436,8 @@ void tst_qquicktextedit::canPasteEmpty() {
QVERIFY(textEdit != 0);
// check initial value - QTBUG-17765
- QQuickTextControl tc(0);
+ QTextDocument document;
+ QQuickTextControl tc(&document);
QCOMPARE(textEdit->canPaste(), tc.canPaste());
#endif
@@ -3820,7 +3822,7 @@ void tst_qquicktextedit::remove()
textEdit->setTextFormat(textFormat);
textEdit->select(selectionStart, selectionEnd);
- QSignalSpy selectionSpy(textEdit, SIGNAL(seletedTextChanged()));
+ QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged()));
QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
QSignalSpy textSpy(textEdit, SIGNAL(textChanged()));