add test for tdf#93151

Change-Id: Ia51c50d29b4790d88e8b8e4b0708d6995d4226f7
Reviewed-on: https://gerrit.libreoffice.org/35440
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Markus Mohrhard 2017-03-18 20:14:24 +01:00
parent 5b878718b9
commit 47d4f6252d
2 changed files with 29 additions and 0 deletions

View File

@ -155,6 +155,7 @@ public:
void testFormulaRefUpdateName();
void testFormulaRefUpdateNameMove();
void testFormulaRefUpdateNameExpandRef();
void testFormulaRefUpdateNameExpandRef2();
void testFormulaRefUpdateNameDeleteRow();
void testFormulaRefUpdateNameCopySheet();
void testFormulaRefUpdateNameCopySheetCheckTab( SCTAB Tab, bool bCheckNames );
@ -553,6 +554,7 @@ public:
CPPUNIT_TEST(testFormulaRefUpdateName);
CPPUNIT_TEST(testFormulaRefUpdateNameMove);
CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef);
CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef2);
CPPUNIT_TEST(testFormulaRefUpdateNameDeleteRow);
CPPUNIT_TEST(testFormulaRefUpdateNameCopySheet);
CPPUNIT_TEST(testFormulaRefUpdateNameDelete);

View File

@ -2901,6 +2901,33 @@ void Test::testFormulaRefUpdateNameExpandRef()
m_pDoc->DeleteTab(0);
}
void Test::testFormulaRefUpdateNameExpandRef2()
{
setExpandRefs(true);
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, "Test");
bool bInserted = m_pDoc->InsertNewRangeName("MyRange", ScAddress(0,0,0), "$A$1:$B$3");
CPPUNIT_ASSERT(bInserted);
// Insert a new row at row 4, which should expand the named range to A1:A4.
ScDocFunc& rFunc = getDocShell().GetDocFunc();
ScMarkData aMark;
aMark.SelectOneTable(0);
// Insert a new column at column 3, which should expand the named
rFunc.InsertCells(ScRange(1,0,0,1,MAXROW,0), &aMark, INS_INSCOLS_BEFORE, false, true);
ScRangeData* pName = m_pDoc->GetRangeName()->findByUpperName("MYRANGE");
CPPUNIT_ASSERT(pName);
OUString aSymbol;
pName->GetSymbol(aSymbol, m_pDoc->GetGrammar());
CPPUNIT_ASSERT_EQUAL(OUString("$A$1:$C$3"), aSymbol);
m_pDoc->DeleteTab(0);
}
void Test::testFormulaRefUpdateNameDeleteRow()
{
m_pDoc->InsertTab(0, "Test");