[Libreoffice-commits] core.git: sc/qa sc/source
Attila Szűcs (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 15 12:28:46 UTC 2021
sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods |binary
sc/qa/unit/subsequent_export-test.cxx | 12 ++++++++++++
sc/source/core/tool/compiler.cxx | 2 +-
3 files changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 8c3041a25fb3d3c3c15c12fecdac23f7935aeffa
Author: Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Mon Jan 11 12:13:48 2021 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Jan 15 13:28:03 2021 +0100
tdf#138832 XLSX export: fix lost file names in modified links
Also for single-reference links, use the temporary indexes
calculated in commit f85d860ccbebd99bc128218148e2992c9415f221
(tdf#87973 XLSX export: fix lost file names in modified links),
Note: only a new test case has been added to the modified unit
test document.
Co-authored-by: Tibor Nagy (NISZ)
Change-Id: I4337a4e68008956ea42b626d210f07b1cbfe59ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109088
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods
index cdaf9d4e7007..d25a18b19cac 100644
Binary files a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods and b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 27fa72e76d30..3bec0ecde3bd 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -5647,6 +5647,15 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds()
aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename);
rDoc.SetFormula(ScAddress(3, 1, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI);
+ // tdf#138832: test the same thing with singleref link
+ rDoc.GetFormula(3, 2, 0, aFormula);
+ nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods");
+ aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods");
+ nIdxOfFile = aFormula.indexOf("file");
+
+ aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename);
+ rDoc.SetFormula(ScAddress(3, 2, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI);
+
// save and load back
ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_XLSX);
CPPUNIT_ASSERT(pDocSh.is());
@@ -5656,6 +5665,9 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds()
rDoc2.GetFormula(3, 1, 0, aFormula2);
CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0);
CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0);
+ rDoc2.GetFormula(3, 2, 0, aFormula2);
+ CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0);
+ CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0);
pDocSh->DoClose();
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f0e116a2acbe..32ff094ab348 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5088,7 +5088,7 @@ void ScCompiler::CreateStringFromExternal( OUStringBuffer& rBuffer, const Formul
break;
case svExternalSingleRef:
pConv->makeExternalRefStr(rDoc.GetSheetLimits(),
- rBuffer, GetPos(), nFileId, *pFileName, t->GetString().getString(),
+ rBuffer, GetPos(), nUsedFileId, *pFileName, t->GetString().getString(),
*t->GetSingleRef());
break;
case svExternalDoubleRef:
More information about the Libreoffice-commits
mailing list