diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-25 01:17:23 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-25 12:52:07 +0200 |
commit | aeae8e9c030549f11c18f5e4a33a06f984e997f0 (patch) | |
tree | 35b20e6ff5acf0d096fe682f5889eb367d06a155 /sw | |
parent | 11e0e576f4e38adcbe16601b63ab353424acf610 (diff) |
SwModelTestBase: assert SwDoc inside getSwDoc()
Change-Id: Icf70904a963b099db6c8be0384cbed92b93a28eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175581
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
22 files changed, 17 insertions, 167 deletions
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index 9bc791a5db62..91295c1ce819 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -31,7 +31,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues) { createSwDoc("DocumentTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -44,7 +43,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testTableSplitMergeAndAltText) { createSwDoc("AccessibilityTests1.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -64,7 +62,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues) // some text inside the paragraph createSwDoc("ParagraphTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -76,7 +73,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) { createSwDoc("BackgroundImageTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -88,7 +84,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckLinkedImage) { createSwDoc("LinkedImageTest.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -100,7 +95,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) { createSwDoc("NewlineTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -115,7 +109,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) { createSwDoc("SpaceTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -129,7 +122,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks) { createSwDoc("HyperlinkTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -145,7 +137,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) { createSwDoc("HighlightTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -159,7 +150,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) { createSwDoc("AccessibilityTests_NumberingCheck.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -175,7 +165,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeFootnote) { createSwDoc("FakeFootnoteTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -192,7 +181,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption) { createSwDoc("FakeCaptionTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -204,7 +192,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTableFormatting) { createSwDoc("TableFormattingTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -216,7 +203,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting) { createSwDoc("TabsTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -238,7 +224,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTOCHyperlink) { createSwDoc("TOCHyperlinkTest.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -253,7 +238,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) // Delete Header from doc and check if we have less Direct format warning createSwDoc("DeleteHeader.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -293,7 +277,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testStylesWithHeader) // Check direct formats, char/para styles and not allowed page styles createSwDoc("PageCharParaStyles.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -332,7 +315,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsinTOC) { createSwDoc("Tabs-in-TOC.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::AccessibilityCheck aCheck(pDoc); aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); @@ -369,7 +351,6 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) createSwDoc("OnlineCheck.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx index e8c0daff71bc..7ae4e2fa2bbf 100644 --- a/sw/qa/core/theme/ThemeTest.cxx +++ b/sw/qa/core/theme/ThemeTest.cxx @@ -45,8 +45,6 @@ public: CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeading) { createSwDoc("ThemeColorInHeading.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(getParagraph(1), u"CharComplexColor"_ustr); @@ -57,8 +55,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeading) CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeadingODT) { createSwDoc("ThemeColorInHeading.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(getParagraph(1), u"CharComplexColor"_ustr); @@ -341,7 +337,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExistsDOCX) { createSwDoc("ThemeColorInHeading.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -387,7 +382,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExistsODT) { createSwDoc("ThemeColorInHeading.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -415,7 +409,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeChanging) { createSwDoc("ThemeColorInHeading.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); @@ -558,7 +551,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_customTransferable) createSwDoc("theme_foo.fodt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -605,7 +597,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_ownTransferable) createSwDoc("theme_bar.odt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); @@ -632,7 +623,6 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testTdf162715_ownTransferable) createSwDoc("theme_foo.fodt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); CPPUNIT_ASSERT(pModel); diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index 56ce9794611a..f52de4a8ab31 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -48,7 +48,6 @@ void IndexingExportTest::testIndexingExport_Paragraphs() { createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -84,7 +83,6 @@ void IndexingExportTest::testIndexingExport_Images() { createSwDoc("IndexingExport_Images.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -107,7 +105,6 @@ void IndexingExportTest::testIndexingExport_OLE() { createSwDoc("IndexingExport_OLE.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -127,7 +124,6 @@ void IndexingExportTest::testIndexingExport_Shapes() { createSwDoc("IndexingExport_Shapes.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -167,7 +163,6 @@ void IndexingExportTest::testIndexingExport_Tables() { createSwDoc("IndexingExport_Tables.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -235,7 +230,6 @@ void IndexingExportTest::testIndexingExport_Sections() { createSwDoc("IndexingExport_Sections.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -267,7 +261,6 @@ void IndexingExportTest::testIndexingExport_Fontwork() { createSwDoc("IndexingExport_Fontwork.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); @@ -292,7 +285,6 @@ void IndexingExportTest::testIndexingExport_Header_Footer() { createSwDoc("IndexingExport_Header_Footer.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SvMemoryStream aMemoryStream; sw::IndexingExport aIndexingExport(aMemoryStream, pDoc); diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index 804a36c29b06..9e239430a0b5 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -45,7 +45,6 @@ void SearchResultLocatorTest::testSearchResultLocator() createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); std::vector<sw::search::SearchIndexData> aDataVector; @@ -73,7 +72,6 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingXmlPayload() createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); OString payload = "<indexing>" @@ -102,7 +100,6 @@ void SearchResultLocatorTest::testSearchResultLocatorUsingJsonPayload() createSwDoc("IndexingExport_VariousParagraphs.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); OString payload = "[" @@ -131,7 +128,6 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() createSwDoc("IndexingExport_Shapes.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); std::vector<sw::search::SearchIndexData> aDataVector; @@ -159,7 +155,6 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjectsUsingJsonPaylo createSwDoc("IndexingExport_Shapes.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); sw::search::SearchResultLocator aLocator(pDoc); OString payload = "[" diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 61da490a87d3..2db76beeca42 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -712,8 +712,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection) { createSwDoc("field_hide_section.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/section/tab/row", 1); @@ -751,8 +749,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666) { createSwDoc("i94666.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); { xmlDocUniquePtr pXmlDoc = parseLayoutDump(); @@ -796,8 +792,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestI94666) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) { createSwDoc("tdf134472.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", u"843"); assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", u"2819"); @@ -806,8 +800,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd) { createSwDoc("tabellen_test_windows_1.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // the row with the nested table should not be split but be the first row on page 2 assertXPathContent(pXmlDoc, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]", @@ -821,7 +813,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) { createSwDoc("tdf136613.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); //get the flys and the root frame const auto vFlyFormats = pDoc->GetFlyFrameFormats(FLYCNTTYPE_ALL, true); @@ -852,8 +843,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf88496) { createSwDoc("tdf88496.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 4, table fallback "switch off repeating header" started on a new page assertXPath(pXmlDoc, "/root/page", 3); @@ -1343,8 +1332,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) { // Check the padding of the textbox createSwDoc("tdf137025.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 8c9c20e02687..aa8adb36df09 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -1950,8 +1950,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137819) { // Open the bugdoc and check if it went wrong createSwDoc("tdf137819.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // Change the anchor if the textbox to As_char uno::Reference<beans::XPropertySet> xShapePropSet(getShape(1), uno::UNO_QUERY); @@ -2482,7 +2480,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509) { createSwDoc("Tdf121509.odt"); auto pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // Get all shape/frame formats auto vFrameFormats = pDoc->GetSpzFrameFormats(); diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 1d84ed142a7d..355097ecb64d 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -857,8 +857,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf115094) CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf112290) { createSwDoc("tdf112290.docx"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); auto pXml = parseLayoutDump(); assertXPath(pXml, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion", u"Xxxx Xxxx"); } diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index be4e8077a1ee..ca8d298c3a09 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -264,8 +264,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf105481) CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf117982) { createSwDoc("tdf117982.docx"); - SwDoc* pDocument = getSwDoc(); - SwDocShell* pShell = pDocument->GetDocShell(); + SwDocShell* pShell = getSwDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); @@ -278,8 +277,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf128959) { // no orphan/widow control in table cells createSwDoc("tdf128959.docx"); - SwDoc* pDocument = getSwDoc(); - CPPUNIT_ASSERT(pDocument); + SwDoc* pDoc = getSwDoc(); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // first two lines of the paragraph in the split table cell on the first page @@ -298,7 +296,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf128959) "portion", u"amet commodo magna eros quis urna."); // Also check that the widow control for the paragraph is not turned off: - sw::TableFrameFormats& rTableFormats = *pDocument->GetTableFrameFormats(); + sw::TableFrameFormats& rTableFormats = *pDoc->GetTableFrameFormats(); SwFrameFormat* pTableFormat = rTableFormats[0]; SwTable* pTable = SwTable::FindTable(pTableFormat); const SwTableBox* pCell = pTable->GetTableBox(u"A1"_ustr); diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index a50922006dbc..09d4707a68ba 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1235,7 +1235,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128188) { loadAndReload("footnote-collect-at-end-of-section.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwFootnoteIdxs const& rFootnotes(pDoc->GetFootnoteIdxs()); // Section1 CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rFootnotes[0]->GetFootnote().GetNumber()); @@ -1829,7 +1828,6 @@ CPPUNIT_TEST_FIXTURE(Test, testBtlrFrame) // mbVertical==true, but mbVertLRBT==false, even if the writing direction in the doc model was // btlr. SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); CPPUNIT_ASSERT(pLayout); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx index c8de2027f40d..004b6b851526 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx @@ -723,7 +723,6 @@ CPPUNIT_TEST_FIXTURE(Test, tdf122201_editUnprotectedText) // get the document SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // get two different nodes SwNodeIndex aDocEnd(pDoc->GetNodes().GetEndOfContent()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 097d68250802..cee6baed8a63 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -68,7 +68,6 @@ DECLARE_OOXMLEXPORT_TEST(testFdo68787, "fdo68787.docx") DECLARE_OOXMLEXPORT_TEST(testTdf92470_footnoteRestart, "tdf92470_footnoteRestart.docx") { SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT( pDoc ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote doesn't restart every Page", FTNNUM_PAGE, pDoc->GetFootnoteInfo().m_eNum ); uno::Reference<beans::XPropertySet> xPageStyle(getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 8945a66534c3..fbea0d4816f7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1056,7 +1056,6 @@ DECLARE_OOXMLEXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustmen { //Preserve the page vertical alignment setting for .docx SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 ); drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment(); diff --git a/sw/qa/extras/pdf/HybridPdfTest.cxx b/sw/qa/extras/pdf/HybridPdfTest.cxx index 0c4e6061c386..840de3298474 100644 --- a/sw/qa/extras/pdf/HybridPdfTest.cxx +++ b/sw/qa/extras/pdf/HybridPdfTest.cxx @@ -47,8 +47,6 @@ void HybridPdfTest::testHybridWithAdditionalStreams() // Load PDF document with an embedded ODT document // The ODT document is embedded in "/AdditionalStreams" structure that is in the PDF trailer createSwDoc("Hybrid_AdditionalStreamsOnly.pdf"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // We can access the document text in a single paragraph that spans multiple rows // This wouldn't be possible with a PDF, so the opened document has to be ODT @@ -62,8 +60,6 @@ void HybridPdfTest::testHybridWithAdditionalStreamsAndAttachedFile() // The ODT document is embedded in "/AdditionalStreams" structure that is in the PDF trailer // and is included as an attached file conforming to the PDF specs createSwDoc("Hybrid_AdditionalStreamsAndPDFAttachedFile.pdf"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // We can access the document text in a single paragraph that spans multiple rows // This wouldn't be possible with a PDF, so the opened document has to be ODT diff --git a/sw/qa/extras/txtimport/txtimport.cxx b/sw/qa/extras/txtimport/txtimport.cxx index 71a05c7fb378..514f05c9e704 100644 --- a/sw/qa/extras/txtimport/txtimport.cxx +++ b/sw/qa/extras/txtimport/txtimport.cxx @@ -54,7 +54,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191) { createSwDoc("bullets.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // just the 5th paragraph - no bullet uno::Reference<text::XTextRange> xPara(getParagraph(5)); @@ -81,8 +80,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf112191) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom) { createSwDoc("UTF8WITHOUTBOM.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -92,8 +89,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom) { createSwDoc("UTF8WITHBOM.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -103,8 +98,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf8withbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom) { createSwDoc("UTF16LEWITHOUTBOM.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -114,8 +107,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom) { createSwDoc("UTF16LEWITHBOM.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -125,8 +116,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16lewithbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf92161_gb18030) { createSwDoc("GB18030.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -136,8 +125,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf92161_gb18030) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom) { createSwDoc("UTF16BEWITHOUTBOM.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -147,8 +134,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithoutbom) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf60145_utf16bewithbom) { createSwDoc("UTF16BEWITHBOM.txt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); uno::Reference<text::XTextRange> xPara(getParagraph(1)); @@ -179,8 +164,6 @@ CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf115088) CPPUNIT_TEST_FIXTURE(TxtImportTest, testTdf70423) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 8deefcfc9ec3..2e3904450545 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1466,7 +1466,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85554) CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testMergeDoc) { createSwDoc("merge-change1.odt"); - SwDoc* pDoc1 = getSwDoc(); + SwDoc* pDoc = getSwDoc(); auto xDoc2Component(loadFromDesktop( createFileURL(u"merge-change2.odt"), @@ -1476,7 +1476,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testMergeDoc) CPPUNIT_ASSERT(pxDoc2Document); SwDoc* const pDoc2(pxDoc2Document->GetDocShell()->GetDoc()); - SwEditShell* const pEditShell(pDoc1->GetEditShell()); + SwEditShell* const pEditShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pEditShell); pEditShell->MergeDoc(*pDoc2); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index f6f10cede04f..f758effa8ec5 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -125,8 +125,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf146449) { createSwDoc("tdf146449.odt"); - auto pDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); auto pShell = getSwDocShell()->GetFEShell(); CPPUNIT_ASSERT(pShell); @@ -648,8 +646,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testBookmarkCollapsed) { // load document createSwDoc("collapsed_bookmark.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // save original document save(u"writer8"_ustr); @@ -866,7 +862,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload // load document createSwDoc("collapsed_bookmark.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // write "abc" to area marked with "testBookmark" bookmark { @@ -1613,9 +1608,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104425) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf104814) { createSwDoc("tdf104814.docx"); - SwDoc* pDoc1 = getSwDoc(); + SwDoc* pDoc = getSwDoc(); - SwEditShell* const pEditShell(pDoc1->GetEditShell()); + SwEditShell* const pEditShell(pDoc->GetEditShell()); CPPUNIT_ASSERT(pEditShell); // accept all redlines @@ -1645,7 +1640,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly) { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1712,7 +1706,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTableRemoveHasTextChangesOnly2) { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1767,7 +1760,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf147182_AcceptAllChangesInTableSelec { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1950,8 +1942,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107362) CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105417) { createSwDoc("tdf105417.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwView* pView = getSwDocShell()->GetView(); CPPUNIT_ASSERT(pView); uno::Reference<linguistic2::XHyphenator> xHyphenator = LinguMgr::GetHyphenator(); diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index 188890f3776d..3f668b9937f5 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -745,7 +745,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTextFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -782,7 +781,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testCheckboxFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -831,7 +829,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDropDownFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -872,7 +869,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testMixedFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); @@ -1498,7 +1494,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldInsertion) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1535,7 +1530,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldContentOperations) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1568,7 +1562,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateHandling) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1622,7 +1615,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testDateFormFieldCurrentDateInvalidation) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); CPPUNIT_ASSERT(pMarkAccess); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); @@ -1999,7 +1991,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_row) // load a 2-row table, and select row 2 by clicking before it createSwDoc("select-column.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2033,7 +2024,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf47979_column) // load a 2-row table, and select column B by clicking before them createSwDoc("select-column.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 050f3e086e49..c5caa395fc59 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -934,7 +934,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013) // Save it as DOCX & load it again saveAndReload(u"Office Open XML Text"_ustr); pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwCursorShell* pShell(pDoc->GetEditShell()); @@ -956,8 +955,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115065) // Source table (first one) has two rows; // destination (second one) has only one row createSwDoc("tdf115065.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -983,7 +980,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf84806_MovingMultipleTableRows) // destination (second one) has only one row createSwDoc("tdf115065.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1044,7 +1040,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf147181_TrackedMovingOfMultipleTable // destination (second one) has only one row createSwDoc("tdf115065.odt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1126,7 +1121,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157492_TrackedMovingRow) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1207,7 +1201,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf154599_MovingColumn) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1257,7 +1250,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155846_MovingColumn) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1341,7 +1333,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf154771_MovingMultipleColumns) { createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1397,7 +1388,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf44773) // allow resizing table rows, if cursor outside the table createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1463,7 +1453,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157833) // allow resizing table rows & columns using a minimal hit area createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1531,7 +1520,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155692) // allow resizing table rows & columns using a normal hit area createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1598,7 +1586,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160842) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table @@ -1635,7 +1622,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -1685,7 +1671,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table @@ -1747,7 +1732,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161332) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table @@ -1808,7 +1792,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161426) { createSwDoc("tdf161426.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table @@ -1870,7 +1853,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161426_content) { createSwDoc("tdf161426.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table @@ -1963,7 +1945,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161360) { createSwDoc("tdf160842.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); // the cursor is not in the table @@ -2025,8 +2006,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157533) { // load a table with objects positioned at beginning of text lines createSwDoc("tdf157533.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); auto pShell = getSwDocShell()->GetFEShell(); @@ -2079,8 +2058,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157533) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132) { createSwDoc(); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -3140,8 +3117,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInsertLongDateFormat) CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf129270) { createSwDoc("tdf129270.odt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); @@ -3199,7 +3174,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf143760WrapContourToOff) // to change a shape by dispatchCommand. createSwDoc("tdf143760_ContourToWrapOff.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), u"SurroundContour"_ustr)); // Mark the object diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 370dfd4d2332..58052fcf8146 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -140,7 +140,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146622) { createSwDoc("TC-table-del-add.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -194,7 +193,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146962) // load a 2-row table, set Hide Changes mode and delete the first row with change tracking createSwDoc("tdf116789.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -246,7 +244,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf159026) // imported as floating tables in Writer) createSwDoc("tdf159026.docx"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -301,7 +298,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147347) // load a 2-row table, set Hide Changes mode and delete the table with change tracking createSwDoc("tdf116789.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -351,8 +347,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf153819) { // copy a table before a deleted table in Hide Changes mode createSwDoc("tdf153819.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -375,7 +369,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148345) // load a 2-row table, set Hide Changes mode and delete the first row with change tracking createSwDoc("tdf116789.fodt"); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -428,8 +421,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391) // load a 2-row table createSwDoc("tdf116789.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -512,8 +503,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf148791) // load a 2-row table createSwDoc("tdf116789.fodt"); - SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -2790,12 +2779,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf103612) { createSwGlobalDoc("DUMMY.odm"); - SwDoc* pGlobalDoc = getSwDoc(); + SwDoc* pDoc = getSwDoc(); CPPUNIT_ASSERT_EQUAL( - size_t(1), - pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size()); - pGlobalDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( - false, false, nullptr, u""_ustr); + size_t(1), pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size()); + pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, false, nullptr, + u""_ustr); xmlDocUniquePtr pLayout = parseLayoutDump(); diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 0886e7304793..1351ca753529 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -298,7 +298,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) createSwDoc(); SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -727,7 +726,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752) // Undoing/redoing a replacement must select the new text createSwDoc(); SwXTextDocument* pDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -754,8 +752,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752) CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Pargraph) { createSwDoc("tdf162326.odt"); - SwXTextDocument* pDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -783,8 +779,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Pargraph) CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf162326_Character) { createSwDoc("tdf162326.odt"); - SwXTextDocument* pDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); - CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 8f4263f59f96..9ac1e8321bef 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1313,7 +1313,6 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment. { //Preserve the page vertical alignment setting for .doc SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 ); drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment(); @@ -1343,7 +1342,6 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment. DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc") { SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); for (SwNodeOffset n(0); ; n++) { @@ -1566,7 +1564,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf99474) DECLARE_WW8EXPORT_TEST(testContinuousSectionsNoPageBreak, "continuous-sections.doc") { SwDoc* pDoc = getSwDoc(); - CPPUNIT_ASSERT(pDoc); // Continuous section breaks should not add new pages CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetPageDescCnt()); diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 123f5f2eab33..91aace9350f9 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -458,7 +458,12 @@ void SwModelTestBase::createSwGlobalDoc(const char* pName) CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.GlobalDocument"_ustr)); } -SwDoc* SwModelTestBase::getSwDoc() { return getSwDocShell()->GetDoc(); } +SwDoc* SwModelTestBase::getSwDoc() +{ + SwDoc* pDoc = getSwDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDoc); + return pDoc; +} SwDocShell* SwModelTestBase::getSwDocShell() { |