summaryrefslogtreecommitdiff
path: root/sw/qa/complex
diff options
context:
space:
mode:
authorjmzambon <jeanmarczambon@gmail.com>2017-07-18 18:08:46 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-09 11:54:49 +0200
commit033a619c979e45d012e1ebe286462eb379997b41 (patch)
tree0bd4ada89f8d27d36fc8bd6d6c9099379def4716 /sw/qa/complex
parent12b739aa2bf1f664acbbb4c4c815b3348c912977 (diff)
tdf#97362: TextPortionEnumerationTest partially migrated to python (part 5)
Convert tests: - test_range1 - test_range_hyperlink_hyperlink - test_range_hyperlink_ruby - test_range_ruby_hyperlink - test_range_ruby_ruby Change-Id: I6c26f3e0fe910ff56bf38482257340b1c3172461 Reviewed-on: https://gerrit.libreoffice.org/40775 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/qa/complex')
-rw-r--r--sw/qa/complex/writer/TextPortionEnumerationTest.java271
1 files changed, 0 insertions, 271 deletions
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java
index b13401e07d20..266134ffb7a3 100644
--- a/sw/qa/complex/writer/TextPortionEnumerationTest.java
+++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java
@@ -1258,277 +1258,6 @@ public class TextPortionEnumerationTest
util.DesktopTools.closeDoc(m_xDoc);
}
- /* some range tests for the insertion: these are for the current
- API which treats hyperlinks and rubys not as entities, but as formatting
- attributes; if these ever become entities, they should not be split!
- */
-
- @Test public void testRange1() throws Exception
- {
- String name1 = mkName("url");
- RangeInserter inserter = new RangeInserter(m_xDoc);
- TreeNode text = new TextNode("12345");
- inserter.insertRange(new Range(0, 0, text));
- TreeNode url1 = new HyperlinkNode(name1);
- Range range1 = new Range(0, 5, url1);
- inserter.insertRange(range1);
- TreeNode root = new TreeNode();
- root.appendChild( url1 );
- url1.appendChild( text );
- doTest(root, false);
- }
-
- @Test public void testRangeHyperlinkHyperlink() 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 url2 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(0, 2, url2) );
- TreeNode root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("12") ) )
- .appendChild( url1.dup().appendChild( new TextNode("34") ) )
- .appendChild( new TextNode("56789") );
- doTest(root, false);
- // overlap right
- TreeNode url3 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(3, 7, url3) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("12") ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( url3.dup().appendChild( new TextNode("4567") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- // around
- TreeNode url4 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(3, 7, url4) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("12") ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( url4.dup().appendChild( new TextNode("4567") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- // inside
- TreeNode url5 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(4, 6, url5) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("12") ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( url4.dup().appendChild( new TextNode("4") ) )
- .appendChild( url5.dup().appendChild( new TextNode("56") ) )
- .appendChild( url4.dup().appendChild( new TextNode("7") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- // empty
- TreeNode url6 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(7, 7, url6) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("12") ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( url4.dup().appendChild( new TextNode("4") ) )
- .appendChild( url5.dup().appendChild( new TextNode("56") ) )
- .appendChild( url4.dup().appendChild( new TextNode("7") ) )
-// this one gets eaten, but we still need to test inserting it (#i106930#)
-// .appendChild( url6.dup().appendChild( new TextNode("") ) )
- .appendChild( new TextNode("89") );
- // inside (left-edge)
- TreeNode url7 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(0, 1, url7) );
- root = new TreeNode()
- .appendChild( url7.dup().appendChild( new TextNode("1") ) )
- .appendChild( url2.dup().appendChild( new TextNode("2") ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( url4.dup().appendChild( new TextNode("4") ) )
- .appendChild( url5.dup().appendChild( new TextNode("56") ) )
- .appendChild( url4.dup().appendChild( new TextNode("7") ) )
- .appendChild( new TextNode("89") );
- // inside (right-edge)
- TreeNode url8 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(5, 6, url8) );
- root = new TreeNode()
- .appendChild( url7.dup().appendChild( new TextNode("1") ) )
- .appendChild( url2.dup().appendChild( new TextNode("2") ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( url4.dup().appendChild( new TextNode("4") ) )
- .appendChild( url5.dup().appendChild( new TextNode("5") ) )
- .appendChild( url8.dup().appendChild( new TextNode("6") ) )
- .appendChild( url4.dup().appendChild( new TextNode("7") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- }
-
- @Test public void testRangeHyperlinkRuby() 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 rby2 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(0, 2, rby2) );
- TreeNode root = new TreeNode()
- .appendChild( rby2.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 rby3 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(3, 5, rby3) );
- root = new TreeNode()
- .appendChild( rby2.dup()
- .appendChild( new TextNode("1") )
- .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
- .appendChild( url1.dup().appendChild( new TextNode("3") ) )
- .appendChild( rby3.dup()
- .appendChild( url1.dup().appendChild( new TextNode("4") ) )
- .appendChild( new TextNode("5") ) )
- .appendChild( new TextNode("6789") );
- doTest(root, false);
- // around
- TreeNode rby4 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(2, 3, rby4) );
- root = new TreeNode()
- .appendChild( rby2.dup()
- .appendChild( new TextNode("1") )
- .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
- .appendChild( rby4.dup()
- .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
- .appendChild( rby3.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(6, 9, url5) );
- TreeNode rby6 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(7, 8, rby6) );
- root = new TreeNode()
- .appendChild( rby2.dup()
- .appendChild( new TextNode("1") )
- .appendChild( url1.dup().appendChild( new TextNode("2") ) ) )
- .appendChild( rby4.dup()
- .appendChild( url1.dup().appendChild( new TextNode("3") ) ) )
- .appendChild( rby3.dup()
- .appendChild( url1.dup().appendChild( new TextNode("4") ) )
- .appendChild( new TextNode("5") ) )
- .appendChild( new TextNode("6") )
- .appendChild( url5.dup().appendChild( new TextNode("7") ) )
- .appendChild( rby6.dup()
- .appendChild( url5.dup().appendChild( new TextNode("8") ) ) )
- .appendChild( url5.dup().appendChild( new TextNode("9") ) );
- doTest(root, false);
- }
-
- @Test public void testRangeRubyHyperlink() 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, 6, rby1) );
- // overlap left
- TreeNode url2 = new HyperlinkNode( mkName("url") );
- inserter.insertRange( new Range(0, 3, url2) );
- TreeNode root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("1") ) )
- .appendChild( rby1.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(5, 7, url3) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("1") ) )
- .appendChild( rby1.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, 8, url4) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("1") ) )
- .appendChild( rby1.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(3, 5, url5) );
- root = new TreeNode()
- .appendChild( url2.dup().appendChild( new TextNode("1") ) )
- .appendChild( rby1.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 testRangeRubyRuby() 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 rby2 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(0, 2, rby2) );
- TreeNode root = new TreeNode()
- .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
- .appendChild( rby1.dup().appendChild( new TextNode("34") ) )
- .appendChild( new TextNode("56789") );
- doTest(root, false);
- // overlap right
- TreeNode rby3 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(3, 7, rby3) );
- root = new TreeNode()
- .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
- .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
- .appendChild( rby3.dup().appendChild( new TextNode("4567") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- // around
- TreeNode rby4 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(3, 7, rby4) );
- root = new TreeNode()
- .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
- .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
- .appendChild( rby4.dup().appendChild( new TextNode("4567") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- // inside
- TreeNode rby5 = new RubyNode( mkName("ruby") );
- inserter.insertRange( new Range(4, 6, rby5) );
- root = new TreeNode()
- .appendChild( rby2.dup().appendChild( new TextNode("12") ) )
- .appendChild( rby1.dup().appendChild( new TextNode("3") ) )
- .appendChild( rby4.dup().appendChild( new TextNode("4") ) )
- .appendChild( rby5.dup().appendChild( new TextNode("56") ) )
- .appendChild( rby4.dup().appendChild( new TextNode("7") ) )
- .appendChild( new TextNode("89") );
- doTest(root, false);
- }
-
@Test public void testRangeHyperlinkMeta() throws Exception
{
RangeInserter inserter = new RangeInserter(m_xDoc);