diff options
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 30 | ||||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 173 | ||||
-rw-r--r-- | sw/qa/extras/layout/layout2.cxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 14 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 14 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 5 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 5 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 17 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport6.cxx | 29 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 5 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter4.cxx | 5 |
11 files changed, 71 insertions, 236 deletions
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index ea391708d060..844037924bb1 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -541,18 +541,9 @@ void SdMiscTest::testTdf101242_ODF_no_settings() "config:config-item-set[@config:name='ooo:view-settings']/" "config:config-item-map-indexed[@config:name='Views']/" "config:config-item-map-entry"); - xmlXPathObjectPtr pXmlObj - = getXPathNode(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='VisibleLayers']"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlObj->nodesetval)); - xmlXPathFreeObject(pXmlObj); - pXmlObj = getXPathNode(pXmlDoc2, - sPathStart2 + "/config:config-item[@config:name='PrintableLayers']"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlObj->nodesetval)); - xmlXPathFreeObject(pXmlObj); - pXmlObj - = getXPathNode(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='LockedLayers']"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlObj->nodesetval)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='VisibleLayers']", 0); + assertXPath(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='PrintableLayers']", 0); + assertXPath(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='LockedLayers']", 0); } void SdMiscTest::testTdf101242_settings_keep() @@ -642,18 +633,9 @@ void SdMiscTest::testTdf101242_settings_remove() "config:config-item-set[@config:name='ooo:view-settings']/" "config:config-item-map-indexed[@config:name='Views']/" "config:config-item-map-entry"); - xmlXPathObjectPtr pXmlObj - = getXPathNode(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='VisibleLayers']"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlObj->nodesetval)); - xmlXPathFreeObject(pXmlObj); - pXmlObj = getXPathNode(pXmlDoc2, - sPathStart2 + "/config:config-item[@config:name='PrintableLayers']"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlObj->nodesetval)); - xmlXPathFreeObject(pXmlObj); - pXmlObj - = getXPathNode(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='LockedLayers']"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlObj->nodesetval)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='VisibleLayers']", 0); + assertXPath(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='PrintableLayers']", 0); + assertXPath(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='LockedLayers']", 0); } void SdMiscTest::testTdf119392() diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index b706858237d3..8e1fe15c32ea 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -139,10 +139,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "//merged", 0); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", "type", "PortionType::Footnote"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", @@ -374,12 +372,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", @@ -483,24 +477,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "portion", "foaz"); - { // hide: no anchored object shown - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // hide: no anchored object shown + assertXPath(pXmlDoc, "//anchored", 0); dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", @@ -618,12 +604,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", @@ -851,12 +833,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "type", "PortionType::Para"); @@ -967,24 +945,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "portion", "foaz"); - { // hide: no anchored object shown - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // hide: no anchored object shown + assertXPath(pXmlDoc, "//anchored", 0); dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type", @@ -1114,12 +1084,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "type", @@ -1394,12 +1360,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", @@ -1562,24 +1524,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) "/root/page[1]/ftncont/ftn[1]/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", "expand", "1"); - { // hide: no anchored object shown - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // hide: no anchored object shown + assertXPath(pXmlDoc, "//anchored", 0); dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", @@ -1757,12 +1711,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/" @@ -1988,10 +1938,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/metafile/push/push/push/layoutmode[2]"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL_MESSAGE("Bad position of shape in page break!", 0, - xmlXPathNodeSetGetLength(pXmlNodes)); + assertXPath(pXmlDoc, "/metafile/push/push/push/layoutmode[2]", 0); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486) @@ -2227,12 +2174,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/anchored[1]/fly[1]/txt[1]/" @@ -2391,24 +2334,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "portion", "foaz"); - { // hide: no anchored object shown - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // hide: no anchored object shown + assertXPath(pXmlDoc, "//anchored", 0); dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", @@ -2597,12 +2532,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", @@ -2828,12 +2759,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/anchored[1]/fly[1]/txt[1]/SwParaPortion/" @@ -2958,24 +2885,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwParaPortion[1]", "portion", "foaz"); - { // hide: no anchored object shown - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//anchored"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // hide: no anchored object shown + assertXPath(pXmlDoc, "//anchored", 0); dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); discardDumpedLayout(); pXmlDoc = parseLayoutDump(); - { // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); - } + // show: nothing is merged + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", "PortionType::Text"); @@ -3104,10 +3023,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]", "type", "PortionType::Text"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]", @@ -3227,10 +3143,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) pXmlDoc = parseLayoutDump(); // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", "PortionType::Text"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 5e2f134c8793..3f8045804e24 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -164,10 +164,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineCharAttributes) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // show: nothing is merged - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "//merged", 0); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", "type", "PortionType::Text"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/SwLinePortion[1]", @@ -2026,10 +2023,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf117028) // The only polypolygon in the rendering result was the white background we // want to avoid. - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polypolygon"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "//polypolygon", 0); // Make sure the text is still rendered. assertXPathContent(pXmlDoc, "//textarray/text", "Hello"); diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index ceae429fae01..8f6a170706d9 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1869,18 +1869,12 @@ DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt") xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // check first page - xmlXPathObjectPtr pXmlPage1Header = getXPathNode(pXmlDoc, "/root/page[1]/header"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Header->nodesetval)); - - xmlXPathObjectPtr pXmlPage1Footer = getXPathNode(pXmlDoc, "/root/page[1]/footer"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Footer->nodesetval)); + assertXPath(pXmlDoc, "/root/page[1]/header", 0); + assertXPath(pXmlDoc, "/root/page[1]/footer", 0); // check second page in the same way - xmlXPathObjectPtr pXmlPage2Header = getXPathNode(pXmlDoc, "/root/page[2]/header"); - CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Header->nodesetval)); - - xmlXPathObjectPtr pXmlPage2Footer = getXPathNode(pXmlDoc, "/root/page[2]/footer"); - CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Footer->nodesetval)); + assertXPath(pXmlDoc, "/root/page[2]/header"); + assertXPath(pXmlDoc, "/root/page[2]/footer"); } // All other pages should have header/footer diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 101fe99027a9..d69b53fa924c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -90,18 +90,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf118393) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // check first page - xmlXPathObjectPtr pXmlPage1Header = getXPathNode(pXmlDoc, "/root/page[1]/header"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Header->nodesetval)); - - xmlXPathObjectPtr pXmlPage1Footer = getXPathNode(pXmlDoc, "/root/page[1]/footer"); - CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlPage1Footer->nodesetval)); + assertXPath(pXmlDoc, "/root/page[1]/header", 0); + assertXPath(pXmlDoc, "/root/page[1]/footer", 0); // check second page in the same way - xmlXPathObjectPtr pXmlPage2Header = getXPathNode(pXmlDoc, "/root/page[2]/header"); - CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Header->nodesetval)); - - xmlXPathObjectPtr pXmlPage2Footer = getXPathNode(pXmlDoc, "/root/page[2]/footer"); - CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlPage2Footer->nodesetval)); + assertXPath(pXmlDoc, "/root/page[2]/header"); + assertXPath(pXmlDoc, "/root/page[2]/footer"); } // All other pages should have header/footer diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index c6c01c680ffc..17cfde266154 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -1011,9 +1011,8 @@ CPPUNIT_TEST_FIXTURE(Test, TestTdf143028) CPPUNIT_ASSERT_EQUAL(1, getPages()); auto pExportXml = parseExport("word/document.xml"); - CPPUNIT_ASSERT_EQUAL(1, getXPathNode( - pExportXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/" - "a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm")->nodesetval->nodeNr); + assertXPath(pExportXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/" + "a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm"); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index fbfe633fd55e..890f1104ee9b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -940,10 +940,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:sdt/w:sdtPr/w:text"); // Ensure that we have no <w:text/> (not quite correct case, but to ensure import/export are okay) - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/w:document/w:body/w:p[4]/w:sdt/w:sdtPr/w:text"); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), - static_cast<sal_Int32>(xmlXPathNodeSetGetLength(pXmlObj->nodesetval))); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:sdt/w:sdtPr/w:text", 0); } DECLARE_OOXMLEXPORT_TEST(testTdf139948, "tdf139948.docx") diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 6912948c57db..3ae9fa470000 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -565,21 +565,8 @@ DECLARE_RTFEXPORT_TEST(testTdf116358, "tdf116358.rtf") // Entire table should go to page 2, no remains on first page xmlDocUniquePtr pDump = parseLayoutDump(); - { - xmlXPathObjectPtr pXmlObj = getXPathNode(pDump, "/root/page[1]/body/tab"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - sal_Int32 tablesOnPage = xmlXPathNodeSetGetLength(pXmlNodes); - xmlXPathFreeObject(pXmlObj); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), tablesOnPage); - } - - { - xmlXPathObjectPtr pXmlObj = getXPathNode(pDump, "/root/page[2]/body/tab"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - sal_Int32 tablesOnPage = xmlXPathNodeSetGetLength(pXmlNodes); - xmlXPathFreeObject(pXmlObj); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), tablesOnPage); - } + assertXPath(pDump, "/root/page[1]/body/tab", 0); + assertXPath(pDump, "/root/page[2]/body/tab", 1); } CPPUNIT_TEST_FIXTURE(Test, testGutterLeft) diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx b/sw/qa/extras/rtfexport/rtfexport6.cxx index 0d36af44c6de..4078030804e7 100644 --- a/sw/qa/extras/rtfexport/rtfexport6.cxx +++ b/sw/qa/extras/rtfexport/rtfexport6.cxx @@ -553,32 +553,13 @@ DECLARE_RTFEXPORT_TEST(testTdf133437, "tdf133437.rtf") xmlDocUniquePtr pDump = parseLayoutDump(); // Count shapes on first page - { - xmlXPathObjectPtr pXmlObj - = getXPathNode(pDump, "/root/page[1]/body/txt[1]/anchored/SwAnchoredDrawObject"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - sal_Int32 shapesOnPage = xmlXPathNodeSetGetLength(pXmlNodes); - xmlXPathFreeObject(pXmlObj); - CPPUNIT_ASSERT_EQUAL(sal_Int32(79), shapesOnPage); - } + assertXPath(pDump, "/root/page[1]/body/txt[1]/anchored/SwAnchoredDrawObject", 79); + // Second page - { - xmlXPathObjectPtr pXmlObj - = getXPathNode(pDump, "/root/page[2]/body/txt[2]/anchored/SwAnchoredDrawObject"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - sal_Int32 shapesOnPage = xmlXPathNodeSetGetLength(pXmlNodes); - xmlXPathFreeObject(pXmlObj); - CPPUNIT_ASSERT_EQUAL(sal_Int32(118), shapesOnPage); - } + assertXPath(pDump, "/root/page[2]/body/txt[2]/anchored/SwAnchoredDrawObject", 118); + // Third page - { - xmlXPathObjectPtr pXmlObj - = getXPathNode(pDump, "/root/page[3]/body/txt[2]/anchored/SwAnchoredDrawObject"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; - sal_Int32 shapesOnPage = xmlXPathNodeSetGetLength(pXmlNodes); - xmlXPathFreeObject(pXmlObj); - CPPUNIT_ASSERT_EQUAL(sal_Int32(84), shapesOnPage); - } + assertXPath(pDump, "/root/page[3]/body/txt[2]/anchored/SwAnchoredDrawObject", 84); } CPPUNIT_TEST_FIXTURE(Test, testTdf128320) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 654f1f3d2281..a3c0cc1ad5a6 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1586,13 +1586,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testCp1000115) { createSwDoc("cp1000115.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/root/page[2]/body/tab/row/cell[2]/txt"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // This was 1: the long paragraph in the B1 cell did flow over to the // second page, so there was only one paragraph in the second cell of the // second page. - CPPUNIT_ASSERT_EQUAL(2, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "/root/page[2]/body/tab/row/cell[2]/txt", 2); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf63214) diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 099b60dfab05..8771d5d15fe2 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -1602,13 +1602,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104440) { createSwDoc("tdf104440.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//page[2]/body/txt/anchored"); - xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // This was 0: both Text Frames in the document were anchored to a // paragraph on page 1, while we expect that the second Text Frame is // anchored to a paragraph on page 2. - CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes)); - xmlXPathFreeObject(pXmlObj); + assertXPath(pXmlDoc, "//page[2]/body/txt/anchored"); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104425) |