From c0f22d7b46cd4d85ac5434db0a27f05500d6feae Mon Sep 17 00:00:00 2001
From: karthik <karthik@karthik-HP-Mini-210-1000.(none)>
Date: Sat, 31 Mar 2012 16:58:18 +0530
Subject: [PATCH] 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
---
 sc/qa/unit/ucalc.cxx |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 965424f..cf2b866 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3907,6 +3907,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,sal_True, false);
+    CPPUNIT_ASSERT_MESSAGE("the correct color is not set", m_pDoc->GetTabBgColor(0)!= aColor.GetColor());
+    
+
+    Color aOldTabBgColor=m_pDoc->GetTabBgColor(nTab);
+    aColor.SetColor(COL_BLUE);//set BLUE
+     m_xDocShRef.GetDocFunc().SetTabBgColor(0,aColor,sal_True, false);
+    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);
+        
+}
+
+
+
 void Test::testUpdateReference()
 {
     //test that formulas are correctly updated during sheet delete
-- 
1.7.5.4

