Unit test for text rotation inside textbox

Michael Stahl mstahl at redhat.com
Thu Dec 14 15:00:05 UTC 2017


On 13.12.2017 23:17, serdar tunc wrote:
> I am working on bug tdf#104290
> https://bugs.documentfoundation.org/show_bug.cgi?id=104290
> I've sended a patch for fix and i need to send unit test. I've couldnt
> found unit test for text rotation inside textbox. I've just found one
> property named "TextRotation" and i've tried it but i get error called
> UnknownPropertyException. I did search opengrok but i couldnt found
> anything else.
> 
> This is my unit test:
> 
> void ScFiltersTest::testTdf104290XLSX()
> {
>     ScDocShellRef xDocSh = loadDoc("tdf104290.", FORMAT_XLSX);
>     CPPUNIT_ASSERT_MESSAGE("Failed to load tdf104290 .xlsx", xDocSh.is());
>     uno::Reference< drawing::XDrawPagesSupplier > xDoc(
>         xDocSh->GetModel(), uno::UNO_QUERY_THROW );
>     uno::Reference< drawing::XDrawPage > xPage(
>         xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
>     uno::Reference< drawing::XShape > xShape(
>         xPage->getByIndex(0), uno::UNO_QUERY_THROW );
>     CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() );
>     uno::Reference< beans::XPropertySet > xShapeProperties(
>         xShape, uno::UNO_QUERY );
>     sal_Int32 nTextRotate = 0;
>     xShapeProperties->getPropertyValue("TextRotation") >>= nTextRotate;
>     CPPUNIT_ASSERT(nTextRotate == 0);
>     xDocSh->DoClose();
> }
> 
> Is there any example unit test for text rotation inside textbox or
> somebody knows property name of text rotation inside textbox? Thank
> you very much

so usually this would be the "TextWritingMode" property of the shape,
with value css::text::WritingMode2::TB_LR probably ... but in your
document it's not, i tried it.

if i paste this shape into a new sheet and save it i get:

	<draw:enhanced-geometry draw:mirror-horizontal="false"
draw:mirror-vertical="false" draw:text-areas="0 0 ?f3 ?f2"
draw:text-rotate-angle="-270" svg:viewBox="0 0 0 0"
draw:type="ooxml-rect" draw:enhanced-path="M 0 0 L ?f3 0 ?f3 ?f2 0 ?f2 Z N">

apparently  draw:text-rotate-angle="-270"  is what effects the rotation,
no idea where to get that in the API, there must be something "generic"
in com/sun/star/drawing/Enhanced...


More information about the LibreOffice mailing list