summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-11-07 18:45:31 +1000
committerMichael Stahl <mstahl@redhat.com>2015-11-10 10:54:18 +0000
commitf4a4bbce92fe753678b218c265f7180c306ddf73 (patch)
tree9b3fdf67b515a412baaebb7c3a96f7a99028e5ec
parenta415a66f1af0944cac631bfd6b75c3d569e6f1df (diff)
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 <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--vcl/qa/cppunit/complextext.cxx26
-rw-r--r--vcl/win/source/gdi/winlayout.cxx4
2 files changed, 28 insertions, 2 deletions
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a7c4e034ce68..31717ccdd12e 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 34bde4fc5ba6..0dfce848c3d2 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;
}