diff options
author | Karthik Padmanabhan <treadstone90@gmail.com> | 2012-03-31 16:58:18 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-03-31 18:03:49 +0200 |
commit | 3d86e4e7223b15d561d1efdac736e932ea41e6a0 (patch) | |
tree | d9648e3b47901e9b257c8ff564e58b896dfe38ad /sc | |
parent | d31f5476fddda994cad6920f7383e4c92ccac9a2 (diff) |
The function tests the SetBackgroundColor function in class ScDocFunc
First a color is set , then another color is set .We finally check again by issuing an undo and checking if the prev color is now set
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 965424f86a47..838d3a1128ac 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -43,6 +43,7 @@ #include "clipparam.hxx" #include "refundo.hxx" #include "undoblk.hxx" +#include "undotab.hxx" #include "queryentry.hxx" #include "postit.hxx" #include "attrib.hxx" @@ -204,6 +205,8 @@ public: */ void testJumpToPrecedentsDependents(); + void testSetBackgroundColor(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testInput); @@ -240,6 +243,7 @@ public: CPPUNIT_TEST(testMergedCells); CPPUNIT_TEST(testUpdateReference); CPPUNIT_TEST(testJumpToPrecedentsDependents); + CPPUNIT_TEST(testSetBackgroundColor); CPPUNIT_TEST_SUITE_END(); private: @@ -3907,6 +3911,34 @@ void Test::testMergedCells() m_pDoc->DeleteTab(0); } +void Test::testSetBackgroundColor() +{ + //test set background color + //TODO: set color1 and set color2 and do an undo to check if color1 is set now. + + m_pDoc->InsertTab(0, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet1"))); + Color aColor; + + //test yellow + aColor=Color(COL_YELLOW); + m_xDocShRef->GetDocFunc().SetTabBgColor(0,aColor,false, true); + CPPUNIT_ASSERT_MESSAGE("the correct color is not set", m_pDoc->GetTabBgColor(0)!= aColor.GetColor()); + + + Color aOldTabBgColor=m_pDoc->GetTabBgColor(0); + aColor.SetColor(COL_BLUE);//set BLUE + m_xDocShRef->GetDocFunc().SetTabBgColor(0,aColor,false, true); + CPPUNIT_ASSERT_MESSAGE("the correct color is not set the second time", m_pDoc->GetTabBgColor(0)!= aColor.GetColor()); + + //now check for undo + SfxUndoAction* pUndo = new ScUndoTabColor(m_xDocShRef,0, aOldTabBgColor, aColor); + pUndo->Undo(); + //CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", m_pDoc->GetTabBgColor(0)!= aOldTabBgColor.GetColor()); + m_pDoc->DeleteTab(0); +} + + + void Test::testUpdateReference() { //test that formulas are correctly updated during sheet delete |