[Libreoffice-commits] .: 2 commits - sc/CppunitTest_sc_macros_test.mk sc/qa
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Mon Oct 24 14:25:49 PDT 2011
sc/CppunitTest_sc_macros_test.mk | 1
sc/qa/unit/macros-test.cxx | 82 +--------------------------------------
2 files changed, 5 insertions(+), 78 deletions(-)
New commits:
commit fb95e1d94538ff7847f0597be756ff289a5608f5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Oct 24 23:21:24 2011 +0200
execute macros_test in headless mode too
otherwise a error dialog might pop up
diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk
index 9049f85..8a9bd3d 100644
--- a/sc/CppunitTest_sc_macros_test.mk
+++ b/sc/CppunitTest_sc_macros_test.mk
@@ -97,6 +97,7 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,sc_macros_test,\
))
$(eval $(call gb_CppunitTest_set_args,sc_macros_test,\
+ --headless \
--protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
-env:OOO_CONFIG_REGISTRY_DIR=$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) \
))
commit c631b30c6b9b9ffaf9a402c406282225c21560ff
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Oct 24 23:07:51 2011 +0200
clean up macros-test
diff --git a/sc/qa/unit/macros-test.cxx b/sc/qa/unit/macros-test.cxx
index 28f5d49..fcc59ba 100644
--- a/sc/qa/unit/macros-test.cxx
+++ b/sc/qa/unit/macros-test.cxx
@@ -40,15 +40,12 @@
#include <sfx2/sfxmodelfactory.hxx>
#include <svl/intitem.hxx>
-#include <editeng/brshitem.hxx>
-#include <editeng/justifyitem.hxx>
#include <basic/sbxdef.hxx>
-#include "helper/csv_handler.hxx"
-#include "orcus/csv_parser.hpp"
-#include <fstream>
-#include <string>
-#include <sstream>
+#include "docsh.hxx"
+#include "patattr.hxx"
+#include "scitems.hxx"
+#include "document.hxx"
#define ODS_FORMAT_TYPE 50331943
#define XLS_FORMAT_TYPE 318767171
@@ -73,68 +70,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);
- }
-}
-
-//need own handler because conditional formatting strings must be generated
-void testCondFile(rtl::OUString& aFileName, ScDocument* pDoc, SCTAB nTab)
-{
- conditional_format_handler aHandler(pDoc, nTab);
- 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<conditional_format_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 */
@@ -151,7 +86,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();
@@ -225,14 +159,6 @@ void ScMacrosTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUSt
rFilePath = aBuffer.makeStringAndClear();
}
-void ScMacrosTest::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 ScMacrosTest::testStarBasic()
{
const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("StarBasic."));
More information about the Libreoffice-commits
mailing list