Check the LAMBDA document on load and across an XLSX round-trip

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 <tomaz.vajngerl@collabora.co.uk>
Change-Id: I490a764c71f83925425de70595611c67404ed761
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5592
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit a5e8980cbf689590a8a984effd51440607ed623f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207823
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Tomaž Vajngerl
2026-07-09 11:42:17 +02:00
committed by Xisco Fauli
parent 715da59c42
commit 5a797fca07
+23 -6
View File
@@ -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()