diff options
author | jmzambon <jeanmarczambon@gmail.com> | 2017-07-18 18:08:46 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-01 16:57:18 +0200 |
commit | 51dee24ce82e0fc4b864ac2905ce3587acf344f3 (patch) | |
tree | 4ac69b96fa00b9c08a5791b39759495b841e6f44 | |
parent | EPUB export: invoke the underlying ODT exporter (diff) | |
download | core-51dee24ce82e0fc4b864ac2905ce3587acf344f3.tar.gz core-51dee24ce82e0fc4b864ac2905ce3587acf344f3.zip |
tdf#97362: TextPortionEnumerationTest partially migrated to python (part 4)
Convert tests:
- test_end1
- test_end2
- test_end3
- test_end4
- test_end5
- test_empty1
- test_empty2
- test_empty3
- test1
Change-Id: Id21f94be9c5c36e72a25409ed8541908671fdb59
Reviewed-on: https://gerrit.libreoffice.org/40149
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/complex/writer/TextPortionEnumerationTest.java | 156 | ||||
-rw-r--r-- | sw/qa/python/text_portion_enumeration_test.py | 137 |
2 files changed, 137 insertions, 156 deletions
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java index 3cf8b6d1299b..b13401e07d20 100644 --- a/sw/qa/complex/writer/TextPortionEnumerationTest.java +++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java @@ -1258,162 +1258,6 @@ public class TextPortionEnumerationTest util.DesktopTools.closeDoc(m_xDoc); } - @Test public void testEnd1() throws Exception - { - String name1 = mkName("bookmark"); - String name2 = mkName("toxmark"); - String name3 = mkName("refmark"); - TreeNode root = new TreeNode(); - root.appendChild( new TextNode("abc") ); - root.appendChild( new BookmarkNode(name1) ); - root.appendChild( new DocumentIndexMarkNode(name2) ); - root.appendChild( new ReferenceMarkNode(name3) ); - doTest(root); - } - - @Test public void testEnd2() throws Exception - { - String name1 = mkName("bookmark"); - String name2 = mkName("frame"); - String name3 = mkName("refmark"); - String name4 = mkName("frame"); - String name5 = mkName("frame"); - TreeNode root = new TreeNode(); - root.appendChild( new TextNode("abc") ); - root.appendChild( new BookmarkNode(name1) ); - root.appendChild( new FrameNode(name2, AT_CHARACTER) ); - root.appendChild( new ReferenceMarkNode(name3) ); - root.appendChild( new FrameNode(name4, AT_CHARACTER) ); - root.appendChild( new FrameNode(name5, AT_CHARACTER) ); - doTest(root); - } - - @Test public void testEnd3() throws Exception - { - String name1 = mkName("ftn"); - String name2 = mkName("toxmark"); - TreeNode root = new TreeNode(); - root.appendChild( new TextNode("abc") ); - root.appendChild( new FootnoteNode(name1) ); - root.appendChild( new DocumentIndexMarkNode(name2) ); - doTest(root); - } - - @Test public void testEnd4() throws Exception - { - String name1 = mkName("bookmark"); - String name2 = mkName("frame"); - TreeNode root = new TreeNode(); - root.appendChild( new BookmarkStartNode(name1) ); - root.appendChild( new TextNode("abc") ); - root.appendChild( new FrameNode(name2, AS_CHARACTER) ); - root.appendChild( new BookmarkEndNode(name1) ); - doTest(root); - } - - @Test public void testEnd5() throws Exception - { - String name1 = mkName("refmark"); - String name2 = mkName("ruby"); - TreeNode root = new TreeNode(); - root.appendChild( new ReferenceMarkStartNode(name1) ); - root.appendChild( new TextNode("abc") ); - TreeNode ruby = new RubyNode(name2); - ruby.appendChild( new TextFieldNode("de") ); - root.appendChild(ruby); - root.appendChild( new ReferenceMarkEndNode(name1) ); - doTest(root); - } - - @Test public void testEmpty1() throws Exception - { - String name1 = mkName("refmark"); - String name2 = mkName("toxmark"); - String name3 = mkName("bookmark"); - String name4 = mkName("frame"); - String name7 = mkName("refmark"); - String name8 = mkName("toxmark"); - String name9 = mkName("bookmark"); - String nameA = mkName("frame"); - TreeNode root = new TreeNode(); - root.appendChild( new ReferenceMarkNode(name1) ); - root.appendChild( new DocumentIndexMarkNode(name2) ); - root.appendChild( new BookmarkNode(name3) ); - root.appendChild( new FrameNode(name4, AT_CHARACTER) ); - root.appendChild( new ReferenceMarkNode(name7) ); - root.appendChild( new DocumentIndexMarkNode(name8) ); - root.appendChild( new BookmarkNode(name9) ); - root.appendChild( new FrameNode(nameA, AT_CHARACTER) ); - doTest(root); - } - - @Test public void testEmpty2() throws Exception - { - String name3 = mkName("bookmark"); - String name4 = mkName("frame"); - String name9 = mkName("bookmark"); - String nameA = mkName("frame"); - TreeNode root = new TreeNode(); - root.appendChild( new BookmarkNode(name3) ); - root.appendChild( new FrameNode(name4, AT_CHARACTER) ); - root.appendChild( new BookmarkNode(name9) ); - root.appendChild( new FrameNode(nameA, AT_CHARACTER) ); - doTest(root); - } - - @Test public void testEmpty3() throws Exception - { - String name1 = mkName("refmark"); - String name2 = mkName("toxmark"); - String name3 = mkName("bookmark"); - String name4 = mkName("frame"); - String name5 = mkName("url"); - String name6 = mkName("ruby"); - String name7 = mkName("refmark"); - String name8 = mkName("toxmark"); - String name9 = mkName("bookmark"); - String nameA = mkName("frame"); - TreeNode root = new TreeNode(); - root.appendChild( new ReferenceMarkNode(name1) ); - root.appendChild( new DocumentIndexMarkNode(name2) ); - root.appendChild( new BookmarkNode(name3) ); - root.appendChild( new FrameNode(name4, AT_CHARACTER) ); - /* currently empty hyperlinks may get eaten... - TreeNode href = new HyperlinkNode(name5); - href.appendChild( new TextNode("") ); - root.appendChild(href); - */ - TreeNode ruby = new RubyNode(name6); - root.appendChild(ruby); - root.appendChild( new ReferenceMarkNode(name7) ); - root.appendChild( new DocumentIndexMarkNode(name8) ); - root.appendChild( new BookmarkNode(name9) ); - root.appendChild( new FrameNode(nameA, AT_CHARACTER) ); - doTest(root); - } - - @Test public void test1() throws Exception - { - String name1 = mkName("frame"); - String name2 = mkName("bookmark"); - String name3 = mkName("ruby"); - String name4 = mkName("ftn"); - String name5 = mkName("frame"); - TreeNode root = new TreeNode(); - root.appendChild( new FrameNode(name1, AT_CHARACTER) ); - root.appendChild( new BookmarkStartNode(name2) ); - root.appendChild( new TextNode("abc") ); - TreeNode ruby = new RubyNode(name3); - ruby.appendChild( new TextNode("de") ); - ruby.appendChild( new FootnoteNode(name4) ); - ruby.appendChild( new BookmarkEndNode(name2) ); - root.appendChild(ruby); - root.appendChild( new TextNode("fg") ); - root.appendChild( new FrameNode(name5, AT_CHARACTER) ); - root.appendChild( new TextFieldNode("h") ); - doTest(root); - } - /* 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! diff --git a/sw/qa/python/text_portion_enumeration_test.py b/sw/qa/python/text_portion_enumeration_test.py index 7251efe6d27a..407b96218bd9 100644 --- a/sw/qa/python/text_portion_enumeration_test.py +++ b/sw/qa/python/text_portion_enumeration_test.py @@ -1336,6 +1336,143 @@ class TextPortionEnumerationTest(unittest.TestCase): root.appendchild(href) self.dotest(root) + def test_end1(self): + name1 = self.mkname("bookmark") + name2 = self.mkname("toxmark") + name3 = self.mkname("refmark") + root = TreeNode() + root.appendchild(TextNode("abc")) + root.appendchild(BookmarkNode(name1)) + root.appendchild(DocumentIndexMarkNode(name2)) + root.appendchild(ReferenceMarkNode(name3)) + self.dotest(root) + + def test_end2(self): + name1 = self.mkname("bookmark") + name2 = self.mkname("frame") + name3 = self.mkname("refmark") + name4 = self.mkname("frame") + name5 = self.mkname("frame") + root = TreeNode() + root.appendchild(TextNode("abc")) + root.appendchild(BookmarkNode(name1)) + root.appendchild(FrameNode(name2, AT_CHARACTER)) + root.appendchild(ReferenceMarkNode(name3)) + root.appendchild(FrameNode(name4, AT_CHARACTER)) + root.appendchild(FrameNode(name5, AT_CHARACTER)) + self.dotest(root) + + def test_end3(self): + name1 = self.mkname("ftn") + name2 = self.mkname("toxmark") + root = TreeNode() + root.appendchild(TextNode("abc")) + root.appendchild(FootnoteNode(name1)) + root.appendchild(DocumentIndexMarkNode(name2)) + self.dotest(root) + + def test_end4(self): + name1 = self.mkname("bookmark") + name2 = self.mkname("frame") + root = TreeNode() + root.appendchild(BookmarkStartNode(name1)) + root.appendchild(TextNode("abc")) + root.appendchild(FrameNode(name2, AS_CHARACTER)) + root.appendchild(BookmarkEndNode(name1)) + self.dotest(root) + + def test_end5(self): + name1 = self.mkname("refmark") + name2 = self.mkname("ruby") + root = TreeNode() + root.appendchild(ReferenceMarkStartNode(name1)) + root.appendchild(TextNode("abc")) + ruby = RubyNode(name2) + ruby.appendchild(TextFieldNode("de")) + root.appendchild(ruby) + root.appendchild(ReferenceMarkEndNode(name1)) + self.dotest(root) + + def test_empty1(self): + name1 = self.mkname("refmark") + name2 = self.mkname("toxmark") + name3 = self.mkname("bookmark") + name4 = self.mkname("frame") + name7 = self.mkname("refmark") + name8 = self.mkname("toxmark") + name9 = self.mkname("bookmark") + nameA = self.mkname("frame") + root = TreeNode() + root.appendchild(ReferenceMarkNode(name1)) + root.appendchild(DocumentIndexMarkNode(name2)) + root.appendchild(BookmarkNode(name3)) + root.appendchild(FrameNode(name4, AT_CHARACTER)) + root.appendchild(ReferenceMarkNode(name7)) + root.appendchild(DocumentIndexMarkNode(name8)) + root.appendchild(BookmarkNode(name9)) + root.appendchild(FrameNode(nameA, AT_CHARACTER)) + self.dotest(root) + + def test_empty2(self): + name3 = self.mkname("bookmark") + name4 = self.mkname("frame") + name9 = self.mkname("bookmark") + nameA = self.mkname("frame") + root = TreeNode() + root.appendchild(BookmarkNode(name3)) + root.appendchild(FrameNode(name4, AT_CHARACTER)) + root.appendchild(BookmarkNode(name9)) + root.appendchild(FrameNode(nameA, AT_CHARACTER)) + self.dotest(root) + + def test_empty3(self): + name1 = self.mkname("refmark") + name2 = self.mkname("toxmark") + name3 = self.mkname("bookmark") + name4 = self.mkname("frame") + name5 = self.mkname("url") + name6 = self.mkname("ruby") + name7 = self.mkname("refmark") + name8 = self.mkname("toxmark") + name9 = self.mkname("bookmark") + nameA = self.mkname("frame") + root = TreeNode() + root.appendchild(ReferenceMarkNode(name1)) + root.appendchild(DocumentIndexMarkNode(name2)) + root.appendchild(BookmarkNode(name3)) + root.appendchild(FrameNode(name4, AT_CHARACTER)) + ## currently empty hyperlinks may get eaten... + # href = HyperlinkNode(name5) + # href.appendchild(TextNode("")) + # root.appendchild(href) + ruby = RubyNode(name6) + root.appendchild(ruby) + root.appendchild(ReferenceMarkNode(name7)) + root.appendchild(DocumentIndexMarkNode(name8)) + root.appendchild(BookmarkNode(name9)) + root.appendchild(FrameNode(nameA, AT_CHARACTER)) + self.dotest(root) + + def test1(self): + name1 = self.mkname("frame") + name2 = self.mkname("bookmark") + name3 = self.mkname("ruby") + name4 = self.mkname("ftn") + name5 = self.mkname("frame") + root = TreeNode() + root.appendchild(FrameNode(name1, AT_CHARACTER)) + root.appendchild(BookmarkStartNode(name2)) + root.appendchild(TextNode("abc")) + ruby = RubyNode(name3) + ruby.appendchild(TextNode("de")) + ruby.appendchild(FootnoteNode(name4)) + ruby.appendchild(BookmarkEndNode(name2)) + root.appendchild(ruby) + root.appendchild(TextNode("fg")) + root.appendchild(FrameNode(name5, AT_CHARACTER)) + root.appendchild(TextFieldNode("h")) + self.dotest(root) + def dotest(self, intree, insert=True): xDoc = self.__class__.xDoc self._dotest(xDoc, intree, insert) |