sw/qa/extras/layout/layout2.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
New commits: commit 7af97df1612e2f8debbce3b771a8f01a8325f7f2 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Apr 17 08:39:42 2025 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Apr 17 10:24:08 2025 +0200 Related: tdf#165322 sw: add tooltip testcase for format+delete redline combo Fails with commit f439448d21ef2feb03a9920d95d30f23795db6ac (tdf#165322 sw: prefer insert/delete redline in mouse-over tooltip, 2025-02-25) reverted. Change-Id: I4be681d5920c93d85e4c295133ceaa608bb8bb6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184304 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index d7fcbb7b5625..e3b741f64cb4 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -29,6 +29,7 @@ #include <IDocumentLayoutAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <fmtanchr.hxx> +#include <redline.hxx> /// Test to assert layout / rendering result of Writer. class SwLayoutWriter2 : public SwModelTestBase @@ -540,6 +541,26 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf165322) "//text[text() = 'Nunc viverra imperdiet enim. Fusce est. Vivamus a " "tellus.']/parent::textarray/preceding-sibling::font[1]", "strikeout", u"1"); + + // Also check if the tooltip shows the delete, not the format + // Given a paragraph with both delete and format: + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + SwRootFrame* pLayout = pWrtShell->GetLayout(); + SwFrame* pPage = pLayout->GetLower(); + SwFrame* pBody = pPage->GetLower(); + SwFrame* pPara = pBody->GetLower()->GetNext(); + // When getting the content at a position for tooltip purposes: + Point aPoint = pPara->getFrameArea().Center(); + SwContentAtPos aContentAtPos(IsAttrAtPos::Redline); + CPPUNIT_ASSERT(pWrtShell->GetContentAtPos(aPoint, aContentAtPos)); + // Then make sure we find a delete redline: + CPPUNIT_ASSERT_EQUAL(IsAttrAtPos::Redline, aContentAtPos.eContentAtPos); + const SwRangeRedline* pRedline = aContentAtPos.aFnd.pRedl; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 (RedlineType::Delete) + // - Actual : 5 (RedlineType::ParagraphFormat) + // i.e. the delete didn't have priority over para format, leading to a misleading tooltip. + CPPUNIT_ASSERT_EQUAL(RedlineType::Delete, pRedline->GetType()); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering)