diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-18 19:14:54 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-18 19:21:06 +0100 |
commit | d0f8b0262707529f36a7317663df1b1035d0c62a (patch) | |
tree | c82ad5d9a5d8ff557c96049fba7f77319568e165 /sw | |
parent | 5fbea544470d1a3edc51e881c12063ef1bf56dda (diff) |
SwFiltersTest::filter: detect import filter on export test
This allows e.g. crash-testing the RTF export, even if the input source
is not RTF but ODT.
Change-Id: I3cf6afd1bc44bb475f1bd8da622d10dac0d3baa6
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_filters_test.mk | 2 | ||||
-rw-r--r-- | sw/qa/core/exportdata/rtf/pass/i23357.odt (renamed from sw/qa/extras/rtfexport/data/i23357.odt) | bin | 25252 -> 25252 bytes | |||
-rw-r--r-- | sw/qa/core/filters-test.cxx | 19 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 5 |
4 files changed, 19 insertions, 7 deletions
diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk index 95be87c07a03..102b8a03abc2 100644 --- a/sw/CppunitTest_sw_filters_test.mk +++ b/sw/CppunitTest_sw_filters_test.mk @@ -73,6 +73,8 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\ svtools/util/svt \ sw/util/msword \ sw/util/sw \ + sw/util/swd \ + uui/util/uui \ toolkit/util/tk \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ diff --git a/sw/qa/extras/rtfexport/data/i23357.odt b/sw/qa/core/exportdata/rtf/pass/i23357.odt Binary files differindex 79705fc35c1b..79705fc35c1b 100644 --- a/sw/qa/extras/rtfexport/data/i23357.odt +++ b/sw/qa/core/exportdata/rtf/pass/i23357.odt diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 7c811a4e6058..7caa99ff49fa 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -91,7 +91,18 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, SwDocShellRef xDocShRef = new SwDocShell; SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ); - pSrcMed->SetFilter(pFilter); + + const SfxFilter* pImportFilter = 0; + SfxFilter* pExportFilter = 0; + if (bExport) + { + SFX_APP()->GetFilterMatcher().GuessFilter(*pSrcMed, &pImportFilter, SFX_FILTER_IMPORT, 0); + pExportFilter = pFilter; + } + else + pImportFilter = pFilter; + + pSrcMed->SetFilter(pImportFilter); if (rUserData == FILTER_TEXT_DLG) { @@ -107,10 +118,14 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, return bLoaded; } + // How come an error may be set, and still DoLoad() returns success? Strange... + if (bLoaded) + xDocShRef->ResetError(); + utl::TempFile aTempFile; aTempFile.EnableKillingFile(); SfxMedium aDstMed(aTempFile.GetURL(), STREAM_STD_WRITE); - aDstMed.SetFilter(pFilter); + aDstMed.SetFilter(pExportFilter); bool bSaved = xDocShRef->DoSaveAs(aDstMed); if (xDocShRef.Is()) xDocShRef->DoClose(); diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index b4d725405d34..b6084cbed641 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -579,11 +579,6 @@ DECLARE_RTFEXPORT_TEST(testFdo66743, "fdo66743.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(0xd8d8d8), getProperty<sal_Int32>(xCell, "BackColor")); } -DECLARE_RTFEXPORT_TEST(testI23357, "i23357.odt") -{ - // crashtest -} - #endif CPPUNIT_PLUGIN_IMPLEMENT(); |