[Libreoffice-bugs] [Bug 129423] New: Make export tests export-only where applicable (DECLARE_*EXPORT_TEST => DECLARE_*EXPORT_EXPORTONLY_TEST)
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Dec 16 07:02:37 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=129423
Bug ID: 129423
Summary: Make export tests export-only where applicable
(DECLARE_*EXPORT_TEST =>
DECLARE_*EXPORT_EXPORTONLY_TEST)
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: mikekaganski at hotmail.com
In the codebase, there are a lot of unit tests that have this pattern:
> DECLARE_OOXMLEXPORT_TEST(testFoo,"test.odt")
> {
> xmlDocPtr pXmlDoc = parseExport();
> if (!pXmlDoc)
> return;
> assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r", 2);
> }
The code tests that pXmlDoc is valid, because the export tests run in two
stages, first in initial import, then in follow-up import-export-import. For
the former, there's no export yet to parse, and so the pXmlDoc validity test
makes this unit test "export-only".
There are special test templates for export-only tests; and so the task is to
change the above code to
> DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFoo,"test.odt")
> {
> xmlDocPtr pXmlDoc = parseExport();
> assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r", 2);
> }
This not only makes it simpler, but also more robust: if parseExport fails for
some parsing problem and returns nullptr, the test should fail, which would
happen now, unlike with original code, where it would silently pass.
The code is in .cxx files, mostly under sw/qa:
https://opengrok.libreoffice.org/search?project=core&full=%2FDECLARE_.*EXPORT_TEST%2F&si=full&n=250
https://opengrok.libreoffice.org/search?project=core&full=%22if+%28%21pXmlDoc%29%22&si=full
Of course, only the actual export-only tests need to be changed.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20191216/94122496/attachment.htm>
More information about the Libreoffice-bugs
mailing list