oox/qa/unit/drawingml.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
New commits: commit 2f48aae12ae949056654cb172873f4025104af67 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Apr 24 22:50:02 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Apr 25 04:22:59 2023 +0200 oox: Harden the testTdf142605_CurveSize Test with extra checks Even if it is likely that we fail, it's important that we check that we are checking thr correct shape and not some other shape. As there is only one shape we could assume that in the case that something goes wrong and we wouldn't be able to read the shape, we would end up with 0 shapes, but in case of an empty page we inject placeholder shapes into the page, so we end up comparing the size of a placeholder shape. In this case the test assert gets confusing as we obviously get wrong sizes, which suggest that something is wrong with the shape and not that the shape we expect to assert against is missing and we compare against a different (placeholder) shape. This adds more asserts, which make sure we actually have the expected shape first and also preven crashes if something would go wrong. Change-Id: I435f87d7e634c5135a376ad084373f8d5053555e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150942 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index c468fd126584..09ab7121d8c8 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -327,10 +327,16 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf142605_CurveSize) saveAndReload("Impress Office Open XML"); uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), - uno::UNO_QUERY); + auto xPage = xDrawPagesSupplier->getDrawPages()->getByIndex(0); + uno::Reference<drawing::XDrawPage> xDrawPage(xPage, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xShapeProps.is()); + uno::Reference<container::XNamed> xShapeNamed(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xShapeNamed.is()); + CPPUNIT_ASSERT_EQUAL(OUString(u"Bézier curve 1"), xShapeNamed->getName()); + css::awt::Rectangle aBoundRect; xShapeProps->getPropertyValue("BoundRect") >>= aBoundRect; // Without fix, size was 6262 x 3509, and position was 10037|6790.