assertFalse("gotoStartOfWord(): succeeded", bSuccess);
// XSentenceCursor
xText.setString("This is a sentence. Another sentence.");
xTextCursor.gotoStart(false);
XSentenceCursor xSentenceCursor = (XSentenceCursor)
UnoRuntime.queryInterface(XSentenceCursor.class, xTextCursor);
bSuccess = xSentenceCursor.gotoNextSentence(true);
assertTrue("gotoNextSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assertEquals("gotoNextSentence(): wrong string",
"This is a sentence. ", string);
}
bSuccess = xSentenceCursor.gotoNextSentence(false);
assertFalse("gotoNextSentence(): succeeded", bSuccess);
// FIXME:
// the sentence cursor seems to work differently than the word cursor
xText.setString("This is a sentence. Another sentence. Sentence 3.");
xTextCursor.gotoEnd(false);
bSuccess = xSentenceCursor.gotoPreviousSentence(true);
assertTrue("gotoPreviousSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assertEquals("gotoPreviousSentence(): wrong string",
"Another sentence. Sentence 3.", string);
}
bSuccess = xSentenceCursor.gotoPreviousSentence(false);
assertFalse("gotoPreviousSentence(): succeeded", bSuccess);
bSuccess = xSentenceCursor.gotoEndOfSentence(true);
assertTrue("gotoEndOfSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assertEquals("gotoEndOfSentence(): wrong string",
"This is a sentence.", string);
}
xTextCursor.gotoEnd(false);
bSuccess = xSentenceCursor.gotoStartOfSentence(true);
assertTrue("gotoStartOfSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assertEquals("gotoStartOfSentence(): wrong string",
"Sentence 3.", string);
}
xText.setString("");
bSuccess = xSentenceCursor.gotoEndOfSentence(false);
assertFalse("gotoEndOfSentence(): succeeded", bSuccess);
bSuccess = xSentenceCursor.gotoStartOfSentence(false);
assertFalse("gotoStartOfSentence(): succeeded", bSuccess);
XParagraphCursor xParagraphCursor = (XParagraphCursor)
UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);