diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-05 13:41:28 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-05 14:36:57 +0200 |
commit | 6cc31515db179c61ec2269fa9fe939ad6ae7a9bc (patch) | |
tree | 6d5811d213245a0143d237bc5260f23ae0470eda /sc/qa | |
parent | 7169026abcdc42182e7649e5bbf5b247a9575a2f (diff) |
extract the calc data structure printers for cppunit equal macros
Change-Id: I9bb1311f5c4688f66c3eb3f85da599686c95e87a
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 21 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 9 | ||||
-rw-r--r-- | sc/qa/unit/rangelst_test.cxx | 21 |
3 files changed, 31 insertions, 20 deletions
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 6ba96cec0b89..2a572136165d 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -29,6 +29,27 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno; +// calc data structure pretty printer +std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) +{ + rStrm << "Col: " << rAddr.Col() << " Row: " << rAddr.Row() << " Tab: " << rAddr.Tab() << "\n"; + return rStrm; +} + +std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange) +{ + rStrm << "ScRange: " << rRange.aStart << rRange.aEnd << "\n"; + return rStrm; +} + +std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList) +{ + rStrm << "ScRangeList: \n"; + for(size_t i = 0; i < rList.size(); ++i) + rStrm << *rList[i]; + return rStrm; +} + FileFormat aFileFormats[] = { { "ods" , "calc8", "", ODS_FORMAT_TYPE }, { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index a4966a15ebfb..eea457635e96 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -78,6 +78,15 @@ struct FileFormat { const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType; }; +// Printers for the calc data structures. Needed for the EQUAL assertion +// macros from CPPUNIT. + +std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr); + +std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange); + +std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList); + // Why is this here and not in osl, and using the already existing file // handling APIs? Do we really want to add arbitrary new file handling // wrappers here and there (and then having to handle the Android (and diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index 4281392b4909..afec0d1c84fa 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -9,6 +9,7 @@ #include <sal/config.h> #include <test/bootstrapfixture.hxx> +#include "helper/qahelper.hxx" #include "document.hxx" #include "docsh.hxx" @@ -78,26 +79,6 @@ private: ScDocShellRef m_xDocShRef; }; -static std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) -{ - rStrm << "Col: " << rAddr.Col() << " Row: " << rAddr.Row() << " Tab: " << rAddr.Tab() << "\n"; - return rStrm; -} - -static std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange) -{ - rStrm << "ScRange: " << rRange.aStart << rRange.aEnd << "\n"; - return rStrm; -} - -static std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList) -{ - rStrm << "ScRangeList: \n"; - for(size_t i = 0; i < rList.size(); ++i) - rStrm << *rList[i]; - return rStrm; -} - void Test::setUp() { BootstrapFixture::setUp(); |