summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVarun <varun.dhall@studentpartner.com>2015-06-09 04:01:32 +0530
committerMichael Stahl <mstahl@redhat.com>2015-06-10 16:51:04 +0200
commit4deaf89bbeadf0395810ab5f1213aecf2b078c8b (patch)
treedb5dbfe9cc30557ae3ee2555ebd72b9631c08c2b /sw
parent8761ab9b5ec7860eb5bc7d05271da081f66a452b (diff)
Added Test for tdf#91145 Set Cell Background Color
Change-Id: I7c41f1d596946706dde4adbeb5434ae0be58b04b Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 57af4a8d058d..f48dd91293dd 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -91,6 +91,7 @@ public:
void testCp1000115();
void testTdf90003();
void testSearchWithTransliterate();
+ void testTableBackgroundColor();
void testTdf90362();
void testUndoCharAttribute();
void testTdf86639();
@@ -130,6 +131,7 @@ public:
CPPUNIT_TEST(testCp1000115);
CPPUNIT_TEST(testTdf90003);
CPPUNIT_TEST(testSearchWithTransliterate);
+ CPPUNIT_TEST(testTableBackgroundColor);
CPPUNIT_TEST(testTdf90362);
CPPUNIT_TEST(testUndoCharAttribute);
CPPUNIT_TEST(testTdf86639);
@@ -904,6 +906,44 @@ void SwUiWriterTest::testSearchWithTransliterate()
CPPUNIT_ASSERT_EQUAL(1,(int)case2);
}
+void SwUiWriterTest::testTableBackgroundColor()
+{
+ SwDoc* pDoc = createDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+ pWrtShell->InsertTable(TableOpt, 3, 3); //Inserting Table
+ //Checking Rows and Columns of Inserted Table
+ uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
+ pWrtShell->SttDoc();
+ pWrtShell->SelTableRow(); //Selecting First Row
+ pWrtShell->ClearMark();
+ //Modifying the color of Table Box
+ Color colour = sal_Int32(0xFF00FF);
+ pWrtShell->SetBoxBackground(SvxBrushItem(colour, sal_Int16(RES_BACKGROUND)));
+ //Checking cells for background color only A1 should be modified
+ uno::Reference<table::XCell> xCell;
+ xCell = xTable->getCellByName("A1");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFF00FF), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("A2");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("A3");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("B1");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("B2");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("B3");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("C1");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("C2");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+ xCell = xTable->getCellByName("C3");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+}
+
void SwUiWriterTest::testTdf90362()
{
// First check if the end of the second paragraph is indeed protected.