summaryrefslogtreecommitdiff
path: root/sc/qa/unit/subsequent_filters-test.cxx
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2020-12-20 19:45:50 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-04 21:51:15 +0100
commit75596e1254f284fca22efc8e6cba158bd6c50b15 (patch)
tree1e09c36f59b88f59d4934d5b135adcae26a3eadc /sc/qa/unit/subsequent_filters-test.cxx
parente7a9d06d7d9f8dcad48c55df35de10d8e1196c56 (diff)
tdf#120749 XLSX: fix "begins/ends with" conditional
formatting when using "Given text" type and cell reference. Follow-up of commit 583e2bfba2d72ac8afe7261c23f380daf5486889 (tdf#139021 XLSX export: fix "contains" conditional formatting). Co-authored-by: Attila Szűcs (NISZ) Change-Id: Idf5d46469765454a11311bd6ec1d85c85b89e26f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108058 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 879ea123514ce6808212dfbef7e1d226e9d5fd9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108592 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 28db571e66de..ce65fc6684cf 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -106,6 +106,7 @@ public:
virtual void tearDown() override;
//ods, xls, xlsx filter tests
+ void testCondFormatBeginsAndEndsWithXLSX();
void testExtCondFormatXLSX();
void testUpdateCircleInMergedCellODS();
void testDeleteCircleInMergedCellODS();
@@ -297,6 +298,7 @@ public:
void testDeleteCirclesInRowAndCol();
CPPUNIT_TEST_SUITE(ScFiltersTest);
+ CPPUNIT_TEST(testCondFormatBeginsAndEndsWithXLSX);
CPPUNIT_TEST(testExtCondFormatXLSX);
CPPUNIT_TEST(testUpdateCircleInMergedCellODS);
CPPUNIT_TEST(testDeleteCircleInMergedCellODS);
@@ -532,6 +534,42 @@ void testRangeNameImpl(const ScDocument& rDoc)
}
+void ScFiltersTest::testCondFormatBeginsAndEndsWithXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("tdf120749.", FORMAT_XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load tdf120749.xlsx", xDocSh.is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ // begins with and ends with conditions
+ ScConditionalFormat* pFormatA1 = rDoc.GetCondFormat(0, 0, 0);
+ CPPUNIT_ASSERT(pFormatA1);
+ ScConditionalFormat* pFormatA2 = rDoc.GetCondFormat(0, 1, 0);
+ CPPUNIT_ASSERT(pFormatA2);
+ ScConditionalFormat* pFormatA3 = rDoc.GetCondFormat(0, 2, 0);
+ CPPUNIT_ASSERT(pFormatA3);
+ ScConditionalFormat* pFormatA4 = rDoc.GetCondFormat(0, 3, 0);
+ CPPUNIT_ASSERT(pFormatA4);
+
+ ScRefCellValue aCellA1(rDoc, ScAddress(0, 0, 0));
+ OUString aCellStyleA1 = pFormatA1->GetCellStyle(aCellA1, ScAddress(0, 0, 0));
+ CPPUNIT_ASSERT(!aCellStyleA1.isEmpty());
+
+ ScRefCellValue aCellA2(rDoc, ScAddress(0, 1, 0));
+ OUString aCellStyleA2 = pFormatA2->GetCellStyle(aCellA2, ScAddress(0, 1, 0));
+ CPPUNIT_ASSERT(!aCellStyleA2.isEmpty());
+
+ ScRefCellValue aCellA3(rDoc, ScAddress(0, 2, 0));
+ OUString aCellStyleA3 = pFormatA3->GetCellStyle(aCellA3, ScAddress(0, 2, 0));
+ CPPUNIT_ASSERT(!aCellStyleA3.isEmpty());
+
+ ScRefCellValue aCellA4(rDoc, ScAddress(0, 3, 0));
+ OUString aCellStyleA4 = pFormatA4->GetCellStyle(aCellA4, ScAddress(0, 3, 0));
+ CPPUNIT_ASSERT(!aCellStyleA4.isEmpty());
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testExtCondFormatXLSX()
{
ScDocShellRef xDocSh = loadDoc("tdf122102.", FORMAT_XLSX);