Hans Leidekker : usp10: Make tests pass on Win7. Conform to the more recent behavior.

Alexandre Julliard julliard at winehq.org
Tue Sep 8 08:53:57 CDT 2009


Module: wine
Branch: master
Commit: f7a4936fc4a6f4f9a5120579aed9a923582160e3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f7a4936fc4a6f4f9a5120579aed9a923582160e3

Author: Hans Leidekker <hans at meelstraat.net>
Date:   Thu Sep  3 14:50:17 2009 +0200

usp10: Make tests pass on Win7. Conform to the more recent behavior.

---

 dlls/usp10/tests/usp10.c |   32 ++++++++++++++++++++------------
 dlls/usp10/usp10.c       |    7 +++++--
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 1eefee0..9a4c3c6 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -67,9 +67,10 @@ static void test_ScriptShape(HDC hdc)
     ok(hr == E_PENDING, "ScriptShape should return E_PENDING not %08x\n", hr);
 
     hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, NULL, attrs, &nb);
-    ok(!hr ||
-       hr == E_INVALIDARG, /* Vista, W2K8 */
-       "ScriptShape should return S_OK or E_INVALIDARG, not %08x\n", hr);
+    ok(broken(hr == S_OK) ||
+       hr == E_INVALIDARG || /* Vista, W2K8 */
+       hr == E_FAIL, /* WIN7 */
+       "ScriptShape should return E_FAIL or E_INVALIDARG, not %08x\n", hr);
     ok(items[0].a.fNoGlyphIndex == FALSE, "fNoGlyphIndex TRUE\n");
 
     hr = ScriptShape(hdc, &sc, test1, 4, 4, &items[0].a, glyphs, logclust, attrs, &nb);
@@ -83,17 +84,19 @@ static void test_ScriptShape(HDC hdc)
     ok(hr == E_INVALIDARG, "ScriptPlace should return E_INVALIDARG not %08x\n", hr);
 
     hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, NULL, NULL);
-    ok(hr == E_PENDING ||
-       hr == E_INVALIDARG, /* Vista, W2K8 */
-       "ScriptPlace should return E_PENDING or E_INVALIDARG, not %08x\n", hr);
+    ok(broken(hr == E_PENDING) ||
+       hr == E_INVALIDARG || /* Vista, W2K8 */
+       hr == E_FAIL, /* WIN7 */
+       "ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr);
 
     hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL);
     ok(hr == E_PENDING, "ScriptPlace should return E_PENDING not %08x\n", hr);
 
     hr = ScriptPlace(NULL, &sc, glyphs, 4, attrs, &items[0].a, widths, NULL, abc);
-    ok(hr == E_PENDING ||
-       hr == E_INVALIDARG, /* Vista, W2K8 */
-       "ScriptPlace should return E_PENDING or E_INVALIDARG, not %08x\n", hr);
+    ok(broken(hr == E_PENDING) ||
+       hr == E_INVALIDARG || /* Vista, W2K8 */
+       hr == E_FAIL, /* WIN7 */
+       "ScriptPlace should return E_FAIL or E_INVALIDARG, not %08x\n", hr);
 
     hr = ScriptPlace(hdc, &sc, glyphs, 4, attrs, &items[0].a, widths, offset, NULL);
     ok(!hr, "ScriptPlace should return S_OK not %08x\n", hr);
@@ -339,14 +342,14 @@ static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
 
     /* Set psc to NULL, to be able to check if a pointer is returned in psc */
     psc = NULL;
-    hr = ScriptGetCMap(NULL, &psc, NULL, 0, 0, NULL);
-    ok( hr == E_PENDING, "(NULL,&psc,NULL,0,0NULL), expected E_PENDING, "
+    hr = ScriptGetCMap(NULL, &psc, TestItem1, cInChars, 0, pwOutGlyphs3);
+    ok( hr == E_PENDING, "(NULL,&psc,NULL,0,0,NULL), expected E_PENDING, "
                          "got %08x\n", hr);
     ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc);
 
     /* Set psc to NULL but add hdc, to be able to check if a pointer is returned in psc */
     psc = NULL;
-    hr = ScriptGetCMap(hdc, &psc, NULL, 0, 0, NULL);
+    hr = ScriptGetCMap(hdc, &psc, TestItem1, cInChars, 0, pwOutGlyphs3);
     ok( hr == S_OK, "ScriptGetCMap(NULL,&psc,NULL,0,0,NULL), expected S_OK, "
                     "got %08x\n", hr);
     ok( psc != NULL, "ScritpGetCMap expected psc to be not NULL\n");
@@ -1058,6 +1061,11 @@ static void test_ScriptGetGlyphABCWidth(HDC hdc)
     ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
 
     hr = ScriptGetGlyphABCWidth(NULL, &sc, 'a', NULL);
+    ok(broken(hr == E_PENDING) ||
+       hr == E_INVALIDARG, /* WIN7 */
+       "expected E_INVALIDARG, got 0x%08x\n", hr);
+
+    hr = ScriptGetGlyphABCWidth(NULL, &sc, 'a', &abc);
     ok(hr == E_PENDING, "expected E_PENDING, got 0x%08x\n", hr);
 
     if (0) {    /* crashes on WinXP */
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 21c74e8..e1c79e6 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -1298,6 +1298,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars,
 
     *pcGlyphs = cChars;
     if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
+    if (!pwLogClust) return E_FAIL;
 
     if ((get_cache_pitch_family(psc) & TMPF_TRUETYPE) && !psa->fNoGlyphIndex)
     {
@@ -1329,7 +1330,7 @@ HRESULT WINAPI ScriptShape(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars,
         psva[i].fReserved      = 0;
         psva[i].fShapeReserved = 0;
 
-        if (pwLogClust) pwLogClust[i] = i;
+        pwLogClust[i] = i;
     }
     return S_OK;
 }
@@ -1366,6 +1367,7 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
 
     if (!psva) return E_INVALIDARG;
     if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
+    if (!pGoffset) return E_FAIL;
 
     if (pABC) memset(pABC, 0, sizeof(ABC));
     for (i = 0; i < cGlyphs; i++)
@@ -1394,7 +1396,7 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
             pABC->abcC += abc.abcC;
         }
         /* FIXME: set to more reasonable values */
-        if (pGoffset)  pGoffset[i].du = pGoffset[i].dv = 0;
+        pGoffset[i].du = pGoffset[i].dv = 0;
         if (piAdvance) piAdvance[i] = abc.abcA + abc.abcB + abc.abcC;
     }
 
@@ -1527,6 +1529,7 @@ HRESULT WINAPI ScriptGetGlyphABCWidth(HDC hdc, SCRIPT_CACHE *psc, WORD glyph, AB
 
     TRACE("(%p, %p, 0x%04x, %p)\n", hdc, psc, glyph, abc);
 
+    if (!abc) return E_INVALIDARG;
     if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
 
     if (!get_cache_glyph_widths(psc, glyph, abc))




More information about the wine-cvs mailing list