From a719841d02fb93ddfc80956c5e6e417f551e8a9f Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Mon, 3 Jun 2013 04:26:43 +0200 Subject: add test case for fdo#62938 Change-Id: Ib15ff9d40b01dee2102ec6137d8b6394f7957ab8 --- sc/qa/unit/data/ods/print-range.ods | Bin 0 -> 6876 bytes sc/qa/unit/helper/qahelper.hxx | 30 ++++++++++++++++++++++++++++++ sc/qa/unit/subsequent_filters-test.cxx | 16 ++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 sc/qa/unit/data/ods/print-range.ods (limited to 'sc') diff --git a/sc/qa/unit/data/ods/print-range.ods b/sc/qa/unit/data/ods/print-range.ods new file mode 100644 index 000000000000..d7207e16a62e Binary files /dev/null and b/sc/qa/unit/data/ods/print-range.ods differ diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index a0168c4245d1..ad25b74d1967 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -115,6 +115,36 @@ void loadFile(const OUString& aFileName, std::string& aContent) aContent = aOStream.str(); } +std::string print(const ScAddress& rAddr) +{ + std::stringstream str; + str << "Col: " << rAddr.Col(); + str << " Row: " << rAddr.Row(); + str << " Tab: " << rAddr.Tab(); + return str.str(); +} + +namespace CppUnit { + +template<> +struct assertion_traits +{ + static bool equal( const ScRange& x, const ScRange& y ) + { + return x == y; + } + + static std::string toString( const ScRange& x ) + { + std::stringstream str; + str << "Start: " << print(x.aStart); + str << "\nEnd: " << print(x.aEnd); + return str.str(); + } +}; + +} + class ScBootstrapFixture : public test::BootstrapFixture { protected: diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 82bbbb4abb2b..ad5466aae707 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -136,6 +136,8 @@ public: void testMiscRowHeights(); void testOptimalHeightReset(); + void testPrintRangeODS(); + CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBasicCellContentODS); CPPUNIT_TEST(testRangeNameXLS); @@ -198,6 +200,7 @@ public: #endif CPPUNIT_TEST(testMiscRowHeights); CPPUNIT_TEST(testOptimalHeightReset); + CPPUNIT_TEST(testPrintRangeODS); CPPUNIT_TEST_SUITE_END(); private: @@ -1925,6 +1928,19 @@ void ScFiltersTest::testOptimalHeightReset() xDocSh->DoClose(); } +void ScFiltersTest::testPrintRangeODS() +{ + ScDocShellRef xDocSh = loadDoc("print-range.", ODS); + ScDocument* pDoc = xDocSh->GetDocument(); + const ScRange* pRange = pDoc->GetRepeatRowRange(0); + CPPUNIT_ASSERT(pRange); + CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,0,1,0), *pRange); + + pRange = pDoc->GetRepeatRowRange(0); + CPPUNIT_ASSERT(pRange); + CPPUNIT_ASSERT_EQUAL(ScRange(0,2,1,0,4,1), *pRange); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { -- cgit