Kaydet (Commit) f4a4bbce authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Michael Stahl

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/19835Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst a415a66f
...@@ -22,9 +22,15 @@ public: ...@@ -22,9 +22,15 @@ public:
/// Play with font measuring etc. /// Play with font measuring etc.
void testArabic(); void testArabic();
#if defined(WNT)
void testTdf95650(); // Windows-only issue
#endif
CPPUNIT_TEST_SUITE(VclComplexTextTest); CPPUNIT_TEST_SUITE(VclComplexTextTest);
CPPUNIT_TEST(testArabic); CPPUNIT_TEST(testArabic);
#if defined(WNT)
CPPUNIT_TEST(testTdf95650);
#endif
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -77,6 +83,26 @@ void VclComplexTextTest::testArabic() ...@@ -77,6 +83,26 @@ void VclComplexTextTest::testArabic()
#endif #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_TEST_SUITE_REGISTRATION(VclComplexTextTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -967,8 +967,8 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) ...@@ -967,8 +967,8 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
if (rArgs.mnMinCharPos >= rVisualItem.mnEndCharPos) if (rArgs.mnMinCharPos >= rVisualItem.mnEndCharPos)
{ // fdo#47553 adjust "guessed" min (maybe up to -8 off) to { // fdo#47553 adjust "guessed" min (maybe up to -8 off) to
// actual min so it can be used properly in GetNextGlyphs // actual min so it can be used properly in GetNextGlyphs
assert(mnSubStringMin <= rVisualItem.mnEndCharPos); if (mnSubStringMin < rVisualItem.mnEndCharPos)
mnSubStringMin = rVisualItem.mnEndCharPos; mnSubStringMin = rVisualItem.mnEndCharPos;
} }
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment