usp10: Add tests and fix for ScriptXtoCP .
This commit is contained in:
parent
aa8392c9e7
commit
39a5b0760c
|
@ -574,6 +574,25 @@ static void test_ScriptXtoX(void)
|
||||||
ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);
|
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);
|
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;
|
iCP=5;
|
||||||
fTrailing = FALSE;
|
fTrailing = FALSE;
|
||||||
cChars = 10;
|
cChars = 10;
|
||||||
|
|
|
@ -561,7 +561,7 @@ HRESULT WINAPI ScriptXtoCP(int iX,
|
||||||
int *piTrailing)
|
int *piTrailing)
|
||||||
{
|
{
|
||||||
int item;
|
int item;
|
||||||
int iPosX = 1;
|
int iPosX;
|
||||||
float fMaxPosX = 1;
|
float fMaxPosX = 1;
|
||||||
float fAvePosX;
|
float fAvePosX;
|
||||||
TRACE("(%d,%d,%d,%p,%p,%p,%p,%p,%p)\n",
|
TRACE("(%d,%d,%d,%p,%p,%p,%p,%p,%p)\n",
|
||||||
|
@ -585,8 +585,9 @@ HRESULT WINAPI ScriptXtoCP(int iX,
|
||||||
}
|
}
|
||||||
|
|
||||||
fAvePosX = fMaxPosX / cGlyphs;
|
fAvePosX = fMaxPosX / cGlyphs;
|
||||||
for (item = 0; item < cGlyphs && iPosX < iX; item++)
|
iPosX = fAvePosX;
|
||||||
iPosX = fAvePosX * (item +1);
|
for (item = 1; item < cGlyphs && iPosX < iX; item++)
|
||||||
|
iPosX += fAvePosX;
|
||||||
if (iPosX - iX > fAvePosX/2)
|
if (iPosX - iX > fAvePosX/2)
|
||||||
*piTrailing = 0;
|
*piTrailing = 0;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue