summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-09-28 13:09:29 (GMT)
committermae <qt-info@nokia.com>2009-09-28 13:25:19 (GMT)
commite131a4653ec13e9a680a4b41094e78f2cc929f4d (patch)
treeb13c0d91ec7289e42861f5ef4350e80fcb4198f1
parent6e5c9afdb16e44d55683794442e66681f60d373b (diff)
downloadQt-e131a4653ec13e9a680a4b41094e78f2cc929f4d.zip
Qt-e131a4653ec13e9a680a4b41094e78f2cc929f4d.tar.gz
Qt-e131a4653ec13e9a680a4b41094e78f2cc929f4d.tar.bz2
Fix tst_QTextDocument::cursorPositionChangedOnSetText
The test was introduced to make sure that the cursor position changed signal was not emitted excessively on setPlainText or on setHtml. The original fix however still included one superfluous emission for a temporary QTextCursor object. This was fixed by change 930ba91ec1e630, this change adjusts the auto test accordingly. Reviewed-by: Simon Hausmann
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index c0d7ed3..f393393 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -1787,21 +1787,17 @@ void tst_QTextDocument::cursorPositionChangedOnSetText()
{
CursorPosSignalSpy spy(doc);
- cursor = QTextCursor();
+ // doc has one QTextCursor stored in the
+ // cursor member variable, thus the signal
+ // gets emitted once.
doc->setPlainText("Foo\nBar\nBaz\nBlub\nBlah");
- // the signal should still be emitted once for the QTextCursor that
- // QTextDocument::setPlainText creates temporarily. But the signal
- // should not be emitted more often.
QCOMPARE(spy.calls, 1);
spy.calls = 0;
doc->setHtml("<p>Foo<p>Bar<p>Baz<p>Blah");
- // the signal should still be emitted once for the QTextCursor that
- // QTextDocument::setPlainText creates temporarily. But the signal
- // should not be emitted more often.
QCOMPARE(spy.calls, 1);
}