summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2019-11-21 14:17:22 +0530
committerAndras Timar <andras.timar@collabora.com>2019-11-27 14:51:31 +0100
commitbeccda79a92db402aeba577beadae8563953297c (patch)
treee4475ab28d80eea6c0af1c96b1125386b3a72242
parent541af6456cd2f0598378f772e25f621d3cf3f6bb (diff)
tdf#128894: unit test for the bugfix
Reviewed-on: https://gerrit.libreoffice.org/83362 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com> (cherry picked from commit 626d1527267ab856e516f2424173104f781b8f09) Change-Id: Ic6d3910f12409f5af541c887760caefcb78b30f9 (cherry picked from commit b53374e26c1aa95461bbcdaf4a985ff4847b6e28) Reviewed-on: https://gerrit.libreoffice.org/83882 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/qa/unit/data/xlsx/shared-formula/refupdate.xlsxbin0 -> 8671 bytes
-rw-r--r--sc/qa/unit/filters-test.cxx31
2 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/shared-formula/refupdate.xlsx b/sc/qa/unit/data/xlsx/shared-formula/refupdate.xlsx
new file mode 100644
index 000000000000..fa386d3a4384
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/shared-formula/refupdate.xlsx
Binary files differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 24250db69aed..5f86c6581746 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -77,6 +77,7 @@ public:
void testContentGnumeric();
void testSharedFormulaXLS();
void testSharedFormulaXLSX();
+ void testSharedFormulaRefUpdateXLSX();
void testSheetNamesXLSX();
void testLegacyCellAnchoredRotatedShape();
void testEnhancedProtectionXLS();
@@ -100,6 +101,7 @@ public:
CPPUNIT_TEST(testContentGnumeric);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testSharedFormulaXLSX);
+ CPPUNIT_TEST(testSharedFormulaRefUpdateXLSX);
CPPUNIT_TEST(testSheetNamesXLSX);
CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape);
CPPUNIT_TEST(testEnhancedProtectionXLS);
@@ -419,6 +421,35 @@ void ScFiltersTest::testSharedFormulaXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testSharedFormulaRefUpdateXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("shared-formula/refupdate.", FORMAT_XLSX);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn auto calc on.
+ rDoc.DeleteRow(ScRange(0, 4, 0, MAXCOL, 4, 0)); // delete row 5.
+
+ struct TestCase {
+ ScAddress aPos;
+ const char* pExpectedFormula;
+ const char* pErrorMsg;
+ };
+
+ TestCase aCases[4] = {
+ { ScAddress(1, 0, 0), "B29+1", "Wrong formula in B1" },
+ { ScAddress(2, 0, 0), "C29+1", "Wrong formula in C1" },
+ { ScAddress(3, 0, 0), "D29+1", "Wrong formula in D1" },
+ { ScAddress(4, 0, 0), "E29+1", "Wrong formula in E1" },
+ };
+
+ for (size_t nIdx = 0; nIdx < 4; ++nIdx)
+ {
+ TestCase& rCase = aCases[nIdx];
+ ASSERT_FORMULA_EQUAL(rDoc, rCase.aPos, rCase.pExpectedFormula, rCase.pErrorMsg);
+ }
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testSheetNamesXLSX()
{
ScDocShellRef xDocSh = loadDoc("sheet-names.", FORMAT_XLSX);