summaryrefslogtreecommitdiff
path: root/xmloff/qa/unit/text.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-08-03 21:03:43 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-08-05 12:09:46 +0200
commit790ab54d7232d232ba84f17f285d4639ddba80d5 (patch)
tree677623e7b1848b1c881861be5c1a36315325438e /xmloff/qa/unit/text.cxx
parent810b9dabc0b91629b0aadadb999b396a7879b385 (diff)
tdf#130707 xmloff: survive <text:database-display> in editeng text
Regression from commit 28d67b792724a23015dec32fb0278b729f676736 (tdf#107776 sw ODF shape import: make is-textbox check more strict, 2019-08-26), now that we correctly identify what shape text to import as "textbox" (Writer TextFrame) and what to import as editeng text, there are documents out there that try to import mailmerge fields into editeng-based shape text. Fix missing error handling there. Note that the error is not just silently ignored, we do insert the field result into the shape text, existing code provides this already. (cherry picked from commit fd18d12efdfbe0e26d41d733edc711d0f40a7804) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100038 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit fec8b842d701cca0b79af9ea9f6192a8cf7610b0) Change-Id: Ibe631ac5d94c1c7795dd00bad05fdcca0e6741a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100055 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'xmloff/qa/unit/text.cxx')
-rw-r--r--xmloff/qa/unit/text.cxx61
1 files changed, 61 insertions, 0 deletions
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
new file mode 100644
index 000000000000..d7da798bafab
--- /dev/null
+++ b/xmloff/qa/unit/text.cxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+using namespace ::com::sun::star;
+
+char const DATA_DIRECTORY[] = "/xmloff/qa/unit/data/";
+
+/// Covers xmloff/source/text/ fixes.
+class XmloffStyleTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+ uno::Reference<lang::XComponent> mxComponent;
+
+public:
+ void setUp() override;
+ void tearDown() override;
+ uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+};
+
+void XmloffStyleTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ uno::Reference<uno::XComponentContext> xComponentContext
+ = comphelper::getProcessComponentContext();
+ mxDesktop.set(frame::Desktop::create(xComponentContext));
+}
+
+void XmloffStyleTest::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMailMergeInEditeng)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "mail-merge-editeng.odt";
+ getComponent() = loadFromDesktop(aURL);
+ // Without the accompanying fix in place, this test would have failed, as unexpected
+ // <text:database-display> in editeng text abored the whole import process.
+ CPPUNIT_ASSERT(getComponent().is());
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */