vcl/qa/cppunit/complextext.cxx   |   26 ++++++++++++++++++++++++++
 vcl/win/source/gdi/winlayout.cxx |    4 ++--
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit f4a4bbce92fe753678b218c265f7180c306ddf73
Author: Mike Kaganski <mike.kagan...@collabora.com>
Date:   Sat Nov 7 18:45:31 2015 +1000

    tdf#95650: Replace wrong assertion with condition
    
    When UniscribeLayout::LayoutText(ImplLayoutArgs & rArgs) is run with
    BiDiRtl flag, and some skipped VisualItems was reversed in lines 908-927,
    it's possible that they will arrive in reverse order to the code adjusting
    mnSubStringMin, so this assertion may fire.
    
    This situation is not erroneous, so simply replacing the assert with "if".
    
    Change-Id: Icb244502dd00b4c08a2c5192369ee66d743b0dcc
    Reviewed-on: https://gerrit.libreoffice.org/19835
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Michael Stahl <mst...@redhat.com>

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a7c4e034..31717cc 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -22,9 +22,15 @@ public:
 
     /// Play with font measuring etc.
     void testArabic();
+#if defined(WNT)
+    void testTdf95650(); // Windows-only issue
+#endif
 
     CPPUNIT_TEST_SUITE(VclComplexTextTest);
     CPPUNIT_TEST(testArabic);
+#if defined(WNT)
+    CPPUNIT_TEST(testTdf95650);
+#endif
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -77,6 +83,26 @@ void VclComplexTextTest::testArabic()
 #endif
 }
 
+#if defined(WNT)
+void VclComplexTextTest::testTdf95650()
+{
+    const sal_Unicode pTxt[] = {
+        0x0131, 0x0302, 0x0504, 0x4E44, 0x3031, 0x3030, 0x3531, 0x2D30,
+        0x3037, 0x0706, 0x0908, 0x0B0A, 0x0D0C, 0x0F0E, 0x072E, 0x100A,
+        0x0D11, 0x1312, 0x0105, 0x020A, 0x0512, 0x1403, 0x030C, 0x1528,
+        0x2931, 0x632E, 0x7074, 0x0D20, 0x0E0A, 0x100A, 0xF00D, 0x0D20,
+        0x030A, 0x0C0B, 0x20E0, 0x0A0D
+    };
+    OUString aTxt(pTxt, SAL_N_ELEMENTS(pTxt) - 1);
+    VclPtr<vcl::Window> pWin = 
VclPtr<WorkWindow>::Create(static_cast<vcl::Window *>(nullptr));
+    CPPUNIT_ASSERT(pWin);
+
+    OutputDevice *pOutDev = static_cast< OutputDevice * >(pWin.get());
+    // Check that the following executes without failing assertion
+    pOutDev->ImplLayout(aTxt, 9, 1, Point(), 0, 0, SalLayoutFlags::BiDiRtl, 
nullptr);
+}
+#endif
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclComplexTextTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 34bde4f..0dfce84 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -967,8 +967,8 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
             if (rArgs.mnMinCharPos >= rVisualItem.mnEndCharPos)
             {   // fdo#47553 adjust "guessed" min (maybe up to -8 off) to
                 // actual min so it can be used properly in GetNextGlyphs
-                assert(mnSubStringMin <= rVisualItem.mnEndCharPos);
-                mnSubStringMin = rVisualItem.mnEndCharPos;
+                if (mnSubStringMin < rVisualItem.mnEndCharPos)
+                    mnSubStringMin = rVisualItem.mnEndCharPos;
             }
             continue;
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to