summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/odfimport
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:29:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:29:03 +0000
commit5a7157d319477830426797532e02ac39d3b859f4 (patch)
tree3773f5ce209bee14a5643e98672e0f3828c71434 /sw/qa/extras/odfimport
parentReleasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff)
downloadlibreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz
libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/extras/odfimport')
-rw-r--r--sw/qa/extras/odfimport/data/tdf123968.odtbin9591 -> 8904 bytes
-rw-r--r--sw/qa/extras/odfimport/data/unreferenced_stream.odtbin0 -> 10311 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx27
3 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/odfimport/data/tdf123968.odt b/sw/qa/extras/odfimport/data/tdf123968.odt
index 1c081619ea..cd1ec8a385 100644
--- a/sw/qa/extras/odfimport/data/tdf123968.odt
+++ b/sw/qa/extras/odfimport/data/tdf123968.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/data/unreferenced_stream.odt b/sw/qa/extras/odfimport/data/unreferenced_stream.odt
new file mode 100644
index 0000000000..0cdba0d485
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/unreferenced_stream.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 6ccc8cce3b..70c6452e3d 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1167,9 +1167,21 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf123968)
SwTextNode& rStart = dynamic_cast<SwTextNode&>(pShellCursor->Start()->GetNode());
// The field is now editable like any text, thus the field content "New value" shows up for the cursor.
+ // This field's variable is declared as string and used as string - typical.
CPPUNIT_ASSERT_EQUAL(OUString("inputfield: " + OUStringChar(CH_TXT_ATR_INPUTFIELDSTART)
+ "New value" + OUStringChar(CH_TXT_ATR_INPUTFIELDEND)),
rStart.GetText());
+
+ // This field's variable is declared as float and used as string - not
+ // typical; this can easily happen if the input field is in a header/footer,
+ // because only content.xml contains the variable-decls, styles.xml is
+ // imported before content.xml, and apparently the default variable type is
+ // numeric.
+ SwTextNode& rEnd = dynamic_cast<SwTextNode&>(pShellCursor->End()->GetNode());
+ CPPUNIT_ASSERT_EQUAL(OUString("inputfield: " + OUStringChar(CH_TXT_ATR_INPUTFIELDSTART)
+ + "String input for num variable" + OUStringChar(CH_TXT_ATR_INPUTFIELDEND)),
+ rEnd.GetText());
+
}
CPPUNIT_TEST_FIXTURE(Test, testTdf133459)
@@ -1534,5 +1546,20 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyTrailingSpans)
CPPUNIT_ASSERT_DOUBLES_EQUAL(184, height2, 1); // allow a bit of room for rounding just in case
}
+CPPUNIT_TEST_FIXTURE(Test, testBrokenPackage_Tdf159474)
+{
+ // Given an invalid ODF having a stream not referenced in manifest.xml
+ const OUString url = createFileURL(u"unreferenced_stream.odt");
+ // It expectedly fails to load normally:
+ CPPUNIT_ASSERT_ASSERTION_FAIL(loadFromDesktop(url, {}, {}));
+ // importing it must succeed with RepairPackage set to true.
+ mxComponent
+ = loadFromDesktop(url, {}, { comphelper::makePropertyValue(u"RepairPackage"_ustr, true) });
+ // The document imports in repair mode; the original broken package is used as a template,
+ // and the loaded document has no URL:
+ CPPUNIT_ASSERT(mxComponent.queryThrow<frame::XModel>()->getURL().isEmpty());
+ CPPUNIT_ASSERT_EQUAL(u"Empty document"_ustr, getParagraph(1)->getString());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */