summaryrefslogtreecommitdiff
path: root/tools/qa/cppunit
AgeCommit message (Collapse)Author
2024-12-07Fix check for further exotic protocolsStephan Bergmann
...that were added in 59891cd3985469bc44dbd05c9fc704eeb07f0c78 "look at 'embedded' protocols for protocols that support them" Change-Id: I42836d6fd27cd99e39ab07e626053f002a2651f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178047 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-11-30tdf#147021 - Use std::size() instead of SAL_N_ELEMENTS() macroRosh
Change-Id: I2495fa1ad081ad75bd8e79a22bdeaa97217aa398 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177581 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Jenkins
2024-11-15add a couple of tests for tools::BigIntNoel Grandin
because I might touch this area and I want to be sure I don't mess it up Change-Id: I62c177031f690f4455a58f3280ed26186df94158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176620 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-04new loplugin:staticconstexprNoel Grandin
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-10-21Make tools::Time ctor taking sal_Int64 privateMike Kaganski
This ctor is meant to set the value of nTime directly; and that value is not nanoseconds, but an encoded value, using SEC_/MIN_/HOUR_MASK. But in some places, this ctor was misused for setting of nanoseconds, which would only accidentally work for values less than one second. All places that initialized tools::Time with 0, now use EMPTY. This makes the ctor private; and for the very few cases where really the encoded value of nTime is stored / restored, fromEncodedTime is introduced. Change-Id: I1f1994bd9aab1b51a41b1de637619049fe820da4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175283 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-07-07move UniqueID to tools and rework to increase counter in constructorTomaž Vajngerl
In the tools module it can be used in more other modules. Changed the instantiation to increase the counter already in the constructor, so no need to check if the ID is 0. Also test for UniqueID Change-Id: I77c80461875c69496a7e218534d16d6550c168c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170061 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-05-16loplugin:ostr in toolsNoel Grandin
Change-Id: I0e601100b034eaa99b08c7cbf09e5f817e69b507 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167736 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-04-17Drop FRound, and use generalized basegfx::froundMike Kaganski
Change-Id: I7447e649dc3ef4e51242f69c7486a3e84e103d2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166159 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-25Avoid MAX_PATH limitation in launcherMike Kaganski
... and drop some manual memory management. Change-Id: I4c60ce559ff185d4685a6b9799a97651438115b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162502 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-23use more string_view in tools::JsonWriterNoel Grandin
Change-Id: Ia3ac54a1164b99a806298a47115ea3bc570f3b0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163810 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-06return string_view from some XmlWalker methodsNoel Grandin
elides some OString temporaries Change-Id: Ic07f18eb3c71637593e64128605c1ebfa8e68474 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163044 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-01-08Simplify JsonWriter a bitMike Kaganski
Change-Id: Ifa4278cfd62df4179dd3ae627369c077e31dbd00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161780 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-20Simplify and rename for clarityMike Kaganski
Change-Id: Ic97a2b313c6f7d9da540a8867f01362c2fe7b0d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161052 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-20ofz#65165 Stack-buffer-overflow READ 4 test caseCaolán McNamara
make VALGRIND=memcheck CppunitTest_tools_test Conditional jump or move depends on uninitialised value(s) at 0x13348ADA: BigInt::DivLong(BigInt const&, BigInt&, BigInt*) const (bigint.cxx:306) by 0x13349A0A: BigInt::operator/=(BigInt const&) (bigint.cxx:635) by 0x12A58F67: tools::BigIntTest::testLenB1() (test_bigint.cxx:103) by 0x12A5C6A8: void std::__invoke_impl<void, void (tools::BigIntTest::*&)(), tools::BigIntTest*&>(std::__invoke_memfun_deref, void (tools::BigIntTest::*&)(), tools::BigIntTest*&) (invoke.h:74) if ( (static_cast<sal_uInt64>(aTmpB.nNum[nLenB1 - 1]) * nQ) > ^ nLenB1 is 0 ((nTmp - static_cast<sal_uInt64>(aTmpB.nNum[nLenB1]) * nQ) << 32) + aTmpA.nNum[j - 2]) Since: commit bcbc0857bf4bc24b5ea36e445a367cce0a382da4 Date: Sun Dec 17 21:11:31 2023 +0300 Simplify BigInt Co-authored-by: Mike Kaganski <mike.kaganski@collabora.com> Change-Id: Id8dbff23f7b4312ba666e1443c41b7869713bfbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160953 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-16Drop incorrect conditional compilationMike Kaganski
Since commit 396196d6143e377f83a81557f4630ac7e7ad9471 (BigInt's non-big value type is currently sal_Int32, 2020-11-14), fixed-size sal_Int32 is used in the unit test; so it must not depend on size of unrelated long type. Change-Id: Ida276e87b927381d093796f4137774a18acded82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160857 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-19Extended loplugin:ostr: toolsStephan Bergmann
Change-Id: I70df74d005c7fca14b1bcb70f4870023bd3af4a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159668 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-01tdf#157820: handle \\?\ prefixes in INetURLObjectMike Kaganski
They are already handled in osl file URL functions. Change-Id: Id0c224bdb79963e7ce52abde57bf05b0a6a81ff5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158741 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-15Repurpose loplugin:stringstatic for O[U]String vars that can be constexprStephan Bergmann
...now that warning about O[U]String vars that could be O[U]StringLiteral is no longer useful Change-Id: I389e72038171f28482049b41f6224257dd11f452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-07loplugin:ostr: automatic rewriteStephan Bergmann
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2023-10-05Drop MinMax in favor of std::clampMike Kaganski
Change-Id: I021f524b232ddbe091981444d859d35dd9cd05ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157582 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-06-23Introduce tools::Duration individual time values ctorEike Rathke
Change-Id: I516d3727cbcf6667b32dc963febbf4b753ef6a91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153497 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-22Introduce tools::Duration(sal_Int32 nDays, const Time& rTime) ctorEike Rathke
Change-Id: If002e04536149b49b2249103ac914d17dec3fae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153409 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-17Related: tdf#153517 Introduce class tools::DurationEike Rathke
Change-Id: I73ea6e162c73382ba470a306ce2852dbff3d1314 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153202 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-04-24loplugin:unnecessarygetstr extend to more std::string checkingNoel Grandin
suggested by mike kaganski Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-05fix leaks when using tools::JsonWriterNoel Grandin
Specifically in sd/source/core/annotations/Annotation.cxx We seem to end up fixing leaks here often. The current tools::JsonWriter API is just very hard to use correctly. So rather return an OString, which is cheap to copy, and push that down into the LOK code. AFAIK that seems to end up requiring less code and less adhoc copying of data (specifically the queueing code in init.cxx was creating copies when converting to std::string). Ideally, we could have some special API to avoid the new strdup() calls in init.cxx, but not sure how to prevent other people from accidentally using that. Change-Id: Ia33437c1bfd9cc2d54dfb99914d1b72db20335f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149963 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-01Teach INetURLObject about RFC 7230 URLs with no path but queryStephan Bergmann
While RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1" defined > http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]] RFC 7230 "Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing" defines > http-URI = "http:" "//" authority path-abempty [ "?" query ] > [ "#" fragment ] Change-Id: I83b1baa404d28bf3b28b1db812f8930bbc1aaf90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148064 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-16Only specialize CppUnit::assetion_traits<T>::toString member functionsStephan Bergmann
...not the whole CppUnit::assetion_traits<T> classes (where applicable). That avoids spelling out the (identical) equals member functions, and also leaves around the less and lessEqual member functions, in case they want to be used after all. Change-Id: I18f8d6cff0353921ced4952b33a0c85ff8292923 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-29tools: rearrange Rectangle test, add construction test caseTomaž Vajngerl
Change-Id: I735600181665100e8540b6f5f14ffebfe6f33371 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146305 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-10-22Fix StartWritingUnicodeTextMike Kaganski
Its comment in include/tools/stream.hxx tells: Switch to no endian swapping and write 0xfeff It was introduced in commit 3c2105e07d29b2069349e1a54e08463d359f988f Author Eike Rathke <er@openoffice.org> Date Fri Dec 22 00:19:05 2000 +0000 new: read/write Unicode or Bytecode and included a call to SetEndianSwap( FALSE ). That call was dropped in commit 8130714148d58dd2bf1ef12dcc6dd6d5838be0d1 Author Noel Grandin <noel@peralex.com> Date Mon Jan 05 08:47:31 2015 +0200 fdo#84938: replace NUMBERFORMAT_INT_ constants with 'enum class' (likely by accident). To simplify the fix, drop redundant m_nEndian: m_isSwap is enough. Change-Id: Ia9a0fe2d55563e7ba21bd4cf17c4ca999c6feaf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141521 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-24tools: test Rectangle::Normalize()Chris Sherlock
Change-Id: Ia3fec45b2b6dd0011910c8db5819e161485336c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138713 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-09tools: json writer test does not need to use test::BootstrapFixtureChris Sherlock
Change-Id: Iea7fa63ca7a3208d065ac2960998041672fc8d7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136231 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-12use a read-only stream when reading graphic dataLuboš Luňák
EmbeddedObjectRef::GetGraphicStream() creates a writable SvMemoryStream, read the graphics data into it and then returns the stream, which will be afterwards used to decode the graphics. But if the data is broken, incorrect seeking may cause a seek way past the buffer, and since the stream is writable, it would be done and cause problems such as running out of memory. The VersionCompatRead class is one such place that reads size from the stream and then seeks based on the read data. Add SvMemoryStream::MakeReadOnly() that will change the stream to be read-only after the initial read of the data into it. Change-Id: I1d44aabaf73071a691adafa489e65e4f5e3f021d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137002 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-07-11tools: rename getHeight/Width() to GetOpenHeight/Width()Chris Sherlock
By default Rectangle uses closed interval, if we really want to use half open intervals then we should specifically say as such in the name. Change-Id: Id7a91120ba1a1a4bc330014216b73a692dbf03a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136575 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-06-15Add unit tests for ZCodecofftkp
Add unit tests that check compressing->decompressing a file should result in the same file. This is done by comparing the CRC32 before and after. The same tests also implicitly test that compression/decompression works by checking the return value of ZCodec::EndCompression. Cases added for both mbGzLib=true/false. Change-Id: I5516760eba5f233c20331cef83fd0b1a1603373f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135233 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-13sw content controls, dropdown: add LOK APIMiklos Vajna
- expose the available list items in a new "items" key of the LOK_CALLBACK_CONTENT_CONTROL callback - add a new lok::Document::sendContentControlEvent() function to be able to select a list item from the current drop-down - add a new listbox to the gtktiledviewer toolbar to select a content control list item when the cursor is inside a dropdown - add tests for the array API of tools::JsonWriter Change-Id: I47f1333a7815d67952f7c20a9cba1b248886f6dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134256 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-04-29use more string_view in INetURLObjectNoel Grandin
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-05Fix typosAndrea Gelmini
Change-Id: Ifed6fa039466e580d911af91288c4a37bce08aae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132560 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2022-04-05add tools::Guid class to generate, parse GUID valuesTomaž Vajngerl
Change-Id: Ie4d8fad4d8f22c8277c22c21b7a9eb3e7c9e4f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132513 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-04-02Recheck modules t* with IWYUGabor Kelemen
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-31tdf#148253: fix matching algorithmMike Kaganski
Using 'flag' as a "continue the loop" marker allowed to continue processing wildcard after its last character - not crashing because it was a subview of a larger string with separators, but failing the match. Change-Id: I308058b68c59d5719f3c8b5f5656998a95a9ba09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132336 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-15tdf#146754: consider xyz:123 as host:port when parsing URLs smartMike Kaganski
... rather than scheme: and path. Change-Id: I9a48310b585b8fa3e31635f877a91f1560b065f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128457 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-24tdf#146382 cant open file from Explorer-attached remote locationNoel Grandin
problem spotted by mikekaganski regression from commit 0b46361ef84a61100a0274a007062317607d097a Author: Noel Grandin <noel@peralex.com> Date: Sat Nov 20 08:03:49 2021 +0200 tdf#133835 speedup calc autofilter (4) where I changed the behaviour of parseHostOrNetBiosName from overwriting the destination buffer to appending to it. Change-Id: I1bd3c7eade035a867c026364f5e114c1e652ca32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127352 Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-01Fix typosAndrea Gelmini
Change-Id: I5e41be3f7e650db0019bcd42a3c1c2cb3bc5dd0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126155 Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-11-29tools Color: implement MSO-style luminance modulation/offset filterMiklos Vajna
To be used when a filtered theme color will be applied on the UI, and not at PPTX import time. Change-Id: Ifb56e38e59b529ef436063c407ee156d76a77f9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126011 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-24Fix typos and translationsAndrea Gelmini
Change-Id: Ic358f008e09718b6f726a55edfe3a3f78bba2942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125728 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2021-11-23Add test for INetURLObject::changeSchemeStephan Bergmann
Change-Id: I84497ee93e30b639199bbbb958ac1b2c758db50c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125693 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-28-Werror,-Wunused-macrosStephan Bergmann
(when e.g. building natively on macOS ARM64) Change-Id: Ibff6f913a6251573058c52a8b4106233fad1d443 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124322 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-27CPU-specific files should not include templates or inlinesLuboš Luňák
Otherwise the possible copy emitted compiled with CPU-specific instructions might be chosen as the copy to keep and would be used by generic code. See history for the Calc Kahan code. Change-Id: Ifc1bbd8d9720d9effe05b8ff8ee5e804363939df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124257 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-13Unify JsonWriter::put and putRaw a bitMike Kaganski
In the process, it turned out that there was unnecessary conversion of OStringBuffer to OString and back to OStringBuffer when using putRaw, which is avoided now. Change-Id: I1e3ee685679df0b025bee8f4430624ee5bc9ccb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123547 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-20clean up ambiguous confusing rectangle APIs like IsInside()Luboš Luňák
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins