parent
ffd9bb495f
commit
7ac188d789
@ -0,0 +1,95 @@
|
|||||||
|
From 0bec3cadcdc5994692581a4fb716b4a152af416e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stephan Bergmann <sbergman@redhat.com>
|
||||||
|
Date: Wed, 20 Jul 2022 17:44:57 +0200
|
||||||
|
Subject: [PATCH] Fix CppunitTest_vcl_svm_test for big endian
|
||||||
|
|
||||||
|
These crc values are the results of Bitmap::GetChecksum() calls, and for
|
||||||
|
headless Linux the formats of those bitmaps (ScanlineFormat::N24BitTcBgr |
|
||||||
|
ScanlineFormat::TopDown vs. ScanlineFormat::N24BitTcRgb |
|
||||||
|
ScanlineFormat::TopDown) depend on little vs. big endian (see the definition of
|
||||||
|
SVP_24BIT_FORMAT in vcl/inc/headless/CairoCommon.hxx), so these tests failed on
|
||||||
|
big endian Linux s390x.
|
||||||
|
|
||||||
|
So I updated the tests with whatever values I got reported on s390x, whether or
|
||||||
|
not those values are actually correct...
|
||||||
|
|
||||||
|
Change-Id: I05d2b656ae2e0cf00cd870b895e1bf3cb9cf82f3
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137270
|
||||||
|
Tested-by: Jenkins
|
||||||
|
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
||||||
|
(cherry picked from commit eea7038c182cc1f6cd792359053ea2561a200026)
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137727
|
||||||
|
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
|
||||||
|
---
|
||||||
|
vcl/qa/cppunit/svm/svmtest.cxx | 28 ++++++++++++++++++++++++++--
|
||||||
|
1 file changed, 26 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
|
||||||
|
index 91c9128278a7..9374e9916772 100644
|
||||||
|
--- a/vcl/qa/cppunit/svm/svmtest.cxx
|
||||||
|
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
|
||||||
|
@@ -12,6 +12,7 @@
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
+#include <osl/endian.h>
|
||||||
|
#include <test/bootstrapfixture.hxx>
|
||||||
|
#include <test/xmltesttools.hxx>
|
||||||
|
#include <vcl/gdimtf.hxx>
|
||||||
|
@@ -937,14 +938,26 @@ void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile)
|
||||||
|
if (SkiaHelper::isVCLSkiaEnabled())
|
||||||
|
return; // TODO SKIA using CRCs is broken (the idea of it)
|
||||||
|
|
||||||
|
- assertXPathAttrs(pDoc, "/metafile/bmp[1]", {{"x", "1"}, {"y", "2"}, {"crc", "b8dee5da"}});
|
||||||
|
+ assertXPathAttrs(pDoc, "/metafile/bmp[1]", {{"x", "1"}, {"y", "2"}, {"crc",
|
||||||
|
+#if defined OSL_BIGENDIAN
|
||||||
|
+ "5e01ddcc"
|
||||||
|
+#else
|
||||||
|
+ "b8dee5da"
|
||||||
|
+#endif
|
||||||
|
+ }});
|
||||||
|
assertXPathAttrs(pDoc, "/metafile/bmpscale[1]", {
|
||||||
|
{"x", "1"}, {"y", "2"}, {"width", "3"}, {"height", "4"}, {"crc", "281fc589"}
|
||||||
|
});
|
||||||
|
assertXPathAttrs(pDoc, "/metafile/bmpscalepart[1]", {
|
||||||
|
{"destx", "1"}, {"desty", "2"}, {"destwidth", "3"}, {"destheight", "4"},
|
||||||
|
{"srcx", "2"}, {"srcy", "1"}, {"srcwidth", "4"}, {"srcheight", "3"},
|
||||||
|
- {"crc", "5e01ddcc"}
|
||||||
|
+ {"crc",
|
||||||
|
+#if defined OSL_BIGENDIAN
|
||||||
|
+ "b8dee5da"
|
||||||
|
+#else
|
||||||
|
+ "5e01ddcc"
|
||||||
|
+#endif
|
||||||
|
+ }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -995,6 +1008,16 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile)
|
||||||
|
std::vector<OUString> aExpectedCRC;
|
||||||
|
aExpectedCRC.insert(aExpectedCRC.end(),
|
||||||
|
{
|
||||||
|
+#if defined OSL_BIGENDIAN
|
||||||
|
+ "08feb5d3",
|
||||||
|
+ "281fc589",
|
||||||
|
+ "b8dee5da",
|
||||||
|
+ "4df0e464",
|
||||||
|
+ "186ff868",
|
||||||
|
+ "33b4a07c", // 4-bit color bitmap - same as 8-bit color bitmap
|
||||||
|
+ "33b4a07c",
|
||||||
|
+ "742c3e35",
|
||||||
|
+#else
|
||||||
|
"d8377d4f",
|
||||||
|
"281fc589",
|
||||||
|
"5e01ddcc",
|
||||||
|
@@ -1003,6 +1026,7 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile)
|
||||||
|
"3c80d829", // 4-bit color bitmap - same as 8-bit color bitmap
|
||||||
|
"3c80d829",
|
||||||
|
"71efc447",
|
||||||
|
+#endif
|
||||||
|
});
|
||||||
|
|
||||||
|
assertXPathAttrs(pDoc, "/metafile/bmpex[1]", {
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
From 095a10a13569195121bedb08ef6afc0e63befc57 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stephan Bergmann <sbergman@redhat.com>
|
||||||
|
Date: Tue, 19 Jul 2022 10:07:57 +0200
|
||||||
|
Subject: [PATCH] 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>
|
||||||
|
(cherry picked from commit f9902fc13aaf2c4614125d78c653435ae454de3a)
|
||||||
|
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137728
|
||||||
|
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
|
||||||
|
---
|
||||||
|
vcl/qa/cppunit/svm/svmtest.cxx | 14 +++++---------
|
||||||
|
1 file changed, 5 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
|
||||||
|
index 9374e9916772..9356b8f5ad6a 100644
|
||||||
|
--- a/vcl/qa/cppunit/svm/svmtest.cxx
|
||||||
|
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
|
||||||
|
@@ -2244,15 +2244,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"}
|
||||||
|
@@ -2269,11 +2263,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"));
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
Loading…
Reference in new issue