diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-07-19 10:07:57 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-07-19 12:56:50 +0200 |
commit | f9902fc13aaf2c4614125d78c653435ae454de3a (patch) | |
tree | 538aeff5498540e9ca162b8aac85d9a73232c53a /vcl | |
parent | 878292b56d552d18a72c5dd4642dcefbc196c8de (diff) |
Fix endian-dependent test for good
SvmTest::testComment introduced in e10df88b8ae4138862d4dd25c221189878641aa4 "Add
Comment cppunit test to vcl" calls SvmTest::checkComment twice, first for a
programmatically generated svm document, and then for the canned
vcl/qa/cppunit/svm/data/comment.svm. 4f533655dd635dab30574c2a3b3915377124bd60
"this test is endian-dependant" had fixed the endian-dependent check in
SvmTest::checkComment for the first, programmatically generated case, but broke
it for the second, canned case. As seen on s390x:
> xmltesttools.cxx:171:Assertion
> Test name: SvmTest::testComment
> equality assertion failed
> - Expected: 00540068006500730065002000610072006500200073006f006d00650020007400650073007400200064006100740061
> - Actual : 540068006500730065002000610072006500200073006f006d0065002000740065007300740020006400610074006100
> - In <>, attribute 'data' of '/metafile/comment[2]' incorrect value.
So just not make the problematic MetaCommentAction payload endian-dependent in
the first place. (And one wonders why the test even needs to test such a
problematic payload.)
Change-Id: I203dae6545e0d4e63e7c2d521a27c661e1cf633c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137223
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/svm/svmtest.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 91c9128278a7..e6fc36ba089a 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -2220,15 +2220,9 @@ void SvmTest::checkComment(const GDIMetaFile& rMetafile) {"datasize", "48"} }); -#ifdef OSL_LITENDIAN assertXPathAttrs(pDoc, "/metafile/comment[2]", { {"data", "540068006500730065002000610072006500200073006f006d0065002000740065007300740020006400610074006100"} }); -#else - assertXPathAttrs(pDoc, "/metafile/comment[2]", { - {"data", "00540068006500730065002000610072006500200073006f006d00650020007400650073007400200064006100740061"} - }); -#endif assertXPathAttrs(pDoc, "/metafile/comment[2]", { {"value", "4"} @@ -2245,11 +2239,13 @@ void SvmTest::testComment() aGDIMetaFile.AddAction(new MetaCommentAction("Test comment")); - OUString aString = "These are some test data"; + using namespace std::literals::string_view_literals; + static constexpr auto aString + = "T\0h\0e\0s\0e\0 \0a\0r\0e\0 \0s\0o\0m\0e\0 \0t\0e\0s\0t\0 \0d\0a\0t\0a\0"sv; aGDIMetaFile.AddAction(new MetaCommentAction("This is a test comment", \ 4, \ - reinterpret_cast<const sal_uInt8*>(aString.getStr()), \ - 2*aString.getLength() )); + reinterpret_cast<const sal_uInt8*>(aString.data()), \ + aString.length() )); checkComment(writeAndReadStream(aGDIMetaFile)); checkComment(readFile(u"comment.svm")); |