diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-10-26 10:49:40 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-10-26 22:28:33 +0200 |
commit | eb664612aba4d7d8d5cf8d5a448f12be55da59ba (patch) | |
tree | d4270d60f0716476a347a9e881ec1bd34e364d97 /sc | |
parent | 0f4756601982da8898c9305d6d03f1dc3fa9264a (diff) |
tdf#142010: sc_uicalc: Add unittest
Change-Id: I99676a273c7ad1dad61ba82bc538c1ee4bd35d03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124175
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/uicalc/data/tdf142010.xls | bin | 0 -> 55296 bytes | |||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 30 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf142010.xls b/sc/qa/unit/uicalc/data/tdf142010.xls Binary files differnew file mode 100644 index 000000000000..c58bc0169fe7 --- /dev/null +++ b/sc/qa/unit/uicalc/data/tdf142010.xls diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 46c430c7e087..1abbf6342ed8 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1103,6 +1103,36 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124815) CPPUNIT_ASSERT_EQUAL(OUString("Rakennukset"), pDoc->GetString(ScAddress(2, 0, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142010) +{ + ScModelObj* pModelObj = createDoc("tdf142010.xls"); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + goToCell("A1"); + + OUString aFormula; + pDoc->GetFormula(5, 71, 0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("=MOD(F$71+$C72,9)"), aFormula); + CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0))); + + dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {}); + + pDoc->GetFormula(6, 71, 0, aFormula); + + // Without the fix in place, this test would have failed with + // - Expected: =MOD(G$71+$D72,9) + // - Actual : =MOD(G$71+$K72,9) + CPPUNIT_ASSERT_EQUAL(OUString("=MOD(G$71+$D72,9)"), aFormula); + CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(6, 71, 0))); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + + pDoc->GetFormula(5, 71, 0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("=MOD(F$71+$C72,9)"), aFormula); + CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132431) { ScModelObj* pModelObj = createDoc("tdf132431.ods"); |