sw/qa/extras/uiwriter/uiwriter3.cxx | 75 ------------------------------------ sw/qa/extras/uiwriter/uiwriter4.cxx | 75 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 75 deletions(-)
New commits: commit cfcf76b67935bb91d7417e8be60ec2a6285652de Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Mar 24 14:36:17 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Mar 24 18:33:48 2023 +0000 CppunitTest_sw_uiwriter3: move failing test to another file In order to see wether this test keeps failing in the new file or it's affected by another test Change-Id: I73ef0287a81d0ea8c2b26f466cd0d623a62933c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149543 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 40f02901de09..a282ae7bcbb4 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -2005,81 +2005,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf108124) CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } -CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975) -{ - // This test also covers tdf#117185 tdf#110442 - - createSwDoc("tdf107975.odt"); - SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); - - uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, - uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess( - xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); - - uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, - getProperty<text::TextContentAnchorType>(xShape, "AnchorType")); - - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - - dispatchCommand(mxComponent, ".uno:SelectAll", {}); - - dispatchCommand(mxComponent, ".uno:Copy", {}); - - //Position the mouse cursor (caret) after "ABC" below the blue image - dispatchCommand(mxComponent, ".uno:GoRight", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); - - // without the fix, it crashes - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); - CPPUNIT_ASSERT_EQUAL(OUString("ABC"), getParagraph(1)->getString()); - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Redo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Redo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - - //try again with anchor at start of doc which is another special case - xShape.set(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - uno::Reference<text::XTextContent> xShapeContent(xShape, uno::UNO_QUERY); - uno::Reference<text::XTextRange> const xStart = pTextDoc->getText()->getStart(); - xShapeContent->attach(xStart); - - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, - getProperty<text::TextContentAnchorType>(xShape, "AnchorType")); - - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - - dispatchCommand(mxComponent, ".uno:SelectAll", {}); - - dispatchCommand(mxComponent, ".uno:Copy", {}); - - //Position the mouse cursor (caret) after "ABC" below the blue image - dispatchCommand(mxComponent, ".uno:GoRight", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); - - // without the fix, it crashes - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); - CPPUNIT_ASSERT_EQUAL(OUString("ABC"), getParagraph(1)->getString()); - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Redo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Redo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); -} - CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134021) { createSwDoc("tdf134021.docx"); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 327d493c8c35..b692becbfcf3 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -2343,6 +2343,81 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf113877_blank_bold_on) CPPUNIT_ASSERT_EQUAL(listId1, listId3); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107975) +{ + // This test also covers tdf#117185 tdf#110442 + + createSwDoc("tdf107975.odt"); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + + uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess( + xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); + + uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, + getProperty<text::TextContentAnchorType>(xShape, "AnchorType")); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Copy", {}); + + //Position the mouse cursor (caret) after "ABC" below the blue image + dispatchCommand(mxComponent, ".uno:GoRight", {}); + dispatchCommand(mxComponent, ".uno:Paste", {}); + + // without the fix, it crashes + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(OUString("ABC"), getParagraph(1)->getString()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Redo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Redo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + //try again with anchor at start of doc which is another special case + xShape.set(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextContent> xShapeContent(xShape, uno::UNO_QUERY); + uno::Reference<text::XTextRange> const xStart = pTextDoc->getText()->getStart(); + xShapeContent->attach(xStart); + + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, + getProperty<text::TextContentAnchorType>(xShape, "AnchorType")); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Copy", {}); + + //Position the mouse cursor (caret) after "ABC" below the blue image + dispatchCommand(mxComponent, ".uno:GoRight", {}); + dispatchCommand(mxComponent, ".uno:Paste", {}); + + // without the fix, it crashes + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(OUString("ABC"), getParagraph(1)->getString()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Redo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Redo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf113877_blank_bold_off) { mergeDocs("tdf113877_blank_bold_off.odt", "tdf113877_insert_numbered_list_abcd.odt");