summaryrefslogtreecommitdiff
path: root/sw/qa/uibase
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/uibase')
-rw-r--r--sw/qa/uibase/uiview/data/update-replacement-nosetting.odtbin0 -> 40982 bytes
-rw-r--r--sw/qa/uibase/uiview/uiview.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/uibase/uiview/data/update-replacement-nosetting.odt b/sw/qa/uibase/uiview/data/update-replacement-nosetting.odt
new file mode 100644
index 000000000000..055c3d1a2c2a
--- /dev/null
+++ b/sw/qa/uibase/uiview/data/update-replacement-nosetting.odt
Binary files differ
diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx
index 8827cea10752..4d622aafaa5f 100644
--- a/sw/qa/uibase/uiview/uiview.cxx
+++ b/sw/qa/uibase/uiview/uiview.cxx
@@ -12,6 +12,7 @@
#include <unotools/mediadescriptor.hxx>
#include <comphelper/processfactory.hxx>
#include <osl/file.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <com/sun/star/frame/DispatchHelper.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
@@ -87,6 +88,30 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateAllObjectReplacements)
CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Components_1"));
}
+CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateReplacementNosetting)
+{
+ // Load a copy of the document in hidden mode.
+ OUString aSourceURL
+ = m_directories.getURLFromSrc(DATA_DIRECTORY) + "update-replacement-nosetting.odt";
+ CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, osl::File::copy(aSourceURL, maTempFile.GetURL()));
+ mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument",
+ { comphelper::makePropertyValue("Hidden", true) });
+
+ // Update "everything" (including object replacements) and save it.
+ dispatchCommand(mxComponent, ".uno:UpdateAll", {});
+ uno::Reference<frame::XStorable2> xStorable(mxComponent, uno::UNO_QUERY);
+ xStorable->storeSelf({});
+
+ // Check the contents of the updated copy.
+ uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
+ = packages::zip::ZipFileAccess::createWithURL(xContext, maTempFile.GetURL());
+
+ // Without the accompanying fix in place, this test would have failed, because the embedded
+ // object replacement image was not generated.
+ CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Components"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */