diff options
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 5 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 4 | ||||
-rw-r--r-- | sw/qa/uitest/data/TestHiddenHeadersFooters.docx | bin | 0 -> 18063 bytes | |||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf141158.py | 47 |
6 files changed, 59 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index c33f99cb4322..ba6a6a6a98e2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -688,7 +688,9 @@ DECLARE_OOXMLEXPORT_TEST(testBnc875718, "bnc875718.docx") // is not SwXBodyText but rather SwXHeadFootText uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); - for( int i = 0; + // The sample bugdoc has 3 footer.xml and has a textframe in each. The first one is hidden + // and it has no text in its anchored text range: it is anchored to body text. Ignoring... + for( int i = 1; i < xIndexAccess->getCount(); ++i ) { @@ -700,6 +702,7 @@ DECLARE_OOXMLEXPORT_TEST(testBnc875718, "bnc875718.docx") // Also check that the footer contents are not in the body text. uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> text = textDocument->getText(); + CPPUNIT_ASSERT(text); //Do not crash on empty content CPPUNIT_ASSERT_EQUAL( OUString( "Text" ), text->getString()); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index cd3ca2f39e46..951a4d8650f2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -670,7 +670,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130167_spilloverHeaderShape, "testTdf130167_spil uno::Reference<container::XIndexAccess> xNameAccess( xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); // graphics from discarded headers were being added to the text body. Reduced from 5 to 2 shapes overall. - CPPUNIT_ASSERT(xNameAccess->getCount() < 4); + // CPPUNIT_ASSERT(xNameAccess->getCount() <= 4); -> What about hidden headers? + CPPUNIT_ASSERT_LESS(sal_Int32(6), xNameAccess->getCount()); } DECLARE_OOXMLEXPORT_TEST(testTdf124986, "tdf124986.docx") diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 216fb0de07c0..59a2688232c8 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -564,10 +564,10 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx") sal_Int32(9), nLeftMargin); /* - * Another problem tested with this document is the unnecessary loading of the shapes - * anchored to a discarded header or footer + * Another problem tested with this document is the loading of the shapes + * anchored to a hidden header or footer */ - CPPUNIT_ASSERT_EQUAL(0, getShapes()); + CPPUNIT_ASSERT_EQUAL(2, getShapes()); } DECLARE_OOXMLIMPORT_TEST(testN779627b, "n779627b.docx") diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e47594a27b42..f56cf50d328d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -5055,7 +5055,9 @@ void SwUiWriterTest::testTdf92648() SwDoc* pDoc = createDoc("tdf92648.docx"); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); // Make sure we have ten draw shapes. - CPPUNIT_ASSERT_EQUAL(sal_Int32(10), SwTextBoxHelper::getCount(pPage)); + // Yes, we have if the left/right pages have different header/footer, + // but if not we have only nine of them: + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), SwTextBoxHelper::getCount(pPage)); // and the text boxes haven't got zero height sal_Int32 nCount = 0; for (const SwFrameFormat* pFormat : *pDoc->GetSpzFrameFormats()) diff --git a/sw/qa/uitest/data/TestHiddenHeadersFooters.docx b/sw/qa/uitest/data/TestHiddenHeadersFooters.docx Binary files differnew file mode 100644 index 000000000000..f33482a93ba1 --- /dev/null +++ b/sw/qa/uitest/data/TestHiddenHeadersFooters.docx diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py new file mode 100644 index 000000000000..906035e37e89 --- /dev/null +++ b/sw/qa/uitest/writer_tests7/tdf141158.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import importlib +import pathlib +import org.libreoffice.unotest +from uitest.uihelper.common import select_pos +import time + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + + +class TestTdf141158(UITestCase): + def test_tdf141158(self): + # load the desired bugdoc + self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + # open the page styles dialog and select the headers tab + self.xUITest.executeCommand(".uno:PageStyleName") + TemplateDialog8 = self.xUITest.getTopFocusWindow() + xTabs = TemplateDialog8.getChild("tabcontrol") + select_pos(xTabs, "4") + # make the same left right page header state to off and apply the setting + checkSameLR = TemplateDialog8.getChild("checkSameLR") + checkSameLR.executeAction("CLICK",tuple()) + ok = TemplateDialog8.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + time.sleep(1) + # go to the left header + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + # get the text of the header + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + # without the fix in place it was "Right Header" (lost hidden left header), + # with the fix it should pass... + self.assertEqual("Left Header", xHeaderLeftText) + time.sleep(1) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |