sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 4 ++-- sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 24 ++++++++++++------------ sw/qa/extras/rtfexport/rtfexport5.cxx | 12 ++++++------ sw/qa/extras/rtfexport/rtfexport8.cxx | 12 ++++++------ sw/qa/extras/rtfimport/rtfimport.cxx | 6 +++--- sw/qa/extras/uiwriter/uiwriter3.cxx | 4 ++-- sw/qa/extras/ww8export/ww8export3.cxx | 2 +- 7 files changed, 32 insertions(+), 32 deletions(-)
New commits: commit 80219819e068dcf53059e2026be2a6f4151d6fc6 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Dec 19 10:14:29 2023 -0500 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Mar 13 22:38:36 2024 +0100 address nit: use xmlDocUniquePtr, not const auto& Miklos "nitted" me that I should NOT use const auto& in this context. Obviously anything I do is simply copy/paste, so lets make sure that this "bad example" is removed from all unit tests. Change-Id: I9b76aeafc5848637e8ebd523a7a550789bd991c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160993 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 49d974b01159..6169ca1140df 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -600,7 +600,7 @@ DECLARE_OOXMLEXPORT_TEST(TestWPGZOrder, "testWPGZOrder.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf148720) { loadAndReload("tdf148720.odt"); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); const OString sShapeXPaths[] = { @@ -1098,7 +1098,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx") DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx") { - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure first element is a tab assertXPath(pLayout, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]"_ostr, "type"_ostr, "PortionType::TabLeft"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index cb41f033730d..de10f434b07c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -131,7 +131,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_largeTab, "tdf153042_largeTab.docx") if (isExported()) return; - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure a large tabstop is used in the pseudo-numbering (numbering::NONE followed by tabstop) assertXPath(pLayout, "//SwFixPortion"_ostr, "width"_ostr, "1701"); } @@ -147,7 +147,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_noTab, "tdf153042_noTab.docx") if (isExported()) return; - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure a miniscule tab is used in the pseudo-numbering (numbering::NONE followed by tabstop) assertXPath(pLayout, "//SwFixPortion"_ostr, "width"_ostr, "10"); } @@ -205,7 +205,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105035_framePrB, "tdf105035_framePrB.docx") { // The paragraphs have different frame definitions, so they must be in separate frames, // and the frames must not overlap - even though their vertical positions are identical. - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); sal_Int32 n1stFlyBottom = getXPath(pLayout, "//page[1]//anchored/fly[1]/infos/bounds"_ostr, "bottom"_ostr).toInt32(); sal_Int32 n2ndFlyTop @@ -222,7 +222,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105035_framePrC, "tdf105035_framePrC.docx") { // The paragraphs have different frame definitions, so they must be in separate frames, // and the frames DO overlap this time. - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); sal_Int32 n1stFlyTop = getXPath(pLayout, "//page[1]//anchored/fly[1]/infos/bounds"_ostr, "top"_ostr).toInt32(); sal_Int32 n2ndFlyTop @@ -307,21 +307,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154703_framePrTextDirection, "tdf154703_framePrT DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak, "tdf153613_anchoredAfterPgBreak.docx") { - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // An anchored TO character image anchors before the page break. assertXPath(pLayout, "//page[1]//anchored"_ostr, 1); } DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak2, "tdf153613_anchoredAfterPgBreak2.docx") { - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // An anchored TO character image, followed by more characters moves to the following page assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak3, "tdf153613_anchoredAfterPgBreak3.docx") { - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // An anchored TO character image, with setting splitPgBreakAndParaMark moves to the following page assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } @@ -333,14 +333,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak6, "tdf153613_anchore CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(4, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(OUString("y"), getXPathContent(pLayout, "//page[2]/body/txt[1]"_ostr)); assertXPath(pLayout, "//page[1]//anchored"_ostr, 1); // DID YOU FIX ME? This should be page[2] } DECLARE_OOXMLEXPORT_TEST(testTdf153613_inlineAfterPgBreak, "tdf153613_inlineAfterPgBreak.docx") { - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // An inline AS character image moves to the following page when after the page break. assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } @@ -352,7 +352,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_inlineAfterPgBreak2, "tdf153613_inlineAft CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(4, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(OUString("x"), getXPathContent(pLayout, "//page[1]/body/txt[2]"_ostr)); assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } @@ -367,7 +367,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, "tdf153613_textboxA // both textboxes on the second (last) page CPPUNIT_ASSERT_EQUAL(2, getPages()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//page[2]/body/txt/anchored/fly"_ostr, 2); } @@ -576,7 +576,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf151912, "tdf151912.docx") DECLARE_OOXMLEXPORT_TEST(testTdf147724, "tdf147724.docx") { - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure we load field value from external XML correctly (it was "HERUNTERLADEN") assertXPathContent(pLayout, "/root/page[1]/body/txt[1]"_ostr, "Placeholder -> *ABC*"); diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index c78f8f8ced3d..37bcf66149af 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -87,7 +87,7 @@ DECLARE_RTFEXPORT_TEST(testTdf153613_anchoredAfterPgBreak, "tdf153613_anchoredAf CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//page[1]//anchored"_ostr, 1); } @@ -97,7 +97,7 @@ DECLARE_RTFEXPORT_TEST(testTdf153613_anchoredAfterPgBreak2, "tdf153613_anchoredA CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } @@ -108,7 +108,7 @@ DECLARE_RTFEXPORT_TEST(testTdf153613_anchoredAfterPgBreak4, "tdf153613_anchoredA CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//page[1]//anchored"_ostr, 1); } @@ -119,7 +119,7 @@ DECLARE_RTFEXPORT_TEST(testTdf153613_anchoredAfterPgBreak5, "tdf153613_anchoredA CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//page[1]//anchored"_ostr, 1); } @@ -129,7 +129,7 @@ DECLARE_RTFEXPORT_TEST(testTdf153613_inlineAfterPgBreak, "tdf153613_inlineAfterP CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(3, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } @@ -140,7 +140,7 @@ DECLARE_RTFEXPORT_TEST(testTdf153613_inlineAfterPgBreak2, "tdf153613_inlineAfter CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(4, getParagraphs()); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(OUString("x"), getXPathContent(pLayout, "//page[1]/body/txt[2]"_ostr)); assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); } diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index 61a0ac2a13e2..e05eb817d07f 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -82,7 +82,7 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf") CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); // There should be no empty paragraph at the start - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//anchored"_ostr, 1); assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page"); } @@ -94,7 +94,7 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_0B, "tdf158586_pageBreak0B.rtf") CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); // There should be no empty paragraph at the start - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//anchored"_ostr, 1); assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page"); } @@ -106,7 +106,7 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf") CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); // There should be no empty carriage return at the start of the second page - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // on import there is a section on page 2; on reimport there is no section // (probably not an important difference?) assertXPathContent(pLayout, "/root/page[2]/body//txt"_ostr, "Second page"); @@ -119,7 +119,7 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_1header, "tdf158586_pageBreak1_header.rtf") CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); // There should be no empty carriage return at the start of the second page - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // on import there is a section on page 2; on reimport there is no section // (probably not an important difference?) assertXPathContent(pLayout, "/root/page[2]/body//txt"_ostr, "Second page"); @@ -128,7 +128,7 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_1header, "tdf158586_pageBreak1_header.rtf") DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, "tdf158586_lostFrame.rtf") { // The anchor and align properties are sufficient to define a frame - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "//anchored"_ostr, 1); assertXPathContent(pLayout, "//page[1]/body//txt"_ostr, "1st page"); assertXPathContent(pLayout, "//page[2]/body//txt"_ostr, "2nd page"); @@ -141,7 +141,7 @@ DECLARE_RTFEXPORT_TEST(testTdf158983, "fdo55504-1-min.rtf") // the problem was that the page break was missing and the shapes were // all anchored to the same node - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); assertXPath(pLayout, "/root/page[1]/body/section/txt"_ostr, 1); assertXPath(pLayout, "/root/page[1]/body/section/txt/anchored/fly"_ostr, 1); // Word shows these shapes anchored in the fly, not body, but at least they are not lost diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index aa6365a40f0e..f1f1085e80b7 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -741,7 +741,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116265) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure that there is a tabstop in the pseudo-numbering (numbering::NONE followed by tabstop) assertXPath(pLayout, "//SwFixPortion"_ostr, 1); } @@ -1481,7 +1481,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf78506) CPPUNIT_ASSERT(rProp.Value.get<OUString>().isEmpty()); } - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure that there is a tabstop in the pseudo-numbering (numbering::NONE followed by tabstop) assertXPath(pLayout, "//SwFixPortion"_ostr, 1); } @@ -1608,7 +1608,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf153196) { createSwDoc("tdf153196.rtf"); - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(4, getPages()); diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 3ec216145801..56ce639a572d 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -543,7 +543,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147126) SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); - const auto pLayoutXML1 = parseLayoutDump(); + xmlDocUniquePtr pLayoutXML1 = parseLayoutDump(); for (auto nFly = 1; nFly < 8; ++nFly) { @@ -602,7 +602,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147126) } dumpLayout(mxComponent); - const auto pLayoutXML2 = parseLayoutDump(); + xmlDocUniquePtr pLayoutXML2 = parseLayoutDump(); for (auto nFly = 1; nFly < 8; ++nFly) { diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 66c5ae5c471c..3668e3938e16 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -860,7 +860,7 @@ DECLARE_WW8EXPORT_TEST(testPresetDash, "tdf127166_prstDash_Word97.doc") CPPUNIT_ASSERT_MESSAGE("LineDash differ", bIsEqual); } - const auto& pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure that there is no tabstop in the first paragraph (despite chapter numbering's setting) // This is a pre-emptive test to ensure something visibly correct is not broken. assertXPath(pLayout, "//body/txt[1]//SwFixPortion"_ostr, 0);