From a36c7459d1ce74414a19c75eca7b8f658cafb832 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 6 Oct 2026 12:39:54 +0500 Subject: [PATCH] Fix unit test testPieTextArea CppunitTest_oox_shape failed in the gerrit_linux_gcc_main and gerrit_linux_clang_dbgutil_main builds like oox/qa/unit/shape.cxx:1170:testPieTextArea::TestBody double equality assertion failed - Expected: 6673 - Actual : 6691 - Delta : 10 The test from 2ac8858b10699c897dd530c8b1434bd9604a4aff (tdf#149918 fix pie in presetShapeDefinitions.xml, 2026-10-06) checked the BoundRect of the shape, which includes the ink of its text; text layout changes merged meanwhile probably moved that ink. Check the text frame that the preset defines instead; it does not depend on fonts or line metrics. Signed-off-by: Mike Kaganski Change-Id: Ica16e4457cc150e9115dfc9994abd3f801778621 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14447 Reviewed-by: Andras Timar Tested-by: Jenkins CPCI (cherry picked from commit 0bcc06cdc592bf7c9828b694b00acb7fed07eccf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211889 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- oox/qa/unit/shape.cxx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index d21ab1363670..add7583d9ebc 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -1155,17 +1155,14 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testPieTextArea) uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); - uno::Reference xShapeProps(xDrawPage->getByIndex(0), uno::UNO_QUERY); - css::awt::Rectangle aBoundRect; - xShapeProps->getPropertyValue(u"BoundRect"_ustr) >>= aBoundRect; - // Without fix, size was 12009 x 7844, and position was 2008|2172. - // The text began in the upper-left corner of the logical rectangle. However it should be inside - // the underlaying ellipse of the pie. - // A BoundRect can vary depending on the system and font and therefore requires a wide tolerance. - CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(10247), aBoundRect.Width, 10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(6673), aBoundRect.Height, 10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(3770), aBoundRect.X, 10); - CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(3343), aBoundRect.Y, 10); + auto xShape = xDrawPage->getByIndex(0).query(); + auto& rSdrCustomShape( + static_cast(*SdrObject::getSdrObjectFromXShape(xShape))); + tools::Rectangle aTextBound; + CPPUNIT_ASSERT(rSdrCustomShape.GetTextBounds(aTextBound)); + // The text frame is inscribed in the ellipse at 45deg. Without the fix in place, it was the + // whole shape, 12000x8000@(1999,1998). + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(3756, 3169, 12241, 8826), aTextBound); } CPPUNIT_PLUGIN_IMPLEMENT();