diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-10 16:44:15 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-10 23:30:15 +0200 |
commit | 4c17c2303d2475aa080bbc10a0c5d0e9f253d505 (patch) | |
tree | ce75d42401848b088474b78015b5eabec01fc78a /sc/qa | |
parent | c0e792cc6ed3eedd05f483e95415b996992a3b15 (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/extras/scriptforge.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
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\n" + " GlobalScope.BasicLibraries.LoadLibrary(\"ScriptForge\")\n" + " ui = CreateScriptService(\"UI\")\n" + " ui.ShowProgressBar\n" + " Test = \"OK\"\n" + "End Function\n"_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) { |