diff options
author | Eike Rathke <erack@redhat.com> | 2017-12-17 17:44:34 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-12-18 00:06:53 +0100 |
commit | 99210a149c859fcd683870b280adaeeffd1250e4 (patch) | |
tree | dfdc4be6df7ca7588f4ccfdc3567cc594b496132 | |
parent | 5afa76782d192d66711e02400987d6153ef9e5a7 (diff) |
Unit test for implicit intersection with shared formulas, tdf#114251 related
Change-Id: I8c11c2719b9496fd33194a7a9906e53f23f38f66
Reviewed-on: https://gerrit.libreoffice.org/46648
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sc/qa/unit/ucalc_sharedformula.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index e46cb5f68c44..1d801ee73fc6 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -262,6 +262,29 @@ void Test::testSharedFormulas() CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode()); + // Test implicit intersection with shared formulas. + aPos.Set(2,0,0); + { + // Insert data in C1:D2 and formulas in E1:E2 + const char* pData[][3] = { + { "5", "1", "=C:C/D:D" }, + { "4", "2", "=C:C/D:D" } + }; + + insertRangeData(m_pDoc, aPos, pData, SAL_N_ELEMENTS(pData)); + } + aPos.Set(4,1,0); + pFC = m_pDoc->GetFormulaCell(aPos); + CPPUNIT_ASSERT_MESSAGE("E2 should be a formula cell.", pFC); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode()); + + aPos.SetRow(0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("5/1=5", 5.0, m_pDoc->GetValue(aPos)); + aPos.SetRow(1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("4/2=2", 2.0, m_pDoc->GetValue(aPos)); + m_pDoc->DeleteTab(0); } |