diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-11 10:09:58 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-11 15:12:21 -0500 |
commit | b51acfb4c0c7dec0cdc3de5890ebb1c051bab509 (patch) | |
tree | 87b1b66d5bf2f047589281af2b7342c5fd88851e /sc/qa | |
parent | 27ad211cd382a3800b1ed56ec7cb3bb9321582ce (diff) |
fdo#74014: Another attempt to reproduce this bug in test.
But still not reproducible in test. Only in the UI. This is maddening.
I give up for now.
Change-Id: I88e6f4ed19856cf81abdf188dc22a5012e8c4a28
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/ods/formula-delete-contents.ods | bin | 0 -> 34064 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 36 |
2 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/formula-delete-contents.ods b/sc/qa/unit/data/ods/formula-delete-contents.ods Binary files differnew file mode 100644 index 000000000000..4b125fd2e2e6 --- /dev/null +++ b/sc/qa/unit/data/ods/formula-delete-contents.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 83841b3e3505..142d24179878 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -96,6 +96,7 @@ public: void testCachedFormulaResultsODS(); void testCachedMatrixFormulaResultsODS(); void testFormulaDepAcrossSheetsODS(); + void testFormulaDepDeleteContentsODS(); void testDatabaseRangesODS(); void testDatabaseRangesXLS(); void testDatabaseRangesXLSX(); @@ -171,6 +172,7 @@ public: CPPUNIT_TEST(testFunctionsExcel2010); CPPUNIT_TEST(testCachedFormulaResultsODS); CPPUNIT_TEST(testFormulaDepAcrossSheetsODS); + CPPUNIT_TEST(testFormulaDepDeleteContentsODS); CPPUNIT_TEST(testCachedMatrixFormulaResultsODS); CPPUNIT_TEST(testDatabaseRangesODS); CPPUNIT_TEST(testDatabaseRangesXLS); @@ -641,6 +643,40 @@ void ScFiltersTest::testFormulaDepAcrossSheetsODS() xDocSh->DoClose(); } +void ScFiltersTest::testFormulaDepDeleteContentsODS() +{ + ScDocShellRef xDocSh = loadDoc("formula-delete-contents.", ODS, true); + CPPUNIT_ASSERT_MESSAGE("Failed to load the file.", xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + + sc::UndoSwitch aUndoSwitch(*pDoc, true); // Enable undo. + sc::AutoCalcSwitch aACSwitch(*pDoc, true); // Make sure auto calc is turned on. + + CPPUNIT_ASSERT_EQUAL(195.0, pDoc->GetValue(ScAddress(3,15,0))); // formula in D16 + + // Delete D2:D5. + ScDocFunc& rFunc = xDocSh->GetDocFunc(); + ScRange aRange(3,1,0,3,4,0); + ScMarkData aMark; + aMark.SetMarkArea(aRange); + aMark.MarkToMulti(); + bool bGood = rFunc.DeleteContents(aMark, IDF_ALL, true, true); + CPPUNIT_ASSERT(bGood); + CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,1,0))); + CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,2,0))); + CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,3,0))); + CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(3,4,0))); + + CPPUNIT_ASSERT_EQUAL(94.0, pDoc->GetValue(ScAddress(3,15,0))); // formula in D16 + + SfxUndoManager* pUndoMgr = pDoc->GetUndoManager(); + CPPUNIT_ASSERT(pUndoMgr); + pUndoMgr->Undo(); + CPPUNIT_ASSERT_EQUAL(195.0, pDoc->GetValue(ScAddress(3,15,0))); // formula in D16 + + xDocSh->DoClose(); +} + namespace { void testDBRanges_Impl(ScDocument* pDoc, sal_Int32 nFormat) |