LCOV - code coverage report
Current view: top level - sc/qa/unit - rangelst_test.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 271 271 100.0 %
Date: 2014-11-03 Functions: 34 35 97.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <sal/config.h>
      11             : #include <test/bootstrapfixture.hxx>
      12             : #include "helper/qahelper.hxx"
      13             : #include "document.hxx"
      14             : #include "docsh.hxx"
      15             : 
      16             : #include "rangelst.hxx"
      17             : 
      18          92 : class Test : public test::BootstrapFixture
      19             : {
      20             : public:
      21          46 :     Test()
      22          46 :         : m_pDoc(NULL)
      23             :     {
      24          46 :     }
      25             : 
      26             :     virtual void setUp() SAL_OVERRIDE;
      27             :     virtual void tearDown() SAL_OVERRIDE;
      28             : 
      29             :     void testDeleteArea_4Ranges();
      30             :     void testDeleteArea_3Ranges();
      31             :     void testDeleteArea_3Ranges_Case2();
      32             :     void testDeleteArea_3Ranges_Case3();
      33             :     void testDeleteArea_3Ranges_Case4();
      34             :     void testDeleteArea_3Ranges_Case5();
      35             :     void testDeleteArea_2Ranges();
      36             :     void testDeleteArea_2Ranges_Case2();
      37             :     void testDeleteArea_2Ranges_Case3();
      38             :     void testDeleteArea_2Ranges_Case4();
      39             :     void testDeleteArea_2Ranges_Case5();
      40             :     void testDeleteArea_2Ranges_Case6();
      41             :     void testDeleteArea_2Ranges_Case7();
      42             :     void testDeleteArea_2Ranges_Case8();
      43             :     void testDeleteArea_1Range();
      44             :     void testDeleteArea_0Ranges();
      45             :     void testJoin_Case1();
      46             :     void testJoin_Case2();
      47             :     void testGetIntersectedRange();
      48             : 
      49             :     void testUpdateReference_DeleteRow();
      50             :     void testUpdateReference_DeleteCol();
      51             : 
      52             :     void testInsertRow();
      53             :     void testInsertCol();
      54             : 
      55           4 :     CPPUNIT_TEST_SUITE(Test);
      56           2 :     CPPUNIT_TEST(testDeleteArea_4Ranges);
      57           2 :     CPPUNIT_TEST(testDeleteArea_3Ranges);
      58           2 :     CPPUNIT_TEST(testDeleteArea_3Ranges_Case2);
      59           2 :     CPPUNIT_TEST(testDeleteArea_3Ranges_Case3);
      60           2 :     CPPUNIT_TEST(testDeleteArea_3Ranges_Case4);
      61           2 :     CPPUNIT_TEST(testDeleteArea_3Ranges_Case5);
      62           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges);
      63           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case2);
      64           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case3);
      65           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case4);
      66           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case5);
      67           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case6);
      68           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case7);
      69           2 :     CPPUNIT_TEST(testDeleteArea_2Ranges_Case8);
      70           2 :     CPPUNIT_TEST(testDeleteArea_1Range);
      71           2 :     CPPUNIT_TEST(testDeleteArea_0Ranges);
      72           2 :     CPPUNIT_TEST(testJoin_Case1);
      73           2 :     CPPUNIT_TEST(testJoin_Case2);
      74           2 :     CPPUNIT_TEST(testUpdateReference_DeleteRow);
      75           2 :     CPPUNIT_TEST(testUpdateReference_DeleteCol);
      76           2 :     CPPUNIT_TEST(testGetIntersectedRange);
      77           2 :     CPPUNIT_TEST(testInsertRow);
      78           2 :     CPPUNIT_TEST(testInsertCol);
      79           4 :     CPPUNIT_TEST_SUITE_END();
      80             : 
      81             : private:
      82             :     ScDocument *m_pDoc;
      83             :     ScDocShellRef m_xDocShRef;
      84             : };
      85             : 
      86          46 : void Test::setUp()
      87             : {
      88          46 :     BootstrapFixture::setUp();
      89             : 
      90          46 :     ScDLL::Init();
      91         138 :     m_xDocShRef = new ScDocShell(
      92             :         SFXMODEL_STANDARD |
      93             :         SFXMODEL_DISABLE_EMBEDDED_SCRIPTS |
      94          92 :         SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
      95             : 
      96          46 :     m_pDoc = &m_xDocShRef->GetDocument();
      97          46 : }
      98             : 
      99          46 : void Test::tearDown()
     100             : {
     101          46 :     m_xDocShRef.Clear();
     102          46 :     BootstrapFixture::tearDown();
     103          46 : }
     104             : 
     105           2 : void Test::testDeleteArea_4Ranges()
     106             : {
     107           2 :     ScRangeList aList(ScRange(0,0,0,5,5,0));
     108           2 :     aList.DeleteArea(2,2,0,3,3,0);
     109             : 
     110           2 :     CPPUNIT_ASSERT_EQUAL(aList.size(), static_cast<size_t>(4));
     111          14 :     for(SCCOL nCol = 0; nCol <= 5; ++nCol)
     112             :     {
     113          84 :         for(SCROW nRow = 0; nRow <= 5; ++nRow)
     114             :         {
     115          72 :             if((nCol == 2 || nCol == 3) && ( nRow == 2 || nRow == 3))
     116           8 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     117             :             else
     118          64 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     119             :         }
     120           2 :     }
     121           2 : }
     122             : 
     123           2 : void Test::testDeleteArea_3Ranges()
     124             : {
     125           2 :     ScRangeList aList(ScRange(1,1,0,6,6,0));
     126           2 :     aList.DeleteArea(3,3,0,8,4,0);
     127             : 
     128           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aList.size());
     129          14 :     for(SCCOL nCol = 1; nCol <= 6; ++nCol)
     130             :     {
     131          84 :         for(SCROW nRow = 1; nRow <= 6; ++nRow)
     132             :         {
     133          72 :             if((nRow == 3 || nRow == 4) && (nCol >= 3))
     134          16 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     135             :             else
     136          56 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     137             :         }
     138             :     }
     139             : 
     140           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(28), aList.GetCellCount());
     141           2 : }
     142             : 
     143           2 : void Test::testDeleteArea_3Ranges_Case2()
     144             : {
     145           2 :     ScRangeList aList(ScRange(1,1,0,6,6,0));
     146           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     147           2 :     aList.DeleteArea(0,2,0,2,4,0);
     148           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aList.size());
     149             : 
     150             :     // Column 1-2 && Row 2-4 should not be in the range list. The rest should
     151             :     // be in the list.
     152          14 :     for (SCCOL nCol = 1; nCol <= 6; ++nCol)
     153             :     {
     154          84 :         for (SCROW nRow = 1; nRow <= 6; ++nRow)
     155             :         {
     156          72 :             if ((1 <= nCol && nCol <= 2) && (2 <= nRow && nRow <= 4))
     157          12 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     158             :             else
     159          60 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     160             :         }
     161           2 :     }
     162           2 : }
     163             : 
     164           2 : void Test::testDeleteArea_3Ranges_Case3()
     165             : {
     166           2 :     ScRangeList aList(ScRange(1,5,0,6,11,0));
     167           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     168           2 :     aList.DeleteArea(3,2,0,4,8,0);
     169           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aList.size());
     170             : 
     171             :     // Column 3-4 && Row 5-8 should not be in the range list.
     172          14 :     for (SCCOL nCol = 1; nCol <= 6; ++nCol)
     173             :     {
     174          96 :         for (SCROW nRow = 5; nRow <= 11; ++nRow)
     175             :         {
     176          84 :             if ((3 <= nCol && nCol <= 4) && (5 <= nRow && nRow <= 8))
     177          16 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     178             :             else
     179          68 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     180             :         }
     181           2 :     }
     182           2 : }
     183             : 
     184           2 : void Test::testDeleteArea_3Ranges_Case4()
     185             : {
     186           2 :     ScRangeList aList(ScRange(1,5,0,6,11,0));
     187           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     188           2 :     aList.DeleteArea(3,5,0,4,5,0);
     189           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aList.size());
     190             : 
     191             :     // Column 3-4 && Row 5 should not be in the range list.
     192          14 :     for (SCCOL nCol = 1; nCol <= 6; ++nCol)
     193             :     {
     194          96 :         for (SCROW nRow = 5; nRow <= 11; ++nRow)
     195             :         {
     196          84 :             if ((3 <= nCol && nCol <= 4) && 5 == nRow )
     197           4 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     198             :             else
     199          80 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     200             :         }
     201           2 :     }
     202           2 : }
     203             : 
     204           2 : void Test::testDeleteArea_3Ranges_Case5()
     205             : {
     206           2 :     ScRangeList aList(ScRange(1,5,0,6,11,0));
     207           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     208           2 :     aList.DeleteArea(6,7,0,6,9,0);
     209           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aList.size());
     210             : 
     211             :     // Column 6 && Row 7-9 should not be in the range list.
     212          14 :     for (SCCOL nCol = 1; nCol <= 6; ++nCol)
     213             :     {
     214          96 :         for (SCROW nRow = 5; nRow <= 11; ++nRow)
     215             :         {
     216          84 :             if ( nCol == 6 && (7 <= nRow && nRow <= 9))
     217           6 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     218             :             else
     219          78 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     220             :         }
     221           2 :     }
     222           2 : }
     223             : 
     224           2 : void Test::testDeleteArea_2Ranges()
     225             : {
     226           2 :     ScRangeList aList(ScRange(0,0,0,5,5,5));
     227           4 :     ScRangeList aList2(aList);
     228             : 
     229           2 :     aList.DeleteArea(4,4,0,6,7,0);
     230           2 :     aList2.DeleteArea(4,4,0,6,7,0);
     231           2 :     CPPUNIT_ASSERT_EQUAL(aList.size(), static_cast<size_t>(2));
     232           2 :     CPPUNIT_ASSERT_EQUAL(aList2.size(), static_cast<size_t>(2));
     233             : 
     234          14 :     for(SCCOL nCol = 0; nCol <= 5; ++nCol)
     235             :     {
     236          84 :         for(SCROW nRow = 0; nRow <= 5; ++nRow)
     237             :         {
     238          72 :             if(nCol>=4 && nRow >= 4)
     239           8 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     240             :             else
     241          64 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     242             :         }
     243           2 :     }
     244           2 : }
     245             : 
     246           2 : void Test::testDeleteArea_2Ranges_Case2()
     247             : {
     248           2 :     ScRangeList aList(ScRange(1,1,0,1,5,0));
     249           2 :     aList.DeleteArea(0,3,0,MAXCOL,3,0);
     250             : 
     251          12 :     for(SCROW nRow = 1; nRow <= 5; ++nRow)
     252             :     {
     253          10 :         if(nRow == 3)
     254           2 :             CPPUNIT_ASSERT(!aList.In(ScRange(1,3,0)));
     255             :         else
     256           8 :             CPPUNIT_ASSERT(aList.In(ScRange(1,nRow,0)));
     257             :     }
     258           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), aList.GetCellCount());
     259           2 : }
     260             : 
     261           2 : void Test::testDeleteArea_2Ranges_Case3()
     262             : {
     263           2 :     ScRangeList aList(ScRange(0,5,0,2,10,0));
     264           2 :     aList.DeleteArea(2,3,0,3,7,0);
     265           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
     266             : 
     267             :     // Column 2 Row 5-7 shouldn't be in the list.
     268           8 :     for (SCCOL nCol = 0; nCol <= 2; ++nCol)
     269             :     {
     270          42 :         for (SCROW nRow = 5; nRow <= 10; ++nRow)
     271             :         {
     272          36 :             if (nCol == 2 && (5 <= nRow && nRow <= 7))
     273           6 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol,nRow,0)));
     274             :             else
     275          30 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol,nRow,0)));
     276             :         }
     277           2 :     }
     278           2 : }
     279             : 
     280           2 : void Test::testDeleteArea_2Ranges_Case4()
     281             : {
     282           2 :     ScRangeList aList(ScRange(2,3,0,4,7,0));
     283           2 :     aList.DeleteArea(0,1,0,2,5,0);
     284           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
     285             : 
     286             :     // Column 2 Row 3-5 shouldn't be in the list.
     287           8 :     for (SCCOL nCol = 2; nCol <= 4; ++nCol)
     288             :     {
     289          36 :         for (SCROW nRow = 3; nRow <= 7; ++nRow)
     290             :         {
     291          30 :             if (nCol == 2 && (3 <= nRow && nRow <= 5))
     292           6 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol,nRow,0)));
     293             :             else
     294          24 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol,nRow,0)));
     295             :         }
     296           2 :     }
     297           2 : }
     298             : 
     299           2 : void Test::testDeleteArea_2Ranges_Case5()
     300             : {
     301           2 :     ScRangeList aList(ScRange(2,2,0,5,5,0));
     302           2 :     aList.DeleteArea(4,5,0,5,5,0);
     303           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
     304             : 
     305             :     // Column 4 and 5 Row 5 shouldn't be in the list.
     306          10 :     for(SCCOL nCol = 2; nCol <= 5; ++nCol)
     307             :     {
     308          40 :         for(SCROW nRow = 2; nRow <= 5; ++nRow)
     309             :         {
     310          32 :             if(nRow == 5 && 4 <= nCol)
     311           4 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     312             :             else
     313          28 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     314             :         }
     315           2 :     }
     316           2 : }
     317             : 
     318           2 : void Test::testDeleteArea_2Ranges_Case6()
     319             : {
     320           2 :     ScRangeList aList(ScRange(2,2,0,5,5,0));
     321           2 :     aList.DeleteArea(4,2,0,5,2,0);
     322           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
     323             : 
     324             :     // Column 4 and 5 Row 2 shouldn't be in the list.
     325          10 :     for(SCCOL nCol = 2; nCol <= 5; ++nCol)
     326             :     {
     327          40 :         for(SCROW nRow = 2; nRow <= 5; ++nRow)
     328             :         {
     329          32 :             if(nRow == 2 && 4 <= nCol)
     330           4 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     331             :             else
     332          28 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     333             :         }
     334           2 :     }
     335           2 : }
     336             : 
     337           2 : void Test::testDeleteArea_2Ranges_Case7()
     338             : {
     339           2 :     ScRangeList aList(ScRange(2,2,0,5,5,0));
     340           2 :     aList.DeleteArea(2,5,0,2,5,0);
     341           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
     342             : 
     343             :     // Column 2 Row 5 shouldn't be in the list.
     344          10 :     for(SCCOL nCol = 2; nCol <= 5; ++nCol)
     345             :     {
     346          40 :         for(SCROW nRow = 2; nRow <= 5; ++nRow)
     347             :         {
     348          32 :             if(nRow == 5 && nCol == 2)
     349           2 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     350             :             else
     351          30 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     352             :         }
     353           2 :     }
     354           2 : }
     355             : 
     356           2 : void Test::testDeleteArea_2Ranges_Case8()
     357             : {
     358           2 :     ScRangeList aList(ScRange(2,2,0,5,5,0));
     359           2 :     aList.DeleteArea(2,2,0,3,2,0);
     360           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
     361             : 
     362             :     // Column 2 & 3 Row 2 shouldn't be in the list.
     363          10 :     for(SCCOL nCol = 2; nCol <= 5; ++nCol)
     364             :     {
     365          40 :         for(SCROW nRow = 2; nRow <= 5; ++nRow)
     366             :         {
     367          32 :             if(nRow == 2 && nCol <= 3)
     368           4 :                 CPPUNIT_ASSERT(!aList.In(ScRange(nCol, nRow, 0)));
     369             :             else
     370          28 :                 CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     371             :         }
     372           2 :     }
     373           2 : }
     374             : 
     375           2 : void Test::testDeleteArea_1Range()
     376             : {
     377           2 :     ScRangeList aList(ScRange(1,1,0,3,3,0));
     378           2 :     aList.DeleteArea(1,1,0,2,3,0);
     379             : 
     380           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     381             : 
     382           8 :     for(SCROW nRow = 1; nRow <= 3; ++nRow)
     383             :     {
     384           6 :         CPPUNIT_ASSERT(aList.In(ScRange(3,nRow,0)));
     385             :     }
     386           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aList.GetCellCount());
     387           2 : }
     388             : 
     389           2 : void Test::testDeleteArea_0Ranges()
     390             : {
     391           2 :     ScRangeList aList(ScRange(1,1,0,3,3,0));
     392           2 :     aList.DeleteArea(1,1,0,3,3,0);
     393             : 
     394           2 :     CPPUNIT_ASSERT(aList.empty());
     395             : 
     396           4 :     ScRangeList aList2(ScRange(1,1,0,3,3,0));
     397           2 :     aList2.DeleteArea(0,0,0,4,4,0);
     398             : 
     399           4 :     CPPUNIT_ASSERT(aList.empty());
     400           2 : }
     401             : 
     402           2 : void Test::testJoin_Case1()
     403             : {
     404           2 :     ScRangeList aList;
     405           2 :     aList.push_back(new ScRange(1,1,0,3,3,0));
     406           2 :     aList.Join(ScRange(4,1,0,6,3,0));
     407             : 
     408           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     409           2 :     CPPUNIT_ASSERT( ScRange(1,1,0,6,3,0) == *aList[0]);
     410           2 : }
     411             : 
     412           2 : void Test::testJoin_Case2()
     413             : {
     414           2 :     ScRangeList aList;
     415           2 :     aList.push_back(new ScRange(1,1,0,3,3,0));
     416           2 :     aList.push_back(new ScRange(4,1,0,6,3,0));
     417           2 :     aList.push_back(new ScRange(7,1,0,9,3,0));
     418             : 
     419           2 :     aList.Join(*aList[2], true);
     420             : 
     421           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
     422           2 :     CPPUNIT_ASSERT(ScRange(1,1,0,9,3,0) == *aList[0]);
     423           2 : }
     424             : 
     425           2 : void Test::testUpdateReference_DeleteRow()
     426             : {
     427           2 :     ScRangeList aList(ScRange(1,1,0,4,4,0));
     428           2 :     bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0);
     429           2 :     CPPUNIT_ASSERT(bUpdated);
     430             : 
     431          10 :     for(SCCOL nCol = 1; nCol <= 4; ++nCol)
     432             :     {
     433          32 :         for(SCROW nRow = 1; nRow <= 3; ++nRow)
     434             :         {
     435          24 :             CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     436             :         }
     437           8 :         CPPUNIT_ASSERT(!aList.In(ScRange(nCol, 4, 0)));
     438             :     }
     439           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(12), aList.GetCellCount());
     440             : 
     441           4 :     ScRangeList aList2(ScRange(2,2,0,2,2,0));
     442           2 :     aList2.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0);
     443           4 :     CPPUNIT_ASSERT(aList2.empty());
     444           2 : }
     445             : 
     446           2 : void Test::testUpdateReference_DeleteCol()
     447             : {
     448           2 :     ScRangeList aList(ScRange(1,1,0,4,4,0));
     449           2 :     bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(3,0,0,MAXCOL,MAXROW,0), -1, 0, 0);
     450           2 :     CPPUNIT_ASSERT(bUpdated);
     451             : 
     452          10 :     for(SCROW nRow = 1; nRow <= 4; ++nRow)
     453             :     {
     454          32 :         for(SCCOL nCol = 1; nCol <= 3; ++nCol)
     455             :         {
     456          24 :             CPPUNIT_ASSERT(aList.In(ScRange(nCol, nRow, 0)));
     457             :         }
     458           8 :         CPPUNIT_ASSERT(!aList.In(ScRange(4, nRow, 0)));
     459             :     }
     460           2 :     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(12), aList.GetCellCount());
     461           2 : }
     462             : 
     463           2 : void Test::testGetIntersectedRange()
     464             : {
     465           2 :     ScRangeList aList(ScRange(2, 2, 0, 5, 5, 0));
     466           4 :     ScRangeList aIntersecting = aList.GetIntersectedRange(ScRange(0, 0, 0, 3, 3, 0));
     467           4 :     CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(2,2,0,3,3,0)), aIntersecting);
     468           2 : }
     469             : 
     470           2 : void Test::testInsertRow()
     471             : {
     472           2 :     ScRangeList aList(ScRange(1,1,0,4,4,0));
     473           2 :     aList.InsertRow(0, 0, MAXCOL, 5, 2);
     474           2 :     CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,0,4,6,0)), aList);
     475           2 : }
     476             : 
     477           2 : void Test::testInsertCol()
     478             : {
     479           2 :     ScRangeList aList(ScRange(1,1,0,4,4,0));
     480           2 :     aList.InsertCol(0, 0, MAXROW, 5, 2);
     481           2 :     CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,0,6,4,0)), aList);
     482           2 : }
     483             : 
     484           2 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
     485             : 
     486           8 : CPPUNIT_PLUGIN_IMPLEMENT();
     487             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10