backport my upstream fixes for these broken tests

f41
Caolán McNamara 3 years ago
parent dda52c655f
commit 7e0c979684

@ -0,0 +1,401 @@
From e60f4c7cc51bb58b4e42bb47b37209fa0e6b3400 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 4 Feb 2022 15:02:17 +0000
Subject: [PATCH] fix direct leaks in vcl cppunit tests
the uses of new are wholly unnecessary
Change-Id: Id7238be6e73567add8a0d3ed6dc9f3262e15c043
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129435
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
---
vcl/qa/cppunit/text.cxx | 276 ++++++++++++++++++++--------------------
1 file changed, 138 insertions(+), 138 deletions(-)
diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index eef1478286d5..072a0d0a1f98 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -425,67 +425,67 @@ void VclTextTest::testImplLayoutRuns_AddPos()
aRuns.AddPos(6, true); // add RTL marker glyph
aRuns.AddPos(7, false);
- int* pCharPos = new int(0);
- bool* pRightToLeftMarker = new bool(false);
+ int nCharPos(0);
+ bool bRightToLeftMarker(false);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(1, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(1, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(2, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(2, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(3, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(3, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(4, *pCharPos);
- CPPUNIT_ASSERT(*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(4, nCharPos);
+ CPPUNIT_ASSERT(bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(5, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(5, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(6, *pCharPos);
- CPPUNIT_ASSERT(*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(6, nCharPos);
+ CPPUNIT_ASSERT(bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(7, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(7, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
// no next position, we are running off the end
- CPPUNIT_ASSERT(!aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
+ CPPUNIT_ASSERT(!aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
aRuns.ResetPos();
int nMinRunPos, nEndRunPos;
- bool* pRightToLeft = new bool(false);
+ bool bRightToLeft(false);
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(1, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(4, nEndRunPos);
- CPPUNIT_ASSERT(!*pRightToLeft);
+ CPPUNIT_ASSERT(!bRightToLeft);
aRuns.NextRun();
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(4, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(5, nEndRunPos);
- CPPUNIT_ASSERT(*pRightToLeft);
+ CPPUNIT_ASSERT(bRightToLeft);
aRuns.NextRun();
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(5, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(6, nEndRunPos);
- CPPUNIT_ASSERT(!*pRightToLeft);
+ CPPUNIT_ASSERT(!bRightToLeft);
aRuns.NextRun();
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(6, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(7, nEndRunPos);
- CPPUNIT_ASSERT(*pRightToLeft);
+ CPPUNIT_ASSERT(bRightToLeft);
// test clear
aRuns.Clear();
@@ -500,63 +500,63 @@ void VclTextTest::testImplLayoutRuns_AddRuns()
aRuns.AddRun(5, 6, false);
aRuns.AddRun(6, 7, true);
- int* pCharPos = new int(0);
- bool* pRightToLeftMarker = new bool(false);
+ int nCharPos(0);
+ bool bRightToLeftMarker(false);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(1, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(1, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(2, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(2, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(3, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(3, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(4, *pCharPos);
- CPPUNIT_ASSERT(*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(4, nCharPos);
+ CPPUNIT_ASSERT(bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(5, *pCharPos);
- CPPUNIT_ASSERT(!*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(5, nCharPos);
+ CPPUNIT_ASSERT(!bRightToLeftMarker);
- CPPUNIT_ASSERT(aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
- CPPUNIT_ASSERT_EQUAL(6, *pCharPos);
- CPPUNIT_ASSERT(*pRightToLeftMarker);
+ CPPUNIT_ASSERT(aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
+ CPPUNIT_ASSERT_EQUAL(6, nCharPos);
+ CPPUNIT_ASSERT(bRightToLeftMarker);
// no next position, we are running off the end
- CPPUNIT_ASSERT(!aRuns.GetNextPos(pCharPos, pRightToLeftMarker));
+ CPPUNIT_ASSERT(!aRuns.GetNextPos(&nCharPos, &bRightToLeftMarker));
aRuns.ResetPos();
int nMinRunPos, nEndRunPos;
- bool* pRightToLeft = new bool(false);
+ bool bRightToLeft(false);
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(1, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(4, nEndRunPos);
- CPPUNIT_ASSERT(!*pRightToLeft);
+ CPPUNIT_ASSERT(!bRightToLeft);
aRuns.NextRun();
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(4, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(5, nEndRunPos);
- CPPUNIT_ASSERT(*pRightToLeft);
+ CPPUNIT_ASSERT(bRightToLeft);
aRuns.NextRun();
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(5, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(6, nEndRunPos);
- CPPUNIT_ASSERT(!*pRightToLeft);
+ CPPUNIT_ASSERT(!bRightToLeft);
aRuns.NextRun();
- CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, pRightToLeft));
+ CPPUNIT_ASSERT(aRuns.GetRun(&nMinRunPos, &nEndRunPos, &bRightToLeft));
CPPUNIT_ASSERT_EQUAL(6, nMinRunPos);
CPPUNIT_ASSERT_EQUAL(7, nEndRunPos);
- CPPUNIT_ASSERT(*pRightToLeft);
+ CPPUNIT_ASSERT(bRightToLeft);
}
void VclTextTest::testImplLayoutRuns_PosIsInRun()
@@ -603,23 +603,23 @@ void VclTextTest::testImplLayoutArgsBiDiStrong()
SalLayoutFlags::BiDiStrong, LanguageTag(LANGUAGE_NONE),
nullptr);
- int* nMinRunPos = new int(0);
- int* nEndRunPos = new int(0);
- bool* pRTL = new bool(false);
+ int nMinRunPos(0);
+ int nEndRunPos(0);
+ bool bRTL(false);
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(0, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(19, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(0, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(19, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(20, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(51, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(20, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(51, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(20, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(51, *nEndRunPos);
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(20, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(51, nEndRunPos);
}
void VclTextTest::testImplLayoutArgsBiDiRtl()
@@ -629,29 +629,29 @@ void VclTextTest::testImplLayoutArgsBiDiRtl()
vcl::text::ImplLayoutArgs aArgs(sTestString, 0, sTestString.getLength(),
SalLayoutFlags::BiDiRtl, LanguageTag(LANGUAGE_NONE), nullptr);
- int* nMinRunPos = new int(0);
- int* nEndRunPos = new int(0);
- bool* pRTL = new bool(false);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(45, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(51, *nEndRunPos);
- CPPUNIT_ASSERT(*pRTL);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(21, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(45, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(20, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(21, *nEndRunPos);
- CPPUNIT_ASSERT(*pRTL);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(0, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(19, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
+ int nMinRunPos(0);
+ int nEndRunPos(0);
+ bool bRTL(false);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(45, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(51, nEndRunPos);
+ CPPUNIT_ASSERT(&bRTL);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(21, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(45, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(20, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(21, nEndRunPos);
+ CPPUNIT_ASSERT(bRTL);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(0, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(19, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
}
void VclTextTest::testImplLayoutArgsRightAlign()
@@ -662,24 +662,24 @@ void VclTextTest::testImplLayoutArgsRightAlign()
SalLayoutFlags::RightAlign, LanguageTag(LANGUAGE_NONE),
nullptr);
- int* nMinRunPos = new int(0);
- int* nEndRunPos = new int(0);
- bool* pRTL = new bool(false);
+ int nMinRunPos(0);
+ int nEndRunPos(0);
+ bool bRTL(false);
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(0, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(19, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(0, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(19, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(20, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(45, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(20, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(45, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(45, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(51, *nEndRunPos);
- CPPUNIT_ASSERT(*pRTL);
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(45, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(51, nEndRunPos);
+ CPPUNIT_ASSERT(bRTL);
}
void VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
@@ -702,29 +702,29 @@ void VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
aArgs.PrepareFallback(pGlyphsImpl);
- int* nMinRunPos = new int(0);
- int* nEndRunPos = new int(0);
- bool* pRTL = new bool(false);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(0, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(3, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(4, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(9, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(11, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(17, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
-
- aArgs.GetNextRun(nMinRunPos, nEndRunPos, pRTL);
- CPPUNIT_ASSERT_EQUAL(18, *nMinRunPos);
- CPPUNIT_ASSERT_EQUAL(22, *nEndRunPos);
- CPPUNIT_ASSERT(!*pRTL);
+ int nMinRunPos(0);
+ int nEndRunPos(0);
+ bool bRTL(false);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(0, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(3, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(4, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(9, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(11, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(17, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
+
+ aArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL);
+ CPPUNIT_ASSERT_EQUAL(18, nMinRunPos);
+ CPPUNIT_ASSERT_EQUAL(22, nEndRunPos);
+ CPPUNIT_ASSERT(!bRTL);
}
CPPUNIT_TEST_SUITE_REGISTRATION(VclTextTest);
--
2.33.1

@ -1,56 +0,0 @@
From 9e0de37a1f4c604d3aff93089f0c2f24818df615 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 3 Feb 2022 15:35:09 +0000
Subject: [PATCH] it doesn't work to just have 'Roman' as a font name and then
depend on metrics
Change-Id: I1135740eea709d2a7ef0303b3a3c070933eb697c
---
emfio/qa/cppunit/wmf/wmfimporttest.cxx | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
index b7a4dc1badb7..260b6d25b1b1 100644
--- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -46,8 +46,10 @@ public:
}
void testNonPlaceableWmf();
+#if 0
void testTdf88163NonPlaceableWmf();
void testTdf88163PlaceableWmf();
+#endif
void testSine();
void testEmfProblem();
void testEmfLineStyles();
@@ -59,8 +61,10 @@ public:
CPPUNIT_TEST_SUITE(WmfTest);
CPPUNIT_TEST(testNonPlaceableWmf);
+#if 0
CPPUNIT_TEST(testTdf88163NonPlaceableWmf);
CPPUNIT_TEST(testTdf88163PlaceableWmf);
+#endif
CPPUNIT_TEST(testSine);
CPPUNIT_TEST(testEmfProblem);
CPPUNIT_TEST(testEmfLineStyles);
@@ -103,6 +107,7 @@ void WmfTest::testNonPlaceableWmf()
assertXPath(pDoc, "/metafile/polyline[1]/point[5]", "y", "1004");
}
+#if 0
void WmfTest::testTdf88163NonPlaceableWmf()
{
OUString fileName(u"tdf88163-non-placeable.wmf");
@@ -182,6 +187,7 @@ void WmfTest::testTdf88163PlaceableWmf()
// Fails without the fix: Expected: 390, Actual: 4068
assertXPath(pDoc, "/metafile/push[2]/textarray[3]", "y", "390");
}
+#endif
void WmfTest::testSine()
{
--
2.33.1

@ -1,52 +0,0 @@
From 26745e523d9be8403573d0ea700f1f417fbf6c71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 3 Feb 2022 21:03:19 +0000
Subject: [PATCH] the fedora kacst-book-fonts-2.0-26 does have these western
glyphs
Change-Id: I4149acfc93e7f48aa98fc001c7958868e118b558
---
vcl/qa/cppunit/text.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index eef1478286d5..0eef380ee1b5 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -53,7 +53,7 @@ public:
void testImplLayoutArgsBiDiStrong();
void testImplLayoutArgsBiDiRtl();
void testImplLayoutArgsRightAlign();
- void testImplLayoutArgs_PrepareFallback_precalculatedglyphs();
+ // void testImplLayoutArgs_PrepareFallback_precalculatedglyphs();
CPPUNIT_TEST_SUITE(VclTextTest);
CPPUNIT_TEST(testSimpleText);
@@ -66,7 +66,7 @@ public:
CPPUNIT_TEST(testImplLayoutArgsBiDiStrong);
CPPUNIT_TEST(testImplLayoutArgsBiDiRtl);
CPPUNIT_TEST(testImplLayoutArgsRightAlign);
- CPPUNIT_TEST(testImplLayoutArgs_PrepareFallback_precalculatedglyphs);
+ // CPPUNIT_TEST(testImplLayoutArgs_PrepareFallback_precalculatedglyphs);
CPPUNIT_TEST_SUITE_END();
};
@@ -682,6 +682,7 @@ void VclTextTest::testImplLayoutArgsRightAlign()
CPPUNIT_ASSERT(*pRTL);
}
+#if 0
void VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
{
// this font has no latin characters and thus needs fallback
@@ -726,6 +727,7 @@ void VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
CPPUNIT_ASSERT_EQUAL(22, *nEndRunPos);
CPPUNIT_ASSERT(!*pRTL);
}
+#endif
CPPUNIT_TEST_SUITE_REGISTRATION(VclTextTest);
--
2.33.1

@ -0,0 +1,103 @@
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

@ -0,0 +1,75 @@
From 32ec6094e81d292346f83db6e18a3daec99bd2ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 4 Feb 2022 15:13:28 +0000
Subject: [PATCH] this test assumes KacstBook has no Latin glyphs
which is true for the one bundled with LibreOffice but is not
true for the fedora one (kacst-book-fonts-2.0-26.fc35), but
neither of them have Cyrillic glyphs
Change-Id: Ide8b84502886c7b9e0bc4fcef4685b4b89ec2bc3
test fails with both fedora KacstBook and bundled KacstBook installed
fedora KacstBook ver is less than bundled KacstBook ver so bundled is
preferred, bundled KacstBook has no Latin glyphs, but glyph fallback
finds system one and sees it has the missing glyphs, determines that the
whole thing can be done in the fallback font, so the toplevel is unused
and so "invalid" and this test fails on checking that.
The test is supposed to ensure that glyph caching gives the same result
as uncached, which it does, so just assert if there is a difference
between cached and uncached
Change-Id: I3c424a17f3e544aa64f4af98e0c151fc00b2e6e5
---
vcl/qa/cppunit/complextext.cxx | 4 +---
vcl/qa/cppunit/text.cxx | 6 ++++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 21e1e58f96ac..5d9ac92f1f69 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -172,13 +172,11 @@ static void testCachedGlyphs( const OUString& aText, const OUString& aFontName =
std::unique_ptr<SalLayout> pLayout1 = pOutputDevice->ImplLayout(
aText, 0, aText.getLength(), Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly);
SalLayoutGlyphs aGlyphs1 = pLayout1->GetGlyphs();
- CPPUNIT_ASSERT_MESSAGE(message, aGlyphs1.IsValid());
- CPPUNIT_ASSERT_MESSAGE(message, aGlyphs1.Impl(0) != nullptr);
// Reuse the cached glyphs to get glyphs again.
std::unique_ptr<SalLayout> pLayout2 = pOutputDevice->ImplLayout(
aText, 0, aText.getLength(), Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly, nullptr, &aGlyphs1);
SalLayoutGlyphs aGlyphs2 = pLayout2->GetGlyphs();
- CPPUNIT_ASSERT_MESSAGE(message, aGlyphs2.IsValid());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(message, aGlyphs1.IsValid(), aGlyphs2.IsValid());
// And check it's the same.
for( int level = 0; level < MAX_FALLBACK; ++level )
{
diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 072a0d0a1f98..3647589a38d1 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -690,7 +690,8 @@ void VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
ScopedVclPtrInstance<VirtualDevice> pVirDev;
pVirDev->SetFont(aFont);
- const OUString sTestString = "The quick\n jumped over";
+ const OString sUTF8String(u8"Тхе яуицк\n ыумпед овер");
+ const OUString sTestString(OUString::fromUtf8(sUTF8String));
std::unique_ptr<SalLayout> pLayout
= pVirDev->ImplLayout(sTestString, 0, sTestString.getLength(), Point(0, 0), 0, {},
SalLayoutFlags::GlyphItemsOnly);
@@ -698,7 +699,8 @@ void VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
SalLayoutGlyphsImpl* pGlyphsImpl = aGlyphs.Impl(1);
vcl::text::ImplLayoutArgs aArgs(sTestString, 0, sTestString.getLength(),
- SalLayoutFlags::BiDiRtl, LanguageTag(LANGUAGE_LATIN), nullptr);
+ SalLayoutFlags::BiDiRtl, LanguageTag(LANGUAGE_RUSSIAN),
+ nullptr);
aArgs.PrepareFallback(pGlyphsImpl);
--
2.33.1

@ -245,14 +245,14 @@ Patch1: 0001-disble-tip-of-the-day-dialog-by-default.patch
Patch2: 0001-Resolves-rhbz-1432468-disable-opencl-by-default.patch
# backported
Patch3: 0001-Revert-tdf-101630-gdrive-support-w-oAuth-and-Drive-A.patch
# disable poor test
Patch4: 0001-it-doesn-t-work-to-just-have-Roman-as-a-font-name-an.patch
Patch4: 0001-the-real-font-used-for-Roman-is-arbitrary.patch
Patch5: 0001-fix-direct-leaks-in-vcl-cppunit-tests.patch
Patch6: 0001-this-test-assumes-KacstBook-has-no-Latin-glyphs.patch
Patch7: 0001-Avoid-calling-AVX-code-in-library-static-initializat.patch
# disable another poor test
Patch5: 0001-the-fedora-kacst-book-fonts-2.0-26-does-have-these-w.patch
Patch6: 0001-Avoid-calling-AVX-code-in-library-static-initializat.patch
Patch7: 0001-yet-another-naieve-font-reliant-test.patch
Patch8: 0001-yet-another-naieve-font-reliant-test.patch
# see if ICE still happens
Patch8: 0001-disable-ICEing-function-under-x86.patch
Patch9: 0001-disable-ICEing-function-under-x86.patch
# not upstreamed
Patch500: 0001-disable-libe-book-support.patch

Loading…
Cancel
Save