summaryrefslogtreecommitdiff
path: root/sfx2/qa/cppunit
AgeCommit message (Collapse)Author
2024-10-05Use good old string literals in assertXPath and friendsMike Kaganski
These are only sent to an external API expecting char*-like strings, or for comparison. Having every assertXPath having three of _[ou]str is too much syntactic noise, making the unit tests almost unreadable. Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2024-10-01cool#9992 lok doc sign: update sign status after modify the list of trusted CAsMiklos Vajna
Load a document, sign it, "green" icon on the status bar. Reload the document, turns into a "yellow" icon saying the CA is not trusted, when it was already trusted before. The trouble is that the document signature status is calculated on load, and the CA to be trusted is only given later, as part of the initialization of the LOK view. Fix the problem by invalidating the signature state when a new CA is trusted. The test document was produced by signing an empty document using the keys from xmlsecurity/qa/xmlsec/data/, which gives us a way to create a signature that is initially not trusted. Change-Id: I1e1dbf616ce54c4823d62104f838342de6870f52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174307 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-24sfx2: move DocumentProperties from Java to CppUnittestXisco Fauli
Change-Id: I007ff75fb63a20304726a22fa3d949eb3616069e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173820 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-09-23cool#9992 lok doc sign: handle .uno:SignatureCert/Key/Ca view optionsMiklos Vajna
The desktop way to sign documents is to manually import a .p12 file into your Firefox user profile, and then the signing key is available in all views. The LOK case wants per-view signing certificates, set in a way similar to the name of the user. Start implementing this by: 1) Extending initializeForRendering() to have JSON entries for the signing cert/key/ca chain. 2) Importing the CA chain as trusted certificates, using a new SfxLokHelper::extractCertificates() + test for this. 3) Marking a certificate as trusted is tricky, extract SfxLokHelper::addCertificate() from the existing doc_addCertificate() to do this. 4) Parsing the signing certificate, but just warn if that fails, still need to connect that to the SfxViewShell later. Change-Id: I00e40b3cdd68dbe8994f28861dc7b0f578189643 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173806 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-19unoxml: move these two tests where they belongXisco Fauli
so they can make use of CPPUNIT_ASSERT_STATEMENT_EQUAL They were moved ported from Java to CppUnittest in commit e42be49887e75c6ec748b6c48bb4e5eda295c715 Author: Xisco Fauli <xiscofauli@libreoffice.org> Date: Wed Jul 3 10:09:54 2024 +0200 tdf#123293: port test from Java to CppUnitTest and commit d6ad09ca884fb7f35e2e24d532d85f6d818a7f1b Author: Xisco Fauli <xiscofauli@libreoffice.org> Date: Tue Jul 2 18:00:26 2024 +0200 sfx2: port checkRDFa from Java to CppUnittest Change-Id: I7b91bde6d968081a5b1c0bbee42208590e062ea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173622 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-09-16tdf#161876 sfx2 store: refuse to overwrite read-only filesMiklos Vajna
Create a read-only file, try to save-as the current document and select the existing read-only file, accept to overwrite it, works fine. This is a regression from commit 2157a3536f97ff5ae7c82611a801fef7e3708983 (sfx2 store: try rename before copying, 2018-01-09), previously such read-only targets were rejected. Fix the problem by explicitly checking if the target is writable: if not, then avoid the rename optimization, because the fallback path will reject the request as expected. Fix this inside an '#ifdef UNX' block, the problem is reportedly not there on Windows. Change-Id: Ifd8798e07a1be504c6747514a53cfc4ff2338a0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173344 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2024-07-03tdf#123293: port test from Java to CppUnitTestXisco Fauli
Change-Id: I5297a041970871ab0fba6a71d59639b07072b64b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169889 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-07-03Fix typoAndrea Gelmini
Change-Id: I5c4735345bdb2a574e4b79ba7bfc88e95d0bf878 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169936 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-07-03sfx2: port checkRDFa from Java to CppUnittestXisco Fauli
TESTRDFA.odt is still used by checkTdf123293. (To be ported in a follow-up commit) while at it, move existing 'hello.odt' file from misc to data, this is the normal folder name for files everywhere Change-Id: I3ab12550e1d2e7654cb59c55c6da40b6c28b7e46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169888 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-05-15WaE: C6011 Dereferencing NULL pointer warningsCaolán McNamara
Change-Id: I1d603f804bada2a6cd9fd8784da4de125a2b87fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167663 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-10loplugin:ostr in sfx2Noel Grandin
Change-Id: I6306260d03c1208ec250c2f9a3860fa569f6d9c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167448 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-01-03UnoApiTest::loadFromURL -> UnoApiTest::loadFromFileMike Kaganski
The old name was misleading (it doesn't take an URL, but a filename); also, now it's easier to grep for it - doesn't get mixed with vcl::graphic::loadFromURL. Change-Id: Ib88d2194200a6a54d2326971e0306ba39f0c7025 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161578 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-19Extended loplugin:ostr: sfx2Stephan Bergmann
Change-Id: I7b2988ed246a0b1b0af0721521ba738ba3de2f27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159677 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-22Fix typoAndrea Gelmini
"an other" -> "another" Change-Id: Id0a2b8f99fd4f87e94e65570ebc75bfdf0d205ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143597 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2022-11-30sfx2: extend .uno:SetDocumentProperties to update custom doc propsMiklos Vajna
Scripting clients (like the LOK API) had a way to get all custom properties where the name matches a certain prefix, but setting such properties was not possible. .uno:SetDocumentProperties can already show a dialog to edit properties interactively and had a parameter to set some properties in a non-interactive way, but there doesn't seem to be a way to influence custom properties there without using the internal API. Fix the problem by adding a new UpdatedProperties parameter that allows removing all old custom properties matching the prefix and adding new ones with a single UNO command dispatch. This is meant to be the write side of the reading commit 5e8f6dcb8ce00d2d5e35b3cf5654187b3068276c (sw lok, .uno:SetDocumentProperties: expose value of custom document properties, 2022-11-29). Change-Id: Ib7450d4d21285d9a73758e1c172543521fc07cef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143491 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-11-24Remove some unused includesMiklos Vajna
Mostly com/sun/star/frame/Desktop.hpp is unused after inheriting from UnoApiTest. Change-Id: Ifba307353a11a14e033a230a291314bee86b51c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143190 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-11-08UnoApiTest: simplify code by using tempfile memberXisco Fauli
SwModelTestBase does the same. this will help to make SwModelTestBase inherit from UnoApiTest Change-Id: If1c824cf92f0e8b70253e4d5fdeddcaa521d4632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142287 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-03qa: remove duplicated codeXisco Fauli
Change-Id: I13da5ca9d07131a340dcf95ca0b980d75ca6e9d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142229 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-03UnoApiXmlTest: add new wrapper for XmlTestTools testsXisco Fauli
Change-Id: I767f464ec666330a2e8e832b6d6f5736a6bef54d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142228 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-02CppunitTest_sfx2_view: inherit from UnoApiTestXisco Fauli
Change-Id: I5a2d62fde3e14bdd47b4d7d3511a30cbd1629b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142125 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-01CppunitTest_sfx2_misc: inherit from UnoApiTestXisco Fauli
Change-Id: Ib3eff92f9e9e84afb3953991bd453ec5e9a4cef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142124 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-01CppunitTest_sfx2_classification: inherit from UnoApiTestXisco Fauli
Change-Id: Iab05ead4aecc619c41cac7cfcfa8e3f57ef21601 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142123 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-01CppunitTest_sfx2_doc: inherit from UnoApiTestXisco Fauli
Change-Id: Ic28ffe09bfc79ca3b254bd060f43eae289e7b488 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142122 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-09-29split utl::TempFile into fast and named variantsNoel Grandin
which makes it easier to know what each variant requires to stay on it's happy path Change-Id: I3275a2543573367714bc78092e882f6535507285 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-10add missing 'xComponent->dispose()' to a testLuboš Luňák
Change-Id: I0ae2847e81eb2f1fba16e65d89ca1db1e55ac4b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135577 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-05-04Just use Any ctor instead of makeAny in sfx2Stephan Bergmann
Change-Id: Ie707881d6f4cd4a2f92f4f5a89aa9e0b051db8a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133783 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-01Recheck modules s[f-t]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I1f520aad1b1c942ad5616d96851016fc366ac58f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130203 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-02-23CppunitTest_sfx2_classification: remove duplicated dispatchCommandXisco Fauli
it's already defined in unotest::MacrosTest Change-Id: I34645b95d83ca1ed167c99bd12c9b6ffebef032c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130400 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-08-30tdf#139734 Drop redundant asserts after MacrosTest::loadFromDesktop4k5h1t
Change-Id: I7347d2c9429647e9cd87ad8147848d24f717d181 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121222 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-16Remove some unused includesMiklos Vajna
See tdf#42949 for motivation. Change-Id: Idf7aa9c902b656c05dc7871675c90dae63289815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114192 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-03-14tdf#139734 Drop redundant asserts after MacrosTest::loadFromDesktopdipanshu124
MacrosTest::loadFromDesktop itself asserts on its return value. Thus, there additional checks in unit tests are redundant. Change-Id: Iec9be2293c6337fa747c78a0963e31aa99b60772 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111810 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-23sfx2 store: fix export to PDF when dir name is URL-encodedMiklos Vajna
Regression from commit 5259ab8104cfba60c40748ed0cd59d93df038c5b (sfx2 store: create temp files next to local files, 2018-01-08), the problem was that the directory hosting the input ODT file was called "Bugzilla%C3%BF" (URL-encoded from "ÿ"), we got this as "Bugzilla%25C3%25BF" (encoded from directory name), but we forgot to decode it before passing this URL to the utl::TempFile ctor as a parent directory, which resulted in failing to save as PDF, and crashing on DOCX export. Note that in practice this only caused a problem on Windows. Change-Id: I5fc8a356b63efc2f16405a14ee59a061b52c5205 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111359 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-02-11tdf#140280 sfx2: fix crash on double-clicking a no-sign shape in read-only modeMiklos Vajna
Don't assume that all shapes provide an InteropGrabBag UNO property, check for it. Change-Id: I6347c54b0631c37154424babbfbd52f802af57d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110726 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
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>
2021-02-01tdf#60237 - correct the behaviour of the Overwrite propertyAndreas Heinisch
If the Overwrite property of the MediaDescriptor is set to false, try to write the file before trying to rename or copy it. If the file already exists, raise an error (ERRCODE_IO_ALREADYEXISTS). In addition, the documentation about the default option was corrected. Change-Id: I1031dca3a039343fc599d194fcaa99a20dd13e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110089 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-01-10fix coverity parse errorsCaolán McNamara
Change-Id: I4884bfb67a061b865e8cf38b2fea6de0cb1bc3d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109057 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@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-26New loplugin:stringliteralvarStephan Bergmann
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-05clean up some temp files after running testsAndras Timar
Change-Id: Ia28e96cf1f6ec476f202e99877fa80e93d691278 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105314 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-09-10Remove some unused includesMiklos Vajna
Change-Id: I296597faa21c995c02f68726abd507d0d46c7f86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102335 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-08-19sd signature line: preserve current page after signingMiklos Vajna
Once the user adds a visible signature to a PDF file, we reload the document, so what you see on the screen matches what's in the file (and you can add a next signature). Make sure that in case the signature is not on the first page, the current page state is preserved. Change-Id: Ia1780ce5602ee350855b6dec8340a65e63bf2d4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100999 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-07-01Upcoming improved loplugin:staticanonymous -> redundantstatic: sfx2Stephan Bergmann
Change-Id: I67ac4f4ed5ddd488c3fd5bae83d1fce18d6213d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97662 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-05Upcoming loplugin:elidestringvar: sfx2Stephan Bergmann
Change-Id: I58b77dd04fb0de28fcbf34a22ed73fe248f0c6b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95547 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
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-05-01improve loplugin:makesharedNoel Grandin
to find places where we are converting stuff to unique_ptr instead of using std::make_shared. As a bonus, this tends to find places where we are using shared_ptr where we can instead be using unique_ptr avoiding the locking overhead. Change-Id: I1b57bbc4a6c766b48bba8e25a55161800e149f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93207 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-12Revert "loplugin:constfields in sfx2"Noel Grandin
This reverts commit 8411b80d46765f1ddd4e37aa634ec963dcf4b04f. Change-Id: Ibf3aa3ce4bfedf9d47001ad824db7c48ff093a21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90416 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-01-21tdf#42949 Fix IWYU warnings in sfx2/source/[s-v]*/*cxx and sfx2/qaGabor Kelemen
Also quickly recheck other parts of sfx2 after recent welding there Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Iff847f142557b5b253887add12c005821554ef65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86891 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-10-09this text -> this testCaolán McNamara
Change-Id: Ibcbd9efb72b0081a3eb6da6df41b9b9fac0584ea Reviewed-on: https://gerrit.libreoffice.org/80519 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-05-13Handle *link return value in sfx2 testJan-Marek Glogowski
Change-Id: I63008858558312b5fb7378249c56fbc3729c9a19 Reviewed-on: https://gerrit.libreoffice.org/72180 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>