sc/qa/unit/uicalc/data/tdf167019.xlsx |binary
 sc/qa/unit/uicalc/uicalc.cxx          |   33 ++++++++++++++++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

New commits:
commit e8a5459003797f35929dd88b957c864643fcdd92
Author:     Xisco Fauli <[email protected]>
AuthorDate: Fri Jun 27 14:29:10 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Jun 27 19:35:38 2025 +0200

    tdf#167019: sc_uicalc: Add test
    
    Change-Id: I347c643e9afc1c3bee27b922f24890e2c33adbd9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187110
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/qa/unit/uicalc/data/tdf167019.xlsx 
b/sc/qa/unit/uicalc/data/tdf167019.xlsx
new file mode 100644
index 000000000000..9e93d9323e3d
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf167019.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 4f35fdcb38dc..30dac837afcd 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -45,11 +45,11 @@ ScUiCalcTest::ScUiCalcTest()
 {
 }
 
-static void lcl_AssertConditionalFormatList(ScDocument& rDoc, size_t nSize,
+static void lcl_AssertConditionalFormatList(ScDocument& rDoc,
                                             std::unordered_map<OUString, 
OUString>& rExpectedValues)
 {
     ScConditionalFormatList* pList = rDoc.GetCondFormList(0);
-    CPPUNIT_ASSERT_EQUAL(nSize, pList->size());
+    CPPUNIT_ASSERT_EQUAL(rExpectedValues.size(), pList->size());
 
     OUString sRangeStr;
     for (const auto& rItem : *pList)
@@ -1320,22 +1320,41 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf104026)
             { "A4", "Cell value != $Sheet1.$B4" }, { "A5", "Cell value != 
$Sheet1.$B5" },
             { "A6", "Cell value != $Sheet1.$B6" }, { "A7", "Cell value != 
$Sheet1.$B7" } };
 
-    lcl_AssertConditionalFormatList(*pDoc, 6, aExpectedValues);
+    lcl_AssertConditionalFormatList(*pDoc, aExpectedValues);
 
     goToCell(u"A2"_ustr);
     dispatchCommand(mxComponent, u".uno:DeleteRows"_ustr, {});
 
+    std::unordered_map<OUString, OUString> aExpectedValues2
+        = { { "A2", "Cell value != $Sheet1.$B2" },
+            { "A3", "Cell value != $Sheet1.$B3" },
+            { "A4", "Cell value != $Sheet1.$B4" },
+            { "A5", "Cell value != $Sheet1.$B5" },
+            { "A6", "Cell value != $Sheet1.$B6" } };
     // Without the fix in place, this test would have failed with
     // - Expected: Cell value != $Sheet1.$B2
     // - Actual  : Cell value != $Sheet1.$B#REF!
-    lcl_AssertConditionalFormatList(*pDoc, 5, aExpectedValues);
+    lcl_AssertConditionalFormatList(*pDoc, aExpectedValues2);
 
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 
     // tdf#140330: Without the fix in place, this test would have failed with
     // - Expected: 6
     // - Actual  : 5
-    lcl_AssertConditionalFormatList(*pDoc, 6, aExpectedValues);
+    lcl_AssertConditionalFormatList(*pDoc, aExpectedValues);
+}
+
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf167019)
+{
+    createScDoc("tdf167019.xlsx");
+    ScDocument* pDoc = getScDoc();
+
+    std::unordered_map<OUString, OUString> aExpectedValues
+        = { { "D4,G4,J4,M4,G6:G10,J6:J10,M6:M10,D6:D10", "Cell value is not 
between 100 and 152" },
+            { "E4,H4,K4,N4,E6:E10,H6:H10,K6:K10,N6:N10", "Cell value is not 
between 54 and 102" },
+            { "F4,I4,L4,O4,F6,I6,L6,O6", "Cell value is not between 32 and 
100" } };
+
+    lcl_AssertConditionalFormatList(*pDoc, aExpectedValues);
 }
 
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963)
@@ -1353,7 +1372,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963)
     std::unordered_map<OUString, OUString> aExpectedValues
         = { { "C1", "Cell value > 14" }, { "C3", "Cell value > 14" }, { "C4", 
"Cell value > 14" } };
 
-    lcl_AssertConditionalFormatList(*pDoc, 3, aExpectedValues);
+    lcl_AssertConditionalFormatList(*pDoc, aExpectedValues);
 
     goToCell(u"A3:C4"_ustr);
 
@@ -1364,7 +1383,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963)
     dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
 
     aExpectedValues = { { "C3,C1", "Cell value > 14" }, { "C4,C2", "Cell value 
> 14" } };
-    lcl_AssertConditionalFormatList(*pDoc, 2, aExpectedValues);
+    lcl_AssertConditionalFormatList(*pDoc, aExpectedValues);
 
     // Restore previous status
     aInputOption.SetReplaceCellsWarn(bOldStatus);

Reply via email to