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 <mike.kaganski@collabora.com>
Change-Id: Ica16e4457cc150e9115dfc9994abd3f801778621
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14447
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0bcc06cdc592bf7c9828b694b00acb7fed07eccf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211889
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Mike Kaganski
2026-10-06 21:18:29 +02:00
committed by Xisco Fauli
parent 7922a1233c
commit a36c7459d1
+8 -11
View File
@@ -1155,17 +1155,14 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testPieTextArea)
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> 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<drawing::XShape>();
auto& rSdrCustomShape(
static_cast<SdrObjCustomShape&>(*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();