summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-20 17:13:26 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-28 07:36:48 +0000
commitd622972dceba40d89852b1dc832c6e2a4612b2fa (patch)
treee82884b3e89281fd207f84d91ee1c02ca212b35e /sc
parentbb97bfe3168916ec54404a35f1f0d66d8c06c50d (diff)
tdf#142391 - Store method using 0x13 format only when actually needed
Change-Id: I907d234b20be5e3c7bee0d44407f1bf4c4b49f05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149175 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/extras/macros-test.cxx33
-rwxr-xr-xsc/qa/extras/testdocuments/tdf142391.odsbin0 -> 138450 bytes
2 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index b8dc5824bebd..92e379cf8ead 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -41,6 +41,7 @@ public:
void testStarBasic();
void testMSP();
void testPasswordProtectedStarBasic();
+ void testTdf142391();
void testTdf114427();
void testRowColumn();
void testTdf104902();
@@ -75,6 +76,7 @@ public:
CPPUNIT_TEST(testStarBasic);
CPPUNIT_TEST(testMSP);
CPPUNIT_TEST(testPasswordProtectedStarBasic);
+ CPPUNIT_TEST(testTdf142391);
CPPUNIT_TEST(testTdf114427);
CPPUNIT_TEST(testRowColumn);
CPPUNIT_TEST(testTdf104902);
@@ -159,6 +161,37 @@ void ScMacrosTest::testPasswordProtectedStarBasic()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Far Method script did not change the value of Sheet1.C1", OUString("success"), aValue);
}
+void ScMacrosTest::testTdf142391()
+{
+ loadFromURL(u"tdf142391.ods");
+
+ SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
+ CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pFoundShell);
+ ScDocument& rDoc = pDocSh->GetDocument();
+
+ // User defined types
+ executeMacro(
+ "vnd.sun.Star.script:Standard.Module1.LoadAndExecuteTest?language=Basic&location=document");
+ OUString aValue = rDoc.GetString(0, 0, 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("User defined types script did not change the value of Sheet1.A1",
+ OUString("success"), aValue);
+
+ // Big Module
+ executeMacro(
+ "vnd.sun.Star.script:MyLibrary.BigModule.bigMethod?language=Basic&location=document");
+ aValue = rDoc.GetString(1, 0, 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Big module script did not change the value of Sheet1.B1",
+ OUString("success"), aValue);
+
+ // tdf#142391 - method exceeds 0xffff offset for methods
+ executeMacro(
+ "vnd.sun.Star.script:MyLibrary.BigModule.farBigMethod?language=Basic&location=document");
+ aValue = rDoc.GetString(2, 0, 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Far Method script did not change the value of Sheet1.C1",
+ OUString("success"), aValue);
+}
+
void ScMacrosTest::testStarBasic()
{
loadFromURL(u"StarBasic.ods");
diff --git a/sc/qa/extras/testdocuments/tdf142391.ods b/sc/qa/extras/testdocuments/tdf142391.ods
new file mode 100755
index 000000000000..aa62239ebe9c
--- /dev/null
+++ b/sc/qa/extras/testdocuments/tdf142391.ods
Binary files differ