Kaydet (Commit) b51acfb4 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 27ad211c
......@@ -2023,7 +2023,7 @@ public:
formula::FormulaGrammar::Grammar GetStorageGrammar() const
{ return eStorageGrammar; }
SfxUndoManager* GetUndoManager();
SC_DLLPUBLIC SfxUndoManager* GetUndoManager();
bool IsInVBAMode() const;
ScRowBreakIterator* GetRowBreakIterator(SCTAB nTab) const;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment