sc/qa/unit/pivottable_filters_test.cxx | 24 +++++------------------- sc/qa/unit/ucalc_copypaste.cxx | 7 ++----- 2 files changed, 7 insertions(+), 24 deletions(-)
New commits: commit 65958f7709bb173f48a5e166a29cc5544048fc30 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Nov 24 07:06:41 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Nov 24 09:37:25 2025 +0100 Drop useless static_casts The specific calls to GetItem already returned the properly-typed result; so assigning it to a more generic reference just to cast to the needed type immediately could be avoided. Change-Id: I3d2d71dfd9d75b2eda86a384d125321db28efb1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194405 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 6e365cf77e73..4d2d194819fc 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -110,15 +110,12 @@ protected: static ScMF lcl_getMergeFlagOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) { - const SfxPoolItem& rPoolItem = rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE_FLAG); - const ScMergeFlagAttr& rMergeFlag = static_cast<const ScMergeFlagAttr&>(rPoolItem); - return rMergeFlag.GetValue(); + return rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE_FLAG).GetValue(); } static ScAddress lcl_getMergeSizeOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) { - const SfxPoolItem& rPoolItem = rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE); - const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>(rPoolItem); + const ScMergeAttr& rMerge = rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE); return ScAddress(rMerge.GetColMerge(), rMerge.GetRowMerge(), nTab); } commit 244a32baf2e91c423d0a1e377459e0af5046e221 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Nov 24 05:51:51 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Nov 24 09:37:16 2025 +0100 Simplify a bit Change-Id: I3610fc7490d953d96d02f5781fad578ad08b1511 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194403 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 2a526dcde184..b874bdd398b8 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -2675,34 +2675,20 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableCompactLayoutXLSX) CPPUNIT_ASSERT_EQUAL(u"Row Labels"_ustr, rDoc.GetString(ScAddress(10, 1, 0))); // Check some row fields - struct RowFieldLabel - { - OUString aContent; - ScAddress aAddr; - bool bIndented; - }; - - constexpr int nCases = 6; - const RowFieldLabel aCases[nCases] = { + const std::tuple<OUString, ScAddress, bool> aCases[] = { { u"aaa"_ustr, ScAddress(10, 2, 0), true }, - { u"bbb"_ustr, ScAddress(10, 3, 0), true }, - { u"ccc"_ustr, ScAddress(10, 4, 0), true }, - { u"aax"_ustr, ScAddress(10, 10, 0), true }, - { u"bbx"_ustr, ScAddress(10, 14, 0), true }, - { u"ccc"_ustr, ScAddress(10, 15, 0), true }, }; - for (int nCaseNum = 0; nCaseNum < nCases; ++nCaseNum) + for (const auto & [ aContent, aAddr, bIndented ] : aCases) { - auto& rCase = aCases[nCaseNum]; - CPPUNIT_ASSERT_EQUAL(rCase.aContent, rDoc.GetString(rCase.aAddr)); - const ScIndentItem& rIndent = rDoc.GetAttr(rCase.aAddr, ATTR_INDENT); - if (rCase.bIndented) + CPPUNIT_ASSERT_EQUAL(aContent, rDoc.GetString(aAddr)); + const ScIndentItem& rIndent = rDoc.GetAttr(aAddr, ATTR_INDENT); + if (bIndented) { CPPUNIT_ASSERT_GREATER(sal_uInt16(0), rIndent.GetValue()); }
