diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2015-12-07 23:00:32 +1000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-08 08:16:35 +0000 |
commit | e4d5b5efac71ed2a08dcd09877078a6cf6bde0d2 (patch) | |
tree | e7622e97d813924f60a73196d76497575d0d45ba /writerfilter/qa | |
parent | c321b6182a31cd2e5d6f74e404797bd4c63e537a (diff) |
tdf#54584: adjust skip-slash condition, allow unterminated quote
Experimenting with different non-alpha characters in front of
field, most of them aren't allowed and result in field not
recognized by MS Word: #$%&'()*+,-./:;<>?@[]^_`{|}~
Besides, if backslash "\" is followed by another backslash or
space, it is illegal, too. This patch takes care of it.
On the other side, not closing quotes is allowed by MS Word.
This patch allows this, too.
The patch does not handle another allowed field code "=2+2".
This should be done in another commit.
Change-Id: I842fe59c026b68977e61a7ae0b5495c02803ad83
Reviewed-on: https://gerrit.libreoffice.org/20435
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/qa')
-rw-r--r-- | writerfilter/qa/cppunittests/misc/misc.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/writerfilter/qa/cppunittests/misc/misc.cxx b/writerfilter/qa/cppunittests/misc/misc.cxx index 49e5e1b393c6..522dc19ee685 100644 --- a/writerfilter/qa/cppunittests/misc/misc.cxx +++ b/writerfilter/qa/cppunittests/misc/misc.cxx @@ -160,6 +160,26 @@ void WriterfilterMiscTest::testFieldParameters() CPPUNIT_ASSERT_EQUAL(OUString("foobar"), boost::get<2>(result)[1]); CPPUNIT_ASSERT_EQUAL(OUString("\\A"), boost::get<2>(result)[2]); CPPUNIT_ASSERT_EQUAL(OUString(), boost::get<2>(result)[3]); + + for (auto prefix : {"#", "$", "%", "&", "'", "(", ")", "*", "+", ",", + "-", ".", "/", ":", ";", "<", ">", "?", "@", "[", + "]", "^", "_", "`", "{", "|", "}", "~"}) + { + OUString test(OUString::createFromAscii(prefix) + OUString("PAGE")); + result = lcl_SplitFieldCommand(test + OUString(" ")); + CPPUNIT_ASSERT_EQUAL(test, boost::get<0>(result)); + } + result = lcl_SplitFieldCommand("\\PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), boost::get<0>(result)); + result = lcl_SplitFieldCommand("\\ PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("\\ "), boost::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), boost::get<1>(result)[0]); + result = lcl_SplitFieldCommand("\\\\PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("\\PAGE"), boost::get<0>(result)); + result = lcl_SplitFieldCommand("\"PAGE\" "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), boost::get<0>(result)); + result = lcl_SplitFieldCommand("\"PAGE "); + CPPUNIT_ASSERT_EQUAL(OUString("PAGE "), boost::get<0>(result)); } CPPUNIT_TEST_SUITE_REGISTRATION(WriterfilterMiscTest); |