[Libreoffice-commits] core.git: sc/qa

Tor Lillqvist tml at collabora.com
Fri Sep 15 11:22:52 UTC 2017


 sc/qa/unit/rangelst_test.cxx |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit cef9cf59f8064be99ce3b7d0738ab0775715112c
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Sep 15 13:05:06 2017 +0300

    Test joining two disjoint ranges into one by adding a third inbetween
    
    In particular, the case where the third one even overlaps one of the
    existing ones, not just borders it.
    
    Change-Id: I3a0dff51a68b048b615f60e579e6e698518cf1bd

diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx
index 79c57364e209..c93b0a541460 100644
--- a/sc/qa/unit/rangelst_test.cxx
+++ b/sc/qa/unit/rangelst_test.cxx
@@ -46,6 +46,7 @@ public:
     void testJoin_Case2();
     void testJoin_Case3();
     void testJoin_Case4();
+    void testJoin_Case5();
     void testGetIntersectedRange();
 
     void testUpdateReference_DeleteRow();
@@ -76,6 +77,7 @@ public:
     CPPUNIT_TEST(testJoin_Case2);
     CPPUNIT_TEST(testJoin_Case3);
     CPPUNIT_TEST(testJoin_Case4);
+    CPPUNIT_TEST(testJoin_Case5);
     CPPUNIT_TEST(testUpdateReference_DeleteRow);
     CPPUNIT_TEST(testUpdateReference_DeleteLastRow);
     CPPUNIT_TEST(testUpdateReference_DeleteCol);
@@ -481,6 +483,24 @@ void Test::testJoin_Case4()
     CPPUNIT_ASSERT_EQUAL(ScRange(1,1,0,8,8,0), *aList2[0]);
 }
 
+void Test::testJoin_Case5()
+{
+    ScRangeList aList;
+    aList.Join(ScRange(0,0,0,4,4,0));
+    aList.Join(ScRange(8,0,0,10,4,0));
+
+    // Nothing special so far, two disjoint ranges
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aList.size());
+    CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,4,4,0), *aList[0]);
+    CPPUNIT_ASSERT_EQUAL(ScRange(8,0,0,10,4,0), *aList[1]);
+
+    // This should join the two ranges into one
+    aList.Join(ScRange(5,0,0,9,4,0));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aList.size());
+    CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,10,4,0), *aList[0]);
+}
+
 void Test::testUpdateReference_DeleteRow()
 {
     ScRangeList aList(ScRange(1,1,0,4,4,0));


More information about the Libreoffice-commits mailing list