Blob Blame History Raw
From ccc57428482903923e6df745ea62f5cad8c64bbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 3 Feb 2022 16:05:48 +0000
Subject: [PATCH] the real font used for 'Roman' is arbitrary

the font name isn't a typical semi-standard one so it neither exists nor
has a standard fallback. binary-hack "Roman" to "Arial" which is
conveniently the same length and does have a standard fallback of
"Liberation Sans" which we can add a dependency on via more_fonts

Change-Id: I1d9b8294f67a00a1e5cabe38b71467e66b83aedf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129473
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
---
 emfio/CppunitTest_emfio_emf.mk                |   2 ++
 emfio/CppunitTest_emfio_wmf.mk                |   1 +
 .../wmf/data/tdf88163-non-placeable.wmf       | Bin 1268 -> 1268 bytes
 .../wmf/data/tdf88163-wrong-font-size.wmf     | Bin 1290 -> 1290 bytes
 emfio/qa/cppunit/wmf/wmfimporttest.cxx        |  13 +++----------
 5 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/emfio/CppunitTest_emfio_emf.mk b/emfio/CppunitTest_emfio_emf.mk
index 5b32187b7ea8..1714755a4fb1 100644
--- a/emfio/CppunitTest_emfio_emf.mk
+++ b/emfio/CppunitTest_emfio_emf.mk
@@ -40,6 +40,8 @@ $(eval $(call gb_CppunitTest_use_vcl,emfio_emf))
 
 $(eval $(call gb_CppunitTest_use_rdb,emfio_emf,services))
 
+$(eval $(call gb_CppunitTest_use_more_fonts,emfio_emf))
+
 $(eval $(call gb_CppunitTest_use_configuration,emfio_emf))
 
 # vim: set noet sw=4 ts=4:
diff --git a/emfio/CppunitTest_emfio_wmf.mk b/emfio/CppunitTest_emfio_wmf.mk
index ec67bff3a9b4..44f0a1b273b7 100644
--- a/emfio/CppunitTest_emfio_wmf.mk
+++ b/emfio/CppunitTest_emfio_wmf.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_components,emfio_wmf,\
     unotools/util/utl \
 ))
 
+$(eval $(call gb_CppunitTest_use_more_fonts,emfio_wmf))
 $(eval $(call gb_CppunitTest_use_configuration,emfio_wmf))
 $(eval $(call gb_CppunitTest_use_sdk_api,emfio_wmf))
 $(eval $(call gb_CppunitTest_use_ure,emfio_wmf))
diff --git a/emfio/qa/cppunit/wmf/data/tdf88163-non-placeable.wmf b/emfio/qa/cppunit/wmf/data/tdf88163-non-placeable.wmf
index b39514bd1b5cefc721175680ddca05cfe2341c15..6d27691f0d2d9dbf9936996b077f1ec64e255d83 100644
GIT binary patch
delta 16
Xcmeyu`Gs?W7OP`XW@64p{i7@ZI9&!z

delta 16
Xcmeyu`Gs?W7Hd#`Zerd>{i7@ZIRpk^

diff --git a/emfio/qa/cppunit/wmf/data/tdf88163-wrong-font-size.wmf b/emfio/qa/cppunit/wmf/data/tdf88163-wrong-font-size.wmf
index edcab8aea63552e27ee3b75a0bf7bff74b3966f5..4902ba18d16bb567cb58c93c7a4167311cf05b19 100644
GIT binary patch
delta 16
XcmeC;>f)N<!0K3(nV7TD^(YGfEkOmQ

delta 16
XcmeC;>f)N<z#5dFo0zxJ^(YGfE$9Wh

diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index b7a4dc1badb7..d6533d8ba07c 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -117,14 +117,10 @@ void WmfTest::testTdf88163NonPlaceableWmf()
 
     // These values come from the fix for tdf#88163
 
-    // Font 'Roman' and its height can vary according to the platform
     // Fails without the fix
-    // Linux:   With fix: 3136, without fix: ~ 8000
-    // Mac:     With fix: 3230, without fix: ~ 8000
-    // Windows: With fix: 3303, without fix: ~ 8000
+    // With fix: 3272, without fix: ~ 8000
     auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
-    CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() > 3000);
-    CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() < 3500);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3272), x.toInt32());
 
     // Fails without the fix: Expected: 7359, Actual: 7336
     assertXPath(pDoc, "/metafile/push[2]/textarray[1]", "x", "7359");
@@ -157,12 +153,9 @@ void WmfTest::testTdf88163PlaceableWmf()
 
     // These values come from the fix for tdf#88163
 
-    // Font 'Roman' and its height can vary according to the platform
     // The fix does not affect the font size
-    // Linux: 300 - Mac: 309 - Windows: 316
     auto x = getXPath(pDoc, "/metafile/push[2]/font[1]", "height");
-    CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() > 290);
-    CPPUNIT_ASSERT_MESSAGE(fileName.toUtf8().getStr(), x.toInt32() < 320);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(313), x.toInt32());
 
     // Fails without the fix: Expected: 1900, Actual: 19818
     assertXPath(pDoc, "/metafile", "height", "1900");
-- 
2.33.1