Hans Leidekker : usp10: Improve handling of whitespace in ScriptBreak.
Alexandre Julliard
julliard at winehq.org
Tue Jan 6 08:23:20 CST 2009
Module: wine
Branch: master
Commit: 020456f71b61c8d4868ca63ac5820611b3ef07d3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=020456f71b61c8d4868ca63ac5820611b3ef07d3
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Jan 6 11:20:26 2009 +0100
usp10: Improve handling of whitespace in ScriptBreak.
---
dlls/usp10/tests/usp10.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
dlls/usp10/usp10.c | 8 +++++++-
2 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index c63c6c8..429f51c 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -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);
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 4af14ae..fb920ca 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -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;
}
More information about the wine-cvs
mailing list