diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-08-15 10:55:53 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-08-15 11:42:55 +0200 |
commit | 5827e30109b683cb74efa21d154e5219fe9e2a0c (patch) | |
tree | 7a1557f85069e434393228f0be75a4266022eddc /embeddedobj/qa/cppunit | |
parent | bb9bad31b9e9f741fed91b2a4b3043814cb07f13 (diff) |
embeddedobj: allow controlling if Visio documents are converted to Draw or not
At the moment this affects only Insert -> Object -> OLE Object -> from
file.
Change-Id: I8d1c6456481610491916e3be3766b0bb04dfa296
Reviewed-on: https://gerrit.libreoffice.org/77489
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'embeddedobj/qa/cppunit')
-rw-r--r-- | embeddedobj/qa/cppunit/data/insert-file-config.vsdx | bin | 0 -> 12483 bytes | |||
-rw-r--r-- | embeddedobj/qa/cppunit/general.cxx | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/embeddedobj/qa/cppunit/data/insert-file-config.vsdx b/embeddedobj/qa/cppunit/data/insert-file-config.vsdx Binary files differnew file mode 100644 index 000000000000..bb3a129cfa7b --- /dev/null +++ b/embeddedobj/qa/cppunit/data/insert-file-config.vsdx diff --git a/embeddedobj/qa/cppunit/general.cxx b/embeddedobj/qa/cppunit/general.cxx index 43b8dd9f4c1b..bbab17440fe3 100644 --- a/embeddedobj/qa/cppunit/general.cxx +++ b/embeddedobj/qa/cppunit/general.cxx @@ -85,6 +85,39 @@ CPPUNIT_TEST_FIXTURE(EmbeddedobjGeneralTest, testInsertFileConfig) CPPUNIT_ASSERT(!xObject.is()); } +CPPUNIT_TEST_FIXTURE(EmbeddedobjGeneralTest, testInsertFileConfigVsdx) +{ + // Explicitly disable Word->Writer mapping for this test. + std::shared_ptr<comphelper::ConfigurationChanges> pBatch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::set(false, pBatch); + pBatch->commit(); + comphelper::ScopeGuard g([]() { + std::shared_ptr<comphelper::ConfigurationChanges> pBatchReset( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::set(true, pBatchReset); + pBatchReset->commit(); + }); + getComponent().set( + loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); + + // Insert a file as an embedded object. + uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage(); + comphelper::EmbeddedObjectContainer aContainer(xStorage); + OUString aFileName + = m_directories.getURLFromSrc("embeddedobj/qa/cppunit/data/insert-file-config.vsdx"); + uno::Sequence<beans::PropertyValue> aMedium{ comphelper::makePropertyValue("URL", aFileName) }; + OUString aName("Object 1"); + uno::Reference<embed::XEmbeddedObject> xObject + = aContainer.InsertEmbeddedObject(aMedium, aName); + + // Make sure that the insertion fails: + // 1) the user explicitly requested that the data is not loaded into Writer + // 2) this is non-Windows, so OLE embedding is not an option + // so silently still loading the data into Writer would be bad. + CPPUNIT_ASSERT(!xObject.is()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |