vcl/qa/cppunit/complextext.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit d21a23cb03b54d423faf6c4a3d706cb9c749916d
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Aug 9 12:46:06 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Fri Aug 12 12:12:33 2022 +0200

    use the same vcl::text::TextLayoutCache when comparing text layout
    
    Otherwise OutputDevice::ImplLayout() might use a temporary cache
    just for the subtext while SalLayoutGlyphsCache would use cache
    for the whole string, and those two might differ e.g. with an arabic
    string starting with numbers when the subset is just the numbers.
    
    Change-Id: Idea7ef277beae07e39e4a714088a7585361d13e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138143
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index d6c624fa7406..9e96205946b1 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -226,8 +226,10 @@ static void testCachedGlyphsSubstring( const OUString& 
aText, const OUString& aF
     vcl::Font aFont( aFontName, Size(0, 12));
     pOutputDevice->SetFont( aFont );
     SalLayoutGlyphsCache::self()->clear();
+    std::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = 
OutputDevice::CreateTextLayoutCache(aText);
     // Get the glyphs for the entire text once, to ensure the cache can built 
subsets from it.
-    pOutputDevice->ImplLayout( aText, 0, aText.getLength(), Point(0, 0), 0, 
{}, SalLayoutFlags::GlyphItemsOnly);
+    pOutputDevice->ImplLayout( aText, 0, aText.getLength(), Point(0, 0), 0, 
{}, SalLayoutFlags::GlyphItemsOnly,
+        layoutCache.get());
     // Now check for all subsets. Some of them possibly do not make sense in 
practice, but the code
     // should cope with them.
     for( sal_Int32 len = 1; len <= aText.getLength(); ++len )
@@ -235,10 +237,10 @@ static void testCachedGlyphsSubstring( const OUString& 
aText, const OUString& aF
         {
             std::string message = prefix + " (" + std::to_string(pos) + "/" + 
std::to_string(len) + ")";
             std::unique_ptr<SalLayout> pLayout1 = pOutputDevice->ImplLayout(
-                aText, pos, len, Point(0, 0), 0, {}, 
SalLayoutFlags::GlyphItemsOnly);
+                aText, pos, len, Point(0, 0), 0, {}, 
SalLayoutFlags::GlyphItemsOnly, layoutCache.get());
             SalLayoutGlyphs aGlyphs1 = pLayout1->GetGlyphs();
             const SalLayoutGlyphs* aGlyphs2 = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(
-                pOutputDevice, aText, pos, len, 0);
+                pOutputDevice, aText, pos, len, 0, layoutCache.get());
             CPPUNIT_ASSERT_MESSAGE(message, aGlyphs2 != nullptr);
             checkCompareGlyphs(aGlyphs1, *aGlyphs2, message);
         }

Reply via email to