diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-12-01 19:57:25 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-12-01 23:14:45 +0100 |
commit | c55e0745d4b190487b2166a7c13410616a2c6faf (patch) | |
tree | 93b59c6db44eb03a54fe6affe7ef6b491473f782 /sc/qa | |
parent | a97a5310f921a483d0d11a98cd18185890bcccbc (diff) |
clean up filters-test after split
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 60 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 18 |
2 files changed, 8 insertions, 70 deletions
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index bffb4f63d788..626b038a67e2 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -30,7 +30,6 @@ #include <sal/config.h> #include <unotest/filters-test.hxx> #include <test/bootstrapfixture.hxx> -#include <rtl/strbuf.hxx> #include <osl/file.hxx> #include <sfx2/app.hxx> @@ -42,13 +41,18 @@ #define CALC_DEBUG_OUTPUT 0 #define TEST_BUG_FILES 0 -#include "helper/csv_handler.hxx" #include "helper/debughelper.hxx" -#include "orcus/csv_parser.hpp" #include <fstream> #include <string> #include <sstream> +#include "docsh.hxx" +#include "postit.hxx" +#include "patattr.hxx" +#include "scitems.hxx" +#include "document.hxx" +#include "cellform.hxx" + #define ODS_FORMAT_TYPE 50331943 #define XLS_FORMAT_TYPE 318767171 #define XLSX_FORMAT_TYPE 268959811 @@ -72,45 +76,6 @@ FileFormat aFileFormats[] = { { "xlsx", "Calc MS Excel 2007 XML" , "MS Excel 2007 XML", XLSX_FORMAT_TYPE } }; -void loadFile(const rtl::OUString& aFileName, std::string& aContent) -{ - rtl::OString aOFileName = rtl::OUStringToOString(aFileName, RTL_TEXTENCODING_UTF8); - std::ifstream aFile(aOFileName.getStr()); - - rtl::OStringBuffer aErrorMsg("Could not open csv file: "); - aErrorMsg.append(aOFileName); - CPPUNIT_ASSERT_MESSAGE(aErrorMsg.getStr(), aFile); - std::ostringstream aOStream; - aOStream << aFile.rdbuf(); - aFile.close(); - aContent = aOStream.str(); -} - -void testFile(rtl::OUString& aFileName, ScDocument* pDoc, SCTAB nTab, StringType aStringFormat = StringValue) -{ - csv_handler aHandler(pDoc, nTab, aStringFormat); - orcus::csv_parser_config aConfig; - aConfig.delimiters.push_back(','); - aConfig.delimiters.push_back(';'); - aConfig.text_qualifier = '"'; - - - std::string aContent; - loadFile(aFileName, aContent); - orcus::csv_parser<csv_handler> parser ( &aContent[0], aContent.size() , aHandler, aConfig); - try - { - parser.parse(); - } - catch (const orcus::csv_parse_error& e) - { - std::cout << "reading csv content file failed: " << e.what() << std::endl; - rtl::OStringBuffer aErrorMsg("csv parser error: "); - aErrorMsg.append(e.what()); - CPPUNIT_ASSERT_MESSAGE(aErrorMsg.getStr(), false); - } -} - } /* Implementation of Filters test */ @@ -127,7 +92,6 @@ public: const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType=0); void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath); - void createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rFilePath); virtual void setUp(); virtual void tearDown(); @@ -138,7 +102,7 @@ public: void testCVEs(); //ods, xls, xlsx filter tests - void testRangeName(); + void testRangeName(); // only test ods here, xls and xlsx in subsequent_filters-test void testContent(); #if TEST_BUG_FILES @@ -212,14 +176,6 @@ void ScFiltersTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUS rFilePath = aBuffer.makeStringAndClear(); } -void ScFiltersTest::createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rCSVPath) -{ - rtl::OUStringBuffer aBuffer(getSrcRootPath()); - aBuffer.append(m_aBaseString).append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/contentCSV/"))); - aBuffer.append(aFileBase).append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("csv"))); - rCSVPath = aBuffer.makeStringAndClear(); -} - void ScFiltersTest::testCVEs() { testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")), diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 0c4ac4f70b68..4a6748619030 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -160,11 +160,6 @@ public: virtual void setUp(); virtual void tearDown(); - /** - * Ensure CVEs remain unbroken - */ - void testCVEs(); - //ods, xls, xlsx filter tests void testRangeName(); void testFunctions(); @@ -179,7 +174,6 @@ public: void testPassword(); CPPUNIT_TEST_SUITE(ScFiltersTest); - CPPUNIT_TEST(testCVEs); CPPUNIT_TEST(testRangeName); CPPUNIT_TEST(testFunctions); CPPUNIT_TEST(testDatabaseRanges); @@ -259,18 +253,6 @@ void ScFiltersTest::createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rCSVPath = aBuffer.makeStringAndClear(); } -void ScFiltersTest::testCVEs() -{ - testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")), - getURLFromSrc("/sc/qa/unit/data/qpro/"), rtl::OUString()); - - //warning, the current "sylk filter" in sc (docsh.cxx) automatically - //chains on failure on trying as csv, rtf, etc. so "success" may - //not indicate that it imported as .slk. - testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYLK")), - getURLFromSrc("/sc/qa/unit/data/slk/"), rtl::OUString()); -} - namespace { void testRangeNameImpl(ScDocument* pDoc) |