diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-03 08:59:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-03 14:26:34 +0100 |
commit | 57f5f399c6047fa6c484a3b969c84aca3a723fab (patch) | |
tree | 1d58aeb587633b70293bc2cc4103799e6cd4ff1b /svx/qa | |
parent | 01e4030aa690e4e408bb9b56a990d7364e9f3a5d (diff) |
use more unique_ptr in EnhancedCustomShape2d
and fix some leaks in the unit tests
Change-Id: I8d324a24de11b14b4820e3cdd7f078d5877489e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110288
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index d0d4ac3d3e6d..271a7aad6f19 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -349,7 +349,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf121845_two_commands_U) SdrObjCustomShape& rSdrObjCustomShape( static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape))); EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape); - SdrPathObj* pPathObj = static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry()); + SdrPathObjUniquePtr pPathObj( + static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry().release())); CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj); const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly()); CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast<sal_uInt32>(2), @@ -777,7 +778,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf103474_commandT_CaseZeroHeight) SdrObjCustomShape& rSdrObjCustomShape( static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape))); EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape); - SdrPathObj* pPathObj = static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry()); + SdrPathObjUniquePtr pPathObj( + static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry().release())); CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj); const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly()); CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast<sal_uInt32>(1), @@ -807,7 +809,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf103474_commandG_CaseZeroHeight) SdrObjCustomShape& rSdrObjCustomShape( static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape))); EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape); - SdrPathObj* pPathObj = static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry()); + SdrPathObjUniquePtr pPathObj( + static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry().release())); CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj); const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly()); CPPUNIT_ASSERT_EQUAL_MESSAGE("count polygons", static_cast<sal_uInt32>(1), @@ -837,7 +840,8 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf122323_largeSwingAngle) SdrObjCustomShape& rSdrObjCustomShape( static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape))); EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape); - SdrPathObj* pPathObj = static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry()); + SdrPathObjUniquePtr pPathObj( + static_cast<SdrPathObj*>(aCustomShape2d.CreateLineGeometry().release())); CPPUNIT_ASSERT_MESSAGE("Could not convert to SdrPathObj", pPathObj); const basegfx::B2DPolyPolygon aPolyPolygon(pPathObj->GetPathPoly()); const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0)); |