The problem is that when finding/applying an attribute, an empty paragraph is counted twice. In my previous patch, I only did the move if the paragraph contained some content. But the same problem exists for empty paragraphs. The unit test was quite annoying, until I discovered it was searching for the exact opposite of what it was intending to look for. make CppunitTest_sw_uiwriter7 CPPUNIT_TEST_NAME=testTdf131431 It still double-counts for the very last paragraph, since it tries to move forward but can't. WARNING: This patch breaks the counting for finding attribs (without replace). The reason for this is that SwFindParaAttr doesn't bMoveFirst when bReplaceAttr is set. So, it worked for 'Find-All', but not for 'Replace-All'. However, Find and Find-All suffer from skipping the first empty para, so that bMoveFirst is a bad thing really. While developing the follow-up patches, I discovered that after the end of a paragraph, a text search checks in anchored editeng objects. So we can't move when doing a text search! I wonder what other disasters are lurking in wait for me... Change-Id: I10a786bd18c7b9957a70ea68324660e3c84b9b03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208681 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Justin Luth <jluth@mail.com>
You can find different types of Writer tests here, the following directories
are available:
- core:
- filters-test: loads different file types (see SwFiltersTest::testCVEs() for
the list of supported filter types), and only makes sure Writer does not
crash. To add new tests, you just need to drop in the test files to the
relevant directory, no code change is necessary.
- uwriter: this test has access to private Writer symbols, add new tests here
if you need that.
- extras:
- see its own README -- executes import and export filters and asserts the
UNO model to verify the resulting document is the expected one.
- also, any new C++ test that links to libsw (but does not need access to
private Writer symbols) should go in this directory, whether using the UNO
API or the internal one.
- complex: JUnit-based tests using the UNO API
- unoapi: JUnit-based test trying to get/set every UNO property, etc.