[Libreoffice-commits] core.git: sw/qa
jmzambon
jeanmarczambon at gmail.com
Fri Jul 14 06:45:59 UTC 2017
sw/qa/complex/writer/TextPortionEnumerationTest.java | 199 -------------------
sw/qa/python/text_portion_enumeration_test.py | 173 ++++++++++++++++
2 files changed, 172 insertions(+), 200 deletions(-)
New commits:
commit 1bb0b3815a1e0ba677d6aac577fbb4c7fffee3bf
Author: jmzambon <jeanmarczambon at gmail.com>
Date: Mon Jun 19 19:35:02 2017 +0200
tdf#97362: TextPortionEnumerationTest partially migrated to python (part 3)
Convert tests:
- test_marks1
- test_marks2
- test_marks3
- test_frame_mark1
- test_frame_mark2
- test_frame_mark3
- test_frame_mark4
- test_frames1
- test_frames2
- test_frames3
- test_frames4
- test_frames5
- test_ruby_hyperlink1
- test_ruby_hyperlink2
Change-Id: I3ee495cdd88cffefd3980184bac0a72bae6a749f
Reviewed-on: https://gerrit.libreoffice.org/38976
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java
index d3d0a2ab50ac..3cf8b6d1299b 100644
--- a/sw/qa/complex/writer/TextPortionEnumerationTest.java
+++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java
@@ -1258,205 +1258,6 @@ public class TextPortionEnumerationTest
util.DesktopTools.closeDoc(m_xDoc);
}
- @Test public void testMarks1() throws Exception
- {
- String name1 = mkName("bookmark");
- String name2 = mkName("toxmark");
- String name3 = mkName("refmark");
- String name4 = mkName("toxmark");
- TreeNode root = new TreeNode();
- root.appendChild( new BookmarkStartNode(name1) );
- root.appendChild( new DocumentIndexMarkNode(name2) );
- root.appendChild( new ReferenceMarkStartNode(name3) );
- root.appendChild( new TextNode("abc") );
- root.appendChild( new BookmarkEndNode(name1) );
- root.appendChild( new DocumentIndexMarkStartNode(name4) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new DocumentIndexMarkEndNode(name4) );
- root.appendChild( new ReferenceMarkEndNode(name3) );
- doTest(root);
- }
-
- @Test public void testMarks2() throws Exception
- {
- String name1 = mkName("bookmark");
- String name2 = mkName("refmark");
- String name3 = mkName("refmark");
- String name4 = mkName("toxmark");
- String name5 = mkName("refmark");
- TreeNode root = new TreeNode();
- root.appendChild( new BookmarkStartNode(name1) );
- root.appendChild( new ReferenceMarkNode(name2) );
- root.appendChild( new ReferenceMarkStartNode(name3) );
- root.appendChild( new TextNode("abc") );
- root.appendChild( new DocumentIndexMarkStartNode(name4) );
- root.appendChild( new ReferenceMarkStartNode(name5) );
- // BUG: #i102541# (this is actually not unoportenum's fault)
- root.appendChild( new ReferenceMarkEndNode(name3) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new DocumentIndexMarkEndNode(name4) );
- root.appendChild( new BookmarkEndNode(name1) );
- root.appendChild( new ReferenceMarkEndNode(name5) );
- doTest(root);
- }
-
- @Test public void testMarks3() throws Exception
- {
- String name1 = mkName("bookmark");
- String name2 = mkName("refmark");
- String name3 = mkName("refmark");
- String name4 = mkName("toxmark");
- String name5 = mkName("refmark");
- TreeNode root = new TreeNode();
- root.appendChild( new BookmarkStartNode(name1) );
- root.appendChild( new DocumentIndexMarkNode(name2) );
- root.appendChild( new DocumentIndexMarkStartNode(name3) );
- root.appendChild( new TextNode("abc") );
- root.appendChild( new ReferenceMarkStartNode(name4) );
- root.appendChild( new DocumentIndexMarkStartNode(name5) );
- root.appendChild( new DocumentIndexMarkEndNode(name3) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new ReferenceMarkEndNode(name4) );
- root.appendChild( new BookmarkEndNode(name1) );
- root.appendChild( new DocumentIndexMarkEndNode(name5) );
- doTest(root);
- }
-
- @Test public void testFrameMark1() throws Exception
- {
- String name1 = mkName("bookmark");
- String name2 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new TextNode("abc") );
- root.appendChild( new BookmarkNode(name1) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new FrameNode(name2, AS_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testFrameMark2() throws Exception
- {
- // BUG: #i98530#
- String name1 = mkName("bookmark");
- String name2 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new TextNode("abc") );
- root.appendChild( new BookmarkNode(name1) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new FrameNode(name2, AT_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testFrameMark3() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("bookmark");
- TreeNode root = new TreeNode();
- root.appendChild( new TextNode("abc") );
- root.appendChild( new FrameNode(name1, AS_CHARACTER) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new BookmarkNode(name2) );
- doTest(root);
- }
-
- @Test public void testFrameMark4() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("bookmark");
- TreeNode root = new TreeNode();
- root.appendChild( new TextNode("abc") );
- root.appendChild( new FrameNode(name1, AT_CHARACTER) );
- root.appendChild( new TextNode("de") );
- root.appendChild( new BookmarkNode(name2) );
- doTest(root);
- }
-
- @Test public void testFrames1() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("frame");
- String name3 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new FrameNode(name1, AT_CHARACTER) );
- root.appendChild( new FrameNode(name2, AT_CHARACTER) );
- root.appendChild( new FrameNode(name3, AT_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testFrames2() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("frame");
- String name3 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new FrameNode(name1, AS_CHARACTER) );
- root.appendChild( new FrameNode(name2, AS_CHARACTER) );
- root.appendChild( new FrameNode(name3, AS_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testFrames3() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("frame");
- String name3 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new FrameNode(name1, AT_CHARACTER) );
- root.appendChild( new FrameNode(name2, AS_CHARACTER) );
- root.appendChild( new FrameNode(name3, AT_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testFrames4() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("frame");
- String name3 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new FrameNode(name1, AT_CHARACTER) );
- root.appendChild( new FrameNode(name2, AT_CHARACTER) );
- root.appendChild( new FrameNode(name3, AS_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testFrames5() throws Exception
- {
- String name1 = mkName("frame");
- String name2 = mkName("frame");
- String name3 = mkName("frame");
- TreeNode root = new TreeNode();
- root.appendChild( new FrameNode(name1, AS_CHARACTER) );
- root.appendChild( new FrameNode(name2, AT_CHARACTER) );
- root.appendChild( new FrameNode(name3, AT_CHARACTER) );
- doTest(root);
- }
-
- @Test public void testRubyHyperlink1() throws Exception
- {
- String name1 = mkName("ruby");
- String name2 = mkName("url");
- TreeNode root = new TreeNode();
- TreeNode ruby = new RubyNode(name1);
- TreeNode href = new HyperlinkNode(name2);
- href.appendChild( new TextNode("abc") );
- ruby.appendChild(href);
- root.appendChild(ruby);
- doTest(root);
- }
-
- @Test public void testRubyHyperlink2() throws Exception
- {
- String name1 = mkName("url");
- String name2 = mkName("ruby");
- TreeNode root = new TreeNode();
- TreeNode href = new HyperlinkNode(name1);
- TreeNode ruby = new RubyNode(name2);
- ruby.appendChild( new TextNode("abc") );
- href.appendChild(ruby);
- root.appendChild(href);
- doTest(root);
- }
-
@Test public void testEnd1() throws Exception
{
String name1 = mkName("bookmark");
diff --git a/sw/qa/python/text_portion_enumeration_test.py b/sw/qa/python/text_portion_enumeration_test.py
index d55080e52455..7251efe6d27a 100644
--- a/sw/qa/python/text_portion_enumeration_test.py
+++ b/sw/qa/python/text_portion_enumeration_test.py
@@ -695,7 +695,7 @@ class EnumConverter():
continue
else:
node = self._stack.pop()
- assert (isinstance(node, RubyNode),
+ assert (isinstance(node, RubyNode),
"stack error: Ruby expected; is: {}".format(str(node)))
elif type_ == "InContentMetadata":
xMeta = xPortion.InContentMetadata
@@ -1165,6 +1165,177 @@ class TextPortionEnumerationTest(unittest.TestCase):
root.appendchild(TextNode("de"))
self.dotest(root)
+ def test_marks1(self):
+ name1 = self.mkname("bookmark")
+ name2 = self.mkname("toxmark")
+ name3 = self.mkname("refmark")
+ name4 = self.mkname("toxmark")
+ root = TreeNode()
+ root.appendchild(BookmarkStartNode(name1))
+ root.appendchild(DocumentIndexMarkNode(name2))
+ root.appendchild(ReferenceMarkStartNode(name3))
+ root.appendchild(TextNode("abc"))
+ root.appendchild(BookmarkEndNode(name1))
+ root.appendchild(DocumentIndexMarkStartNode(name4))
+ root.appendchild(TextNode("de"))
+ root.appendchild(DocumentIndexMarkEndNode(name4))
+ root.appendchild(ReferenceMarkEndNode(name3))
+ self.dotest(root)
+
+ def test_marks2(self):
+ name1 = self.mkname("bookmark")
+ name2 = self.mkname("refmark")
+ name3 = self.mkname("refmark")
+ name4 = self.mkname("toxmark")
+ name5 = self.mkname("refmark")
+ root = TreeNode()
+ root.appendchild(BookmarkStartNode(name1))
+ root.appendchild(ReferenceMarkNode(name2))
+ root.appendchild(ReferenceMarkStartNode(name3))
+ root.appendchild(TextNode("abc"))
+ root.appendchild(DocumentIndexMarkStartNode(name4))
+ root.appendchild(ReferenceMarkStartNode(name5))
+ # BUG: #i102541# (this is actually not unoportenum's fault)
+ root.appendchild(ReferenceMarkEndNode(name3))
+ root.appendchild(TextNode("de"))
+ root.appendchild(DocumentIndexMarkEndNode(name4))
+ root.appendchild(BookmarkEndNode(name1))
+ root.appendchild(ReferenceMarkEndNode(name5))
+ self.dotest(root)
+
+ def test_marks3(self):
+ name1 = self.mkname("bookmark")
+ name2 = self.mkname("refmark")
+ name3 = self.mkname("refmark")
+ name4 = self.mkname("toxmark")
+ name5 = self.mkname("refmark")
+ root = TreeNode()
+ root.appendchild(BookmarkStartNode(name1))
+ root.appendchild(DocumentIndexMarkNode(name2))
+ root.appendchild(DocumentIndexMarkStartNode(name3))
+ root.appendchild(TextNode("abc"))
+ root.appendchild(ReferenceMarkStartNode(name4))
+ root.appendchild(DocumentIndexMarkStartNode(name5))
+ root.appendchild(DocumentIndexMarkEndNode(name3))
+ root.appendchild(TextNode("de"))
+ root.appendchild(ReferenceMarkEndNode(name4))
+ root.appendchild(BookmarkEndNode(name1))
+ root.appendchild(DocumentIndexMarkEndNode(name5))
+ self.dotest(root)
+
+ def test_frame_mark1(self):
+ name1 = self.mkname("bookmark")
+ name2 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(TextNode("abc"))
+ root.appendchild(BookmarkNode(name1))
+ root.appendchild(TextNode("de"))
+ root.appendchild(FrameNode(name2, AS_CHARACTER))
+ self.dotest(root)
+
+ def test_frame_mark2(self):
+ # BUG: #i98530#
+ name1 = self.mkname("bookmark")
+ name2 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(TextNode("abc"))
+ root.appendchild(BookmarkNode(name1))
+ root.appendchild(TextNode("de"))
+ root.appendchild(FrameNode(name2, AT_CHARACTER))
+ self.dotest(root)
+
+ def test_frame_mark3(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("bookmark")
+ root = TreeNode()
+ root.appendchild(TextNode("abc"))
+ root.appendchild(FrameNode(name1, AS_CHARACTER))
+ root.appendchild(TextNode("de"))
+ root.appendchild(BookmarkNode(name2))
+ self.dotest(root)
+
+ def test_frame_mark4(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("bookmark")
+ root = TreeNode()
+ root.appendchild(TextNode("abc"))
+ root.appendchild(FrameNode(name1, AT_CHARACTER))
+ root.appendchild(TextNode("de"))
+ root.appendchild(BookmarkNode(name2))
+ self.dotest(root)
+
+ def test_frames1(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("frame")
+ name3 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(FrameNode(name1, AT_CHARACTER))
+ root.appendchild(FrameNode(name2, AT_CHARACTER))
+ root.appendchild(FrameNode(name3, AT_CHARACTER))
+ self.dotest(root)
+
+ def test_frames2(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("frame")
+ name3 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(FrameNode(name1, AS_CHARACTER))
+ root.appendchild(FrameNode(name2, AS_CHARACTER))
+ root.appendchild(FrameNode(name3, AS_CHARACTER))
+ self.dotest(root)
+
+ def test_frames3(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("frame")
+ name3 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(FrameNode(name1, AT_CHARACTER))
+ root.appendchild(FrameNode(name2, AS_CHARACTER))
+ root.appendchild(FrameNode(name3, AT_CHARACTER))
+ self.dotest(root)
+
+ def test_frames4(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("frame")
+ name3 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(FrameNode(name1, AT_CHARACTER))
+ root.appendchild(FrameNode(name2, AT_CHARACTER))
+ root.appendchild(FrameNode(name3, AS_CHARACTER))
+ self.dotest(root)
+
+ def test_frames5(self):
+ name1 = self.mkname("frame")
+ name2 = self.mkname("frame")
+ name3 = self.mkname("frame")
+ root = TreeNode()
+ root.appendchild(FrameNode(name1, AS_CHARACTER))
+ root.appendchild(FrameNode(name2, AT_CHARACTER))
+ root.appendchild(FrameNode(name3, AT_CHARACTER))
+ self.dotest(root)
+
+ def test_ruby_hyperlink1(self):
+ name1 = self.mkname("ruby")
+ name2 = self.mkname("url")
+ root = TreeNode()
+ ruby = RubyNode(name1)
+ href = HyperlinkNode(name2)
+ href.appendchild(TextNode("abc"))
+ ruby.appendchild(href)
+ root.appendchild(ruby)
+ self.dotest(root)
+
+ def test_ruby_hyperlink2(self):
+ name1 = self.mkname("url")
+ name2 = self.mkname("ruby")
+ root = TreeNode()
+ href = HyperlinkNode(name1)
+ ruby = RubyNode(name2)
+ ruby.appendchild(TextNode("abc"))
+ href.appendchild(ruby)
+ root.appendchild(href)
+ self.dotest(root)
+
def dotest(self, intree, insert=True):
xDoc = self.__class__.xDoc
self._dotest(xDoc, intree, insert)
More information about the Libreoffice-commits
mailing list