sc/qa/unit/ucalc_sharedformula.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
New commits: commit 99210a149c859fcd683870b280adaeeffd1250e4 Author: Eike Rathke <er...@redhat.com> Date: Sun Dec 17 17:44:34 2017 +0100 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 <er...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> 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); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits