diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-11 14:18:18 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-11 16:26:05 +0100 |
commit | 4a6b56a5a1cd8756ff6d0335554fe78bf9988c27 (patch) | |
tree | dfc8d944064120d6a1736ec8efc2093517276064 /sw/qa/uibase | |
parent | 69efabc0ce798b86b6971f5a9adca11e98bec4d1 (diff) |
SwModelTestBase: use createSwDoc everywhere
In order to unify the code
Also call getSwDoc only when it's needed so move it outside
createSwDoc
Change-Id: I082d46108581e8f2e2e430e854980035f471ceac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142586
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uibase')
-rw-r--r-- | sw/qa/uibase/dochdl/dochdl.cxx | 6 | ||||
-rw-r--r-- | sw/qa/uibase/docvw/docvw.cxx | 6 | ||||
-rw-r--r-- | sw/qa/uibase/fldui/fldui.cxx | 3 | ||||
-rw-r--r-- | sw/qa/uibase/frmdlg/frmdlg.cxx | 2 | ||||
-rw-r--r-- | sw/qa/uibase/shells/shells.cxx | 19 | ||||
-rw-r--r-- | sw/qa/uibase/uiview/uiview.cxx | 3 | ||||
-rw-r--r-- | sw/qa/uibase/uno/uno.cxx | 5 | ||||
-rw-r--r-- | sw/qa/uibase/wrtsh/wrtsh.cxx | 39 |
8 files changed, 54 insertions, 29 deletions
diff --git a/sw/qa/uibase/dochdl/dochdl.cxx b/sw/qa/uibase/dochdl/dochdl.cxx index 579bc5d84058..95314b48be1f 100644 --- a/sw/qa/uibase/dochdl/dochdl.cxx +++ b/sw/qa/uibase/dochdl/dochdl.cxx @@ -27,7 +27,8 @@ class SwUibaseDochdlTest : public SwModelTestBase CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testSelectPasteFormat) { // Create a new document and cut a character. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2("x"); @@ -53,7 +54,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testSelectPasteFormat) CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testComplexSelection) { // Given a document where a text node has hints, but no as-char images. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2("abc"); diff --git a/sw/qa/uibase/docvw/docvw.cxx b/sw/qa/uibase/docvw/docvw.cxx index 3ec8027c8468..677a5abd2a54 100644 --- a/sw/qa/uibase/docvw/docvw.cxx +++ b/sw/qa/uibase/docvw/docvw.cxx @@ -31,7 +31,8 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testShiftClickOnImage) { // Given a document with a fly frame: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); @@ -140,7 +141,8 @@ int GraphicDialogInterceptor::GetGraphicDialogs() const { return m_nGraphicDialo CPPUNIT_TEST_FIXTURE(Test, testShiftDoubleClickOnImage) { // Given a document with a fly frame, and an interceptor to catch the graphic dialog: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx index 28f491e95f78..65e945fa61ab 100644 --- a/sw/qa/uibase/fldui/fldui.cxx +++ b/sw/qa/uibase/fldui/fldui.cxx @@ -32,7 +32,8 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testBiblioPageNumberUpdate) { // Given a document with 2 biblio fields, same properties, but different page number in the URL: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); diff --git a/sw/qa/uibase/frmdlg/frmdlg.cxx b/sw/qa/uibase/frmdlg/frmdlg.cxx index b16728cf2ecc..f6b7653de824 100644 --- a/sw/qa/uibase/frmdlg/frmdlg.cxx +++ b/sw/qa/uibase/frmdlg/frmdlg.cxx @@ -26,7 +26,7 @@ public: CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testWrappedMathObject) { // The document includes a Math object with explicit wrapping. - load("wrapped-math-object.docx"); + createSwDoc("wrapped-math-object.docx"); uno::Reference<drawing::XShape> xMath = getShape(1); // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 2f91ba4f8b38..55b388860adc 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -47,7 +47,8 @@ public: CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testTdf130179) { - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); IDocumentContentOperations& rIDCO = pDoc->getIDocumentContentOperations(); SwCursorShell* pShell(pDoc->GetEditShell()); SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END - 1>); @@ -78,7 +79,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment) // FIXME find out why this fails on macOS/Windows #if !defined(MACOSX) && !defined(_WIN32) // Create a document with a rectangle in it. - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); Point aStartPos(1000, 1000); pWrtShell->BeginCreate(SdrObjKind::Rectangle, aStartPos); @@ -119,7 +121,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) { // Load a document with 2 charts in it. The second is down enough that you have to scroll to // trigger its rendering. Previews are missing for both. - load("ole-save-preview-update.odt"); + createSwDoc("ole-save-preview-update.odt"); // Explicitly update OLE previews, etc. dispatchCommand(mxComponent, ".uno:UpdateAll", {}); @@ -140,7 +142,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) { // Given a document with an embedded Writer object: - load("ole-preview-update.odt"); + createSwDoc("ole-preview-update.odt"); // When updating "all" (including OLE previews): dispatchCommand(mxComponent, ".uno:UpdateAll", {}); @@ -162,7 +164,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) { // Given a document with a bibliography field: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); @@ -199,7 +202,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) { // Given a document with a bibliography field's local copy: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); @@ -237,7 +241,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak) { // Given a document with a content control and a cursor inside the content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index 4dfae7772b26..348574b13f85 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -237,7 +237,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testSwitchBetweenImages) { // Given a document with 2 images, and an interceptor catching an UNO command that specific to // the current selection: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index 0535bb27c8f4..a1484b1ce629 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -48,7 +48,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testLockControllers) CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCondFieldCachedValue) { - load("cond-field-cached-value.docx"); + createSwDoc("cond-field-cached-value.docx"); Scheduler::ProcessEventsToIdle(); // Without the accompanying fix in place, this test would have failed with: @@ -61,7 +61,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCondFieldCachedValue) CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPosition) { // Given a document with 2 characters, and the pixel position of the point between them: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); pWrtShell->Insert2("AZ"); diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx index e40f641e706a..d44cb23ce190 100644 --- a/sw/qa/uibase/wrtsh/wrtsh.cxx +++ b/sw/qa/uibase/wrtsh/wrtsh.cxx @@ -37,7 +37,8 @@ class Test : public SwModelTestBase CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a clearing break: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -60,7 +61,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl) { // Given a document with a content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -96,7 +98,8 @@ CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl) CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) { // Given a document with a checkbox (checked) content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -133,7 +136,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -149,7 +153,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -170,7 +175,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl) CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) { // Given a document with a dropdown content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -221,7 +227,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -244,7 +251,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl) CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) { // Given a document with a picture content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -289,7 +297,8 @@ CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertPictureContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -311,7 +320,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPictureContentControl) CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) { // Given a document with a date content control: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -350,7 +360,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a date content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -371,7 +382,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertDateContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a plain text content control: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -392,7 +404,8 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl) CPPUNIT_TEST_FIXTURE(Test, testInsertComboBoxContentControl) { // Given an empty document: - SwDoc* pDoc = createSwDoc(); + createSwDoc(); + SwDoc* pDoc = getSwDoc(); // When inserting a combo box content control: dispatchCommand(mxComponent, ".uno:InsertComboBoxContentControl", {}); |