sw/qa/extras/layout/layout.cxx |  250 ++++++++++++++++++++++++++---------------
 1 file changed, 159 insertions(+), 91 deletions(-)

New commits:
commit 87c963199c438b88cb21f52d25a08e4d0f1535ff
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jun 2 20:12:12 2022 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Jun 3 08:03:26 2022 +0200

    CppunitTest_sw_layoutwriter: use more SwParaPortion::dumpAsXml()
    
    See commit feeed3e762cf077fbd9cf48f82e949365108ccc1
    (CppunitTest_sw_layoutwriter: avoid some a11y-based layout testing,
    2022-04-07) for motivation.
    
    Change-Id: I647a84109c0eb79883e1c22e59a5098aa294f02f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135325
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2a6b2ca099c9..c961d990eb91 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1923,15 +1923,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTableOverlapFooterFly)
     load(DATA_DIRECTORY, "footer-fly-table.fodt");
     xmlDocUniquePtr pLayout = parseLayoutDump();
     // no fly portions, was: 8
-    assertXPath(
-        pLayout,
-        
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/Special[@nType='PortionType::Fly']",
 0);
+    assertXPath(pLayout,
+                
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/"
+                
"SwFixPortion[@type='PortionType::Fly'][@type='PortionType::Fly']",
+                0);
     // one line break, was: 5
-    assertXPath(pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/LineBreak", 1);
+    assertXPath(pLayout,
+                
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout", 
1);
     // one text portion, was: 1
-    assertXPath(pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/Text", 1);
-    assertXPath(pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/Text", "Portion",
-                "Abc def ghi jkl mno pqr stu vwx yz.");
+    assertXPath(
+        pLayout,
+        
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
+        1);
+    assertXPath(
+        pLayout,
+        
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion",
+        "portion", "Abc def ghi jkl mno pqr stu vwx yz.");
     // height was: 1517
     // tdf#134782 height was: 379
     assertXPath(pLayout, 
"/root/page[2]/body/tab[1]/row[5]/cell[5]/txt[1]/infos/bounds", "height",
@@ -1971,7 +1978,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf142080)
 
     xmlDocUniquePtr pLayout = parseLayoutDump();
     // check the first paragraph on page 9 with its fly; the column was empty 
too
-    assertXPath(pLayout, 
"/root/page[9]/body/section[1]/column[1]/body/txt[1]/Text[1]", "Portion",
+    assertXPath(pLayout,
+                
"/root/page[9]/body/section[1]/column[1]/body/txt[1]/SwParaPortion/SwLineLayout[2]/"
+                "SwLinePortion",
+                "portion",
                 "De kleur u (rood) in het rechtervlak (R), de kleur r (wit) 
beneden (D),");
     SwTwips nPage9Top = getXPath(pLayout, "/root/page[9]/infos/bounds", 
"top").toInt32();
     assertXPath(
@@ -2156,22 +2166,33 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
             pXmlDoc,
             
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/merged",
             "paraPropsNodeIndex", "11");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
-            "nType", "PortionType::Para");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
-            "Portion", "jqr");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
+                    "SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "type", "PortionType::Para");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
+                    "SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "portion", "jqr");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwFixPortion[1]",
+                    "type",
                     "PortionType::Fly"); // remove???
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
-                    "PortionType::Lay");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
-                    "abhi");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::Para");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwLineLayout[1]",
+                    "type", "PortionType::Lay");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwLineLayout[1]",
+                    "portion", "abhi");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
+                    "PortionType::Para");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "portion", "foaz");
 
         dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
         CPPUNIT_ASSERT(!pLayout->IsHideRedlines());
@@ -2185,78 +2206,121 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
             xmlXPathFreeObject(pXmlObj);
         }
 
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
-            "nType", "PortionType::Text");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[1]",
-            "Portion", "j");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
-            "nType", "PortionType::Text");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/Text[2]",
-            "Portion", "kl");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
-            "nType", "PortionType::Para");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/Text[1]",
-            "Portion", "mno");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
-            "nType", "PortionType::Text");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[1]",
-            "Portion", "p");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
-            "nType", "PortionType::Text");
-        assertXPath(
-            pXmlDoc,
-            
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/Text[2]",
-            "Portion", "qr");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Special[1]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[1]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[1]",
+                    "portion", "j");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[2]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[2]",
+                    "portion", "kl");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/"
+                    "SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "type", "PortionType::Para");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[2]/"
+                    "SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "portion", "mno");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[1]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[1]",
+                    "portion", "p");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[2]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[3]/"
+                    "SwParaPortion/SwLineLayout/SwLinePortion[2]",
+                    "portion", "qr");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwFixPortion[1]",
+                    "type",
                     "PortionType::Fly"); // remove???
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[1]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[1]",
+                    "portion", "ab");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[2]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[2]",
+                    "portion", "c");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
+                    "SwParaPortion[1]",
+                    "type", "PortionType::Para");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/SwParaPortion/SwLineLayout/"
+                    "SwParaPortion[1]",
+                    "portion", "def");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[1]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[1]",
+                    "portion", "g");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[2]",
+                    "type", "PortionType::Text");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/SwParaPortion/SwLineLayout/"
+                    "SwLinePortion[2]",
+                    "portion", "hi");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
                     "PortionType::Text");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[1]", "Portion",
-                    "ab");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[2]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
+                    "portion", "fo");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
                     "PortionType::Text");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/Text[2]", "Portion",
-                    "c");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/Text[1]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
+                    "portion", "o");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
                     "PortionType::Para");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[2]/Text[1]", "Portion",
-                    "def");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[1]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[2]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "portion", "bar");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type",
                     "PortionType::Text");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[1]", "Portion",
-                    "g");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[2]", "nType",
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[1]",
+                    "portion", "b");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]", "type",
                     "PortionType::Text");
-        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[1]/anchored/fly[1]/txt[3]/Text[2]", "Portion",
-                    "hi");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::Text");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"fo");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[2]", "nType", 
"PortionType::Text");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[2]", "Portion", 
"o");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "nType", 
"PortionType::Para");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "Portion", 
"bar");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"PortionType::Text");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "Portion", 
"b");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "nType", 
"PortionType::Text");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[2]", "Portion", 
"az");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[3]/SwParaPortion/SwLineLayout/SwLinePortion[2]",
+                    "portion", "az");
     }
 
     // anchor to 2nd (deleted) paragraph
@@ -2292,8 +2356,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFlys)
         discardDumpedLayout();
         xmlDocUniquePtr pXmlDoc = parseLayoutDump();
         assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", 
"paraPropsNodeIndex", "19");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::Para");
-        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", 
"foaz");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type",
+                    "PortionType::Para");
+        assertXPath(pXmlDoc,
+                    
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]",
+                    "portion", "foaz");
 
         { // hide: no anchored object shown
             xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored");

Reply via email to