Need help for unit test

Regina Henschel rb.henschel at
Tue Mar 16 01:58:49 UTC 2021

Hi all,

and again I need help for making a unit test.

My idea for unit test for 
is to load a document with a custom shape in 3D mode. It has extrusion 
direction "Extrusion Backwards", which means, that no side faces are 
Then I want let a DrawViewShell execute a request with 
SID_EXTRUSION_DIRECTION. That should show a side face and I can examine 
whether the BoundRect has the correct height. But I struggle:

In svx/qa/unit/customshape.cxx I can write
CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141021ExtrusionNorth)
     OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + 
     mxComponent = loadFromDesktop(aURL, 
     uno::Reference<drawing::XShape> xShape(getShape(0));

     SdrObjCustomShape& rSdrShape( 
     tools::Rectangle aBoundRect(rSdrShape.GetCurrentBoundRect());
     CPPUNIT_ASSERT_EQUAL(tools::Long(5895), aBoundRect.GetHeight());

I get a non-empty BoundRect, but I cannot get a DrawViewShell to execute 
the request.

In sd/qa/unit/misc-tests.cxx I can write
void SdMiscTest::testTdf141021ExtrusionNorth()
     sd::DrawDocShellRef xDocSh = 
     sd::DrawViewShell* pViewShell = 

     SdPage* pPage = pViewShell->GetActualPage();
     SdrObjCustomShape* pObject = 
     tools::Rectangle aBoundRect(pObject->GetCurrentBoundRect());
     CPPUNIT_ASSERT_EQUAL(tools::Long(5895), aBoundRect.GetHeight());

Here I have a DrawViewShell, but the BoundRect is empty.

Any idea?

Kind regards

More information about the LibreOffice mailing list