summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2023-11-24 10:00:54 -0400
committerHenry Castro <hcastro@collabora.com>2023-11-29 20:54:34 +0100
commit3275f57221904426e5c136f5596a83050f8585a4 (patch)
tree7341e8a6bf58710324bc01dc276d8ba2411905fb /sc
parent24cc5f55a04eeb6a9f286066c1389191b153a910 (diff)
sc: qa: add unit test "testBackColorFilter"
Change-Id: Icdccd6778d1157bb31f38b510a58562a640bdeae Signed-off-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159929 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160089 Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_filters_test2.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx
index 790ab5c99057..22339c010e8f 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -27,6 +27,8 @@
#include <editeng/justifyitem.hxx>
#include <editeng/lineitem.hxx>
#include <editeng/colritem.hxx>
+#include <cellvalue.hxx>
+#include <docpool.hxx>
#include <dbdata.hxx>
#include <validat.hxx>
#include <formulacell.hxx>
@@ -39,6 +41,7 @@
#include <columnspanset.hxx>
#include <tokenstringcontext.hxx>
#include <externalrefmgr.hxx>
+#include <filterentries.hxx>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
@@ -1626,6 +1629,41 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSingleLine)
testCells(pDoc);
}
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testBackColorFilter)
+{
+ Color aBackColor1(0xc99c00);
+ Color aBackColor2(0x0369a3);
+
+ createScDoc();
+ ScDocument* pDoc = getScDoc();
+
+ ScPatternAttr aPattern1(pDoc->GetPool());
+ aPattern1.GetItemSet().Put(SvxBrushItem(aBackColor1, ATTR_BACKGROUND));
+
+ ScPatternAttr aPattern2(pDoc->GetPool());
+ aPattern2.GetItemSet().Put(SvxBrushItem(aBackColor2, ATTR_BACKGROUND));
+
+ // Apply the pattern to cell A1:A2
+ pDoc->ApplyPatternAreaTab(0, 0, 0, 1, 0, aPattern1);
+
+ // Apply the pattern to cell A3:A5
+ pDoc->ApplyPatternAreaTab(0, 2, 0, 4, 0, aPattern2);
+
+ {
+ ScRefCellValue aCell;
+ aCell.assign(*pDoc, ScAddress(0, 0, 0));
+ CPPUNIT_ASSERT_MESSAGE("Cell A1 should be empty.", aCell.isEmpty());
+ aCell.assign(*pDoc, ScAddress(0, 2, 0));
+ CPPUNIT_ASSERT_MESSAGE("Cell A3 should be empty.", aCell.isEmpty());
+ }
+
+ {
+ ScFilterEntries aFilterEntries;
+ pDoc->GetFilterEntriesArea(0, 0, 4, 0, true, aFilterEntries);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aFilterEntries.getBackgroundColors().size());
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */