diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2021-10-04 21:32:20 +0200 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2021-10-12 21:11:10 +0200 |
commit | 5c502a100476c6b57a1a9f4305195c7e2d5d5608 (patch) | |
tree | 80cad644cdafa7245ce55d90e3681975adf845a9 /sc/qa/extras | |
parent | 6e21f5a6b71790b3a36f67c3915b07a5f5717bcf (diff) |
tdf#130307 - Support for each loop for objects exposing XIndexAccess
Change-Id: Ib94c642e6d2a52ac7c60a8f7ae3c79d611b41614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123072
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc/qa/extras')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 28 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf130307.ods | bin | 0 -> 8277 bytes |
2 files changed, 28 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 6c4c9e185521..759f416ae490 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -68,6 +68,7 @@ public: void testTdf90278(); void testTdf143582(); void testTdf144085(); + void testTdf130307(); void testMacroButtonFormControlXlsxExport(); CPPUNIT_TEST_SUITE(ScMacrosTest); @@ -97,6 +98,7 @@ public: CPPUNIT_TEST(testTdf90278); CPPUNIT_TEST(testTdf143582); CPPUNIT_TEST(testTdf144085); + CPPUNIT_TEST(testTdf130307); CPPUNIT_TEST(testMacroButtonFormControlXlsxExport); CPPUNIT_TEST_SUITE_END(); @@ -1057,6 +1059,32 @@ void ScMacrosTest::testTdf144085() xCloseable->close(true); } +void ScMacrosTest::testTdf130307() +{ + OUString aFileName; + createFileURL(u"tdf130307.ods", aFileName); + auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + + css::uno::Any aRet; + css::uno::Sequence<css::uno::Any> aParams; + css::uno::Sequence<css::uno::Any> aOutParam; + css::uno::Sequence<sal_Int16> aOutParamIndex; + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:Standard.Module1.ForEachSheets?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + OUString aReturnValue; + aRet >>= aReturnValue; + + // Without the fix in place, this test would have crashed here + CPPUNIT_ASSERT_EQUAL(OUString("Sheet1Sheet2"), aReturnValue); + + css::uno::Reference<css::util::XCloseable> xCloseable(xComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(true); +} + void ScMacrosTest::testTdf144970() { OUString aFileName; diff --git a/sc/qa/extras/testdocuments/tdf130307.ods b/sc/qa/extras/testdocuments/tdf130307.ods Binary files differnew file mode 100644 index 000000000000..fc354cf2cb1e --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf130307.ods |