Need help for unit test with rotated shape in Calc

Regina Henschel rb.henschel at t-online.de
Tue Dec 3 00:38:59 UTC 2019


Hi all,

my proposed fix for tdf#119191 in 
https://gerrit.libreoffice.org/#/c/84216/ will also fix, that the 
command .uno:FitCellSize does not work on cell anchored custom shapes, 
in case they are transformed. So I'm trying to write a unit test for it. 
The command is new [1] and has no unit test at all, so I have no 
template to look how it can be done.
[1] 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=073b4eadd2a9a00b915c664df90b15d5b2d709c0

The feature is done by the method ScDrawView::FitToCellSize(). So I 
tried to get a ScDrawView, but without success.
The following attempt does not work, xDocSh->GetBestViewShell(false) 
returns a nullptr.

     ScDocShellRef xDocSh = loadDoc("tdf119191_FitToCellSize.", FORMAT_ODS);
     ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
     ScDrawView* pDrawView = pViewShell->GetScDrawView();

So I tried to do the same as in ScCopyPasteTest::testCopyPasteXLS() to 
get a ScTabViewShell. But in that attempt the line 
xController->attachFrame( xTargetFrame ); gives an assertion.

Any idea, how I can apply FitToCellSize() to a shape in a unit test?

Kind regards
Regina


More information about the LibreOffice mailing list