sw/qa/core/crsr/crsr.cxx | 2 - sw/qa/core/doc/doc.cxx | 2 - sw/qa/core/text/text.cxx | 8 ++-- sw/qa/core/unocore/unocore.cxx | 4 +- sw/qa/extras/htmlexport/htmlexport.cxx | 46 ++++++++++++------------- sw/qa/extras/layout/layout.cxx | 31 ++++++---------- sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 10 ++--- sw/qa/extras/rtfexport/rtfexport5.cxx | 2 - sw/qa/extras/tiledrendering/tiledrendering.cxx | 2 - sw/qa/extras/uiwriter/uiwriter7.cxx | 9 +--- sw/qa/extras/unowriter/unowriter.cxx | 34 +++++++++--------- sw/qa/extras/ww8export/ww8export3.cxx | 4 +- sw/qa/inc/swmodeltestbase.hxx | 2 - sw/qa/unit/swmodeltestbase.cxx | 11 ++--- 14 files changed, 76 insertions(+), 91 deletions(-)
New commits: commit e9f78eda01172c7f100d6e7695aaafe2b961d565 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Nov 10 11:56:41 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Nov 11 09:56:45 2022 +0100 SwModelTestBase: remove duplicated method Change-Id: I343fe2711e232ffbdec13f0072ee31a7549f7da8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142546 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx index eec0f9a42c31..fe341f6c276f 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -39,7 +39,7 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Given: a document with two "foo" in it, the second followed by a formatted soft hyphen. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 67523084d9f7..7c5bdd8f3eb9 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -207,7 +207,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping) CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle) { // Given a document with an image with a hyperlink: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index d51f6c18f71c..e8ab18ff9682 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -72,7 +72,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText) { // Create an in-memory empty document. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Set text to half-transparent and type a character. uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); @@ -324,7 +324,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeft) { // Given a document with two anchored objects (left height is 5cm, right height is 7.5cm) and a // clearing break (type=left): - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); @@ -375,7 +375,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeft) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeftRTL) { // Given a document with an anchored object in an RTL para and a clearing break (type=left): - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); @@ -416,7 +416,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakLeftRTL) CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testClearingLineBreakVertical) { // Given a document with an anchored object in a vertical page and a clearing break (type=all): - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index 2484dd05efb0..0706005a047e 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -286,7 +286,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testLineBreakTextPortionEnum) CPPUNIT_TEST_FIXTURE(SwModelTestBase, testUserFieldTooltip) { // Given a document with a user field: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XDependentTextField> xField( xFactory->createInstance("com.sun.star.text.TextField.User"), uno::UNO_QUERY); @@ -359,7 +359,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testContentControlInsert) CPPUNIT_TEST_FIXTURE(SwModelTestBase, testImageTooltip) { // Given a document with an image and a hyperlink on it: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xDocument->getText(); diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 3ccf3e487252..29d52500fa86 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -802,7 +802,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable2, "reqif-table2.odt") CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfTableHeight) { // Given a document with a table in it, with an explicit row height: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Sequence<beans::PropertyValue> aTableProperties = { comphelper::makePropertyValue("Rows", static_cast<sal_Int32>(1)), comphelper::makePropertyValue("Columns", static_cast<sal_Int32>(1)), @@ -1049,7 +1049,7 @@ DECLARE_HTMLEXPORT_TEST(testTdf126879, "tdf126879.odt") CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteReqIf) { // Build a document model that uses the Quotations paragraph style. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); xParagraph->setPropertyValue("ParaStyleName", uno::Any(OUString("Quotations"))); @@ -1114,7 +1114,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifComment) { // Create a document with a comment in it. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({ { "Text", uno::Any(OUString("some text")) }, { "Author", uno::Any(OUString("me")) }, @@ -1135,7 +1135,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifComment) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifFontNameSize) { // Create a document with a custom font name and size in it. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); xParagraph->setPropertyValue("CharFontName", uno::Any(OUString("Liberation Serif"))); float fCharHeight = 14.0; @@ -1163,7 +1163,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifFontNameSize) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifParagraphAlignment) { // Create a document with an explicitly aligned paragraph. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); xParagraph->setPropertyValue("ParaAdjust", uno::Any(static_cast<sal_Int16>(style::ParagraphAdjust_RIGHT))); @@ -1304,7 +1304,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PaintBitmapFormat) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testMultiParaListItem) { // Create a document with 3 list items: A, B&C and D. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("A"); @@ -1348,7 +1348,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testMultiParaListItem) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testUnderlineNone) { // Create a document with a single paragraph: its underlying is set to an explicit 'none' value. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); xText->insertString(xText->getEnd(), "x", /*bAbsorb=*/false); @@ -1446,7 +1446,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifObjdataPresentationDataSize) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeading) { // Given a document with a list heading: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("list header"); @@ -1477,7 +1477,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeading) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testPartiallyNumberedList) { // Given a document with a list, first para is numbered, second is not: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("list header"); @@ -1519,7 +1519,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testPartiallyNumberedList) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeaderAndItem) { // Given a document with a list, first para is not numbered, but the second is: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("not numbered"); @@ -1560,7 +1560,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeaderAndItem) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteNoMargin) { // Given a document with some text, para style set to Quotations, no bottom margin: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); xText->insertString(xText->getEnd(), "string", /*bAbsorb=*/false); @@ -1590,7 +1590,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteNoMargin) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifImageToOle) { // Given a document with an image: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Sequence<beans::PropertyValue> aArgs = { comphelper::makePropertyValue("FileName", createFileURL(u"ole2.png")), }; @@ -1633,7 +1633,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifImageToOle) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGDirectly) { // Given a document with an image: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Sequence<beans::PropertyValue> aArgs = { comphelper::makePropertyValue("FileName", createFileURL(u"ole2.png")), }; @@ -1657,7 +1657,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGDirectly) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGDirectly) { // Given a document with an image: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Sequence<beans::PropertyValue> aArgs = { comphelper::makePropertyValue("FileName", createFileURL(u"reqif-ole-img.jpg")), }; @@ -1683,7 +1683,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGDirectly) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeDirectly) { // Given a document with an image shape: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); @@ -1710,7 +1710,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeDirectly) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGShapeDirectly) { // Given a document with an image: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); @@ -1740,7 +1740,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedJPGShapeDirectly) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeAsOLE) { // Given a document with an image shape: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); @@ -1774,7 +1774,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedPNGShapeAsOLE) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNG) { // Given a document with a shape: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); @@ -1809,7 +1809,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNG) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testShapeAsImageHtml) { // Given a document with a shape: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); @@ -1830,7 +1830,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testShapeAsImageHtml) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testJson) { // Given a document with a shape: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); @@ -1858,7 +1858,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testJson) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNGCustomDPI) { // Given a document with a shape: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); @@ -1906,7 +1906,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifEmbedShapeAsPNGCustomDPI) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOleBmpTransparent) { // Given a document with a transparent image: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Sequence<beans::PropertyValue> aArgs = { comphelper::makePropertyValue("FileName", createFileURL(u"transparent.png")), }; @@ -1948,7 +1948,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOleBmpTransparent) CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListsHeading) { // Given a document with lh, lh, li, li, lh and lh nodes: - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); pWrtShell->Insert("list 1, header 1"); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 190478c40063..4d251d786218 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -294,7 +294,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136588) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -762,7 +762,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -1267,7 +1267,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -2079,7 +2079,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106153) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -2698,7 +2698,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwDoc* pDoc(pTextDoc->GetDocShell()->GetDoc()); @@ -3379,14 +3379,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137) { createSwDoc("tdf109137.docx"); + // FIXME: it's not possible to use 'reload' here because the validation fails with + // Error: attribute "text:start-value" has a bad value uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::TempFileNamed aTempFile; - aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, })); - xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); - loadURL(aTempFile.GetURL(), "tdf109137.odt"); + xStorable->storeToURL(maTempFile.GetURL(), aDescriptor); + mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 0, the blue rectangle moved from the 1st to the 2nd page. assertXPath(pXmlDoc, "/root/page[1]/body/txt/anchored/fly/notxt", @@ -3496,14 +3496,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134463) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) { createSwDoc("tdf117188.docx"); - uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::TempFileNamed aTempFile; - aTempFile.EnableKillingFile(); - uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({ - { "FilterName", uno::Any(OUString("writer8")) }, - })); - xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); - loadURL(aTempFile.GetURL(), "tdf117188.odt"); + reload("writer8", "tdf117188.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); OUString sWidth = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "width"); OUString sHeight = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height"); @@ -4280,7 +4273,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testShapeAllowOverlap) #if !defined(MACOSX) && !defined(_WIN32) // Create an empty document with two, intentionally overlapping shapes. // Set their AllowOverlap property to false. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); awt::Point aPoint(1000, 1000); awt::Size aSize(2000, 2000); @@ -4335,7 +4328,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testShapeAllowOverlapWrap) { // Create an empty document with two, intentionally overlapping shapes. // Set their AllowOverlap property to false and their wrap to through. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); awt::Point aPoint(1000, 1000); awt::Size aSize(2000, 2000); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 388b7a6e5b11..1dd6d9dd5ba3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -404,7 +404,7 @@ DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.docx") CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote) { // Create a document, set footnote numbering type to ARABIC_ZERO. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFootnoteSettings = xFootnotesSupplier->getFootnoteSettings(); @@ -432,7 +432,7 @@ CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote) CPPUNIT_TEST_FIXTURE(Test, testChicagoNumberingFootnote) { // Create a document, set footnote numbering type to SYMBOL_CHICAGO. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFootnoteSettings = xFootnotesSupplier->getFootnoteSettings(); @@ -811,7 +811,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133771) CPPUNIT_TEST_FIXTURE(Test, testZeroLineSpacing) { // Create the doc model. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); style::LineSpacing aSpacing; aSpacing.Mode = style::LineSpacingMode::MINIMUM; @@ -834,7 +834,7 @@ CPPUNIT_TEST_FIXTURE(Test, testZeroLineSpacing) CPPUNIT_TEST_FIXTURE(Test, testSemiTransparentText) { // Create an in-memory empty document. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Set text to half-transparent and type a character. uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); @@ -876,7 +876,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf149546) CPPUNIT_TEST_FIXTURE(Test, testUserField) { // Create an in-memory empty document with a user field. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XDependentTextField> xField( xFactory->createInstance("com.sun.star.text.TextField.User"), uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 3f870784dacb..82ae7824b312 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1122,7 +1122,7 @@ DECLARE_RTFEXPORT_TEST(testTdf104744, "tdf104744.rtf") CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote) { // Create a document, set footnote numbering type to SYMBOL_CHICAGO. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFootnoteSettings = xFootnotesSupplier->getFootnoteSettings(); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 1e8e3b64070b..7eb3f1b74e57 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -161,7 +161,7 @@ void SwTiledRenderingTest::tearDown() SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter", nullptr); + createSwDoc(); else load(pName); diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 3592d99ea230..35eef322044e 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -74,8 +74,6 @@ namespace { -constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/uiwriter/data/"; - int CountFilesInDirectory(const OUString& rURL) { int nRet = 0; @@ -101,7 +99,7 @@ class SwUiWriterTest7 : public SwModelTestBase { public: SwUiWriterTest7() - : SwModelTestBase(DATA_DIRECTORY) + : SwModelTestBase("/sw/qa/extras/uiwriter/data/") { } }; @@ -2057,9 +2055,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testEmbeddedDataSource) // Load: should have a component and a data source, too. // Path with "#" must not cause issues - OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::Concat(u"hash%23path/") - + "embedded-data-source.odt"; - loadURL(aURL, nullptr); + OUString aURL = OUString::Concat(u"hash%23path/") + "embedded-data-source.odt"; + createSwDoc(aURL.toUtf8().getStr()); CPPUNIT_ASSERT(xDatabaseContext->hasByName("calc-data-source")); // Data source has a table named Sheet1. diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index c643f7a45e14..931770282881 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -115,7 +115,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testDefaultCharStyle) { // Create a new document, type a character, set its char style to Emphasis // and assert the style was set. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XSimpleText> xBodyText = xTextDocument->getText(); @@ -139,7 +139,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testDefaultCharStyle) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertStringExpandsHints) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> const xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> const xText(xTextDocument->getText()); uno::Reference<text::XTextCursor> const xCursor(xText->createTextCursor()); @@ -159,7 +159,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertStringExpandsHints) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertTextPortionNotExpandsHints) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> const xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> const xText(xTextDocument->getText()); uno::Reference<text::XTextPortionAppend> const xTextA(xText, uno::UNO_QUERY); @@ -180,7 +180,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertTextPortionNotExpandsHints) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertTextContentExpandsHints) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> const xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<lang::XMultiServiceFactory> const xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> const xText(xTextDocument->getText()); @@ -203,7 +203,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertTextContentExpandsHints) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertTextContentWithPropertiesNotExpandsHints) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> const xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<lang::XMultiServiceFactory> const xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> const xText(xTextDocument->getText()); @@ -228,7 +228,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testInsertTextContentWithPropertiesNotExpandsH CPPUNIT_TEST_FIXTURE(SwUnoWriter, testGraphicDescriptorURL) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Create a graphic object, but don't insert it yet. uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); @@ -254,7 +254,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testGraphicDescriptorURL) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testGraphicDescriptorURLBitmap) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Load a bitmap into the bitmap table. uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); @@ -655,7 +655,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testXURI) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSetPagePrintSettings) { // Create an empty new document with a single char - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XSimpleText> xBodyText = xTextDocument->getText(); @@ -678,7 +678,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSetPagePrintSettings) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testDeleteFlyAtCharAtStart) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); SwWrtShell* const pWrtShell(pTextDoc->GetDocShell()->GetWrtShell()); @@ -841,7 +841,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testRenderablePagePosition) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testPasteListener) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Insert initial string. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); @@ -958,7 +958,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testImageCommentAtChar) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testChapterNumberingCharStyle) { - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xDoc(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xStyle( @@ -1023,7 +1023,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testXTextCursor_setPropertyValues) // Create a new document, type a character, pass a set of property/value pairs consisting of one // unknown property and CharStyleName, assert that it threw UnknownPropertyException (actually // wrapped into WrappedTargetException), and assert the style was set, not discarded. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XSimpleText> xBodyText = xTextDocument->getText(); @@ -1046,7 +1046,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testShapeAllowOverlap) // Test the AllowOverlap frame/shape property. // Create a new document and insert a rectangle. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); awt::Point aPoint(1000, 1000); awt::Size aSize(10000, 10000); @@ -1094,7 +1094,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextConvertToTableLineSpacing) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testMultiSelect) { // Create a new document and add a text with several repeated sequences. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, css::uno::UNO_QUERY_THROW); auto xSimpleText = xTextDocument->getText(); xSimpleText->insertString(xSimpleText->getStart(), "Abc aBc abC", false); @@ -1133,7 +1133,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTransparentText) // Test the CharTransparence text portion property. // Create a new document. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); // Set a custom transparency. uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); @@ -1147,7 +1147,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTransparentText) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129839) { // Create a new document and add a table - loadURL("private:factory/swriter", nullptr); + createSwDoc(); css::uno::Reference<css::text::XTextDocument> xTextDocument(mxComponent, css::uno::UNO_QUERY_THROW); css::uno::Reference<css::lang::XMultiServiceFactory> xFac(xTextDocument, @@ -1169,7 +1169,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129839) CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841) { // Create a new document and add a table - loadURL("private:factory/swriter", nullptr); + createSwDoc(); css::uno::Reference<css::text::XTextDocument> xTextDocument(mxComponent, css::uno::UNO_QUERY_THROW); css::uno::Reference<css::lang::XMultiServiceFactory> xFac(xTextDocument, diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 6b9a687a0ea0..f4eb995c8ab2 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -235,7 +235,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128501, "tdf128501.doc") CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote) { // Create a document, set footnote numbering type to ARABIC_ZERO. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFootnoteSettings = xFootnotesSupplier->getFootnoteSettings(); @@ -265,7 +265,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote) CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote) { // Create a document, set footnote numbering type to SYMBOL_CHICAGO. - loadURL("private:factory/swriter", nullptr); + createSwDoc(); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFootnoteSettings = xFootnotesSupplier->getFootnoteSettings(); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index ed1537384686..24ab586544c8 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -313,8 +313,6 @@ protected: void loadURLWithComponent(OUString const& rURL, OUString const& rComponent, const char* pName, const char* pPassword); - void loadURL(OUString const& rURL, const char* pName, const char* pPassword = nullptr); - void reload(const char* pFilter, const char* pName, const char* pPassword = nullptr); /// Save the loaded document to a tempfile. Can be used to check the resulting docx/odt directly as a ZIP file. diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 6aa8639d16e9..d675c18c2617 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -513,11 +513,6 @@ void SwModelTestBase::loadURLWithComponent(OUString const& rURL, OUString const& calcLayout(); } -void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const char* pPassword) -{ - loadURLWithComponent(rURL, "com.sun.star.text.TextDocument", pName, pPassword); -} - void SwModelTestBase::reload(const char* pFilter, const char* pName, const char* pPassword) { save(OUString::createFromAscii(pFilter), pName, pPassword); @@ -617,7 +612,8 @@ void SwModelTestBase::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) SwDoc* SwModelTestBase::createSwDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter", nullptr); + loadURLWithComponent("private:factory/swriter", "com.sun.star.text.TextDocument", pName, + nullptr); else load(pName); @@ -627,7 +623,8 @@ SwDoc* SwModelTestBase::createSwDoc(const char* pName) SwDoc* SwModelTestBase::createSwWebDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter/web", nullptr); + loadURLWithComponent("private:factory/swriter/web", "com.sun.star.text.TextDocument", pName, + nullptr); else load_web(pName);