summaryrefslogtreecommitdiff
path: root/basic/qa
AgeCommit message (Collapse)Author
2023-05-09tdf#153543 - Add vba shell constantsAndreas Heinisch
Change-Id: Ifa73050f6892ce8ce95d16dedc166e68d1809491 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151567 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-03-22Refactor and fix VBA StrConvMike Kaganski
This properly handles null bytes that are expected when converting between byte strings and Unicode. It properly handles TransliterationFlags, which are not a bitset. In vbProperCase, it uses the correct method to lowercase the string, working not only with ASCII. Change-Id: I04e8cdca66ef9863a6516b15205a2a543ed97680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149224 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-16tdf#152690: Fix "!" behavior when it is not the first in a groupBaole Fang
Fix "!" behavior when it is not the first in a group. Add testcases for "!" and Like. Change-Id: Ia76fa26722b6546d08dd8842d83f55bb0c0ea5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148720 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-26tdf#141474 tdf#151901 BASIC functions argument names do not match that of VBAAlain Romedenne
Basic function argument names can be used either by position either by name, keyword arguments ae called 'named arguments' in VBA - VBA doc: https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/understanding-named-arguments-and-optional-arguments - libO Basic function signatures: https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03090401.html?DbPAR=BASIC#bm_id3154422 This patch attempts to correct - all in one - malformed keyword names in BASIC function signatures. It reflects keyword arguments usage inside QA BASIC unit tests. In the end Online help pages may incorporate such practice. Change-Id: Iab0c92b2c152d2564662e51e68f1f736b8deefd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145720 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-02-24Fix build in a specific VS2022 environmentMike Kaganski
Building CppunitTest_basic_macros using VS2022 failed for me reproducibly for some time, with make[1]: *** [C:/lo/src/core/solenv/gbuild/LinkTarget.mk:841: C:/lo/src/build/workdir/LinkTarget/CppunitTest/test_basic_macros.dll] Error 139 It is caused by linking odbccp32, and legacy_stdio_definitions required by the latter with current versions of UCRT. It seems to work OK for others; but being unable to find what's different on my system, I have this workaround, using run-time loading instead. Change-Id: Ic4094398f7510bc281dfa96f980f29f12f09d7ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147626 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-02-23Extend loplugin:cppunitassertequals to more argument typesStephan Bergmann
Change-Id: Ic2990ebc2e4a9a36dcd3f90c5f634ca7dd225d52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147491 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-26Delete extra whitespaces inserted by the editorAndreas Heinisch
Change-Id: I89ef4d04e27e52f5ee6168f368e23f96e112a8be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146085 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-01-09tdf#152917: basic_macros: Add unittestXisco Fauli
Change-Id: I69050ae0e6607ed4a1d1da0e89b45125e2c06e3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145190 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-12-20basic: remove tabs from test fileXisco Fauli
Introduced in c6dc676306d2e507bf57369d02dcaf2408d43eb0 "tdf#152520: basic_macros: Add unittest" Change-Id: Ieef7177b3eb1c7c4ab1aaa11cc343ace3f26601f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144581 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-12-20basic: add missing license statement in .vb test filesXisco Fauli
Change-Id: I304615540edad3d3486bcdb17d7d6ae12fc084b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144584 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-12-20basic: add missing license statement in test filesXisco Fauli
While at it, convert test_optional_paramter_type.bas to Unix format Change-Id: I141fa0a00d6b6784c3a84c8b3041086d51e5cdbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144540 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-12-20tdf#152520: basic_macros: Add unittestXisco Fauli
Change-Id: I30f6badc620f3932cacff07bd37ef4da96f1bafd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144539 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-10-14tdf#151503 - Do not evaluate a missing optional variable to a booleanAndreas Heinisch
Change-Id: I671f857344f91de63612eabcbbdb2cab9b94cc0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141296 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-09-25tdf#151012 - Initialize optional parameters with their default valuesAndreas Heinisch
Change-Id: I3ed3eb904b50892e5946abe684e801819ba296e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140128 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-06-28Removed executable bits on filesAndrea Gelmini
Change-Id: I8508d26067084ff7bb15bbf2326a1ff7bc61a6ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136521 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-06-28tdf#149447: use proper UNO types for marshalling unsigned Basic typesMike Kaganski
cppu::UnoType<sal_uInt8> corresponds to UNO boolean, so its use made the unsigned values be converted to a true/false in Any; and additionally, using such a boolean Any, even having a 'true' value, as a parameter to a double argument would make operator >>=(const Any &, double &) return false, giving the resulting double equal to 0. The wrong conversion of UShorts and ULongs to cppu::UnoType<sal_uInt8> (aka TypeClass_BOOLEAN) was introduced in commit 11f9aa4fcb2ad0a5fada8561c7041e7f25a059fc Author Andreas Bregas <ab@openoffice.org> Date Thu May 10 14:22:42 2001 +0000 #79615# sbxToUnoValue(): Choose smallest possible type for numeric values Treating of unsigned Basic Byte as a signed cppu::UnoType<sal_Int8> (aka TypeClass_BYTE) was already introduced in commit c25ec0608a167bcf1d891043f02273761c351701 Author Jens-Heiner Rechtien <hr@openoffice.org> Date Mon Sep 18 15:18:56 2000 +0000 initial import Then, in commit 553cf2a834fcca17be6f7712c53e190e90e260eb Author Andreas Bregas <ab@openoffice.org> Date Fri Jun 08 14:59:57 2001 +0000 #87927# Map TypeClass_BYTE to SbxINTEGER instead of SbxBYTE because of signed/unsigned problem an attempt was made to handle obviously this same problem, changing the corresponding UNO type to TypeClass_SHORT. But it seems that it created problems when passing arrays of Byte through UNO to COM, where it needed to convert to a safearray, so this decision was reverted in commit dd6ba6b64aec20d37a402bee233e742e29285e88 Author Mikhail Voytenko <mav@openoffice.org> Date Thu Jul 08 21:33:48 2010 +0200 mib17: #162917# let basic byte use one byte, let olebridge convert sequence to safearray correctly This change tries to avoid the problem that caused the latter revert, by only treating Bytes as UNO shorts in getUnoTypeForSbxValue, where scalar Byte values are considered, keeping old handling for arrays. Change-Id: I805108743376e2fc27dd21a27c31759b76dc0d09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136526 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-24tdf#147529 - BASIC MsgBox: Check for missing optional parametersAndreas Heinisch
Change-Id: Iecb47e0005c609ee1117d6fb141e810c0166806a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136339 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-06-20tdf#149622: also clear return value before calling method from SbxObject::CallMike Kaganski
Moves the custom cleanup logic to overridden SbxMethod::Clear, to simplify the cleanup code and make sure it restores empty Variant correctly. Change-Id: I01fa0529acd9ac787ffcda60fd6836ade4afdcb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136108 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-06tdf#149402 - BASIC: Don't extend comment if line ends in a whitespaceAndreas Heinisch
Change-Id: I8adf530e77a0e65329fa59ac2873b99f48befac4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135336 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-05-31tdf#149157 - Break multiline continuation in a comment after a new lineAndreas Heinisch
Change-Id: I3dd875152a6f2cfafb67f13f597c36f01a4759b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135018 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-05-07tdf#148358 - Compare Non-ASCII variable names case-insensitiveAndreas Heinisch
Change-Id: I761eb27b16c92d58df1be8e6011fc9b94db2a59c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133774 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-05-05Just use Any ctor instead of makeAny in basicStephan Bergmann
Change-Id: I21d9679064c4e68a1492d3550f083c3c91b5b43b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133848 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-21tdf#148651: basic_macros: Add unittestXisco Fauli
Change-Id: Iadbe470de5a33dc633fe8f53083520988e497df0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133255 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-04-17Test StarBasic's native non-ASCII name syntaxMike Kaganski
Change-Id: Ie9f0cd21e59ffc1e3fbe2616e2ae7abbd0169424 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133103 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-31Basic Collection class unit testAlain Romedenne
Change-Id: I7b67727ab8c3f7f67c2038500434ab44fa7d1949 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128544 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-31Adapt test to even slower buildsStephan Bergmann
...like my local ASan+UBSan build, which now happened to fail once with > Failed: TestReplacePerformance (t = 60 s) > Tests passed: 0 > Tests failed: 1 when the machine was under load during a parallelizing `make check`, following up on 3564b5c6e93b2bf5881b359015efae351dbe8342 "Adapt test to slow builds" Change-Id: I8f0c8f7e6e145b6d5009f48d2af865ea5caab375 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-30tdf#114263 tdf#147262 CallByName() function LibO Basic test unitAlain Romedenne
Change-Id: Ia9bd38c0da4d3f94b824ebb1f98ac912758e8d38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129610 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-02Change the comment of the test cases to clarify the textual representation ↵Andreas Heinisch
of the calculated string Change-Id: I98478297a577f723864b37514bbd432a6224350d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129844 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-21tdf#147089 - Round Integral Division (IDIV) literals to Integer valuesAndreas Heinisch
Change-Id: Ia243c6117a437d0c6efb33a4e76c5e9ee539fbdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130302 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-12Basic compiler undetected typoAlain Romedenne
Change-Id: I53add0bbb14e084978e3582083978924d1c11c88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129434 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-11tdf#147364: fix function signature to account to calling conventionMike Kaganski
First, the integer function result is returned in a 64-bit register (RAX), and truncation it to sal_Int32 breaks any pointer return value. Second, using explicit (not vararg) first function double argument would pass it through XMM0, without also copying it to RCX (which is guaranteed for varargs). Ref: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention Change-Id: I08212c44d8690d6910068b13c16af2ce899c94f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129808 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-09tdf#146672 - CDbl: skip spaces and tabs at the end of the scanned stringAndreas Heinisch
Change-Id: Ib7a4e8c7145b549a5327de23549d39d11f8590cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129648 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-06tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroVaibhavMalik4187
Change-Id: I4f5258ca5b37e9b1b4237c5d29e4a9e5362fa855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129116 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2022-01-31Adapt test to slow buildsStephan Bergmann
...like my local ASan+UBSan build, which kept failing with > Failed: TestReplacePerformance (t = 35 s) > Tests passed: 0 > Tests failed: 1 when the machine was under load during a parallelizing `make check` Change-Id: I59c81a61a29df7165f6fad33e3fe3da975f05ed2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129237 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-31Fix format stringMike Kaganski
Change-Id: I18952bf6641175d25128b512ddfb56fd51767038 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129083 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-31tdf#132388: add unit testMike Kaganski
I hope that this performance test is OK. I chose 20 s threshold, as it works much faster on my system (under 4 s); it shouldn't be much slower elsewhere; and both the original bug, and the regression that followed the initial fix, made it execute orders of magnitute slower (I expect hours on fast systems). Change-Id: I75ee4c60e562473fe70a203faa94b48c5fbfb4fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-13Recheck modules [a-c]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I74a3c3a67c3639376e2251c3eb917fa4139dfbd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127808 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-08tdf#145693 - Argument name should be 'charcode' instead of 'string'Andreas Heinisch
In addition, changed argument datatype from Int to Long. Change-Id: I702e09b6b8061d7cf00dd403e4681a0ab348d4c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128100 Tested-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-01-07tdf#130426 - Rename file for tdf#145693Andreas Heinisch
Change-Id: I1435f3e8c8ecf41ecd6b2766e19009c6b1783326 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128099 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-12-28tdf#145960 - Return type of boolean operators should be of type booleanAndreas Heinisch
In addition, added missing vba test to the test routine. Change-Id: I3ee837e1eab30f10e0a4169d11014f9b6574ad1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127631 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-12-09Make the tdf#97983 changes to BASIC optionalTor Lillqvist
If you want to keep the string to floating point conversion semantics in BASIC as they were in LibreOffice 6, you can either set the LIBREOFFICE6FLOATINGPOINTMODE environment variable to some non-empty value, or set the org.openoffice.Office.Scripting/Basic/Compatibility/ UseLibreOffice6FloatingPointConversion flag in the Expert Configuration. (Or use a registry modification file with that effect.) Adapt the relevant unit test accordingly. Thanks to Mike Kaganski for showing how to access the setting in the LibreOffice registry from Basic. Change-Id: I13d6d5d834e1bb81ef8df489db2b1da79f01dfc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125756 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-11Resolves: tdf#110003 tdf#143128 handle lowercase ß vs uppercase ẞ foldingEike Rathke
Change lowercase ß U+00DF LATIN SMALL LETTER SHARP S from LowerToUpper, ToUpper: SS ToTitle: Ss FullFolding: ss to LowerToUpper, ToUpper: ẞ U+1E9E ToTitle: ẞ U+1E9E FullFolding: ss Add uppercase ẞ U+1E9E LATIN CAPITAL LETTER SHARP S UpperToLower, ToLower: ß U+00DF FullFolding: ss Adjust BASIC Collection test to new reality. Change-Id: I198e06985b81a71e5de94bf7fab7a0dbaf10baef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124988 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2021-10-30tdf#145371 - Delete array variable only before ReDimAndreas Heinisch
Otherwise, global array variables don't maintain their state. Change-Id: I10dafd9e2946630c5476c9858f765d67ef2f6d6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124368 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-10-20tdf#125637 - Correctly hand names ending with an underscoreAndreas Heinisch
If a name is ending with an underscore at the end of the line, it won't be recognized correctly and it will be wrongly interpreted as the respective name without the underscore at the end. Instead of changing the macro source, use a flag in order to correclty identify the line end. Change-Id: I6f933d7382b510bffed3e2692d32c232b7084624 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123833 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-10-19Fix Windows buildStephan Bergmann
...after cf3971a9414f52b116c1c21f267128ffa67f171b "Simplify Sequence in b*" Change-Id: If8650faa7a45258729e54b3df37e9084221babfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123792 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-17Simplify Sequence in b*Julien Nabet
Change-Id: I0817d9a35a9c3fc43badb6cc60727de69849b063 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123720 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-07tdf#144924 - Change return type of array elements of the split functionAndreas Heinisch
If VBA is not enabled, allow the assignment of variables with different data types to the individual array elements created by the split function. Change-Id: I7bdd432cdebbfded5f7fb3acc0216474eb6b6821 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123122 Tested-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-30tdf#143575, tdf#143974 - Use rtl::math::doubleToUString to convert numbers ↵Andreas Heinisch
to strings Change-Id: I1427dbd49af680a1bf386410977c9cb2b0a3961e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122831 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-27tdf#131563 - Add vba color constantsAndreas Heinisch
Change-Id: I59bcd11b5da1450fced77671c2cf6ed44e299a06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122607 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-19tdf#123144 - Always translate an error number to a vba error messageAndreas Heinisch
In addition, create a meaningful error message and don't create and artificial error message if there exists a custom one. Change-Id: I682e497ee3fdfe4da80fb17ab41c1b4cf90eb2cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122206 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>