summaryrefslogtreecommitdiffstats
path: root/sc/qa
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2014-10-25 21:47:55 +0200
committerAndras Timar <andras.timar@collabora.com>2014-10-25 23:58:01 +0200
commit3f5251675eeeeae56ea282fdeb09dbc53ce4aae6 (patch)
tree52e55ec1c4f6a01fe5243aaec0c5d8b13edadc63 /sc/qa
parenttypo: uesd -> used (diff)
downloadcore-3f5251675eeeeae56ea282fdeb09dbc53ce4aae6.tar.gz
core-3f5251675eeeeae56ea282fdeb09dbc53ce4aae6.zip
bnc#893791 XLS export: external sheet references on Linux/OSX
The commit solves two problems. 1. Make sure we save absolute paths on Linux/OSX 2. Make sure we don't save invalid XLS (VirtualPath longer than 255 chars) The first problem has always been there, so after a few load/save cycles an XLS with reference to other XLS on a Unix-like file system became invalid, and only LibreOffice could open it, Excel could not. These broken XLS files can be repaired by saving after this patch, however, the original reference will remain broken. Change-Id: I8f575acb1d560d539c1da61a1afdaac3f0c13977
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/data/xls/external-ref.xlsbin0 -> 5632 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx22
2 files changed, 22 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/external-ref.xls b/sc/qa/unit/data/xls/external-ref.xls
new file mode 100644
index 000000000000..21f3338bd878
--- /dev/null
+++ b/sc/qa/unit/data/xls/external-ref.xls
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 988ed3447e45..ef3e8dce8403 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -125,6 +125,8 @@ public:
void testPivotTableXLSX();
void testPivotTableTwoDataFieldsXLSX();
+ void testSupBookVirtualPath();
+
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
#if !defined(MACOSX) && !defined(DRAGONFLY)
@@ -164,6 +166,9 @@ public:
CPPUNIT_TEST(testPivotTableXLSX);
CPPUNIT_TEST(testPivotTableTwoDataFieldsXLSX);
CPPUNIT_TEST(testFunctionsExcel2010ODS);
+#if !defined(WNT)
+ CPPUNIT_TEST(testSupBookVirtualPath);
+#endif
CPPUNIT_TEST_SUITE_END();
@@ -2272,6 +2277,23 @@ void ScExportTest::tearDown()
test::BootstrapFixture::tearDown();
}
+void ScExportTest::testSupBookVirtualPath()
+{
+ ScDocShellRef xShell = loadDoc("external-ref.", XLS);
+ CPPUNIT_ASSERT(xShell.Is());
+
+ ScDocShellRef xDocSh = saveAndReload(xShell, XLS);
+ xShell->DoClose();
+ CPPUNIT_ASSERT(xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ if (!checkFormula(rDoc, ScAddress(0,0,0), "'file:///home/timar/Documents/external.xls'#$Sheet1.A1"))
+ CPPUNIT_FAIL("Wrong SupBook VirtualPath URL");
+
+ xDocSh->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();