gdi32: Upper 24 bits of a character range must be same.
authorKusanagi Kouichi <slash@ac.auone-net.jp>
Tue, 1 Feb 2011 16:37:09 +0000 (01:37 +0900)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 1 Feb 2011 17:14:09 +0000 (18:14 +0100)
dlls/gdi32/font.c
dlls/gdi32/tests/font.c

index 3df3d0bf1b2ef3e98e70e95d36fdc66ae989e142..6f1f867a418024fc408cc98d08ff45f8d08620af 100644 (file)
@@ -1571,6 +1571,8 @@ static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, PINT
     case 1361:
         if (lastChar > 0xffff)
             return NULL;
+        if ((firstChar ^ lastChar) > 0xff)
+            return NULL;
         break;
     default:
         if (lastChar > 0xff)
index 538e983ccc7e0980a69e5031f22c8a607db1bbe0..01411ffa49d383b7c477e5f3e0efc3174583805b 100644 (file)
@@ -921,19 +921,37 @@ static void test_GetCharABCWidths(void)
     WORD glyphs[1];
     DWORD nb;
     static const struct
+    {
+        UINT first;
+        UINT last;
+    } range[] =
+    {
+        {0xff, 0xff},
+        {0x100, 0x100},
+        {0xff, 0x100},
+        {0x1ff, 0xff00},
+        {0xffff, 0xffff},
+        {0x10000, 0x10000},
+        {0xffff, 0x10000},
+        {0xffffff, 0xffffff},
+        {0x1000000, 0x1000000},
+        {0xffffff, 0x1000000},
+        {0xffffffff, 0xffffffff}
+    };
+    static const struct
     {
         UINT cs;
         UINT a;
         UINT w;
-        BOOL r[10];
+        BOOL r[sizeof range / sizeof range[0]];
     } c[] =
     {
         {ANSI_CHARSET, 0x30, 0x30, {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
-        {SHIFTJIS_CHARSET, 0x82a0, 0x3042, {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
-        {HANGEUL_CHARSET, 0x8141, 0xac02, {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
-        {JOHAB_CHARSET, 0x8446, 0x3135, {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
-        {GB2312_CHARSET, 0x8141, 0x4e04, {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
-        {CHINESEBIG5_CHARSET, 0xa142, 0x3001, {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}}
+        {SHIFTJIS_CHARSET, 0x82a0, 0x3042, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {HANGEUL_CHARSET, 0x8141, 0xac02, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {JOHAB_CHARSET, 0x8446, 0x3135, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {GB2312_CHARSET, 0x8141, 0x4e04, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {CHINESEBIG5_CHARSET, 0xa142, 0x3001, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}}
     };
     UINT i;
 
@@ -979,7 +997,7 @@ static void test_GetCharABCWidths(void)
     {
         ABC a[2], w[2];
         ABC full[256];
-        UINT code = 0x41;
+        UINT code = 0x41, j;
 
         lf.lfFaceName[0] = '\0';
         lf.lfCharSet = c[i].cs;
@@ -1007,35 +1025,12 @@ static void test_GetCharABCWidths(void)
         ok(memcmp(&a[0], &full[code], sizeof(ABC)) == 0,
            "GetCharABCWidthsA info should match. codepage = %u\n", c[i].cs);
 
-        ret = pGetCharABCWidthsA(hdc, 0xff, 0xff, abc);
-        ok(ret == c[i].r[0], "GetCharABCWidthsA should have %s\n", c[i].r[0] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0x100, 0x100, abc);
-        ok(ret == c[i].r[1], "GetCharABCWidthsA should have %s\n", c[i].r[1] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0xff, 0x100, a);
-        ok(ret == c[i].r[2], "GetCharABCWidthsA should have %s\n", c[i].r[2] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0xffff, 0xffff, abc);
-        ok(ret == c[i].r[3], "GetCharABCWidthsA should have %s\n", c[i].r[3] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0x10000, 0x10000, abc);
-        ok(ret == c[i].r[4], "GetCharABCWidthsA should have %s\n", c[i].r[4] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0xffff, 0x10000, a);
-        ok(ret == c[i].r[5], "GetCharABCWidthsA should have %s\n", c[i].r[5] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0xffffff, 0xffffff, abc);
-        ok(ret == c[i].r[6], "GetCharABCWidthsA should have %s\n", c[i].r[6] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0x1000000, 0x1000000, abc);
-        ok(ret == c[i].r[7], "GetCharABCWidthsA should have %s\n", c[i].r[7] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0xffffff, 0x1000000, a);
-        ok(ret == c[i].r[8], "GetCharABCWidthsA should have %s\n", c[i].r[8] ? "succeeded" : "failed");
-
-        ret = pGetCharABCWidthsA(hdc, 0xffffffff, 0xffffffff, abc);
-        ok(ret == c[i].r[9], "GetCharABCWidthsA should have %s\n", c[i].r[9] ? "succeeded" : "failed");
+        for (j = 0; j < sizeof range / sizeof range[0]; ++j)
+        {
+            ret = pGetCharABCWidthsA(hdc, range[j].first, range[j].last, full);
+            ok(ret == c[i].r[j], "GetCharABCWidthsA %x - %x should have %s\n",
+               range[j].first, range[j].last, c[i].r[j] ? "succeeded" : "failed");
+        }
 
         hfont = SelectObject(hdc, hfont);
         DeleteObject(hfont);