diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-26 04:10:50 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-26 04:16:58 +0100 |
commit | ef48f2fd617aad8a19c2d5613db8fa513b2ef455 (patch) | |
tree | c86f08507f9c6ee893247d367281ec08760cb0c6 /sc | |
parent | 7c528f40e0aea9386d175b007974c02d265f96c6 (diff) |
add a unit test for new method in ScRangeList
Change-Id: Id27973cc82c71daffec62cbaccba30777c08612b
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/rangelst_test.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index b5381eceeee3..62d9002af503 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -38,6 +38,7 @@ public: void testDeleteArea_0Ranges(); void testJoin_Case1(); void testJoin_Case2(); + void testGetIntersectedRange(); void testUpdateReference_DeleteRow(); void testUpdateReference_DeleteCol(); @@ -63,6 +64,7 @@ public: CPPUNIT_TEST(testJoin_Case2); CPPUNIT_TEST(testUpdateReference_DeleteRow); CPPUNIT_TEST(testUpdateReference_DeleteCol); + CPPUNIT_TEST(testGetIntersectedRange); CPPUNIT_TEST_SUITE_END(); @@ -71,6 +73,30 @@ private: ScDocShellRef m_xDocShRef; }; +namespace { + +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; +} + +} + void Test::setUp() { @@ -449,6 +475,13 @@ void Test::testUpdateReference_DeleteCol() CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(12), aList.GetCellCount()); } +void Test::testGetIntersectedRange() +{ + ScRangeList aList(ScRange(2, 2, 0, 5, 5, 0)); + ScRangeList aIntersecting = aList.GetIntersectedRange(ScRange(0, 0, 0, 3, 3, 0)); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(2,2,0,3,3,0)), aIntersecting); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |