diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-04-24 22:50:02 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-04-26 11:17:53 +0900 |
commit | 14612e03c7c763fee6d59b2514786722083a573f (patch) | |
tree | 6c389ce7d44770701b2e8d8cf48d5f4f22d72a6e /oox | |
parent | 0fb4ba1ca706cb83524f0be3b9b0680a0f94cfb2 (diff) |
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 <quikee@gmail.com>
(cherry picked from commit 2f48aae12ae949056654cb172873f4025104af67)
Diffstat (limited to 'oox')
-rw-r--r-- | oox/qa/unit/drawingml.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 342ee41f9f83..e6375c24723c 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. |