summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2021-10-19xmlsecurity: fix new tests on WNTMichael Stahl
Tests added in commit 40d70d427edddb589eda64fafc2e56536953d274 don't actually run on WNT but that wasn't obvious because commit 149df1fec6472e30582162e17e04c75aee91d26a prevented running them in Jenkins on master, they failed only in the libreoffice-7-1 backport. xmlsecurity/qa/unit/signing/signing.cxx(631) : error : Assertion Test name: testODFDoubleX509Certificate::TestBody assertion failed - Expression: (nActual == SignatureState::NOTVALIDATED || nActual == SignatureState::OK) - 2 This is an oddity where NSS claims the signature in the document is valid but CryptoAPI claims it is invalid; the hashes passed into the validation functions are the same. Just allow BROKEN as an additional result value on WNT. xmlsecurity/qa/unit/signing/signing.cxx(550) : error : Assertion Test name: testODFX509CertificateChain::TestBody equality assertion failed - Expected: 0 - Actual : 1 The problem here is that with NSS the tests use a custom NSS database in test/signing-keys so we need to make these certificates available for CryptoAPI too. The following one-liner converts the NSS database to a PKCS#7 that can be loaded by CrytpAPI: > openssl crl2pkcs7 -nocrl -certfile <(certutil -d sql:test/signing-keys -L | awk '/^[^ ].*,[^ ]*,/ { printf "%s", $1; for (i = 2; i < NF; i++) { printf " %s", $i; } printf "\n"; }' | while read name; do certutil -L -d sql:test/signing-keys -a -n "${name}" ; done) > test/signing-keys/test.p7b Then one might naively assume that something like this would allow these certificates to be added temporarily as trusted CAs: + HCERTSTORE hRoot = CertOpenSystemStoreW( 0, L"Root" ) ; + HCERTSTORE const hExtra = CertOpenStore( + CERT_STORE_PROV_FILENAME_A, + PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, + NULL, + CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG, + path); + if (hExtra != NULL && hRoot != NULL) + { + BOOL ret = CertAddStoreToCollection( + hRoot, + hExtra, + CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, + 0); + SAL_DEBUG("XXX hExtra done " << ret); + } There is no error from this, but it doesn't work. Instead, check if CertGetCertificateChain() sets the CERT_TRUST_IS_UNTRUSTED_ROOT flag and then look up the certificate manually in the extra PKCS#7 store. Change-Id: Ic9865e0b5783211c2128ce0327c4583b7784ff62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123667 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 12403df424cdcc9fe55800af3aea037fd28f1c27) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123645 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-10-18test: upgrade test NSS database from dbm: to sql:Michael Stahl
Fedora nss-3.69.0-1.fc34.x86_64 and Debian libnss3:amd64 2:3.70-1 no longer support the old BerekelyDB databases, so convert them to the new SQLite format for the benefit of --with-system-nss builds. This worked to do the upgrade: > certutil -N -d sql:test/new --empty-password > LD_LIBRARY_PATH=instdir/program workdir/UnpackedTarball/nss/dist/out/bin/certutil --merge -d sql:test/new --source-dir dbm:test/signing-keys Builds would fail running tests added in commit 40d70d427edddb589eda64fafc2e56536953d274 signing.cxx:551:Assertion Test name: testODFX509CertificateChain::TestBody equality assertion failed - Expected: 0 - Actual : 1 Change-Id: I00aa20703e117ebf583c3331b84e966c2cfc78cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123586 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 907784ccce7bd8b5121888cff7f5723a55d35358) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123643 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-10-02tdf#144758: default value for 'table:orientation' attribute is 'row'Mike Kaganski
See [OpenDocument-v1.3-part3] section 19.690.3 <table:database-range>. Regression after commit ed88b144ce24b9a733d4a9ab6614307c96537baa. Also fixes relevant part of unit test first introduced in commit 6069ef7976c4455c1875afecf02c41c5731f6546, which was at that time testing that IsSortColumns property returned false; then in commit fc95d20500997a1a460be6f3553727299a5080eb, the correct value was changed to true, reflecting the regression fixed here. Change-Id: I6a12a0ad13405bc388efb7c2c3bbf31e89905620 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122955 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122975 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-07-12editengine-columns: tdf#143258 Fix handling rotated textMike Kaganski
This reverts modifications to existing unit tests made in commit d0a1616ccad0dd5f5a02c1b0204f537b57d0b4b5. My idea that those changes were required because of more correct calculations was wrong, and in fact they were caused by off-by-1 error in height calculations. Change-Id: Ib94878a911238c977c35a8f8e3e5694cedc79a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118705 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118711 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-02tdf#142871 sw HTML export: avoid unwanted inner PNG for imagesMiklos Vajna
Regression from commit e76471c5ce725dae9abb6f78b7674c6f77df34f4 (sw XHTML / reqif export: export non-PNG graphic shapes directly, 2021-06-02), reqif wants to have a PNG fallback for non-PNG pixel formats, but this is not needed for plain HTML, make this reqif-only. Change-Id: I0fc1bc13ad4bf808afbe68407e7db802f910c7a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118233 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit 2d9580e6a65a2699ff61fc1b0e07f62b4946de84) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118268 Reviewed-by: Miklos Vajna <vmiklos@vmiklos.hu>
2021-06-10schema: update to ODF 1.3 OSMichael Stahl
Change-Id: I97e28612aeeebed709da9ad621250c6b26e55f92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116734 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-06-08chart2: use registerOOXMLNamespaces and registerODFNamespacesXisco Fauli
Change-Id: I2ee15ec29fbf5fc4fcaea035a9cd99ba49453a4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116831 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-06-08editengine-columns: Implement layoutMike Kaganski
This changes the way how different parts access positions of lines and paragraphs. Now there is ImpEditEngine::IterateLineAreas, which performs uniform iteration over all ParaPortions and lines in order, calling a user-provided callback function for each portion and line; it passes all information about current portion, line, area, and column to the callback, and checks the return from the callback, to decide if it needs to continue iteration (in case when callback indicated that if doesn't need further data), and if it needs calling the callback for the rest of current portion's lines. This allows to have the code that calculates and iterates dimensions of lines in one central place, without the need to have duplicating logic in several places. One important exception is ImpEditEngine::Paint, which iterates without ImpEditEngine::IterateLineAreas, because it does many atomic paint operations in different points of iteration process, and implementing ImpEditEngine::IterateLineAreas to call callback in the required places would require increased complexity, which is left for a future change. To make that possible, ImpEditEngine::IterFlag should be extended to indicate additional requirements. Note that in fact, ImpEditEngine::Paint was taken as the model for implementation of ImpEditEngine::IterateLineAreas, with its detailed handling of all the vertical offsets like additional line spacing and interparagraph spacings that depend on context. The notable result of the centralization of the iteration code is slight change of heights reported by ImpEditEngine::CalcTextHeight. Previously it simply added all pre-calculated heights of portions, and not taking into account all the spacing handling that ImpEditEngine::Paint did, which was inconsistent (calculated height was different from painted height). Now ImpEditEngine::CalcTextHeight should provide more accurate results, which required small changes in the unit tests. Change-Id: I33cbb978deb974b314d36fda8674186a03991107 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116034 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-07sd: use registerOOXMLNamespaces and registerODFNamespacesXisco Fauli
While at it, fix incorrect r:Relationships with rels:Relationships Change-Id: Ia8e6556b0e7d3839e00936626627471a7a276071 Change-Id: I77f950dabd4d2131256673e517625d31ade9aa76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116800 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-06-04sc: use XmlTestTools::registerOOXMLNamespaces()Xisco Fauli
after 1ba1bb1cacdc8825d01559859100a2b575967e55 <test: introduce XmlTestTools::registerOOXMLNamespaces() to reduce copy&paste> Change-Id: I5f8fcb977233c30bae74e7cc9fde45d41a523b85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116686 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-06-04test: introduce XmlTestTools::registerOOXMLNamespaces() to reduce copy&pasteMiklos Vajna
sc/ could potentially benefit from this as well, that's not yet done here. Change-Id: I03d0b4afa21a02c74d34aab6e03ab53991df29dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116679 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-04-21loplugin:stringadd replace OUStringLiteral temporaries with OUString::ConcatNoel Grandin
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-12getXPathNode may return nullptrMike Kaganski
E.g., when "Undefined namespace prefix" error is thrown Change-Id: I9dfcf761dc8463e2679fb41962502689c91cd2f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113994 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-09tdf#119457 - check for a valid range name and cell referenceAndreas Heinisch
Change-Id: If23eda52142ba5e59cfd354f2177b1ac1727efaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113341 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
Previously, all of the README files have been renamed to README.md and now, the contents of these files were changed to use Markdown format. Other than format inconsistency, some README.md files lacked information about modules, or were out of date. By using LibreOffice / OpenOffice wiki and other documentation websites, these files were updated. Now every README.md file has a title, and some description. The top-level README.md file is changed to add links to the modules. The result of processing the Markdown format README.md files can be seen at: https://docs.libreoffice.org/ Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-04-01Exclude tests based on device color depth, not RDPMike Kaganski
After 5c9ba1f47d00ed10960b59928befd68f6c020b15, the failures on Jenkins (see 21191d0d8953a3ca6eac6022c0a14a87fe9c5e2a) made it apparent that (at least some of) Jenkins builds also run in RDP sessions. Since the tests excluded in commit 9c6142ec26a0ba61b1cf58d1e6bf0b5376394bcd never failed in Jenkins builds before, it is wrong to exclude all those tests in all RDP sessions: our CI would not test those on Windows. In the meanwhile, I discovered that the system that failed the tests actually had 16-bit color depth, despite RDP being configured to use 32-bit colors; that was the reason why the colors were modified on roundtrip. So it is better to test the actual problem to exclude tests. This reimplements the check that was introduced in commit 9c6142ec26a0ba61b1cf58d1e6bf0b5376394bcd to test default virtual device color depth. Change-Id: I329a3e2d8eca21732c77dcacf15394d1246b2e18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113460 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-26Extract copy&pasted namespace list to XmlTestTools::registerODFNamespaces()Miklos Vajna
Both sw/ and xmloff/ can depend on test/, so no need to duplicate this. Change-Id: I93bfdb4422bdef9f8d28bc37548130fae49829e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113107 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-03-25const OUString -> const OUStringLiteralMike Kaganski
Mostly automated rewrite Change-Id: Ie020a083f898bc126b8fb039d4ecb2e687172da1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112965 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-24Using .md extension/Markdown syntax for modules READMEHossein
Renaming all README files for all top level modules to README.md, applying no content change at this stage to be able to track history of the files. These files should be edited to use correct Markdown syntax later. Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-03-09tdf#140674 sw change tracking: fix :emoji: replacementLászló Németh
Regression from commit 2951c96bcb673a260a09e2c6eb92ca0f99bf0c18 (tdf#83419 sw change tracking: clean-up autocorrect). Note: only :snowman: -> ☃ was added to the test autocorrect file acor_en-GB.dat. Change-Id: Ic3013e969ab937a5f9e5b6d1a6fac2f533b541f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112166 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2021-03-05tdf#139734 Remove redundant asserts after functions loadFromDesktop and loadMoaz
MacrosTest::loadFromDesktop itself asserts on its return value. Thus, the additional checks in unit tests are redundant, and only create noise unrelated to the tested functionality. SwModelTestBase::load calls SwModelTestBase::loadURL which calls loadFromDesktop from within. Change-Id: I30061bbc6e13e05f0cfbf17a7910926070b996f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111547 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-24Fix typoAndrea Gelmini
Change-Id: I98757c517d54d38ac96bc80ddb030d00ddfbb1e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110661 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-02-20loplugin:refcounting in testNoel
Change-Id: I1e741283bffae6c3e40f4e61aaed5c085997c74f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111214 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-17loplugin:referencecasting in test..toolkitNoel
Change-Id: Ia290ff4849f4d7eda978c7b1e2c7f36de744056f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110997 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-08Improve loplugin:cppunitassertequal for CPPUNIT_ASSERT(a && b)Stephan Bergmann
...by re-enabling the code temporarily #if'ed-out in a528392e71bc70136021be4e3d83732fccbb885e "Fixed/improved loplugin:cppunitassertequals" (and which then triggers lots of other lopglugin:cppunitassertequal CPPUNIT_ASSERT -> CPPUNIT_ASSERT_EQUAL warnings). For two css::uno::Reference equality comparisons in cppu/qa/test_any.cxx, it was more straightforward to rewrite them with an explicit call to operator == (which silences loplugin:cppunitassertequal) than to adapt them to CPPUNIT_ASSERT_EQUAL's requirement for arguments of identical types. In sc/qa/unit/ucalc_pivottable.cxx, ScDPItemData needs toString, which has been implemented trivially for now, but might want to combine that with the DEBUG_PIVOT_TABLE-only ScDPItemData::Dump. Change-Id: Iae6d09cf69bd4e52fe4411bba9e50c48e696291c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110546 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11Strength-reduce some OUStringToOString("..."+...)Stephan Bergmann
...to "..."+OUStringToOString(...), in preparation of making OUStringToOString take a std::u16string_view Change-Id: Ic01ca249d4d0eb58ac959ffdf96471308a3715dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107600 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-10Avoid calling OString ctor with null pointerStephan Bergmann
...in preparation of potential future changes from using OString to using std::string_view, where OString has an undocumented feature of allowing construction from a null pointer. This is mostly the result of a manual audit of potentially problematic getenv calls across the code base. But there can be other problematic places too, like the xmlGetProp call in tools/source/xml/XmlWalker.cxx. To identify those, rtl_{string,uString}_newFromStr aborts now in non-production debug builds when a null pointer is passed(and all places that hit with a full `make check screenshot` have been addressed here). Once we are confident that all problematic places have been identified, we should drop support for the undocumented feature (see the TODO in sal/rtl/strtmpl.cxx). Change-Id: I595cc6d4f1cda74add2a3db171323f817d362b08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107430 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-26Introduce BootstrapFixture::IsDefaultDPI convenience functionMike Kaganski
It should be used to conditionally disable tests that are unreliable in non-default-DPI environments. The workaround implemented by use of the function should be temporary, until a proper fix is found. Change-Id: Ie236226fcfd0ffb054149efc2b7a1727506c4ad0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106661 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-24loplugin:stringviewparam extend to comparison operatorsNoel
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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>