sc/qa/unit/functions_test.cxx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
New commits: commit ea1221867af90b452ec2d96b6b141abd6b8408cd Author: Eike Rathke <er...@redhat.com> AuthorDate: Mon May 27 17:04:33 2024 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Mon May 27 23:52:46 2024 +0200 FunctionsTest: get detailed error also for string results That always was "result: 0, expected: 0" because it created a number from string. Also, while it looped over all sheets starting with the second, values were always obtained from the second sheet. Change-Id: Ib2d2a51d757c12fd9cd2a76b0b194c2112747e62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168107 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/sc/qa/unit/functions_test.cxx b/sc/qa/unit/functions_test.cxx index 40504480d04d..862711e16cb7 100644 --- a/sc/qa/unit/functions_test.cxx +++ b/sc/qa/unit/functions_test.cxx @@ -45,13 +45,27 @@ bool FunctionsTest::load(const OUString& rFilter, const OUString& rURL, // the formula text. if(rDoc.HasStringData(2, row, tab) || !rDoc.HasData(2, row, tab)) continue; - if(!rtl::math::approxEqual(1.0, rDoc.GetValue(2, row, 1))) - CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, " - + rDoc.GetAllTableNames()[tab] + ".A" + OUString::number(row+1) - + " \'" + rDoc.GetString(3, row, 1) + "\'" - " result: " + OUString::number(rDoc.GetValue(0, row, 1)) - + ", expected: " + OUString::number(rDoc.GetValue(1, row, 1))) - .toUtf8().getStr()); + if (!rtl::math::approxEqual(1.0, rDoc.GetValue(2, row, tab))) + { + if (rDoc.HasValueData(1, row, tab)) + { + CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, " + + rDoc.GetAllTableNames()[tab] + ".A" + OUString::number(row+1) + + " \'" + rDoc.GetString(3, row, tab) + "\'" + " result: " + OUString::number(rDoc.GetValue(0, row, tab)) + + ", expected: " + OUString::number(rDoc.GetValue(1, row, tab))) + .toUtf8().getStr()); + } + else + { + CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, " + + rDoc.GetAllTableNames()[tab] + ".A" + OUString::number(row+1) + + " \'" + rDoc.GetString(3, row, tab) + "\'" + " result: " + rDoc.GetString(0, row, tab) + + ", expected: " + rDoc.GetString(1, row, tab)) + .toUtf8().getStr()); + } + } } } }