sc/qa/extras/scriptforge.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
New commits: commit 4c17c2303d2475aa080bbc10a0c5d0e9f253d505 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Oct 10 16:44:15 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Oct 10 23:30:15 2024 +0200 tdf#163219: sc_scriptforge_test: Add unittest Change-Id: I045f9e8ae8805c81f455e4171be95e1222ee908f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174765 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/extras/scriptforge.cxx b/sc/qa/extras/scriptforge.cxx index 4f6b1b5dc2c6..32a8b0cd7687 100644 --- a/sc/qa/extras/scriptforge.cxx +++ b/sc/qa/extras/scriptforge.cxx @@ -45,6 +45,30 @@ CPPUNIT_TEST_FIXTURE(ScScriptForgeTest, testSetValue) CPPUNIT_ASSERT_EQUAL(u"10"_ustr, pDoc->GetString(ScAddress(0, 0, 0))); } +CPPUNIT_TEST_FIXTURE(ScScriptForgeTest, testShowProgressBar) +{ + createScDoc(); + + // insert initial library + css::uno::Reference<css::document::XEmbeddedScripts> xDocScr(mxComponent, UNO_QUERY_THROW); + auto xLibs = xDocScr->getBasicLibraries(); + auto xLibrary = xLibs->createLibrary(u"TestLibrary"_ustr); + xLibrary->insertByName(u"TestModule"_ustr, + uno::Any(u"Function Test as String " + " GlobalScope.BasicLibraries.LoadLibrary(\"ScriptForge\") " + " ui = CreateScriptService(\"UI\") " + " ui.ShowProgressBar " + " Test = \"OK\" " + "End Function "_ustr)); + + // Without the fix in place, this test would have crashed + Any aRet = executeMacro( + u"vnd.sun.Star.script:TestLibrary.TestModule.Test?language=Basic&location=document"_ustr); + OUString sResult; + aRet >>= sResult; + CPPUNIT_ASSERT_EQUAL(u"OK"_ustr, sResult); +} + ScScriptForgeTest::ScScriptForgeTest() : ScModelTestBase(u"/sc/qa/extras/testdocuments"_ustr) {