summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2022-10-21CalcUnoApiTest: work with mxComponent directlyXisco Fauli1-17/+9
Change-Id: If6f2104ef3136952341c9d5d59a1f9784d0fe4b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141628 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-10-20CalcUnoApiTest: factor out common codeXisco Fauli1-0/+25
Change-Id: I1a56f152d6c6e6bca55ef20d0d52da2d82b77a8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141565 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-10-19sc: factor out common code in testsXisco Fauli2-0/+15
Change-Id: I58558dd87f235bf3699f3f65271522bb1e7a2ea0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141529 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-10-17CalcUnoApiTest: factor out tearDownXisco Fauli1-0/+1
Change-Id: Iae1ae76c1903ff3155da2dd407f1237c29f91840 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141375 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-10-06[API CHANGE] Resolves tdf#131136 - Remove option "Use printer metrics"Heiko Tietze1-1/+0
Option is out-dated and access via UI confusing * UI access removed from Tools > Options > General (Impress, Calc) resp. > Compatibility (Writer) * Unit tests updated * Tip-Of-The-Day cleaned-up * remove UsePrtMetrics value Change-Id: Ib645f6e1f648455e0536a437be14c2c6a7b25a49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139863 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2022-09-29split utl::TempFile into fast and named variantsNoel Grandin4-4/+4
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-09-14libxml2: upgrade to release 2.10.2Michael Stahl1-0/+2
Fixes CVE-2022-2309 Change-Id: I180218be275d3b6d38f8f74aa51c57e50d2734ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139911 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-09-02[API CHANGE] tdf#150683 a11y: Switch a11y child index to 64 bitMichael Weghorn2-4/+4
With 16k column support in Calc enabled by default in commit 4c5f8ccf0a2320432b8fe91add1dcadf54d9fd58 Date: Tue Mar 8 12:44:49 2022 +0100 change default Calc number of columns to 16384 (tdf#50916) , the number of Calc cells in a spreadsheet is larger than SAL_MAX_INT32, meaning that a 32-bit a11y child index is no more enough and using it resulted in integer overflows in methods handling corresponding Calc cells in the a11y layer. This e.g. had the effect of the Orca and NVDA screen readers not announcing focused or selected cells properly when their a11y child index was out of the 32-bit integer range. Switch the internal a11y child indices to 64 bit to be able to handle this properly internally. Since the platform APIs (at least AT-SPI on Linux and IAccessible2 on Windows; from what I can see LO's macOS a11y bridge doesn't directly expose the child index) are still restricted to 32 bit, larger child indices still cannot be exposed via the platform APIs. As a consequence, use of the the IAccessible2 and AT-SPI methods that use the child index remains problematic in those cases where the child index is larger. However, as an alternative to using the AT-SPI Table interface and the IAccessibleTable/ IAccessibleTable2 interfaces with the child index to retrieve information about a specific cell, both AT-SPI and IAccessible2 also provide interfaces to retrieve that information directly from the cell object (TableCell interface for AT-SPI, IAccessibleTableCell for IAccessible2). Those interfaces are already implemented/exposed for winaccessibility (s. `CAccTable`) and the qt5/qt6/kf5 VCL plugins (s. the `QAccessibleTableCellInterface` methods implemented in `QtAccessibleInterface`). With the switch to 64-bit internal a11y child indices, these now behave correctly for cells with a child index that doesn't fit into 32 bit as well. NVDA on Windows already uses the IAccessibleTableCell interface and thus announcing focused cells works fine with this change in place. Orca on Linux currently doesn't make use of the AT-SPI TableCell interface yet, but with a suggested change to do so [1], announcement of selected cells works with the qt6 VCL plugin with a current qtbase dev branch as well - when combined with the suggested changes to implement support for the AT-SPI TableCell interface in Qt [2] [3] and the LO change based on that [4] and a fix for a nullptr dereference [5]. The gtk3 VCL plugin doesn't expose the AT-SPI TableCell interface yet, but once it does so (via `AtkTableCell`), it also works with the suggested Orca change [1] in place. (Adding that is planned for an upcoming change, works with a local WIP patch.) For handling return values that are larger than what platform APIs support, the following approach has been chosen for now: 1) When the return value is for the count of (selected) children, the maximum value N supported by the platform API is returned. (This is what `ScAccessibleTableBase::getAccessibleChildCount` did previously.) The first N elements can be accessed by their actual (selection) indices. 2) When the return value is the child/cell index, -2 is returned for objects whose index is greater than the maximum value supported by the platform API. Using a non-negative value would mean that the index would refer to *another* actually existing child. A child index of -1 on the other hand tends to be interpreted as "child is invalid" or "object isn't actually a child of its (previous) parent any more)". For the Orca case, this would result in objects with a child index of -1 not being announced, as they are considered "zombies" [6]. What's still somewhat problematic is the case where more than 2^31 children are *selected*, since access to those children still happens by the index into the selection in the platform APIs, and not all selected items are accessible this way. (Screen readers usually just retrieve the first and last element from the selection and announce those.) Orca already seems to apply different handling for the case for fully selected rows and columns, so "All cells selected" or "Columns ... to ... selected" is announced just fine even if more than 2^31 cells are selected. (Side note: While Microsoft User Interface Automation - UIA - also uses 32-bit indices, it also has specific methods in the ISelectionProvider2 interface that allow to explicitly retrieve the first and last selected item, `ISelectionProvider2::get_FirstSelectedItem` and `ISelectionProvider2::get_LastSelectedItem`, but we currently don't support UIA on Windows.) Bound checks at the beginning of the methods from the `XAccessibleContext`, `XAccessibleSelection` and `XAccessibleTable` interfaces that take a child index (or in helper methods called by those) should generally already prevent too large indices from being passed to the methods in the lower layer code that take smaller integer types. Such bound checking has been been added in various places where it wasn't present yet. If there any remaining issues of this kind that show after this commit, they can probably be solved in a similar way (s.e.g. the change to `AccessibleBrowseBox::getAccessibleChild` in this commit). A few asserts were also added at places where my understanding is that values shouldn't be larger than what is supported by a called method anyway. A test case will be added in a following change. [1] https://gitlab.gnome.org/GNOME/orca/-/merge_requests/131 [2] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [3] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [4] https://gerrit.libreoffice.org/c/core/+/138750 [5] https://codereview.qt-project.org/c/qt/qtbase/+/430157 [6] https://gitlab.gnome.org/GNOME/orca/-/blob/82c8542002e36e0d3d918088d583162d25136143/src/orca/script_utilities.py#L5155 Change-Id: I3af590c988b0e6754fc72545918412f39e8fea07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-25lok: make sure flushPendingLOKInvalidateTiles() is calledLuboš Luňák1-0/+6
SwViewShellImp::AddPendingLOKInvalidation() collects invalidations, but this was relying on something eventually calling flushPendingLOKInvalidateTiles(), which wasn't guaranteed. If e.g. a spellchecker caused an invalidation from in idle callback and nothing else changed, then the LOK callback handling code didn't know there was something pending. So add an explicit call to ensure to notify about these pending invalidations. Change-Id: I0a9cb0d5aba2fdbbac126cd8a4a3412bef1cab25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136531 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-08-17Return std::optional instead of using bool* argumentMike Kaganski1-8/+6
Change-Id: I47f03411a6677f22291bea4dc06920ab9052349a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138399 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-01Add infrastructure and basic tests including slight UI interactionColomban Wendling4-13/+434
This introduces a couple helper base classes for implementing accessibility tests more easily, and includes a few tests as examples, including basic document layout check and minimal UI interaction through menus. Change-Id: I8961af8be1e7d52dc55fe27c758806d9b4c3c5d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137337 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-07-27Better report unknown constant names by including their valuesColomban Wendling1-3/+11
Change-Id: Id93dedf39ad0e2d1968e80878dd1a1bb07d94b61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137336 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-07-27Fix comparing some Writer objectsColomban Wendling1-0/+21
Offscreen objects in Writer are not exposed as children of their parent, but might be reachable through relations. In this case, similar objects can easily be mistakenly deemed equal (e.g. empty paragraphs will have the same role, empty name and description, etc.). Try to avoid this by taking into account the object's relations, which should at least have different targets if they are not the same. Change-Id: Ie6e1aaf388006b76d014ba2bd26aabef88d7dd6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137335 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2022-07-27Make AccessibilityTools available more widely and use itColomban Wendling2-0/+572
Move AccessibilityTools helper to test/ and use it in accessible_relation_set test replacing the copied over feature and consolidating the test as well. Change-Id: Ia5ea69bb08bb2a86e3eb6c3dba2ab182b612561d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137307 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-07-19Replace old png writer in baseindex.cxxofftkp1-3/+3
Change-Id: I660579ed6ea886f9ab3fc913b785f92740f48dc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137125 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-07-19Replace old png writer in screenshot_test.cxxofftkp1-3/+3
Change-Id: I5271b56bcce32e1ce71544421b9581518b05455e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137124 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-07-12unittest: Split out registry entries to alter UI definition search pathColomban Wendling3-10/+22
Accessibility tests will require testing the normal UI, so will need not alter the search path for definitions. It will however benefit from other environmental overrides (locale, fonts, etc.). The solution here splits out to a separate registry the piece of configuration that alter the UI, so users can select the features set they need. The default gb_CppunitTest_use_configuration is updated to keep working the same as before, using both layers. gb_CppunitTest_use_unittest_configuration is replaced by specific ones for each configuration layer, and the two direct call sites removed as they were redundant anyway (gb_CppunitTest_use_unittest_configuration is only a subset of gb_CppunitTest_use_configuration). New macros are gb_CppunitTest_use_common_configuration for the common layer and gb_CppunitTest_use_user_ui_configuration for the UI one. Change-Id: I75f82092079752b4e173e48ab463636e7b7515b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136997 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-28clang-tidy modernize-pass-by-value in testNoel Grandin1-2/+3
Change-Id: I375ff43a60d0058be36dd07e409027ad1dcd1bcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136558 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-20-Werror=maybe-uninitializedStephan Bergmann1-3/+3
Change-Id: I640fbd373262c008c44b616fbc0c05d28778226d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136083 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03Just use Any ctor instead of makeAny in testStephan Bergmann6-16/+16
Change-Id: I926cabc8be39344ec254e87b429f4d1bc8cfc94f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133763 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03tdf#99708 Save formula bar height to documentSamuel Mehrbrodt1-0/+10
Save the current state of the Calc formula bar to the document. Number of visible lines is saved into the document settings and restored when loading that document. Also adds a UNO property, so that the formula bar height can be changed via UNO. Change-Id: Ifef0c9e42cb4f7465516629d2c22974367e0eb33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133499 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2022-05-01use more string_view in variousNoel Grandin1-2/+3
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-30Chinese Traditional defaults needed for CppunitTest_sw_layoutwriter2Caolán McNamara1-0/+11
Change-Id: Ia11843d7e99e969a2d965de0355e0f9c81709c57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133625 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-29set a CTL_SPREADSHEET font from more_fonts for cppunit testsCaolán McNamara1-2/+8
Change-Id: Iff38496dbdcaec91048e6dd409addac1d0668e21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133614 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-29set CTL_HEADING for cppunit tests to something from more_fontsCaolán McNamara1-1/+4
Change-Id: Ieb2878048017cc186fb98fa3c79eaf72b8e7b798 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133565 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-29move HAVE_EXPORT_VALIDATION from config_features.hLuboš Luňák1-1/+1
So that so much stuff doesn't get rebuilt on --with-java change. Change-Id: I87388590a4fd218fd22e68ba0edd290831f6f0fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133570 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-28set CJK_HEADING and CTL_HEADING for cppunit tests to something from more_fontsCaolán McNamara1-0/+6
Change-Id: Iabd60e6266f0543e258151aa1bc7199eb7edc35f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133559 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-28override default "Segoe UI" for UI_SANS for cppunit testsCaolán McNamara1-0/+3
Change-Id: If8b073c6ed9f9508a03ec65e885313d7a618b600 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133556 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-28set default cjk/ctl fonts for cppunit tests that exist in "more fonts"Caolán McNamara1-1/+31
Change-Id: Ib145f1ce60eb8bb3aef15c803b0d78f684507bc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133550 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-04-10loplugin:stringview check for getToken and trimNoel Grandin1-2/+3
since we now have o3tl versions of those that work on string_view. Also improve those o3tl functions to support both string_view and u16string_view Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-04sc: add support for xr2 namespace and read uid of sparkline groupTomaž Vajngerl1-0/+2
Change-Id: I470819a89338f4fb1d9b2486ffb4d93f8eb42844 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132504 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-04-02Recheck modules t* with IWYUGabor Kelemen2-3/+5
See tdf#42949 for motivation Change-Id: I109fa07d52721fd10354de07a2ed995ffa2f27c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132369 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-03-07Fix some DPI-dependent testsMike Kaganski1-0/+6
Change-Id: I3c669802ac558379498c877c8ac4796bbff80f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131096 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-12-22Separate core drawinglayer func. into drawinglayercore libraryTomaž Vajngerl1-0/+1
This separates the drawinglayer core functionallity into a separate library, to keep a strict separation what is backend dependent and what is not. More strict separation can be done at a later date. This will make it possible to push part of drawinglayer (part of processor2d) directly into VCL. Change-Id: Ibc26580067e50bf20d7cdd37fa0e44eb10200878 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127286 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-29tdf#132145: Synchronize ScAppCfg with configurationMike Kaganski1-36/+13
Change-Id: Iadf5ff86d043f63355fd30816a9e2011479465c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125990 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-28tdf#132145: Synchronize ScPrintCfg with configurationMike Kaganski1-44/+30
Change-Id: I903e8277fea5c223081244ae30dff31bbda7d554 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125904 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-27tdf#132145: Synchronize ScInputCfg with configurationMike Kaganski1-103/+58
Change-Id: I45cc9b6c8cbd9205e185bebff97644f53f5cf0af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125896 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-12make it explicit whether to ignore the result of getLOKPayload()Luboš Luňák1-4/+6
Returning an empty string to signify 'ignore' was a poor design, as some messages types actually may have valid empty messages. Change-Id: Ia82d3d97d150bc5ef412a1bd4b1091d9b2d84385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124979 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-31Prepare for removal of non-const operator[] from Sequence in testMike Kaganski21-84/+82
Change-Id: I9f2c0deda676b10377b0a4572d26422cb0d8b807 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124399 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-25use pull model also for LOK text selectionLuboš Luňák1-1/+1
Make LOK_CALLBACK_TEXT_SELECTION, LOK_CALLBACK_TEXT_SELECTION_START, LOK_CALLBACK_TEXT_SELECTION_END and LOK_CALLBACK_TEXT_VIEW_SELECTION also use pull model, i.e. LO core will only set a flag and when CallbackFlushHandler needs the actual data it'll use getLOKPayload(). This again avoids a large number of messages passed to CallbackFlushHandler only for them to be sooner or later discarded. Change-Id: Ia7528039be996a6e9e8491b4eba3f4133582fa56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124146 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-24change some LOK internal updates to be pull model instead of pushLuboš Luňák1-6/+115
Some LOK messages may get called very often, such as updates about cursor position. And since only the last one matters, they get generated every time, which costs some time, and then later except for one they get all discard again from CallbackFlushHandler queue, which again costs time. Change the model to instead only set an 'updated' flag, and CallbackFlushHandler will request the actual message payload only before flushing. This commit changes LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR and LOK_CALLBACK_INVALIDATE_VIEW_CURSOR to work this way. Change-Id: I376be63176c0b4b5cb492fbf529c21ed01b35481 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124083 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22properly flush LOK invalidations in testsLuboš Luňák2-1/+19
This should be done always before doing something with a flag related to the invalidations. Use an idle timer for simplicity, tests already usually process to idle. Change-Id: I979900da28061cc690ecbcce023dbb769239f205 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124003 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22better name for a function overloadLuboš Luňák1-2/+2
It's better to add to the name what the overload does rather than just have a "mysterious" extra int. Change-Id: Iff89679c4a978a4596ac662ef74e934cdefefc9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124001 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22revert unittests to use plain text-based LibreOfficeKitCallbackLuboš Luňák2-0/+56
At least for now it seems that the more complex SfxLokCallbackInterface is just an unnecessary complication for unit tests. The performance doesn't matter, and handling all the specialized callbacks makes things more complicated. In the future it'd be also useful to make the tests (optionally?) use also CallbackFlushHandler as the provider of the messages, in order to test CallbackFlushHandler more thoroughly, so perhaps in the end it makes more sense to keep unit tests using the plain text interface. This reverts unittest-related parts of 3b729db05553c1a6d461fb41c89 and adds a smaller wrapper callback class that converts messages from SfxLokCallbackInterface to LibreOfficeKitCallback format. Change-Id: I6c14f0be4ed7b777444b131140be54188d309cca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124000 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-18xmlsecurity: fix new tests on WNTMichael Stahl1-0/+249
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>
2021-10-15test: upgrade test NSS database from dbm: to sql:Michael Stahl4-0/+5
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>
2021-10-15Remove non-const Sequence::begin()/end() in internal codeMike Kaganski1-1/+1
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14Avoid COW overhead using css::uno::SequenceMike Kaganski1-1/+1
The scenarios are: 1. Calling sequence's begin() and end() in pairs to pass to algorithms (both calls use getArray(), which does the COW checks) 2. In addition to #1, calling end() again when checking result of find algorithms, and/or begin() to calculate result's distance 3. Using non-const sequences in range-based for loops, which internally do #1 4. Assigning sequence to another sequence variable, and then modifying one of them In many cases, the sequences could be made const, or treated as const for the purposes of the algorithms (using std::as_const, std::cbegin, and std::cend). Where algorithm modifies the sequence, it was changed to only call getArray() once. For that, css::uno::toNonConstRange was introduced, which returns a struct (sublclass of std::pair) with two iterators [begin, end], that are calculated using one call to begin() and one call to getLength(). To handle #4, css::uno::Sequence::swap was introduced, that swaps the internal pointer to uno_Sequence. So when a local Sequence variable should be assigned to another variable, and the latter will be modified further, it's now possible to use swap instead, so the two sequences are kept independent. The modified places were found by temporarily removing non-const end(). Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-09Typo: *adress* -> *address* (except from not translated German parts)Julien Nabet1-21/+21
Change-Id: I62e12aed5bc67119433c39ff333f69b79944dca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123318 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-02tdf#144758: default value for 'table:orientation' attribute is 'row'Mike Kaganski1-1/+1
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>