summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2020-11-18tdf#123936 Formatting files in module test with clang-formatPhilipp Hofer
Change-Id: I8b2cc4917564626432ce0219e24f253a534ce8e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105719 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-17loplugin:stringviewparam check methods tooNoel
not just functions Change-Id: Icca295dd159002b428b73f2c95d40725434f04d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105789 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-06tdf#130546 sw autocorrect: don't replace redliningLászló Németh
if it starts or ends within the removed text to avoid various problems, for example, reappearing deleted comma before ellipsis replacement: text[,]... -> text,...[,] or replacing words based on already deleted text: [tt]he -> [tt]the Add test/user-template/user/autocorr/acor_en-GB.dat unit test autocorrect definition with three dots to ellipsis replacement. Change-Id: I195922cb92bc29d3ded694fea4ca351244dab17b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105424 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2020-10-31Improve 'resize with cell' handlingRegina Henschel
The patch contains a larger rework of RecalcPos and connected areas and covers several bugs. Essentials in short: Move initialization from RecalcPos to own method and use it in ScXMLImport::endDocument Do not change hidden objects, which includes not setting width or height to zero, and be consistent in using object visibility. Special handling of vertical flipped customshapes. Repair anchor on import of line and measure line. ODF conformance: Create logical rectangle from anchor instead using size. Details: tdf#137044 ScDrawLayer::SetPageSize is called several times while loading a document. It includes a call to ScDrawLayer::RecalcPos for all cell anchored objects. An object gets initialized with the first call. Problem was, that the row heights were not finished at that time and anchor cells and offsets were partly calculated based on default cell height. That results in wrong height and offset of objects. The solution separates initialization from RecalcPos and puts it into an own method ScDrawLayer::InitializeCellAnchoredObj. This is then called from ScXMLImport::endDocument when row height settings are finished. The call to RecalcPos is not totally removed from SetPageSize but only excluded while loading, because it is needed for size changes after the document is loaded. tdf#137576 partly For measure lines and ordinary lines, which were anchored 'To cell (resize with cell)', LibreOffice has written wrong end-cell info to file. So reopening results in wrong lines. The geometry of lines is based on two points. Fortunatelly the combination of position of the cell, which contains the shape, and start and end points gives correct absolute position of these points. Solution is, to regenerate the initial ScDrawObjData infos from these points and do not use the stored end-cell info. For a total fix implementation of NbcSetSnapRect for SdrMeasureObj is needed, which is not included here. tdf#137020 Cell anchored shapes are contained in a cell in file. To determine size and position of the shape a rectangle is used, so defined, that after applying transformation you get the desired shape. In case of custom shapes, a vertical flip is not contained in the transformation but it is an attribute inside the shape and flip is done at the shape center and will not change the rectangle. This rectangle determines start and end addresses and offsets in ScDrawObjData in rNoRotatedAnchor. The info is used directly in XML export. It is correctly build while loading the file. But in case of vertical flipped custom shapes the logical rectangle of the shape has an additional 180deg rotation. Changing that behavior is currently out of scope. Therefore special handling of vertical flipped custom shapes was added. tdf#99549 ODF specifies that in case of existence of end-cell attribute, size attributes have to be ignored. But LO has based the logical rectangle on size. In addition it has written zero width and height in case of hidden row and cols. Result was, that objects are 'lost' on opening although they still exists in the file. With the patch the object size is recalculated from anchor on opening. tdf#137355, tdf#137044, tdf#115655 The old solution has recalculated the snap rectangle based on current state of hidden row or column. That has produced shapes of zero width or height and loss of offset in case start or end cell of the shape was hidden. In running LO it was partly offset by using cached infos in ScDrawObjData. That failed in case of save and reload. Solution is, to only change visible shapes. It is enough to adapt the shape when it becomes visible. That is introduced in RecalcPos and SetCellAnchoredFromPosition. tdf#137216 Shapes anchored to cell were not hidden, if the column of its anchor was hidden, and undo of hiding an image in a cell by hiding its column didn't work. Reason was, that the shapes were not set to hidden in the shapes geometry. Solution is to copy a similar part from SetRowHidden to SetColHidden. without bugreport, but detected while debugging LO has used a cell reference with bHiddenAsZero as true in shape export. That has resulted in wrong offsets. Unittest changes: Test::testGraphicsInGroup() ScShapeTest::testCustomShapeCellAnchoredRotatedShape() Set expected values so, that they correspond to anchor in file. ScFiltersTest::testLegacyCellAnchoredRotatedShape() FIXME is solved now and the test is adaped to reflect that. XSheetAnnotationShapeSupplier::testGetAnnotationShape() Expected value is adapted to the fact, that now annotation shape gets its position after optimal row height is applied. Change-Id: Iffee996054ebf79e04044da5520f8d1a8a48b7c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104643 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2020-09-26Fix typo in codeAndrea Gelmini
It passed "make check" on Linux Change-Id: Ia508a9968a21fc8e316a3ec5bb1aa204c4dfc2c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103453 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-09-23tdf#136949: Revert "tdf#115753 fix table border missing when there are ↵Xisco Fauli
merged cells" This reverts commit 2b19cd84f10552c438dace0a4c52a70ccd440369. Change-Id: I5f3f51e0e816416c364155ab67bc37bb8c6fe545 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103187 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-09-22OUStringLiteral/OStringLiteral coverity PARSE_ERROR workaroundCaolán McNamara
do more like commit 121771e37f7e2de41cd5643475861062bf25627b Date: Mon Sep 21 09:17:54 2020 +0200 Make some OUStringLiteral vars constexpr cause coverity can live with that Change-Id: I9efd7f848289c4865997a44c6780373068422227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-18Disable automatic onFirstVisibleTask UpdateCheck during CppunitTestsStephan Bergmann
Some CppunitTests like CppunitTest_sw_core_layout that use gb_CppunitTest_use_configuration and happen to run enough VCL may trigger the UpdateCheckJob (see example backtrace below), which is known to be problematic as it may spawn (via UpdateCheck) an UpdateCheckThread that is not joined, so it can still run during exit and cause trouble. However, there should be no need for CppunitTests to (accidentally) run that UpdateCheckJob anyway, so disable it. Example backtrace from CppunitTest_sw_core_layout: > #9 0x00007fe612e1e89a in (anonymous namespace)::UpdateCheckJob::execute(com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&) (this=0x3422200, namedValues=uno::Sequence of length 2 = {...}) at extensions/source/update/check/updatecheckjob.cxx:150 > #10 0x00007fe612e1ec45 in non-virtual thunk to (anonymous namespace)::UpdateCheckJob::execute(com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&) () at instdir/program/libupdchklo.so > #11 0x00007fe61917a51e in framework::Job::execute(com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&) (this=0x33bbd30, lDynamicArgs=empty uno::Sequence) at framework/source/jobs/job.cxx:209 > #12 0x00007fe61918ae85 in (anonymous namespace)::JobExecutor::trigger(rtl::OUString const&) (this=0x3050030, sEvent="onFirstVisibleTask") at framework/source/jobs/jobexecutor.cxx:238 > #13 0x00007fe619267b09 in (anonymous namespace)::XFrameImpl::windowShown(com::sun::star::lang::EventObject const&) (this=0x31db1c0) at framework/source/services/frame.cxx:2606 > #14 0x00007fe6187b3107 in WindowListenerMultiplexer::windowShown(com::sun::star::lang::EventObject const&) (this=0x32136a8, evt=...) at toolkit/source/helper/listenermultiplexer.cxx:85 > #15 0x00007fe61855989b in VCLXWindow::ProcessWindowEvent(VclWindowEvent const&) (this=0x31d22c8, rVclWindowEvent=...) at toolkit/source/awt/vclxwindow.cxx:480 > #16 0x00007fe6185591a9 in VCLXWindow::WindowEventListener(VclWindowEvent&) (this=0x31d22c8, rEvent=...) at toolkit/source/awt/vclxwindow.cxx:396 > #17 0x00007fe618558a00 in VCLXWindow::LinkStubWindowEventListener(void*, VclWindowEvent&) (instance=0x31d22c8, data=...) at toolkit/source/awt/vclxwindow.cxx:390 > #18 0x00007fe622f934c8 in Link<VclWindowEvent&, void>::Call(VclWindowEvent&) const (this=0x341f540, data=...) at include/tools/link.hxx:111 > #19 0x00007fe622f8f5bb in vcl::Window::CallEventListeners(VclEventId, void*) (this=0x3115da0, nEvent=VclEventId::WindowShow, pData=0x3115da0) at vcl/source/window/event.cxx:256 > #20 0x00007fe6230fbbb3 in vcl::Window::ImplSetReallyVisible() (this=0x3115da0) at vcl/source/window/window.cxx:1306 > #21 0x00007fe6230fbc9e in vcl::Window::ImplSetReallyVisible() (this=0x30ecc20) at vcl/source/window/window.cxx:1322 > #22 0x00007fe6230ff712 in vcl::Window::Show(bool, ShowFlags) (this=0x30ecc20, bVisible=true, nFlags=ShowFlags::NONE) at vcl/source/window/window.cxx:2312 > #23 0x00007fe6230ff859 in vcl::Window::Show(bool, ShowFlags) (this=0x3115da0, bVisible=true, nFlags=ShowFlags::NONE) at vcl/source/window/window.cxx:2328 > #24 0x00007fe6190aa53d in framework::StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() (this=0x32d83f0) at framework/source/helper/statusindicatorfactory.cxx:373 > #25 0x00007fe6190a9b65 in framework::StatusIndicatorFactory::start(com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> const&, rtl::OUString const&, int) (this=0x32d83f0, xChild=uno::Reference to (class framework::StatusIndicator *) 0x31128a8, sText="Loading :", nRange=4) at framework/source/helper/statusindicatorfactory.cxx:133 > #26 0x00007fe6190a74cf in framework::StatusIndicator::start(rtl::OUString const&, int) (this=0x3112880, sText="Loading :", nRange=4) at framework/source/helper/statusindicator.cxx:51 > #27 0x00007fe612f3263d in XmlFilterAdaptor::importImpl(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x3420600, aDescriptor=uno::Sequence of length 12 = {...}) at filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:70 > #28 0x00007fe612f36564 in XmlFilterAdaptor::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x3420600, aDescriptor=uno::Sequence of length 12 = {...}) at filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx:308 > #29 0x00007fe61dc6f02d in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) (this=0x32fa6a0, rMedium=..., xInsertPosition=empty uno::Reference) at sfx2/source/doc/objstor.cxx:2251 > #30 0x00007fe61dc61688 in SfxObjectShell::DoLoad(SfxMedium*) (this=0x32fa6a0, pMed=0x3316a40) at sfx2/source/doc/objstor.cxx:738 > #31 0x00007fe61dcc8e28 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x3320b00, seqArguments=uno::Sequence of length 14 = {...}) at sfx2/source/doc/sfxbasemodel.cxx:1883 > #32 0x00007fe61de63f9c in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) (this=0x32deca0, rArgs=uno::Sequence of length 11 = {...}, _rTargetFrame=uno::Reference to (class (anonymous namespace)::XFrameImpl *) 0x31db230) at sfx2/source/view/frmload.cxx:680 > #33 0x00007fe6191f5f31 in framework::LoadEnv::impl_loadContent() (this=0x7ffe003aa618) at framework/source/loadenv/loadenv.cxx:1157 > #34 0x00007fe6191f2c12 in framework::LoadEnv::start() (this=0x7ffe003aa618) at framework/source/loadenv/loadenv.cxx:395 > #35 0x00007fe6191f0960 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) (this=0x7ffe003aa618, sURL="file:///sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt", lMediaDescriptor=uno::Sequence of length 2 = {...}, xBaseFrame=uno::Reference to (class framework::Desktop *) 0x29e7768, sTarget="_default", nSearchFlags=0, eFeature=LoadEnvFeatures::NONE) at framework/source/loadenv/loadenv.cxx:300 > #36 0x00007fe6191ef2dc in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (xLoader=uno::Reference to (class framework::Desktop *) 0x29e7778, xContext=uno::Reference to (class cppu::(anonymous namespace)::ComponentContext *) 0x2124250, sURL="file:///sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt", sTarget="_default", nSearchFlags=0, lArgs=uno::Sequence of length 2 = {...}) at framework/source/loadenv/loadenv.cxx:169 > #37 0x00007fe6192514b2 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x29e7700, sURL="file:///sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt", sTargetFrameName="_default", nSearchFlags=0, lArguments=uno::Sequence of length 2 = {...}) at framework/source/services/desktop.cxx:593 > #38 0x00007fe619251575 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) () at instdir/program/libfwklo.so > #39 0x00007fe61a48bc68 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x3045750, rURL="file:///sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt", rDocService="com.sun.star.text.TextDocument", rExtraArgs=empty uno::Sequence) at unotest/source/cpp/macros_test.cxx:61 > #40 0x00007fe61a53754d in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) (this=0x3045700, rURL="file:///sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt", pName=0x7fe621e07e58 "tdf134783_testAnchorPositionBasedOnParagraph.fodt", pPassword=0x0) at sw/qa/unit/swmodeltestbase.cxx:514 > #41 0x00007fe621e15f7a in SwModelTestBase::load(rtl::OUString const&, char const*, char const*) (this=0x3045700, pDir="/sw/qa/core/layout/data/", pName=0x7fe621e07e58 "tdf134783_testAnchorPositionBasedOnParagraph.fodt", pPassword=0x0) at sw/qa/inc/swmodeltestbase.hxx:348 > #42 0x00007fe621e150ea in testAnchorPositionBasedOnParagraph::TestBody() (this=0x3045700) at sw/qa/core/layout/layout.cxx:155 Change-Id: Idcd348ecfa6b6495d9a8710e142232baed8ff45f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103003 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-01Fix typo in codeAndrea Gelmini
It passed "make check" on Linux Change-Id: I77ea2951798ce84bb5ec617ff16e7ea918b8ef5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101795 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-08-31Fix typo in codeAndrea Gelmini
It passed "make check" on Linux Change-Id: Ia1fbd635d7d13c69c9b8911eadaa86ee5f7aadb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101707 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-13loplugin:stringstatic also look for local staticsNoel Grandin
Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-11loplugin:flattenNoel Grandin
Change-Id: I6560756eb63856a22b43e3e65a7b7843cd2d5376 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100447 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-30terminate XDesktop properly in unit testsNoel Grandin
So that the UNO constructor work can continue - where we need the desktop to be disposed properly so that all UNO constructors objects have their dispose() called, and they can clean up their global state. We detect this case by changing a SAL_WARN to an assert in Desktop::disposing() (*) in ~ScTabViewShell, don't call EnterHandler, because that tries to create EditEngine's and other stuff, which crashes (*) Need a fake singleton so that the servicemanager calls dispose() on the AnalysAddIn and we can clear the global variable there. Change-Id: Id13b51e17afc16fcbbc65d64281cdf847e4a58cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99640 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-29tdf#115753 fix table border missing when there are merged cellsnd101
Remove code that ignores merged cells. Change-Id: I907220e9ffc9d18561171efd7d6b39d14a8341fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93836 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-10replace usage of blacklist with excludelist for IWYUThorsten Behrens
Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 Change-Id: I2f22d455d2a936a85750eaab1fda215ebb6d9d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98182 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-08distinguish between dialog screenshoting and rendering a widgetCaolán McNamara
Change-Id: I43ee0c68d72c97a15d26e2ffea577c2a44ba91e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98326 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-02Upcoming improved loplugin:staticanonymous -> redundantstatic: testStephan Bergmann
Change-Id: I7926d0fef411337e637bca6d0f18ea75a12dc522 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97704 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-24test: set LoadExoticFileFormats to 2 for cppunit test purposesMiklos Vajna
So that in case the officecfg/ default for LoadExoticFileFormats is set to 1 for more conservative users, the tests still pass. make CppunitTest_writerperfect_epubexport CPPUNIT_TEST_NAME="testAbi11105" was one such case when a failure happens without this fix. Change-Id: I7b2dbbf7e64da850cf442ff41e2b6e5fec47d00a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96978 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-06-19Move data for signing tests to test/Miklos Vajna
This was duplicated under xmlsecurity and made it hard to have test code outside xmlsecurity, even if the core of the pdf signing is nowadays under svl/. Change-Id: If5ce8269bb72f503263727d8255fe856742dfa60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96745 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-06-05Upcoming loplugin:elidestringvar: testStephan Bergmann
Change-Id: Id28d83963443e85bf8309bf41fa28140c4070af8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95580 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-29Fix order of some CPPUNIT_ASSERT_EQUAL argumentsStephan Bergmann
"aExpectedContent" apparently denotes the expected value, which goes first. Change-Id: I3d902cb9bd4bbd19e466dd53e68130857b3be7c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95151 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-12tdf#127778 DOCX import: fix unexpected heading on non-first page ...Miklos Vajna
... when the first page has a heading Regression from commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page header should always set default headers as well, 2014-11-21), the problem is around how to split a first + follow page style on import, and then do the opposite on export. This is described using a single section in OOXML, but Writer has 2 page styles for this (unlike in case of the DOC filter). This means the header margin has to be taken from one of these page styles. The above commit tweaked the import, so the follow page style has the wanted header margin, but this leads to incorrect layout. Fix the problem by tweaking the export instead: it has random access to the doc model, so it can take the header margin from the first page style if needed, and then the import side can be reverted, leading to correct layout. Also remove some leftover debug code in test/, which was added in commit 5352d45dd4a04f8f02cf7f6ad4169126d3b3586a (convert AnimationImport to fast-parser APIs, 2020-02-18). Change-Id: I4bbf7271f3a437e8432399bd1e32e9d24190a501 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94013 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-05-10Fix typoAndrea Gelmini
Change-Id: I5fe3a2891a0af26ce17d8e151ce68df38cfcc824 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93938 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-05-07fix memory leak of xmlDoc objectsNoel Grandin
in unit tests Change-Id: Id16731bbbe2f1b0e3642722d77aba04fc98db4cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93508 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-26Fix typo in codeAndrea Gelmini
Change-Id: I4709f3fd11c8d5800efab65b6f9533cbad3ffe78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92927 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-04-08SVG export: fix lost semi-transparent line shapesMiklos Vajna
The line shape itself didn't really have a height, rather it had a stroke. For some reason, the SVG mask then decides that nothing has to be painted there, so unless the line is entirely opaque, the line shape gets lost on export. Fix the problem by handling transparency similar to the PDF export, which detects if the whole purpose of the transparency gradient is to pass around a transparency percentage. We don't need a mask in that case, we can just use opacity as described at e.g. <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/opacity>. Change-Id: I0355b9b09b6dd48bbacc5b7cc54fb71866304ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91932 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-03-14tdf#130975 replace `rtl::math::isNan` with `std::isnan`.Yukio Siraichi
Change-Id: I5d53e6369d35093445b2efd8936bbf8c6775ff47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90451 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-03-13Revert "loplugin:constfields in sw"Noel Grandin
This reverts commit 4969f4c0d3e2581aaa8a5b5a5769840fa6b6f8ea. Change-Id: I527e9366b05e8a20633720e334395b285991c524 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90473 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-05Fix typoAndrea Gelmini
Change-Id: Id1adbd647f8be20fa3ccd4d07b879885e56ea776 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89958 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-03-03test: log the validator cmdlineMiklos Vajna
The validator cmdline is fairly nontrivial, log it so that in case it fails, one can invoke it manually without having to hunt down the string in a debugger. Change-Id: Id18c6d67f1b3b78da31e8be8c60f703623b80309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89875 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-03-03remove some dead codeNoel Grandin
GpgComponentFactory is unused since: commit 06d7dbb3568889aa50f46d6307a39fa53a17313b Date: Sun May 21 14:28:57 2017 +0200 gpg4libre: share static xmlsec lib between nss and gpg tableautoformatfield.cxx should have been removed in: commit 5990beed9aba690ea9487e2c4a64615b7504a0a1 Date: Fri Aug 29 16:37:43 2014 +0200 Dead code xmlRow is unused since initial import Change-Id: Ief186e9ef46238cc8cdb49f4adde52a45a98cbc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89830 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-27convert AnimationImport to fast-parser APIsNoel Grandin
And... (*) space out the namespace constant values so I dont keep forgetting and making them overlap. (*) Remove CreateDocumentContext from SvXMLImport since it is now unused. Change-Id: I30f54bfc1389e91b18e4fee8b83e1b297419899b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88938 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-10cppcheck: redundantInitialization in XSheetCondition::testGetSetOperator()Muhammet Kara
Change-Id: I0895478ec5bbb69cc8a7d88d848755aeabe7b51d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88350 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2020-02-07test: move component context from subclasses to BootstrapFixtureMiklos Vajna
To avoid duplication. Change-Id: I0ee7c26d5d55bd868ead04c77e7f4ef2582f90e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88138 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-03make some headers privateCaolán McNamara
as shown with ./bin/find-headers-to-move-inside-modules.py Change-Id: I7662417e76fe00c0fc352957560e104b6c2a3d61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87850 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-01-31clang-tidy modernize-concat-nested-namespaceNoel Grandin
Change-Id: Iab35a8b85b3ba1df791c774f40b037f9420a071a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86708 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-28New loplugin:unsignedcompareStephan Bergmann
"Find explicit casts from signed to unsigned integer in comparison against unsigned integer, where the cast is presumably used to avoid warnings about signed vs. unsigned comparisons, and could thus be replaced with o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx) o3tl::make_unsigned requires its argument to be non-negative, and there is a chance that some original code like static_cast<sal_uInt32>(n) >= c used the explicit cast to actually force a (potentially negative) value of sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the cast to avoid a false "signed vs. unsigned comparison" warning in a case where n is known to be non-negative. It appears that restricting this plugin to non- equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=) is a useful heuristic to avoid such false positives. The only remainging false positive I found was 0288c8ffecff4956a52b9147d441979941e8b87f "Rephrase cast from sal_Int32 to sal_uInt32". But which of course does not mean that there were no further false positivies that I missed. So this commit may accidentally introduce some false hits of the assert in o3tl::make_unsigned. At least, it passed a full (Linux ASan+UBSan --enable-dbgutil) `make check && make screenshot`. It is by design that o3tl::make_unsigned only accepts signed integer parameter types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses which would in general be suspicious. But the STATIC_ARRAY_SELECT macro in include/oox/helper/helper.hxx is used with both signed and unsigned types, so needs a little oox::detail::make_unsigned helper function for now. (The ultimate fix being to get rid of the macro in the first place.) Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-25tdf#124176: Use pragma once instead of include guardEfdal İncesu
Change-Id: Ic525a57880067fc589346b87237c08fae4644ac5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87403 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2019-12-23sal_Char->char in test..testtoolsNoel Grandin
Change-Id: I060d5fc9124dc46b57400d108a889e4c879b5e8c Reviewed-on: https://gerrit.libreoffice.org/85731 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-23XStyleLoader::loadStylesFromURL Allow loading from streamSamuel Mehrbrodt
Change-Id: Iab0c301096118203466dd91c724c25f1283a0488 Reviewed-on: https://gerrit.libreoffice.org/85392 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-12-20sidebarwrap is conforming nowCaolán McNamara
Change-Id: Idca7964555a3ede2842473ec47752095d612bff2 Reviewed-on: https://gerrit.libreoffice.org/85576 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-12-20remove unused sidebarpage.uiCaolán McNamara
since... commit 292560a957498bed70b625c992ec6bcf631dceb3 Date: Mon Oct 17 13:23:23 2016 +0200 loplugin:unusedmethods Change-Id: I3a954cbeef459195247d22e17d2a0377f516f307 Reviewed-on: https://gerrit.libreoffice.org/85575 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-12-19these .ui no longer need special handlingCaolán McNamara
Change-Id: I1b112ea6780ff5da2b8aa86f8039b47e98219f08 Reviewed-on: https://gerrit.libreoffice.org/85407 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-12-19tdf#42949 Fix IWYU warnings in test/Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Id1ee9b6d44315443d023bdfbf9ae8e5aa2158ab2 Reviewed-on: https://gerrit.libreoffice.org/85171 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-12-06Test results across all imported and inserted sheets.Eike Rathke
Change-Id: I573467a962a2835765cc5672b81cce4c7772ddff Reviewed-on: https://gerrit.libreoffice.org/84669 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2019-12-06Swap expected and actual valuesEike Rathke
in CPPUNIT_ASSERT... the first parameter is the expected value and the second the actual value. Passing them swapped is confusing if the test is failing. Change-Id: I06f8f345d52c3743d10441aae6d8c943f9b49b41 Reviewed-on: https://gerrit.libreoffice.org/84635 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2019-12-06Use correct destination sheet instead of arbitrary leftover of expected nameEike Rathke
Tests are executed in sequence, inserting a sheet with each importSheetToCopy(), ended up with 'SheetToCopy_4' as the first sheet (last sheet inserted), but obtained "destination" values from sheet 'SheetToCopy' (the first sheet inserted) whatever may have happened to its references during the previous tests or by inserting more sheets in front of it. Instead of obtaining the destination sheet by name 'SheetToCopy', obtain it by index 0 where it was inserted We could also remove the inserted sheet after each test, but likely a cleaner approach would be to setup a fresh document to be inserted into for each test to avoid any side effects like names already being present from a previous insertion. Change-Id: I38f35ccac7d656026b6fec8d3c5faa68d6f4a642 Reviewed-on: https://gerrit.libreoffice.org/84631 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2019-12-03Silence false -Werror=maybe-uninitializedStephan Bergmann
...where success of >>= has already been checked with CPPUNIT_ASSERT Change-Id: I9aa553749988b6b2e26d9a5ac5b376cc5997aba7 Reviewed-on: https://gerrit.libreoffice.org/84335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>