diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-08 20:29:45 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-08 20:58:11 +0000 |
commit | 55f81ec93752a0b6f7ee2356db3c8d73d550d1e6 (patch) | |
tree | 72997963afff84c9ac1ba087c891641759dcd030 /sc | |
parent | effa6dcb553bd3fc6df89ac88604816feda98873 (diff) |
add test for tdf#95617
Change-Id: I8acab5af4dfc8f058eb9624abafe63e212ddb437
Reviewed-on: https://gerrit.libreoffice.org/36296
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 3 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_condformat.cxx | 41 |
2 files changed, 44 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index d616f8cb5b9b..de92fe9245ce 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -499,6 +499,8 @@ public: void testCondFormatEndsWithStr(); void testCondFormatEndsWithVal(); + void testCondFormatUndoList(); + void testImportStream(); void testDeleteContents(); void testTransliterateText(); @@ -762,6 +764,7 @@ public: CPPUNIT_TEST(testCondFormatEndsWithVal); CPPUNIT_TEST(testCondFormatUpdateReferenceDelRow); CPPUNIT_TEST(testCondFormatUpdateReferenceInsRow); + CPPUNIT_TEST(testCondFormatUndoList); CPPUNIT_TEST(testIconSet); CPPUNIT_TEST(testDataBarLengthAutomaticAxis); CPPUNIT_TEST(testDataBarLengthMiddleAxis); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 391766f9f146..c3fe3ed3afcf 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -980,4 +980,45 @@ void Test::testCondFormatUpdateReferenceInsRow() m_pDoc->DeleteTab(0); } +void Test::testCondFormatUndoList() +{ + m_pDoc->InsertTab(0, "test"); + + ScConditionEntry* pEntry = new ScConditionEntry(SC_COND_EQUAL, "B6", "", m_pDoc, ScAddress(0, 5, 0), "", "", formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::GRAM_DEFAULT); + + ScConditionalFormat* pFormat = new ScConditionalFormat(0, m_pDoc); + pFormat->AddEntry(pEntry); + pFormat->SetRange(ScRange(0, 0, 0, 0, 5, 0)); + m_pDoc->AddCondFormat(pFormat, 0); + m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, pFormat->GetKey()); + + ScDocFunc& rFunc = getDocShell().GetDocFunc(); + + CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size()); + for (SCROW nRow = 0; nRow <= 5; ++nRow) + CPPUNIT_ASSERT(m_pDoc->GetCondFormat(0, nRow, 0)); + + ScConditionalFormatList* pNewList = new ScConditionalFormatList(); + + rFunc.SetConditionalFormatList(pNewList, 0); + + CPPUNIT_ASSERT_EQUAL(size_t(0), m_pDoc->GetCondFormList(0)->size()); + for (SCROW nRow = 0; nRow <= 5; ++nRow) + CPPUNIT_ASSERT(!m_pDoc->GetCondFormat(0, nRow, 0)); + + m_pDoc->GetUndoManager()->Undo(); + + CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size()); + for (SCROW nRow = 0; nRow <= 5; ++nRow) + CPPUNIT_ASSERT(m_pDoc->GetCondFormat(0, nRow, 0)); + + m_pDoc->GetUndoManager()->Redo(); + + CPPUNIT_ASSERT_EQUAL(size_t(0), m_pDoc->GetCondFormList(0)->size()); + for (SCROW nRow = 0; nRow <= 5; ++nRow) + CPPUNIT_ASSERT(!m_pDoc->GetCondFormat(0, nRow, 0)); + + m_pDoc->DeleteTab(0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |