diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-11-24 18:16:11 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-11-24 17:51:34 +0100 |
commit | b09cf69f7afa6946a9a4dde6bfa130d382ab1f81 (patch) | |
tree | 46ddb38c9be558b2b02be9186d5da54b9d44a7c5 /svtools/qa | |
parent | cb70626ccb63e09f3a4130fd115a29ac79d823f2 (diff) |
Fix HtmlWriter::characters
This method may be called after an end(), and then it shouldn't try
to close a tag again. Also in this case the characters shouldn't be
considered in the next start()/characters()/end() run.
Clarify the meaning of the previous mbElementOpen, by renaming it
to mbOpeningTagOpen. The old mbCharactersWritten flag was redundant.
Change-Id: Ie0ac6ddd88be774853a1fc152742b51793af798b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159932
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svtools/qa')
-rw-r--r-- | svtools/qa/unit/testHtmlWriter.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/svtools/qa/unit/testHtmlWriter.cxx b/svtools/qa/unit/testHtmlWriter.cxx index 19e5b6078947..3e7e10d34c12 100644 --- a/svtools/qa/unit/testHtmlWriter.cxx +++ b/svtools/qa/unit/testHtmlWriter.cxx @@ -175,10 +175,14 @@ CPPUNIT_TEST_FIXTURE(Test, testCharacters) aHtml.start("abc"_ostr); aHtml.characters("hello"); aHtml.end(); + aHtml.characters(" "); // Should not try to close a not opened tag + aHtml.start("abc"_ostr); + aHtml.characters("world"); // Should close opening tag + aHtml.end(); OString aString = extractFromStream(aStream); - CPPUNIT_ASSERT_EQUAL("<abc>hello</abc>"_ostr, aString); + CPPUNIT_ASSERT_EQUAL("<abc>hello</abc> <abc>world</abc>"_ostr, aString); } CPPUNIT_TEST_FIXTURE(Test, testExactElementEnd) |