summaryrefslogtreecommitdiff
path: root/include/test/xmltesttools.hxx
AgeCommit message (Collapse)Author
2024-10-05Use good old string literals in assertXPath and friendsMike Kaganski
These are only sent to an external API expecting char*-like strings, or for comparison. Having every assertXPath having three of _[ou]str is too much syntactic noise, making the unit tests almost unreadable. Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2024-07-30sw: get rid of parseDumpXisco Fauli
So parseLayoutDump is only called once per test Change-Id: Ia199e0a7eeac26fbde94f6450d2aa49828940806 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171219 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2024-01-30tdf#159438: when there's no frame, close previous bookmark firstMike Kaganski
Commit 260d6cc6471444b4ef20ed6673831b0b12f96333 (INTEGRATION: CWS mtg2 (1.30.120); FILE MERGED, 2005-12-21) for #i58438# made sure to process previously opened bookmarks that close at this node, before opening the bookmarks that start here. Commit 76a4305d1e90b6617054dd33036e64f005dbcf04 (sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames, 2017-12-21) re-introduced the problem accidentally: it only intended to handle case when there is an anchored frame here. This change re-instates the correct order (close bookmarks first; then process collapsed ones; then open new bookmarks) in case there's no anchored frames here. To avoid a problem when a non-collapsed bookmark starts and ends at the same point (e.g., its text was deleted), it gets converted to collapsed in lcl_FillBookmark. Thus, testRemoveBookmarkText was fixed in sw/qa/extras/uiwriter/uiwriter4.cxx. There is no reason to keep the separate -begin/-end elements, especially since on the following open/save round-trip, it will become collapsed anyway. Change-Id: Ib555a76f6f776001e12908a1299c24eebf591f6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162743 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-06xmltesttools: add assertXPathDoubleValue that takes a double with deltaIlmari Lauhakangas
and use it to make WmfTest::testSetTextAlignWmf independent of DPI Change-Id: I2048239088a8dcc3e3ab1db96413894b5bcc56d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157377 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-11-25Merge two assertXPath overloads that both check number of nodesMike Kaganski
Change-Id: I67eec623b90ab20330fa0c268152211b6bbdbe1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143301 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-25tdf#152200: Make sure to not write objects into field character runsMike Kaganski
Similar how it's done for preceding objects immediately after calculating 'ofs', we also need to make sure to create a separate run for the objects that may be anchored after the last character; otherwise, the field that was just processed (and is waiting in the attributes) would be put out of place, inside an inner run (e.g., in a text box inside the object). Change-Id: I2702693595acf4befdbd25ef07a9f7c444926aab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143297 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-29split utl::TempFile into fast and named variantsNoel Grandin
which makes it easier to know what each variant requires to stay on it's happy path Change-Id: I3275a2543573367714bc78092e882f6535507285 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-04test: introduce XmlTestTools::registerOOXMLNamespaces() to reduce copy&pasteMiklos Vajna
sc/ could potentially benefit from this as well, that's not yet done here. Change-Id: I03d0b4afa21a02c74d34aab6e03ab53991df29dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116679 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-03-26Extract copy&pasted namespace list to XmlTestTools::registerODFNamespaces()Miklos Vajna
Both sw/ and xmloff/ can depend on test/, so no need to duplicate this. Change-Id: I93bfdb4422bdef9f8d28bc37548130fae49829e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113107 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-24loplugin:stringviewparam extend to comparison operatorsNoel
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-23tdf#136949: Revert "tdf#115753 fix table border missing when there are ↵Xisco Fauli
merged cells" This reverts commit 2b19cd84f10552c438dace0a4c52a70ccd440369. Change-Id: I5f3f51e0e816416c364155ab67bc37bb8c6fe545 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103187 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-08-28test: fix misleading documentation of assertXPathNoAttribute()Michael Stahl
Change-Id: I5bb603fe1d615f7df790bcd352beb09d65dcb3a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101536 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Michael Stahl <michael.stahl@cib.de>
2020-07-29tdf#115753 fix table border missing when there are merged cellsnd101
Remove code that ignores merged cells. Change-Id: I907220e9ffc9d18561171efd7d6b39d14a8341fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93836 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-05-07fix memory leak of xmlDoc objectsNoel Grandin
in unit tests Change-Id: Id16731bbbe2f1b0e3642722d77aba04fc98db4cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93508 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-01Make getXPathPosition assert on requested child foundMike Kaganski
Previously, for an XML like this: <sharedItems> <d v="2017-07-10T09:11:02"/> <d v="2017-07-10T09:11:03"/> <m/> </sharedItems> the call like int pos = getXPathPosition(pDoc, "/x:sharedItems", "absent"); gave 3. That could result in mistakes, when a test would assert on position "3" for a child element which name is mistyped. I made such a mistake when creating a unit test trying to assert on a position of the last element, and writing its name as "x:m", like in rXPath itself; the return was 3, and I initially wrongly assumed that the return is 1-based (like in xpath bracketed expressions). rChildName made const OString&, for consistency with rXPath, or with rAttribute in getXPath: child name is just a part of a longer xpath. Change-Id: I7ba9c4466c75b1b10fce1ccf26ef3b56b4e11e87 Reviewed-on: https://gerrit.libreoffice.org/71614 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-04-25assertXPath: disallow passing rAttribute without rExpectedValueMike Kaganski
Change-Id: I7fb59039429361dad04fb68507f40545f9c4dd6d Reviewed-on: https://gerrit.libreoffice.org/71290 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-01-03svm xml dumper: move this from test to vclMiklos Vajna
This is very useful functionality, this way it can be invoked from the debugger and/or nested into an outer xml dump (sw/sd doc model dump) more easily. Change-Id: If6c83b11d0f3e65fcce71e8d820c6bc354f64d68 Reviewed-on: https://gerrit.libreoffice.org/65834 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2018-09-06clang-tidy performance-unnecessary-value-paramNoel Grandin
Change-Id: I69247498e13331f6ef84afeb242479f8fb1178a8 Reviewed-on: https://gerrit.libreoffice.org/60068 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-12EPUB export, fixed layout: fix validation error with imagesMiklos Vajna
The "xlink" prefix for the "xlink:href" attribute on the "image" element was not bound. Change-Id: I473a0b1612b4842cf84a264960bb28a9f19600e5 Reviewed-on: https://gerrit.libreoffice.org/49612 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2017-11-06loplugin:constparams in various(2)Noel Grandin
Change-Id: I533a7eb724b15e168a28dc92cd5962a39bc96e7c Reviewed-on: https://gerrit.libreoffice.org/44313 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-14vcl: add SVM metafile reading and writing test and extend xml dumpTomaž Vajngerl
Change-Id: I88ffb795a9c33ea62d05d599757a287335c7d680 Reviewed-on: https://gerrit.libreoffice.org/32914 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2015-05-05loplugin:staticmethodsNoel Grandin
Change-Id: I384a5e60f4b7b2f479c89ef97630519059ab720f
2014-09-30Factor out duplicated code to XmlTestTools::assertXPathNoAttribute()Miklos Vajna
Change-Id: I1eb3778e6bcdd8c44ffb9a7548add109331fc83b
2014-08-28parseXml should return xmlDocPtr instead of htmlDocPtrTomaž Vajngerl
Change-Id: Ia9fb79ea40ca840d7328a078e747ad64a63d18f1
2014-06-10MetafileXmlDump: No need to specify the stream, simplify the API.Jan Holesovsky
Change-Id: Ia08f67e359bbd26cefdba8661f0b0c4ae2147382
2014-06-02Fix memory leaks in test codeStephan Bergmann
Change-Id: Ifa756a5da636e0b37654ad83900115872bc40f0e
2014-05-15test: parseXmlStream & parseHtmlStream added to test toolsTomaž Vajngerl
Change-Id: Iff8af5e9ffefb4c3cecf387b16473d45e8b4a65a
2014-05-15Resolves fdo#70681: fixincludeguards.pl: all that's leftThomas Arnhold
Change-Id: I3e51a62710bb46c8255fd228d41d9300c90a1fb5 Reviewed-on: https://gerrit.libreoffice.org/9360 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-04-30test: move XmlTestTools API documentation to the headerMiklos Vajna
Change-Id: Iae56b1fb68fde0cbc44f6b9e37ba1a66194b25e0
2014-04-29tests: add XML and HTML test tools to test moduleTomaž Vajngerl
XML and HTML parsing and XPath asserts are used by many test in sw, sc and sd modules. This commit moves this functionallity to test module, where it is available to all modules. Change-Id: I53ad9c45b24f4c9bf106cb58ea619002968bfeda