diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-09-17 02:43:18 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-09-17 02:44:11 +0200 |
commit | c4a6a8d239d2e3da2e4a772efe095c292ca69827 (patch) | |
tree | 653d399370c30f6f194618b6c6e909faaf453547 /sc/qa/unit | |
parent | 21edfcb82484be3e30e8e7f27f4cf68ec1cb8c4b (diff) |
add more test for ScRangeList::DeleteArea
Change-Id: I2484603b74cbdb1f92c08eac6c02d9a091e06eb9
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/rangelst_test.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index a65a0eb27010..290196598ac8 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -21,9 +21,13 @@ public: virtual void tearDown(); void testDeleteArea_4Ranges(); + void testDeleteArea_2Ranges(); + void testDeleteArea_0Ranges(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testDeleteArea_4Ranges); + CPPUNIT_TEST(testDeleteArea_2Ranges); + CPPUNIT_TEST(testDeleteArea_0Ranges); CPPUNIT_TEST_SUITE_END(); @@ -70,6 +74,41 @@ void Test::testDeleteArea_4Ranges() } } +void Test::testDeleteArea_2Ranges() +{ + ScRangeList aList(ScRange(0,0,0,5,5,5)); + ScRangeList aList2(aList); + + aList.DeleteArea(4,4,0,6,7,0); + aList2.DeleteArea(4,4,0,6,7,0); + CPPUNIT_ASSERT_EQUAL(aList.size(), static_cast<size_t>(2)); + CPPUNIT_ASSERT_EQUAL(aList2.size(), static_cast<size_t>(2)); + + for(SCCOL nCol = 0; nCol <= 5; ++nCol) + { + for(SCROW nRow = 0; nRow <= 5; ++nRow) + { + if(nCol>=4 && nRow >= 4) + CPPUNIT_ASSERT(!aList.Intersects(ScRange(nCol, nRow, 0))); + else + CPPUNIT_ASSERT(aList.Intersects(ScRange(nCol, nRow, 0))); + } + } +} + +void Test::testDeleteArea_0Ranges() +{ + ScRangeList aList(ScRange(1,1,0,3,3,0)); + aList.DeleteArea(1,1,0,3,3,0); + + CPPUNIT_ASSERT(aList.empty()); + + ScRangeList aList2(ScRange(1,1,0,3,3,0)); + aList2.DeleteArea(0,0,0,4,4,0); + + CPPUNIT_ASSERT(aList.empty()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |