diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-09-01 21:55:05 +0200 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-09-06 11:31:42 +0200 |
commit | f972f27b455ef78f0d5db5eea96edd707909a154 (patch) | |
tree | b5feeba41935da178c59ae3b6508854a8954851f /sc/qa/extras | |
parent | f2d7f2a28c4334feed4a12eb1553b8d0563c0fc9 (diff) |
tdf#118247 - Correctly handle xlCellTypeConstants parameter
Change-Id: I5cc281d6193bcf03d2da3c594d427ec340c2cfc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139239
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc/qa/extras')
-rwxr-xr-x | sc/qa/extras/testdocuments/tdf118247.xlsm | bin | 0 -> 7224 bytes | |||
-rw-r--r-- | sc/qa/extras/vba-macro-test.cxx | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sc/qa/extras/testdocuments/tdf118247.xlsm b/sc/qa/extras/testdocuments/tdf118247.xlsm Binary files differnew file mode 100755 index 000000000000..73de66a0d423 --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf118247.xlsm diff --git a/sc/qa/extras/vba-macro-test.cxx b/sc/qa/extras/vba-macro-test.cxx index 71c3b9033da1..24f8ddb996c6 100644 --- a/sc/qa/extras/vba-macro-test.cxx +++ b/sc/qa/extras/vba-macro-test.cxx @@ -29,7 +29,10 @@ #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/awt/KeyModifier.hpp> +#include <ooo/vba/excel/XlSpecialCellsValue.hpp> + using namespace css; +using namespace ooo::vba; class VBAMacroTest : public UnoApiTest { @@ -71,6 +74,7 @@ public: void testTdf107902(); void testTdf90278(); void testTdf149531(); + void testTdf118247(); CPPUNIT_TEST_SUITE(VBAMacroTest); CPPUNIT_TEST(testSimpleCopyAndPaste); @@ -92,6 +96,7 @@ public: CPPUNIT_TEST(testTdf107902); CPPUNIT_TEST(testTdf90278); CPPUNIT_TEST(testTdf149531); + CPPUNIT_TEST(testTdf118247); CPPUNIT_TEST_SUITE_END(); }; @@ -928,6 +933,48 @@ void VBAMacroTest::testTdf149531() pDocSh->DoClose(); } + +void VBAMacroTest::testTdf118247() +{ + OUString aFileName; + createFileURL(u"tdf118247.xlsm", aFileName); + auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + + uno::Any aRet; + uno::Sequence<sal_Int16> aOutParamIndex; + uno::Sequence<uno::Any> aOutParam; + uno::Sequence<uno::Any> aParams; + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:VBAProject.Module1.testXlSpecialCellsValuesConstantsEmpty?" + "language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + OUString aReturnValue; + aRet >>= aReturnValue; + CPPUNIT_ASSERT_EQUAL(OUString("$A$1:$A$3"), aReturnValue); + + const std::vector<std::pair<sal_Int32, OUString>> aTestParams( + { { excel::XlSpecialCellsValue::xlNumbers, "$A$1:$A$2" }, + { excel::XlSpecialCellsValue::xlTextValues, "$A$3" }, + { excel::XlSpecialCellsValue::xlLogical, "$A$1:$A$2" }, + { excel::XlSpecialCellsValue::xlErrors, "$A$1:$A$4" } }); + + for (auto & [ nXlSpecialCellsValue, sRange ] : aTestParams) + { + aParams = { uno::Any(nXlSpecialCellsValue) }; + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:VBAProject.Module1.testXlSpecialCellsValuesConstants?" + "language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + aRet >>= aReturnValue; + CPPUNIT_ASSERT_EQUAL(sRange, aReturnValue); + } + css::uno::Reference<css::util::XCloseable> xCloseable(xComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(true); +} CPPUNIT_TEST_SUITE_REGISTRATION(VBAMacroTest); CPPUNIT_PLUGIN_IMPLEMENT(); |