diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-06-15 14:32:00 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-06-23 08:54:52 +0200 |
commit | e10df88b8ae4138862d4dd25c221189878641aa4 (patch) | |
tree | 63998ba596307bc158930bf99ffdba4252e1349a /vcl/source/gdi | |
parent | a344462ccb324b14dbf17391146f78d84307cbec (diff) |
Add Comment cppunit test to vcl.
The test creates two MetaCommentActions from the GDIMetafile and
checks their attributes and contents.
Change-Id: I748a6fa5dcf0dc09359fb48ea0bf3d7ceef3dbcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117245
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/mtfxmldump.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index e5651906ed57..84c280c2eaae 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -439,6 +439,17 @@ OUString hex32(sal_uInt32 nNumber) return OUString::createFromAscii(ss.str().c_str()); } +OUString toHexString(const sal_uInt8* nData, sal_uInt32 nDataSize){ + + std::stringstream aStrm; + for (sal_uInt32 i = 0; i < nDataSize; i++) + { + aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(nData[i]); + } + + return OUString::createFromAscii(aStrm.str().c_str()); +} + void writePoint(tools::XmlWriter& rWriter, Point const& rPoint) { rWriter.attribute("x", rPoint.X()); @@ -1353,14 +1364,16 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r if (pMetaCommentAction->GetDataSize() > 0) { rWriter.attribute("datasize", pMetaCommentAction->GetDataSize()); + rWriter.attribute("data", toHexString(pMetaCommentAction->GetData(), pMetaCommentAction->GetDataSize())); } + rWriter.attribute("value", pMetaCommentAction->GetValue()); + if (!pMetaCommentAction->GetComment().isEmpty()) { rWriter.startElement("comment"); rWriter.content(pMetaCommentAction->GetComment()); rWriter.endElement(); } - rWriter.endElement(); } break; |