usp10: Improve handling of whitespace in ScriptBreak.
This commit is contained in:
parent
36bd62c012
commit
020456f71b
|
@ -1382,6 +1382,50 @@ static void test_ScriptGetProperties(void)
|
|||
ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
static void test_ScriptBreak(void)
|
||||
{
|
||||
static const WCHAR test[] = {' ','\r','\n',0};
|
||||
SCRIPT_ITEM items[4];
|
||||
SCRIPT_LOGATTR la;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL);
|
||||
ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
|
||||
|
||||
memset(&la, 0, sizeof(la));
|
||||
hr = ScriptBreak(test, 1, &items[0].a, &la);
|
||||
ok(!hr, "ScriptBreak should return S_OK not %08x\n", hr);
|
||||
|
||||
ok(!la.fSoftBreak, "fSoftBreak set\n");
|
||||
ok(la.fWhiteSpace, "fWhiteSpace not set\n");
|
||||
ok(la.fCharStop, "fCharStop not set\n");
|
||||
ok(!la.fWordStop, "fWordStop set\n");
|
||||
ok(!la.fInvalid, "fInvalid set\n");
|
||||
ok(!la.fReserved, "fReserved set\n");
|
||||
|
||||
memset(&la, 0, sizeof(la));
|
||||
hr = ScriptBreak(test + 1, 1, &items[1].a, &la);
|
||||
ok(!hr, "ScriptBreak should return S_OK not %08x\n", hr);
|
||||
|
||||
ok(!la.fSoftBreak, "fSoftBreak set\n");
|
||||
ok(!la.fWhiteSpace, "fWhiteSpace set\n");
|
||||
ok(la.fCharStop, "fCharStop not set\n");
|
||||
ok(!la.fWordStop, "fWordStop set\n");
|
||||
ok(!la.fInvalid, "fInvalid set\n");
|
||||
ok(!la.fReserved, "fReserved set\n");
|
||||
|
||||
memset(&la, 0, sizeof(la));
|
||||
hr = ScriptBreak(test + 2, 1, &items[2].a, &la);
|
||||
ok(!hr, "ScriptBreak should return S_OK not %08x\n", hr);
|
||||
|
||||
ok(!la.fSoftBreak, "fSoftBreak set\n");
|
||||
ok(!la.fWhiteSpace, "fWhiteSpace set\n");
|
||||
ok(la.fCharStop, "fCharStop not set\n");
|
||||
ok(!la.fWordStop, "fWordStop set\n");
|
||||
ok(!la.fInvalid, "fInvalid set\n");
|
||||
ok(!la.fReserved, "fReserved set\n");
|
||||
}
|
||||
|
||||
START_TEST(usp10)
|
||||
{
|
||||
HWND hwnd;
|
||||
|
@ -1426,6 +1470,7 @@ START_TEST(usp10)
|
|||
test_ScriptLayout();
|
||||
test_digit_substitution();
|
||||
test_ScriptGetProperties();
|
||||
test_ScriptBreak();
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
DestroyWindow(hwnd);
|
||||
|
|
|
@ -1041,8 +1041,14 @@ HRESULT WINAPI ScriptBreak(const WCHAR *chars, int count, const SCRIPT_ANALYSIS
|
|||
memset(&la[i], 0, sizeof(SCRIPT_LOGATTR));
|
||||
|
||||
/* FIXME: set the other flags */
|
||||
la[i].fWhiteSpace = isspaceW(chars[i]);
|
||||
la[i].fWhiteSpace = (chars[i] == ' ');
|
||||
la[i].fCharStop = 1;
|
||||
|
||||
if (i > 0 && la[i - 1].fWhiteSpace)
|
||||
{
|
||||
la[i].fSoftBreak = 1;
|
||||
la[i].fWordStop = 1;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue