summaryrefslogtreecommitdiff
path: root/sfx2/qa
AgeCommit message (Collapse)Author
2024-10-21Optimize JsonToPropertyValues a bitMike Kaganski
1. Make it take string view: helps to avoid extra string allocation e.g. in desktop::jsonToPropertyValuesVector, and will help more, when C++26 stringstream ctor taking string view is available. 2. Factor out a function taking boost::property_tree::ptree, making implementation simpler for [][]com.sun.star.beans.PropertyValue and []com.sun.star.beans.PropertyValue, without writing a child node to a JSON string, and parsing it again. Change-Id: I16ac2641633ea67a7c9c054c9df09a790500e6fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175361 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
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-21sfx2: move rdf java test to CppUnittestXisco Fauli
Change-Id: Id66b752fdcf23546416b3b7f99e2f61756c3a76d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173664 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
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-28sfx2, solenv, sw: fix issues found by Ruff linterIlmari Lauhakangas
Change-Id: Iab375e8c8aa4c4915f3c70a9ef6aede268e4619f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171138 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-07-19sfx2/qa: remove unused codeXisco Fauli
Change-Id: I41087f4fc1ab29fb8635b33317390c4b784ae086 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170723 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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-12-27tdf#158803 Fix issues detected by pyflakesChenxiong Qi
Change-Id: Iaa329dff61db894e7d5fecd840e785a53a48b26f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160889 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
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>
2023-11-09enable unchecked lint for our java codeNoel Grandin
and annotate where necessary, mostly just suppressing the warnings Change-Id: I8e39d797cde6c7c3f4e3e1bd93a128965ecec81d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159205 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-02'new Double' is deprecated in JavaNoel Grandin
replace with Double.valueOf Change-Id: If5be8e500e31ebf9d5fb20ea7dd474677d7c74ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158785 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-10sfx2: add config warning in UndoManager complex testMichael Stahl
... and remove obsolete comment, that problem was fixed a decade ago. Change-Id: I06e122128ff009778da87891739016ecc8975895 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134110 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
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-06-29uitest: combine execute_dialog_through_command methodsXisco Fauli
Change-Id: Iaa03d37a9ac3862b8cb08a81e37a611632433880 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118077 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-06-29uitest: guard remaining execute_dialog_through_commandXisco Fauli
Mostly done with a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: Ib8e7c5f5e2c9b8a7756fe533ea4f30349dd68761 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118076 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-06-22uitest: guard load_fileXisco Fauli
Mostly done by a script for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac < UITest: introduce guarded context managers > Change-Id: Ia924293dc2a12230fd13f69fd734875ced86be8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117593 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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-04-08sfx2 objserv uitest: fix missing newlineMiklos Vajna
PEP8 suggests two newlines after the module import list, restore that. Change-Id: I2834104e352f58bce3b8fb10679db6902244977b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113815 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-04-07uitest: remove duplicated codeXisco Fauli
Change-Id: I86a4cd75e103445a288ad52a8c2167fa5b20c794 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113720 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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>