summaryrefslogtreecommitdiff
path: root/sw/qa/complex
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-07-17 14:03:28 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-07-17 14:11:05 +0100
commitf8f05d43de8728db58c8224c8aebf31ff570b6fc (patch)
tree350661fcc9ac7ede6c97baa56d39fcca7e1b0721 /sw/qa/complex
parentd1561a0813e15c6694b136db116004b212a463f6 (diff)
Resolves: fdo49629 GotoEndOfWord fails with footnote at word end
a) remove special handling of 0x0002 in our custom icu rules. Which brings us a step closer to getting rid of at least some of them in favour of the defaults b) expand the 0x02 in SwTxtNode::BuildConversionMap like we do for fields so Good side effect is our word count and character count now take into account the actual footnote indicator text, as does our cursor travelling. Both of which are more word-alike. Change-Id: I3b0024ac4b10934bee7a9e83b0fce08a18556c7b
Diffstat (limited to 'sw/qa/complex')
-rw-r--r--sw/qa/complex/writer/TextPortionEnumerationTest.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java
index 62c3624e4c8e..3170b930ff9c 100644
--- a/sw/qa/complex/writer/TextPortionEnumerationTest.java
+++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java
@@ -3187,26 +3187,31 @@ public class TextPortionEnumerationTest
xTextCursor.gotoStart(false);
XWordCursor xWordCursor = UnoRuntime.queryInterface(XWordCursor.class, xTextCursor);
- bSuccess = xWordCursor.gotoNextWord(true);
+ bSuccess = xWordCursor.gotoNextWord(true); //at start of "words"
assertTrue("gotoNextWord(): failed", bSuccess);
{
String string = xTextCursor.getString();
assertEquals("gotoNextWord(): wrong string",
"Two ", string);
}
- bSuccess = xWordCursor.gotoNextWord(false);
+ bSuccess = xWordCursor.gotoNextWord(false); //at end of "words", cannot leave metafield
assertFalse("gotoNextWord(): succeeded", bSuccess);
xTextCursor.collapseToEnd();
- bSuccess = xWordCursor.gotoPreviousWord(true);
+ bSuccess = xWordCursor.gotoPreviousWord(true); //at start of "words"
assertTrue("gotoPreviousWord(): failed", bSuccess);
{
String string = xTextCursor.getString();
assertEquals("gotoPreviousWord(): wrong string",
"words", string);
}
- bSuccess = xWordCursor.gotoPreviousWord(false);
+ bSuccess = xWordCursor.gotoPreviousWord(false); //at start of "Two"
+ assertTrue("gotoPreviousWord(): failed", bSuccess);
+
+
+ bSuccess = xWordCursor.gotoPreviousWord(false); //cannot leave metafield
assertFalse("gotoPreviousWord(): succeeded", bSuccess);
- bSuccess = xWordCursor.gotoEndOfWord(true);
+
+ bSuccess = xWordCursor.gotoEndOfWord(true); //at end of "Two"
assertTrue("gotoEndOfWord(): failed", bSuccess);
{
String string = xTextCursor.getString();
@@ -3288,6 +3293,23 @@ public class TextPortionEnumerationTest
assertFalse("gotoEndOfParagraph(): succeeded", bSuccess);
}
+ /** See https://bugs.freedesktop.org/show_bug.cgi?id=49629
+ ensure that gotoEndOfWord does not fail when footnote is at word end*/
+ @Test public void testXTextCursor() throws Exception
+ {
+ RangeInserter inserter = new RangeInserter(m_xDoc);
+ XText xDocText = m_xDoc.getText();
+ XTextCursor xDocTextCursor = xDocText.createTextCursor();
+ inserter.insertText(xDocTextCursor, "Text");
+ XWordCursor xWordCursor = UnoRuntime.queryInterface(XWordCursor.class, xDocTextCursor);
+ xWordCursor.gotoEndOfWord(false);
+ inserter.insertFootnote(xDocTextCursor, "footnote");
+ xDocTextCursor.gotoStart(false);
+ boolean bSuccess = xWordCursor.gotoEndOfWord(true);
+ assertTrue("gotoEndOfWord(): failed", bSuccess);
+ String string = xWordCursor.getString();
+ assertEquals("gotoEndOfWord(): wrong string", "Text", string);
+ }
abstract class AttachHelper
{