diff options
Diffstat (limited to 'sw/qa/complex/writer/TextPortionEnumerationTest.java')
-rw-r--r-- | sw/qa/complex/writer/TextPortionEnumerationTest.java | 331 |
1 files changed, 0 insertions, 331 deletions
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java index 266134ffb7a3..0866ec897d51 100644 --- a/sw/qa/complex/writer/TextPortionEnumerationTest.java +++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java @@ -1258,337 +1258,6 @@ public class TextPortionEnumerationTest util.DesktopTools.closeDoc(m_xDoc); } - @Test public void testRangeHyperlinkMeta() throws Exception - { - RangeInserter inserter = new RangeInserter(m_xDoc); - TreeNode text = new TextNode("123456789"); - inserter.insertRange( new Range(0, 0, text) ); - TreeNode url1 = new HyperlinkNode( mkName("url") ); - inserter.insertRange( new Range(1, 4, url1) ); - // overlap left - TreeNode met2 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(0, 2, met2) ); - TreeNode root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( url1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( url1.dup().appendChild( new TextNode("34") ) ) - .appendChild( new TextNode("56789") ); - doTest(root, false); - // overlap right - TreeNode met3 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, met3) ); - root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( url1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( url1.dup().appendChild( new TextNode("3") ) ) - .appendChild( met3.dup() - .appendChild( url1.dup().appendChild( new TextNode("4") ) ) - .appendChild( new TextNode("5") ) ) - .appendChild( new TextNode("6789") ); - doTest(root, false); - // around - TreeNode met4 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(3/*-1*/, 4/*-1*/, met4) ); - root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( url1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( met4.dup() - .appendChild( url1.dup().appendChild( new TextNode("3") ) ) ) - .appendChild( met3.dup() - .appendChild( url1.dup().appendChild( new TextNode("4") ) ) - .appendChild( new TextNode("5") ) ) - .appendChild( new TextNode("6789") ); - doTest(root, false); - // inside - TreeNode url5 = new HyperlinkNode( mkName("url") ); - inserter.insertRange( new Range(9/*-3*/, 12/*-3*/, url5) ); - TreeNode met6 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(10/*-3*/, 11/*-3*/, met6) ); - root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( url1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( met4.dup() - .appendChild( url1.dup().appendChild( new TextNode("3") ) ) ) - .appendChild( met3.dup() - .appendChild( url1.dup().appendChild( new TextNode("4") ) ) - .appendChild( new TextNode("5") ) ) - .appendChild( new TextNode("6") ) - .appendChild( url5.dup().appendChild( new TextNode("7") ) ) - .appendChild( met6.dup() - .appendChild( url5.dup().appendChild( new TextNode("8") ) ) ) - .appendChild( url5.dup().appendChild( new TextNode("9") ) ); - doTest(root, false); - } - - @Test public void testRangeRubyMeta() throws Exception - { - RangeInserter inserter = new RangeInserter(m_xDoc); - TreeNode text = new TextNode("123456789"); - inserter.insertRange( new Range(0, 0, text) ); - TreeNode rby1 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(1, 4, rby1) ); - // overlap left - TreeNode met2 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(0, 2, met2) ); - TreeNode root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( rby1.dup().appendChild( new TextNode("34") ) ) - .appendChild( new TextNode("56789") ); - doTest(root, false); - // overlap right - TreeNode met3 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, met3) ); - root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) - .appendChild( met3.dup() - .appendChild( rby1.dup().appendChild( new TextNode("4") ) ) - .appendChild( new TextNode("5") ) ) - .appendChild( new TextNode("6789") ); - doTest(root, false); - // around - TreeNode met4 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(3/*-1*/, 4/*-1*/, met4) ); - root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( met4.dup() - .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) ) - .appendChild( met3.dup() - .appendChild( rby1.dup().appendChild( new TextNode("4") ) ) - .appendChild( new TextNode("5") ) ) - .appendChild( new TextNode("6789") ); - doTest(root, false); - // inside - TreeNode rby5 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(9/*-3*/, 12/*-3*/, rby5) ); - TreeNode met6 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(10/*-3*/, 11/*-3*/, met6) ); - root = new TreeNode() - .appendChild( met2.dup() - .appendChild( new TextNode("1") ) - .appendChild( rby1.dup().appendChild( new TextNode("2") ) ) ) - .appendChild( met4.dup() - .appendChild( rby1.dup().appendChild( new TextNode("3") ) ) ) - .appendChild( met3.dup() - .appendChild( rby1.dup().appendChild( new TextNode("4") ) ) - .appendChild( new TextNode("5") ) ) - .appendChild( new TextNode("6") ) - .appendChild( rby5.dup() - .appendChild( new TextNode("7") ) - .appendChild( met6.dup() - .appendChild( new TextNode("8") ) ) - .appendChild( new TextNode("9") ) ); - doTest(root, false); - } - - @Test public void testRangeMetaHyperlink() throws Exception - { - RangeInserter inserter = new RangeInserter(m_xDoc); - TreeNode text = new TextNode("123456789"); - inserter.insertRange( new Range(0, 0, text) ); - TreeNode met1 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(1, 6, met1) ); - // overlap left - TreeNode url2 = new HyperlinkNode( mkName("url") ); - inserter.insertRange( new Range(0, 4/*-1*/, url2) ); - TreeNode root = new TreeNode() - .appendChild( url2.dup().appendChild( new TextNode("1") ) ) - .appendChild( met1.dup() - .appendChild( url2.dup().appendChild( new TextNode("23") ) ) - .appendChild( new TextNode("456") ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - // overlap right - TreeNode url3 = new HyperlinkNode( mkName("url") ); - inserter.insertRange( new Range(6/*-1*/, 8/*-1*/, url3) ); - root = new TreeNode() - .appendChild( url2.dup().appendChild( new TextNode("1") ) ) - .appendChild( met1.dup() - .appendChild( url2.dup().appendChild( new TextNode("23") ) ) - .appendChild( new TextNode("45") ) - .appendChild( url3.dup().appendChild( new TextNode("6") ) ) ) - .appendChild( url3.dup().appendChild( new TextNode("7") ) ) - .appendChild( new TextNode("89") ); - doTest(root, false); - // around (not quite, due to API) - TreeNode url4 = new HyperlinkNode( mkName("url") ); - inserter.insertRange( new Range(1, 9/*-1*/, url4) ); - root = new TreeNode() - .appendChild( url2.dup().appendChild( new TextNode("1") ) ) - .appendChild( met1.dup() - .appendChild( url4.dup() - .appendChild( new TextNode("23456") ) ) ) - .appendChild( url4.dup().appendChild( new TextNode("78") ) ) - .appendChild( new TextNode("9") ); - doTest(root, false); - // inside - TreeNode url5 = new HyperlinkNode( mkName("url") ); - inserter.insertRange( new Range(4/*-1*/, 6/*-1*/, url5) ); - root = new TreeNode() - .appendChild( url2.dup().appendChild( new TextNode("1") ) ) - .appendChild( met1.dup() - .appendChild( url4.dup() - .appendChild( new TextNode("23") ) ) - .appendChild( url5.dup() - .appendChild( new TextNode("45") ) ) - .appendChild( url4.dup() - .appendChild( new TextNode("6") ) ) ) - .appendChild( url4.dup().appendChild( new TextNode("78") ) ) - .appendChild( new TextNode("9") ); - doTest(root, false); - } - - @Test public void testRangeMetaRuby() throws Exception - { - RangeInserter inserter = new RangeInserter(m_xDoc); - TreeNode text = new TextNode("123456789"); - inserter.insertRange( new Range(0, 0, text) ); - TreeNode met1 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(1, 5, met1) ); - // overlap left - TreeNode rby2 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(0, 3/*-1*/, rby2) ); - TreeNode root = new TreeNode() - .appendChild( rby2.dup().appendChild( new TextNode("1") ) ) - .appendChild( met1.dup() - .appendChild( rby2.dup().appendChild( new TextNode("2") ) ) - .appendChild( new TextNode("345") ) ) - .appendChild( new TextNode("6789") ); - doTest(root, false); - // overlap right - TreeNode rby3 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(5/*-1*/, 7/*-1*/, rby3) ); - root = new TreeNode() - .appendChild( rby2.dup().appendChild( new TextNode("1") ) ) - .appendChild( met1.dup() - .appendChild( rby2.dup().appendChild( new TextNode("2") ) ) - .appendChild( new TextNode("34") ) - .appendChild( rby3.dup().appendChild( new TextNode("5") ) ) ) - .appendChild( rby3.dup().appendChild( new TextNode("6") ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - // around - TreeNode rby4 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(1, 7/*-1*/, rby4) ); - root = new TreeNode() - .appendChild( rby2.dup().appendChild( new TextNode("1") ) ) - .appendChild( rby4.dup() - .appendChild( met1.dup() - .appendChild( new TextNode("2345") ) ) - .appendChild( new TextNode("6") ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - // inside - TreeNode met5 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(7/*-1*/, 9/*-1*/, met5) ); - TreeNode rby6 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(9/*-2*/, 10/*-2*/, rby6) ); - root = new TreeNode() - .appendChild( rby2.dup().appendChild( new TextNode("1") ) ) - .appendChild( rby4.dup() - .appendChild( met1.dup() - .appendChild( new TextNode("2345") ) ) - .appendChild( new TextNode("6") ) ) - .appendChild( met5.dup() - .appendChild( new TextNode("7") ) - .appendChild( rby6.dup() - .appendChild( new TextNode("8") ) ) ) - .appendChild( new TextNode("9") ); - doTest(root, false); - // inside, with invalid range that includes the dummy char - TreeNode rby7 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(7/*-1*/, 9/*-2*/, rby7) ); - root = new TreeNode() - .appendChild( rby2.dup().appendChild( new TextNode("1") ) ) - .appendChild( rby4.dup() - .appendChild( met1.dup() - .appendChild( new TextNode("2345") ) ) - .appendChild( new TextNode("6") ) ) - .appendChild( met5.dup() - .appendChild( rby7.dup() - .appendChild( new TextNode("7") ) ) - .appendChild( rby6.dup() - .appendChild( new TextNode("8") ) ) ) - .appendChild( new TextNode("9") ); - doTest(root, false); - // around, at same position as meta - TreeNode rby8 = new RubyNode( mkName("ruby") ); - inserter.insertRange( new Range(7/*-1*/, 10/*-2*/, rby8) ); - root = new TreeNode() - .appendChild( rby2.dup().appendChild( new TextNode("1") ) ) - .appendChild( rby4.dup() - .appendChild( met1.dup() - .appendChild( new TextNode("2345") ) ) - .appendChild( new TextNode("6") ) ) - .appendChild( rby8.dup() - .appendChild( met5.dup() - .appendChild( new TextNode("78") ) ) ) - .appendChild( new TextNode("9") ); - doTest(root, false); - } - - @Test public void testRangeMetaMeta() throws Exception - { - RangeInserter inserter = new RangeInserter(m_xDoc); - TreeNode text = new TextNode("123456789"); - inserter.insertRange( new Range(0, 0, text) ); - TreeNode met1 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(3, 6, met1) ); - // overlap left - TreeNode met2 = new MetaNode( mkId("id") ); - try { - inserter.insertRange( new Range(0, 4, met2) ); - fail("testRangeMetaMeta: overlap left allowed"); - } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ } - TreeNode root = new TreeNode() - .appendChild( new TextNode("123") ) - .appendChild( met1.dup().appendChild( new TextNode("456") ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - // overlap right - TreeNode met3 = new MetaNode( mkId("id") ); - try { - inserter.insertRange( new Range(5/*-1*/, 8/*-1*/, met3) ); - fail("testRangeMetaMeta: overlap right allowed"); - } catch (com.sun.star.lang.IllegalArgumentException e) { /* ignore */ } - root = new TreeNode() - .appendChild( new TextNode("123") ) - .appendChild( met1.dup().appendChild( new TextNode("456") ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - // around - TreeNode met4 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(3, 7/*-1*/, met4) ); - root = new TreeNode() - .appendChild( new TextNode("123") ) - .appendChild( met4.dup() - .appendChild( met1.dup().appendChild( new TextNode("456") ) ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - // inside - TreeNode met5 = new MetaNode( mkId("id") ); - inserter.insertRange( new Range(6/*-2*/, 8/*-2*/, met5) ); - root = new TreeNode() - .appendChild( new TextNode("123") ) - .appendChild( met4.dup() - .appendChild( met1.dup() - .appendChild( new TextNode("4") ) - .appendChild( met5.dup() - .appendChild( new TextNode("56") ) ) ) ) - .appendChild( new TextNode("789") ); - doTest(root, false); - } - @Test public void testRange2() throws Exception { RangeInserter inserter = new RangeInserter(m_xDoc); |