summaryrefslogtreecommitdiff
path: root/basic/qa
AgeCommit message (Collapse)Author
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>
2021-09-10tdf#144353 - Handling of missing optional parametersAndreas Heinisch
Don't assign a missing optional variable to a property and don't allow the computation/comparision including missing optional attributes. In the previous cases a ERRCODE_BASIC_NOT_OPTIONAL is raised. Change-Id: Iab391286fcace16c271ae511304075e2a0c5c651 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121794 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-07Fixed a copy paste error in the test casesAndreas Heinisch
Change-Id: Ib11b6cfe385542664b28de35897caee67099d22c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121792 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-07tdf#144245 - Added test file to automatic testAndreas Heinisch
Change-Id: I92b71b7e7ac8c2262d36875e4b04ed91e17bc495 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121791 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-07tdf#144245 - Case-insensitive operation for non-ASCII charactersAndreas Heinisch
Support case-insensitive operation for non-ASCII characters in the Collection object (VBA). Change-Id: Ie17560cb9aac5bfb32aa041744445dd4839681d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121534 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-08-10tdf#143707 - Change strategy to support suffix type charactersAndreas Heinisch
In order to support the correct data type of numeric constants, booleans, and default values for strings, the strategy to transport the data type character to the runtime has been changed. The type character will be added after the literal and the string termination symbol in order to keep compatibility. This allows to retrieve the correct type in StepLOADNC and in StepPARAM. Any legacy written images are still possible to process, since if there is a suffix type character where the data type character was directly written after the numeric constant, it will be processed in StepLOADNC. Without this fix, an optional parameter of type Variant, would still include the suffixe type character, and will not be converted to the correct type in StepPARAM. Change-Id: I86c8192c6dc28457053fa7b23a073420e45407b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119945 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-28tdf#107953 - Extend significant digitsAndreas Heinisch
According to https://randomascii.wordpress.com/2012/03/08/float-precisionfrom-zero-to-100-digits-2/ show at least 9 / 17 significant digits for a single / double data type in order to identify the contained value. Change-Id: Id2833fc51ca005bc78b68d6b4cca28f2d95f5a85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119526 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-19tdf#143332 - Use utl::TextSearch to implement the InStrRev functionAndreas Heinisch
Change-Id: I2dae038d061f036b3b7c0fbbcb6a821305d4839e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119094 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-16tdf#139840 - Use utl::TextSearch to implement the InStr functionAndreas Heinisch
In addtion, fixed a crash if the start position is greater than the length of the string being searched. Change-Id: I9bcda1131324bdfac6957018e91b3a36dd2dc3d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118996 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-15tdf#111313: basic_macros: Add unittestXisco Fauli
Change-Id: Id6f8bc0998d4f79434d46017b998917dcc53ac6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118949 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-14tdf#98778: basic_macros: Add unittestXisco Fauli
Change-Id: I35468fb35f5c24af2138688d99af0e41ba672334 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118944 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-14tdf#114011: basic_macros: Add unittestXisco Fauli
Change-Id: Ib9a7e87b4c8159fd5fbaaaa66705cddae138fcdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118942 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-12tdf#142487 - use utl::TextSearch in order to implement the replace algorithmAndreas Heinisch
In the old algorithm, some special unicode characters lead to a malfunction of basic's replace function. For instance, replacing a German ß to uppercase in the insensitive case will lead to SS, breaking the replace positions. Change-Id: I4e6f6e5fba3d560b8cfd0786fa2439ed5174a928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118760 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-07basic_coverage: use Option Explicit where possibleXisco Fauli
Add missing license headers to a couple of files Change-Id: I7610f922e9ac914ae8fda0d0b6a7ca389401caca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118489 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-06tdf#142922 fixes Round to follow half-to-even roundingbaltasarq
The LibreOffice's Basic Round function does not return values that are compatible with VBA's Round. This can be easily fixed using rtl/round, which has a flag parameter called rtl_math_RoundingMode_HalfEven which rounds real numbers exactly in the expected way. Change-Id: I2215f08427e5777fc2d35f054b635dfa6247af8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118444 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-06basic: remove unneeded variable in testXisco Fauli
Kudos to M. Kaganski for spotting it Change-Id: I04ceea4607cf94a5a84af4f171d6f2b204ef8653 Change-Id: Ie9064d3c12da657ecd82fdab6891bc8703ee6f37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118464 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-05tdf#117612: basic_macros: Add unittestXisco Fauli
Change-Id: I4189b52be788deafe921c860f807ec5cee8ec667 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118443 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-05tdf#134692: basic_macros: Add unittestXisco Fauli
Change-Id: I9115eca2fce784cd55a8eb4f1cfd6e614fd3612b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118442 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-02Move utility code out of test directoriesMike Kaganski
This simplifies iteration over the test files, and avoids relying on file URLs being the same (e.g., having no /./ segments). Change-Id: I227785806e474a3a2dffeb46df21617eae43327e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118329 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-07-02Rename LibreOffice Basic test files from .vb to .bas: they are not VBAMike Kaganski
Change-Id: I4ff8a8dc855da2c60084318e067d4ec8149d055e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118330 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-07-02tdf#143081: basic_macros: Add unittestXisco Fauli
Change-Id: I2d9fa23627f40a2398288b1ee7f5bfd4de4a6131 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118326 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-02tdf#84098 kill copy+paste in basic/qa/basic_coverageXisco Fauli
This also fix the problem of basic_coverage tests not showing the results when they were failing, since doUnitTest returned a Integer Change-Id: I637cd4cfaa34047bc99bfe6e0930f2945f1a9315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118234 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-01Purge out rtl::math::setInfBaiXiaochun
Change-Id: I71af8273c672a4cbcbfefafffd0003ab266dcce6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118132 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-25tdf#142460: properly handle boolean values in string poolbaltasarq
This makes sure that results of comparison of literals have proper boolean type, and that this type is properly stored to/read from the string pool. This introduces a new non-standard "type" character used in the pool: 'b'. It is not a proper type character used in Basic (unlike '%'/'&'/'!'/'@'), but we have to use this trick locally, because we need to pass the type that has no own type character. The change should be backward-compatible: older versions reading the value should just ignore the 'b', and read the value as double. Change-Id: Ibd4a70b366331342346eb171c8ed3c7026279596 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117655 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-23tdf#142180 Swapped comparison operators for static stringsJoshua Williams
It seems that, for some reason, the comparison operators for strings in basic were swapped in the code that evaluates string comparisons at compile-time. This is what caused bug #142180. This commit simply swaps the operators and should fix the bug. Change-Id: I14f90db8598f2f7f8b709e26902986e1f64af576 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115983 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-13tdf#139840 - Case-insensitive operation for non-ASCII charactersAndreas Heinisch
Support case-insensitive operation for non-ASCII characters in the InStr function in Basic. Change-Id: Idb2b8e128adf3596fa49e3e86365d5724ea3e11c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115538 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-05-06Change en_GB calendar StartDayOfWeek to Monday and MinimalDaysInFirstWeek to 4Eike Rathke
Inherit day, month and era names from en_US but with proper values. See https://lh.2xlibre.net/locale/en_GB/ - Week definition (week) - First day of week (first_weekday) or % LC_TIME=en_US locale -k LC_TIME week-ndays=7 week-1stday=19971130 week-1stweek=1 first_weekday=1 first_workday=2 % LC_TIME=en_GB locale -k LC_TIME week-ndays=7 week-1stday=19971130 week-1stweek=4 first_weekday=2 first_workday=2 This makes it necessary to adapt basic/qa/vba_tests/weekdayname.vb because basic/qa/cppunit/test_vba.cxx sets LANGUAGE_ENGLISH_UK Change-Id: I752bf0e59396f0cbd601beb596c07e77e4e4cfaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115160 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2021-05-01tdf#124184 Fixing StrConv VBA Functiontushar
* vbUnicode/vbFromUnicode considers optional third LCID argument. * LCID is also used for other conversions. * The encoding is decided based on the language defined in LCID, or on program locale when LCID is omitted, using MS default ACP mapping for languages. * Unit testis for vbWide / vbNarrow are changed and enabled. * Unit tests for vbKatakana / vbHiragana are changed and enabled. * Unit test for vbFromUnicode / vbUnicode is changed to rely on en-US locale used in testing, and is enabled. Change-Id: Iabd4153db311cd02c3f3e7247f9fc71ad9f5f682 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112539 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-05tdf#141201 - Round MOD literals to Integer valuesAndreas Heinisch
(regression from commit I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b "tdf#84435: Mod operator does not deal with decimals as described in help"). Change-Id: I74b231d3814148579a3be0a92b7602fa4387281f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113571 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-03-29TypeName, VarType, TypeLen Basic QA test casesAlain Romedenne
1- exhibiting array type names 2- highlighting supplemental libO Basic constants 3- precising data types internal representations I intend to document in help: 1- primitive data types array names: Boolean(), Byte(), … as IsArray() function does not provide such info 2- Publish extra Basic constants for already published values: - V_OBJECT=9, V_BOOLEAN=11, V_VARIANT=12, V_BYTE=17 - not necessarily V_ARRAY=8192, V_ERROR=10 The latter is conditioned to the creation of an enhancement request. FYI, published Vartype() values and constants for VBA and other Basic-like languages: https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/vartype-function https://docs.xojo.com/VarType https://help.hcltechsw.com/dom_designer/9.0.1/appdev/LSAZ_DATATYPE_FUNCTION.html Change-Id: I51bac3caf555d94e91de7c6d624b3fca9e73a673 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111042 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-21tdf#88442 SBasic: Don't double-initialize a Global ... As New ...John
"As New" variables use lazy instantiation, but that should not re-apply each time one re-enters the module. If the object is still there, don't replace it. Change-Id: Ic568a56b93db9bc9139d434d97a4a4deb05840df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112018 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-20tdf#141050 Accept CCur with negative stringsarpit1912
the ImpStringToCurrency now increment the pointer on finding a '+' or '-' in sbxcurr.cxx file Change-Id: I4a1093ae0b4e52b6a61dc412bd5e7b95b1309e7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112734 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-03-15tdf#141045 - fixed copy paste error in the replace functionAndreas Heinisch
Change-Id: Id68670fed89e4cc700c5eea395139914bebdb657 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112509 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-03-09Drop "32" from names of SbxArray methods taking 32-bit indicesMike Kaganski
... a leftover from times when there were methods for 16-bit as well as for 32-bit indices. 16-bit indices were removed in commit 62f3f3d92aa204eaaa063b30d7ade44df501b997. Change-Id: Idf8b1160e68e8b303cf75ea79dd7dbb3bd00275d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112187 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-17tdf#130677 Write new tests for literalsshubham656
Change-Id: I22607fdcaab840ca1512abf534712d36d4b5ee9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109964 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Jenkins
2021-01-25tdf#136755, tdf#124008 - delete the variable beforehand REDIMAndreas Heinisch
If an array of objects is passed as an argument to ReDim, delete the variable beforehand, otherwise the construction of the new variable fails, because the old one is still on the stack. Change-Id: Ic863a36f5f2aca658df369f95d275aa287edf795 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106832 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2020-12-30Fix build after 042033f1e6da22616cb76c8d950c20c9efecbad5Mike Kaganski
Change-Id: Ifca32f434442f7838aae6f47dc2831dfa6a3f5db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108496 Tested-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Stephan Bergmann <sbergman@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-22Related: tdf#84098 Unify testsMike Kaganski
Shorten the tools module name; use TestUtil.AssertEqual where applicable; remove unnecessary variables that only made noise and masked what was actually asserted; add missing licence headers. Change-Id: If891ed8ceb38fed18335aad061b2b09d341264f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108118 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-19tdf#84098 kill copy+paste in VBA testsGeorge Bateman
Move repeated code into _test_asserts.vb Change-Id: Idfe124a8dbab4925309fa5f1322e0cce5f097b7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107860 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-27tdf#136801 : IsNumeric("+2") and CInt("+2") return correct valuesAnshu
Change-Id: I036f21c8196530973d2cdc366da7654ccd930892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106556 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-13tdf#123936 Formatting files in module basic with clang-formatPhilipp Hofer
Change-Id: I87736d6f1a1d069c990b4e7b9ca291634ab4fb44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105646 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-05tdf#42949 Fix new IWYU warnings in directories [ab]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ib0008b9bb095f27e5e436d6b507dc709ab7bf01a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105313 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>