From 5a797fca073006d399d93a4ae1e39e7624feb5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Sat, 27 Jun 2026 02:18:10 +0900 Subject: [PATCH] Check the LAMBDA document on load and across an XLSX round-trip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The document test for LAMBDA and the callable functions only looked at the combined result after a recalculation. That left two things unchecked: whether the result stored in the file is right as loaded, and whether the formulas survive being written back out as XLSX. Check the result cell B3 at four points now: as loaded, after a recalculation, and both again after saving to XLSX and reading it back. The as-loaded checks cover the stored results, the recalculation checks cover the engine recomputing them, and the round-trip covers the export path. Signed-off-by: Tomaž Vajngerl Change-Id: I490a764c71f83925425de70595611c67404ed761 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5592 Tested-by: Jenkins CPCI Reviewed-by: Mike Kaganski (cherry picked from commit a5e8980cbf689590a8a984effd51440607ed623f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207823 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- sc/qa/unit/subsequent_filters_test.cxx | 29 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 2d1305cd5faf..53b50d7ac149 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -1770,18 +1770,35 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testExpandedArrayCollapsesOnNewBlockerXLSX) CPPUNIT_TEST_FIXTURE(ScFiltersTest, testLambdaAndRelatedFunctions) { - // The document checks every LAMBDA and callable-function formula against - // its expected result. Cell B3 of the first sheet holds the combined - // outcome over all the per-function checks, and is true only when every - // check passed. Recalculate with the engine and confirm B3 is true. + // The document combines a per-formula check of every LAMBDA and + // callable-function result into cell B3 of the first sheet, true only when + // every check passed. Confirm B3 holds as loaded and after a + // recalculation, both before and after a round-trip through the XLSX export. createScDoc("xlsx/LambdaAndRelatedFunctions.xlsx"); + ScDocument* pDoc = getScDoc(); + // The result as stored in the file, before the engine recomputes anything. + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("as loaded, a formula did not match its expected result", + 1.0, pDoc->GetValue(ScAddress(1, 2, 0)), 0.0); pDoc->CalcAll(); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( - "B3 reports that a formula in the document did not match its expected result", 1.0, + "after recalculation, a formula did not match its expected result", 1.0, pDoc->GetValue(ScAddress(1, 2, 0)), 0.0); + + // Write the document back out as XLSX and read it in again. + saveAndReload(TestFilter::XLSX); + + pDoc = getScDoc(); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( + "after save and reload, a formula did not match its expected result", 1.0, + pDoc->GetValue(ScAddress(1, 2, 0)), 0.0); + + pDoc->CalcAll(); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( + "after save, reload and recalculation, a formula did not match its " + "expected result", + 1.0, pDoc->GetValue(ScAddress(1, 2, 0)), 0.0); } ScFiltersTest::ScFiltersTest()