diff options
author | Noel Power <noel.power@suse.com> | 2013-07-31 10:50:35 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-07-31 10:53:31 +0100 |
commit | 6add3c38a82bbac7e096327277707ba4858bf26a (patch) | |
tree | a397a6294dad200ee6925d4e3013e4fc2d3a34c4 /sc | |
parent | c7a8462b839f37712620fd2c236cfda026ec546d (diff) |
unit ( slowcheck ) test for fdo#67547
although this really isn't the correct location for the test ( a scripting
module slowcheck test would be more appropriate I think ). Still better than
no test.
Change-Id: I434e1217c25ee33b59ea3b09c4500bdd7bb081ba
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 40 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/MasterScriptProviderProblem.ods | bin | 0 -> 8967 bytes |
2 files changed, 40 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index f65b88c754a1..31171c73ee13 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -39,11 +39,13 @@ public: void testStarBasic(); void testVba(); + void testMSP(); CPPUNIT_TEST_SUITE(ScMacrosTest); #if !defined(MACOSX) //enable this test if you want to play with star basic macros in unit tests //works but does nothing useful yet CPPUNIT_TEST(testStarBasic); + CPPUNIT_TEST(testMSP); CPPUNIT_TEST(testVba); #endif @@ -53,6 +55,44 @@ private: uno::Reference<uno::XInterface> m_xCalcComponent; }; +// I suppose you could say this test doesn't really belong here, OTOH +// we need a full document to run the test ( it related originally to an +// imported Excel VBA macro ) It's convenient and fast to unit test +// this the problem this way. Perhaps in the future there will be some sort +// of slowcheck tests ( requiring a full document environment in the scripting +// module, we could move the test there then ) - relates to fdo#67547 +void ScMacrosTest::testMSP() +{ + const OUString aFileNameBase("MasterScriptProviderProblem.ods"); + OUString aFileName; + createFileURL(aFileNameBase, aFileName); + std::cout << "MasterScriptProviderProblem (fdo#67547) test" << std::endl; + uno::Reference< com::sun::star::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + + CPPUNIT_ASSERT_MESSAGE("Failed to load MasterScriptProviderProblem.ods", xComponent.is()); + + OUString aURL("vnd.sun.Star.script:Standard.Module1.TestMSP?language=Basic&location=document"); + String sUrl = aURL; + Any aRet; + Sequence< sal_Int16 > aOutParamIndex; + Sequence< Any > aOutParam; + Sequence< uno::Any > aParams; + + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); + + CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + ScDocShell* xDocSh = static_cast<ScDocShell*>(pFoundShell); + ScDocument* pDoc = xDocSh->GetDocument(); + + pFoundShell->CallXScript(xComponent, sUrl, aParams, aRet, aOutParamIndex,aOutParam); + OUString sResult; + aRet >>= sResult; + + std::cout << "Result is " << sResult << std::endl; + CPPUNIT_ASSERT_MESSAGE("TestMSP ( for fdo#67547) failed", sResult == "OK" ); + xDocSh->DoClose(); +} + void ScMacrosTest::testStarBasic() { const OUString aFileNameBase("StarBasic.ods"); diff --git a/sc/qa/extras/testdocuments/MasterScriptProviderProblem.ods b/sc/qa/extras/testdocuments/MasterScriptProviderProblem.ods Binary files differnew file mode 100644 index 000000000000..35e2b985b80e --- /dev/null +++ b/sc/qa/extras/testdocuments/MasterScriptProviderProblem.ods |