From 1e2bbf4bc723a9838bb8786908682ea2dd841866 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 25 Sep 2013 20:52:38 +0200 Subject: add test case for fdo#69720 Change-Id: Ib89a596f0e28cacc9ae180d23b9995e524c45b52 --- sc/qa/unit/helper/qahelper.cxx | 6 ++++++ sc/qa/unit/helper/qahelper.hxx | 2 ++ sc/qa/unit/ucalc.cxx | 20 ++++++++++++++++++++ sc/qa/unit/ucalc.hxx | 2 ++ 4 files changed, 30 insertions(+) diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 8139363c4079..0de8b6b5098e 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -55,6 +55,12 @@ std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList) return rStrm; } +std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) +{ + rStrm << "Color: R:" << rColor.GetRed() << " G:" << rColor.GetGreen() << " B: << rColor.GetBlue()"; + return rStrm; +} + FileFormat aFileFormats[] = { { "ods" , "calc8", "", ODS_FORMAT_TYPE }, { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 7bcf5197c153..8d0f27df8004 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -97,6 +97,8 @@ std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange); std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList); +std::ostream& operator<<(std::ostream& rStrm, const Color& rColor); + // Why is this here and not in osl, and using the already existing file // handling APIs? Do we really want to add arbitrary new file handling // wrappers here and there (and then having to handle the Android (and diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index e5e6198d45a9..433107352f0f 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -56,6 +56,7 @@ #include #include +#include #include #include @@ -3857,6 +3858,25 @@ void Test::testDeleteCol() pDoc->DeleteTab(0); } +void Test::testDeleteArea() +{ + ScDocument* pDoc = getDocShell().GetDocument(); + pDoc->InsertTab(0, "Test"); + + pDoc->SetValue(0,0,0,3.2); + pDoc->ApplyAttr(0,0,0,SvxBrushItem(Color(COL_LIGHTRED), ATTR_BACKGROUND)); + + ScMarkData aMark; + ScRange aRange(0,0,0,0,0,0); + aMark.SetMarkArea(aRange); + pDoc->DeleteArea(0,0,0,0,aMark, IDF_CONTENTS); + const SfxPoolItem* pItem = pDoc->GetAttr(0,0,0,ATTR_BACKGROUND); + CPPUNIT_ASSERT(pItem); + CPPUNIT_ASSERT_EQUAL(Color(COL_LIGHTRED), static_cast(pItem)->GetColor()); + + pDoc->DeleteTab(0); +} + void Test::testAnchoredRotatedShape() { OUString aTabName("TestTab"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index e97bb8df24e7..698d6837827b 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -267,6 +267,7 @@ public: void testShiftCells(); void testDeleteRow(); void testDeleteCol(); + void testDeleteArea(); void testAnchoredRotatedShape(); void testCellTextWidth(); void testEditTextIterator(); @@ -367,6 +368,7 @@ public: CPPUNIT_TEST(testShiftCells); CPPUNIT_TEST(testDeleteRow); CPPUNIT_TEST(testDeleteCol); + CPPUNIT_TEST(testDeleteArea); CPPUNIT_TEST(testAnchoredRotatedShape); CPPUNIT_TEST(testCellTextWidth); CPPUNIT_TEST(testEditTextIterator); -- cgit