Need help for unit test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

and again I need help for making a unit test.

My idea for unit test for https://gerrit.libreoffice.org/c/core/+/112474 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 visible. 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) + "tdf141021_ExtrusionNorth.odp"; mxComponent = loadFromDesktop(aURL, "com.sun.star.comp.presentation.PresentationDocument");
    uno::Reference<drawing::XShape> xShape(getShape(0));

SdrObjCustomShape& rSdrShape( static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
    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 = Load(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf141021_ExtrusionNorth.odp"), ODP); sd::DrawViewShell* pViewShell = static_cast<sd::DrawViewShell*>(xDocSh->GetViewShell());

    SdPage* pPage = pViewShell->GetActualPage();
SdrObjCustomShape* pObject = static_cast<SdrObjCustomShape*>(pPage->GetObj(0));
    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
Regina

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux