From f44c104106170fca4bcaa90b50572dddda6c9858 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 2 Sep 2011 15:26:20 +0100 Subject: [PATCH] enable calc's ODS file filter unit test --- sc/CppunitTest_sc_test_filters.mk | 36 ++++++++++++++++++++++--------- sc/prj/build.lst | 2 +- sc/qa/unit/filters-test.cxx | 23 ++++++++++++-------- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/sc/CppunitTest_sc_test_filters.mk b/sc/CppunitTest_sc_test_filters.mk index 6a52e2caa9c4..073a4c906278 100644 --- a/sc/CppunitTest_sc_test_filters.mk +++ b/sc/CppunitTest_sc_test_filters.mk @@ -35,20 +35,36 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_filters_test, \ )) $(eval $(call gb_CppunitTest_add_linked_libs,sc_filters_test, \ - sc \ - sfx \ - svl \ - svt \ - vcl \ - tl \ - ucbhelper \ - utl \ - i18nisolang1 \ + avmedia \ + basegfx \ comphelper \ cppu \ cppuhelper \ + drawinglayer \ + editeng \ + fileacc \ + for \ + forui \ + i18nisolang1 \ + msfilter \ sal \ - $(gb_STDLIBS) \ + salhelper \ + sb \ + sc \ + sfx \ + sot \ + svl \ + svt \ + svx \ + svxcore \ + tk \ + tl \ + ucbhelper \ + utl \ + vbahelper \ + vcl \ + xo \ + $(gb_STDLIBS) \ )) $(eval $(call gb_CppunitTest_set_include,sc_filters_test,\ diff --git a/sc/prj/build.lst b/sc/prj/build.lst index 00807e2b3df1..b2c1b774fab4 100644 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -1,2 +1,2 @@ -sc sc : filter TRANSLATIONS:translations vbahelper oovbaapi svx uui stoc BOOST:boost formula MDDS:mdds oox LIBXSLT:libxslt unoxml ure test NULL +sc sc : filter TRANSLATIONS:translations vbahelper oovbaapi svx uui stoc BOOST:boost formula MDDS:mdds oox LIBXSLT:libxslt unoxml ure test xmloff desktop ucb package configmgr NULL sc sc\prj nmake - all sc_prj NULL diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 08a8969e5a58..17e6a232654d 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -73,7 +73,7 @@ public: virtual void tearDown(); void recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, int nExpected); - ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData); + ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, sal_uLong nFormatType = 0); /** * Ensure CVEs remain unbroken @@ -95,12 +95,16 @@ private: }; ScDocShellRef FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData) + const rtl::OUString &rUserData, sal_uLong nFormatType) { + sal_uInt32 nFormat = 0; + if (nFormatType) + nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; SfxFilter aFilter( rFilter, - rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(), - rUserData, rtl::OUString() ); + rtl::OUString(), nFormatType, nFormat, rtl::OUString(), 0, rtl::OUString(), + rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); + aFilter.SetVersion(SOFFICE_FILEFORMAT_CURRENT); ScDocShellRef xDocShRef = new ScDocShell; SfxMedium aSrcMed(rURL, STREAM_STD_READ, true); @@ -186,13 +190,14 @@ void FiltersTest::testCVEs() void FiltersTest::testODSs() { -#if 0 -// TODO: loading of ods still fails. I need to look into this. - ScDocShellRef xDocSh = load(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc8")), - m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/calc/sc/qa/unit/data/ods/named-ranges-global.ods")), rtl::OUString()); + rtl::OUString aString1(RTL_CONSTASCII_USTRINGPARAM("calc8")); + rtl::OUString aString2 = m_aSrcRoot + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data/ods/named-ranges-global.ods")); + return; + + ScDocShellRef xDocSh = load( aString1, aString2 , rtl::OUString(), 50331943); CPPUNIT_ASSERT_MESSAGE("Failed to load named-ranges-global.ods.", xDocSh.Is()); -#endif } FiltersTest::FiltersTest()