Clinton Stimpson : usp10: Add tests and fix for ScriptXtoCP .
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 12 14:29:53 CST 2006
Module: wine
Branch: master
Commit: 39a5b0760c49c5d03bab99320f70927782fd0192
URL: http://source.winehq.org/git/wine.git/?a=commit;h=39a5b0760c49c5d03bab99320f70927782fd0192
Author: Clinton Stimpson <cjstimpson at utwire.net>
Date: Mon Dec 11 22:23:53 2006 -0700
usp10: Add tests and fix for ScriptXtoCP .
---
dlls/usp10/tests/usp10.c | 19 +++++++++++++++++++
dlls/usp10/usp10.c | 7 ++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 45988d6..c6ffd8a 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -574,6 +574,25 @@ static void test_ScriptXtoX(void)
ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);
ok(piCP == 4, "iX=%d should return piCP=4 not %d\n", iX, piCP);
+ iX = 0;
+ cChars = 10;
+ cGlyphs = 10;
+ hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);
+ ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);
+ ok(piCP == 0, "iX=%d should return piCP=0 not %d\n", iX, piCP);
+ iX = 195;
+ cChars = 10;
+ cGlyphs = 10;
+ hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);
+ ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);
+ ok(piCP == 0, "iX=%d should return piCP=0 not %d\n", iX, piCP);
+ iX = 196;
+ cChars = 10;
+ cGlyphs = 10;
+ hr = ScriptXtoCP(iX, cChars, cGlyphs, pwLogClust, psva, piAdvance, &psa, &piCP, &piTrailing);
+ ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);
+ ok(piCP == 1, "iX=%d should return piCP=1 not %d\n", iX, piCP);
+
iCP=5;
fTrailing = FALSE;
cChars = 10;
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 9fd6c1e..5f88138 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -561,7 +561,7 @@ HRESULT WINAPI ScriptXtoCP(int iX,
int *piTrailing)
{
int item;
- int iPosX = 1;
+ int iPosX;
float fMaxPosX = 1;
float fAvePosX;
TRACE("(%d,%d,%d,%p,%p,%p,%p,%p,%p)\n",
@@ -585,8 +585,9 @@ HRESULT WINAPI ScriptXtoCP(int iX,
}
fAvePosX = fMaxPosX / cGlyphs;
- for (item = 0; item < cGlyphs && iPosX < iX; item++)
- iPosX = fAvePosX * (item +1);
+ iPosX = fAvePosX;
+ for (item = 1; item < cGlyphs && iPosX < iX; item++)
+ iPosX += fAvePosX;
if (iPosX - iX > fAvePosX/2)
*piTrailing = 0;
else
More information about the wine-cvs
mailing list