[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/plugins/textshape/tests
From: Ganesh Paramasivam <ganesh () crystalfab ! com>
Date: 2010-05-03 9:48:12
Message-ID: 20100503094812.6CC55AC8AA () svn ! kde ! org
[Download RAW message or body]
SVN commit 1122223 by ganeshp:
Adding test case to check the merging of an existing delete change within a delete
M +29 -0 TestChangeTrackedDelete.cpp
M +1 -0 TestChangeTrackedDelete.h
--- trunk/koffice/plugins/textshape/tests/TestChangeTrackedDelete.cpp \
#1122222:1122223 @@ -127,6 +127,35 @@
delete textTool;
}
+void TestChangeTrackedDelete::testInterMerge()
+{
+ TextTool *textTool = new TextTool(new MockCanvas);
+ QTextDocument *document = textTool->m_textEditor->document();
+ KoTextDocumentLayout *layout = \
qobject_cast<KoTextDocumentLayout*>(document->documentLayout()); + QTextCursor \
*cursor = textTool->m_textEditor->cursor(); + cursor->insertText("Hello World");
+ cursor->setPosition(4);
+ ChangeTrackedDeleteCommand *delCommand = new \
ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::NextChar, textTool); + \
textTool->m_textEditor->addCommand(delCommand); + \
QCOMPARE(document->characterAt(4).unicode(), \
(ushort)(QChar::ObjectReplacementCharacter)); +
+ cursor->setPosition(2);
+ cursor->setPosition(8, QTextCursor::KeepAnchor);
+ delCommand = new \
ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::NextChar, textTool); + \
textTool->m_textEditor->addCommand(delCommand); +
+ QCOMPARE(document->characterAt(2).unicode(), \
(ushort)(QChar::ObjectReplacementCharacter)); + // This is wierd. Without this \
loop present the succeeding call to inlineTextObject returs NULL. Why ?????? + for \
(int i=0; i<document->characterCount(); i++) { + cursor->setPosition(i);
+ }
+ cursor->setPosition(3);
+ KoDeleteChangeMarker *testMarker = \
dynamic_cast<KoDeleteChangeMarker*>(layout->inlineTextObjectManager()->inlineTextObject(*cursor));
+ QTextDocumentFragment deleteData = \
KoTextDocument(document).changeTracker()->elementById(testMarker->changeId())->getDeleteData();
+ QCOMPARE(deleteData.toPlainText(), QString("llo Wor"));
+ delete textTool;
+}
+
QTEST_MAIN(TestChangeTrackedDelete)
#include <TestChangeTrackedDelete.moc>
--- trunk/koffice/plugins/textshape/tests/TestChangeTrackedDelete.h #1122222:1122223
@@ -21,6 +21,7 @@
void testDeleteSelection();
void testPrefixMerge();
void testSuffixMerge();
+ void testInterMerge();
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic