Kaydet (Commit) 6add3c38 authored tarafından Noel Power's avatar Noel Power

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
üst c7a8462b
...@@ -39,11 +39,13 @@ public: ...@@ -39,11 +39,13 @@ public:
void testStarBasic(); void testStarBasic();
void testVba(); void testVba();
void testMSP();
CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST_SUITE(ScMacrosTest);
#if !defined(MACOSX) #if !defined(MACOSX)
//enable this test if you want to play with star basic macros in unit tests //enable this test if you want to play with star basic macros in unit tests
//works but does nothing useful yet //works but does nothing useful yet
CPPUNIT_TEST(testStarBasic); CPPUNIT_TEST(testStarBasic);
CPPUNIT_TEST(testMSP);
CPPUNIT_TEST(testVba); CPPUNIT_TEST(testVba);
#endif #endif
...@@ -53,6 +55,44 @@ private: ...@@ -53,6 +55,44 @@ private:
uno::Reference<uno::XInterface> m_xCalcComponent; 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() void ScMacrosTest::testStarBasic()
{ {
const OUString aFileNameBase("StarBasic.ods"); const OUString aFileNameBase("StarBasic.ods");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment