Hi all,
I'm still working on https://gerrit.libreoffice.org/#/c/59269/. The
suggested range-based for-loops work well. Now I try to make a unit test
as suggested by Tomaž.
I have a test file "tdf101242_without_settings.odg", which has the
attributes in the <draw:layer> elements in styles.xml and has no
visible/printable/locked items in settings.xml. I want to load the file,
then save it, then verify that the attributes are still there in
styles.xml. After that works, make a test to verify, that the old kind
items in settings.xml are written correctly.
Is there any example, where I can see how to do that?
I have tried a start like
void SdMiscTest::testTdf101242_ODF2ODF()
{
::sd::DrawDocShellRef xDocShRef =
Load(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf101242_without_settings.odg"),
ODG);
Is there a human readable way to see, what I get there?
Then I have continued (mimicking what I have seen in other places) with:
uno::Reference<lang::XComponent > xComponent(xDocShRef->GetModel(),
uno::UNO_QUERY);
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= OUString("draw8");
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
xStorable->storeToURL(aTempFile.GetURL(),
aMediaDescriptor.getAsConstPropertyValueList());
I see a temp file in C:\cygwin64\tmp\. But it has mimetype
application/vnd.oasis.opendocument.presentation and the attributes in
the <draw:layer> elements are wrong.
My idea was to use something like
xmlDocPtr pXmlDoc = parseExport(aTempFile, "styles.xml");
OString
sPathStart("/office:document-styles/office:master-styles/draw:layer-set/draw:layer");
assertXPath(pXmlDoc, sPathStart +
"[@draw:name='backgroundobjects']", "draw:protected", "true" );
I get something in pXmlDoc. How can I see, what I have got? I cannot get
nodes from it, e.g
getXPathNode(pXmlDoc,OString("/office:document-styles")) or
getXPathNode(pXmlDoc,"/office:document-styles") is already empty.
Obviously I need help.
Kind regards
Regina
Context
- How to make a unit test for Draw to test file format? · Regina Henschel
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.