basic/qa/basic_coverage/test_isnumeric_method.bas | 2 +- basic/qa/vba_tests/isnumeric.vb | 8 ++++++++ basic/source/sbx/sbxscan.cxx | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
New commits: commit 6d9ecc59fc7f1e282f773e81913f660d033f0d68 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jan 6 15:16:40 2025 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Jan 8 13:04:46 2025 +0100 tdf#164599: Allow space between sign and number in VBASupport mode Change-Id: Ib9e8c8770f8c2d1b348ff032502467915829c4f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179865 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179934 diff --git a/basic/qa/basic_coverage/test_isnumeric_method.bas b/basic/qa/basic_coverage/test_isnumeric_method.bas index 21e4a91a8b45..eb476e8a6b35 100644 --- a/basic/qa/basic_coverage/test_isnumeric_method.bas +++ b/basic/qa/basic_coverage/test_isnumeric_method.bas @@ -28,7 +28,7 @@ Sub verify_IsNumeric TestUtil.Assert(Not IsNumeric(" "), "Not IsNumeric("" "")") TestUtil.Assert(Not IsNumeric(" + "), "Not IsNumeric("" + "")") TestUtil.Assert(Not IsNumeric(" - "), "Not IsNumeric("" - "")") - ' Note: the two following tests should behave different in VBA (TODO/FIXME); + ' Note: the two following tests behave different in VBA; ' should it be unified maybe in non-VBA, too (a breaking change)? TestUtil.Assert(Not IsNumeric(" + 0 "), "Not IsNumeric("" + 0 "")") TestUtil.Assert(Not IsNumeric(" - 0 "), "Not IsNumeric("" - 0 "")") diff --git a/basic/qa/vba_tests/isnumeric.vb b/basic/qa/vba_tests/isnumeric.vb index ead7e83e1494..721a2fb7f4b6 100644 --- a/basic/qa/vba_tests/isnumeric.vb +++ b/basic/qa/vba_tests/isnumeric.vb @@ -26,6 +26,14 @@ rem TestUtil.Assert(IsNumeric(True), "IsNumeric(True)") TestUtil.Assert(IsNumeric("123"), "IsNumeric(""123"")") TestUtil.Assert(IsNumeric("+123"), "IsNumeric(""+123"")") + TestUtil.Assert(Not IsNumeric(""), "Not IsNumeric("""")") + TestUtil.Assert(Not IsNumeric(" "), "Not IsNumeric("" "")") + TestUtil.Assert(Not IsNumeric(" + "), "Not IsNumeric("" + "")") + TestUtil.Assert(Not IsNumeric(" - "), "Not IsNumeric("" - "")") + + TestUtil.Assert(IsNumeric(" + 0 "), "IsNumeric("" + 0 "")") + TestUtil.Assert(IsNumeric(" - 0 "), "IsNumeric("" - 0 "")") + Exit Sub errorHandler: TestUtil.ReportErrorHandler("verify_testIsNumeric", Err, Error$, Erl) diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 008b5aeb0a4e..d3396f1da4a0 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -102,6 +102,13 @@ ErrCode ImpScan( std::u16string_view rWSrc, double& nVal, SbxDataType& rType, p++; bMinus = true; } +#if HAVE_FEATURE_SCRIPTING + if (SbiRuntime::isVBAEnabled()) + { + while (p != rWSrc.end() && (*p == ' ' || *p == ' ')) + p++; + } +#endif const auto pNumberStart = p; if (p != rWSrc.end() && (rtl::isAsciiDigit(*p)