[GDI32_WINETEST] Sync with Wine Staging 1.9.4. CORE-10912
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 8 Mar 2016 15:01:05 +0000 (15:01 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 8 Mar 2016 15:01:05 +0000 (15:01 +0000)
svn path=/trunk/; revision=70971

rostests/winetests/gdi32/dc.c
rostests/winetests/gdi32/dib.c
rostests/winetests/gdi32/font.c
rostests/winetests/gdi32/icm.c
rostests/winetests/gdi32/metafile.c
rostests/winetests/gdi32/path.c

index d215d9c..09c05c1 100644 (file)
@@ -424,9 +424,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
         else
             ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %d), error %u\n", descr, GetObjectType( hdc ), GetLastError() );
         type = GetClipBox( hdc, &rect );
-        if (GetObjectType( hdc ) == OBJ_ENHMETADC)
-            todo_wine ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
-        else
+        todo_wine_if (GetObjectType( hdc ) == OBJ_ENHMETADC)
             ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
 
         type = GetBoundsRect( hdc, &rect, 0 );
@@ -443,12 +441,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
         SetMapMode( hdc, MM_TEXT );
         Rectangle( hdc, 2, 2, 4, 4 );
         type = GetBoundsRect( hdc, &rect, DCB_RESET );
-        if (GetObjectType( hdc ) == OBJ_ENHMETADC || (GetObjectType( hdc ) == OBJ_DC && GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER))
-            todo_wine
-            ok( rect.left == 2 && rect.top == 2 && rect.right == 4 && rect.bottom == 4 && type == DCB_SET,
-                "GetBoundsRect returned %d,%d,%d,%d type %x for %s\n",
-                rect.left, rect.top, rect.right, rect.bottom, type, descr );
-        else
+        todo_wine_if (GetObjectType( hdc ) == OBJ_ENHMETADC || (GetObjectType( hdc ) == OBJ_DC && GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER))
             ok( rect.left == 2 && rect.top == 2 && rect.right == 4 && rect.bottom == 4 && type == DCB_SET,
                 "GetBoundsRect returned %d,%d,%d,%d type %x for %s\n",
                 rect.left, rect.top, rect.right, rect.bottom, type, descr );
@@ -462,20 +455,12 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
         ok( type == SIMPLEREGION, "GetClipBox returned %d on %s\n", type, descr );
         if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY)
         {
-            if (GetSystemMetrics( SM_CXSCREEN ) != GetSystemMetrics( SM_CXVIRTUALSCREEN ))
-                todo_wine ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetSystemMetrics( SM_CXSCREEN ),
-                              "Got DESKTOPHORZRES %d on %s, expected %d\n",
-                              GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetSystemMetrics( SM_CXSCREEN ) );
-            else
+            todo_wine_if (GetSystemMetrics( SM_CXSCREEN ) != GetSystemMetrics( SM_CXVIRTUALSCREEN ))
                 ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetSystemMetrics( SM_CXSCREEN ),
                     "Got DESKTOPHORZRES %d on %s, expected %d\n",
                     GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetSystemMetrics( SM_CXSCREEN ) );
 
-            if (GetSystemMetrics( SM_CYSCREEN ) != GetSystemMetrics( SM_CYVIRTUALSCREEN ))
-                todo_wine ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetSystemMetrics( SM_CYSCREEN ),
-                              "Got DESKTOPVERTRES %d on %s, expected %d\n",
-                              GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetSystemMetrics( SM_CYSCREEN ) );
-            else
+            todo_wine_if (GetSystemMetrics( SM_CYSCREEN ) != GetSystemMetrics( SM_CYVIRTUALSCREEN ))
                 ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetSystemMetrics( SM_CYSCREEN ),
                     "Got DESKTOPVERTRES %d on %s, expected %d\n",
                     GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetSystemMetrics( SM_CYSCREEN ) );
@@ -490,11 +475,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
                      GetDeviceCaps( ref_dc, DESKTOPVERTRES ) );
         }
 
-        if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY && GetObjectType( hdc ) != OBJ_ENHMETADC &&
+        todo_wine_if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY && GetObjectType( hdc ) != OBJ_ENHMETADC &&
             (GetSystemMetrics( SM_XVIRTUALSCREEN ) || GetSystemMetrics( SM_YVIRTUALSCREEN )))
-            todo_wine ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %d,%d,%d,%d on %s\n",
-                          rect.left, rect.top, rect.right, rect.bottom, descr );
-        else
             ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %d,%d,%d,%d on %s\n",
                 rect.left, rect.top, rect.right, rect.bottom, descr );
     }
@@ -630,11 +612,13 @@ static void test_CreateCompatibleDC(void)
 
 static void test_DC_bitmap(void)
 {
+    PIXELFORMATDESCRIPTOR descr;
     HDC hdc, hdcmem;
     DWORD bits[64];
     HBITMAP hbmp, oldhbmp;
     COLORREF col;
     int i, bitspixel;
+    int ret, ret2;
 
     /* fill bitmap data with b&w pattern */
     for( i = 0; i < 64; i++) bits[i] = i & 1 ? 0 : 0xffffff;
@@ -645,7 +629,31 @@ static void test_DC_bitmap(void)
     /* create a memory dc */
     hdcmem = CreateCompatibleDC( hdc);
     ok( hdcmem != NULL, "CreateCompatibleDC rets %p\n", hdcmem);
-    /* tests */
+
+    /* test DescribePixelFormat with descr == NULL */
+    ret2 = DescribePixelFormat(hdcmem, 0, sizeof(descr), NULL);
+    ok(ret2 > 0, "expected ret2 > 0, got %d\n", ret2);
+    ret = DescribePixelFormat(hdcmem, 1, sizeof(descr), NULL);
+    ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
+    ret = DescribePixelFormat(hdcmem, 0x10000, sizeof(descr), NULL);
+    ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
+
+    /* test DescribePixelFormat with descr != NULL */
+    memset(&descr, 0, sizeof(descr));
+    ret = DescribePixelFormat(hdcmem, 0, sizeof(descr), &descr);
+    ok(ret == 0, "expected ret == 0, got %d\n", ret);
+    ok(descr.nSize == 0, "expected descr.nSize == 0, got %d\n", descr.nSize);
+
+    memset(&descr, 0, sizeof(descr));
+    ret = DescribePixelFormat(hdcmem, 1, sizeof(descr), &descr);
+    ok(ret == ret2, "expected ret == %d, got %d\n", ret2, ret);
+    ok(descr.nSize == sizeof(descr), "expected desc.nSize == sizeof(descr), got %d\n", descr.nSize);
+
+    memset(&descr, 0, sizeof(descr));
+    ret = DescribePixelFormat(hdcmem, 0x10000, sizeof(descr), &descr);
+    ok(ret == 0, "expected ret == 0, got %d\n", ret);
+    ok(descr.nSize == 0, "expected descr.nSize == 0, got %d\n", descr.nSize);
+
     /* test monochrome bitmap: should always work */
     hbmp = CreateBitmap(32, 32, 1, 1, bits);
     ok( hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
index b090415..c6cb44c 100644 (file)
@@ -1322,10 +1322,7 @@ static void compare_hash_broken_todo(HDC hdc, const BITMAPINFO *bmi, BYTE *bits,
     for(i = 1; i <= num_broken; i++)
         ok_cond = ok_cond || broken( !strcmp(hash, current_sha1[i]) );
 
-    if(todo)
-        todo_wine ok( ok_cond, "%s: %s: expected hash %s got %s\n",
-                      dst_format, info, *current_sha1, hash );
-    else
+    todo_wine_if(todo)
         ok( ok_cond, "%s: %s: expected hash %s got %s\n",
             dst_format, info, *current_sha1, hash );
 
index 6eefc3b..a1917b4 100644 (file)
@@ -926,7 +926,7 @@ static void test_bitmap_font_metrics(void)
     trace("ACP %d -> charset %d\n", GetACP(), expected_cs);
 
     hdc = CreateCompatibleDC(0);
-    assert(hdc);
+    ok(hdc != NULL, "failed to create hdc\n");
 
     trace("logpixelsX %d, logpixelsY %d\n", GetDeviceCaps(hdc, LOGPIXELSX),
           GetDeviceCaps(hdc, LOGPIXELSY));
@@ -974,9 +974,7 @@ static void test_bitmap_font_metrics(void)
             {
                 if (font_res == fd[i].dpi && lf.lfCharSet == expected_cs)
                 {
-                    if (ret) /* FIXME: Remove once Wine is fixed */
-                        todo_wine ok(!ret, "%s height %d charset %d dpi %d should be enumerated\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
-                    else
+                    todo_wine_if (ret) /* FIXME: Remove once Wine is fixed */
                         ok(!ret, "%s height %d charset %d dpi %d should be enumerated\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
                 }
             }
@@ -1136,26 +1134,26 @@ static void ABCWidths_helper(const char* description, HDC hdc, WORD *glyphs, ABC
     ret = pGetCharABCWidthsI(hdc, 0, 1, glyphs, abc);
     ok(ret, "%s: GetCharABCWidthsI should have succeeded\n", description);
     ok ((INT)abc->abcB > 0, "%s: abcB should be positive\n", description);
-    if (todo) todo_wine ok(abc->abcA * base_abci->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
-    else ok(abc->abcA * base_abci->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
-    if (todo) todo_wine ok(abc->abcC * base_abci->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
-    else ok(abc->abcC * base_abci->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
+    todo_wine_if (todo)
+        ok(abc->abcA * base_abci->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
+    todo_wine_if (todo)
+        ok(abc->abcC * base_abci->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
 
     ret = pGetCharABCWidthsW(hdc, 'i', 'i', abc);
     ok(ret, "%s: GetCharABCWidthsW should have succeeded\n", description);
     ok ((INT)abc->abcB > 0, "%s: abcB should be positive\n", description);
-    if (todo) todo_wine ok(abc->abcA * base_abcw->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
-    else ok(abc->abcA * base_abcw->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
-    if (todo) todo_wine ok(abc->abcC * base_abcw->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
-    else ok(abc->abcC * base_abcw->abcC >= 0, "%s: abcC's should be unchanged\n", description);
+    todo_wine_if (todo)
+        ok(abc->abcA * base_abcw->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
+    todo_wine_if (todo)
+        ok(abc->abcC * base_abcw->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
 
     ret = pGetCharABCWidthsFloatW(hdc, 'i', 'i', abcf);
     ok(ret, "%s: GetCharABCWidthsFloatW should have succeeded\n", description);
     ok (abcf->abcfB > 0.0, "%s: abcfB should be positive\n", description);
-    if (todo) todo_wine ok(abcf->abcfA * base_abcf->abcfA >= 0.0, "%s: abcfA's sign should be unchanged\n", description);
-    else ok(abcf->abcfA * base_abcf->abcfA >= 0.0, "%s: abcfA's should be unchanged\n", description);
-    if (todo) todo_wine ok(abcf->abcfC * base_abcf->abcfC >= 0.0, "%s: abcfC's sign should be unchanged\n", description);
-    else ok(abcf->abcfC * base_abcf->abcfC >= 0.0, "%s: abcfC's sign should be unchanged\n", description);
+    todo_wine_if (todo)
+        ok(abcf->abcfA * base_abcf->abcfA >= 0.0, "%s: abcfA's sign should be unchanged\n", description);
+    todo_wine_if (todo)
+        ok(abcf->abcfC * base_abcf->abcfC >= 0.0, "%s: abcfC's sign should be unchanged\n", description);
 }
 
 static void test_GetCharABCWidths(void)
@@ -1410,6 +1408,7 @@ static void test_GetCharABCWidths(void)
 static void test_text_extents(void)
 {
     static const WCHAR wt[] = {'O','n','e','\n','t','w','o',' ','3',0};
+    static const WCHAR emptyW[] = {0};
     LPINT extents;
     INT i, len, fit1, fit2, extents2[3];
     LOGFONTA lf;
@@ -1428,9 +1427,20 @@ static void test_text_extents(void)
     hdc = GetDC(0);
     hfont = SelectObject(hdc, hfont);
     GetTextMetricsA(hdc, &tm);
-    GetTextExtentPointA(hdc, "o", 1, &sz);
+    ret = GetTextExtentPointA(hdc, "o", 1, &sz);
+    ok(ret, "got %d\n", ret);
     ok(sz.cy == tm.tmHeight, "cy %d tmHeight %d\n", sz.cy, tm.tmHeight);
 
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointA(hdc, "o", 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointA(hdc, "", 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
     SetLastError(0xdeadbeef);
     GetTextExtentExPointW(hdc, wt, 1, 1, &fit1, &fit2, &sz1);
     if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
@@ -1442,6 +1452,16 @@ static void test_text_extents(void)
         return;
     }
 
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointW(hdc, wt, 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointW(hdc, emptyW, 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
     len = lstrlenW(wt);
     extents = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof extents[0]);
     extents[0] = 1;         /* So that the increasing sequence test will fail
@@ -1724,7 +1744,7 @@ static void test_GetKerningPairs(void)
         strcpy(lf.lfFaceName, kd[i].face_name);
         lf.lfHeight = kd[i].height;
         hfont = CreateFontIndirectA(&lf);
-        assert(hfont != 0);
+        ok(hfont != NULL, "failed to create a font, name %s\n", kd[i].face_name);
 
         hfont_old = SelectObject(hdc, hfont);
 
@@ -1850,7 +1870,7 @@ static void test_height( HDC hdc, const struct font_data *fd )
         strcpy(lf.lfFaceName, fd[i].face_name);
 
         hfont = CreateFontIndirectA(&lf);
-        assert(hfont);
+        ok(hfont != NULL, "failed to create a font, name %s\n", fd[i].face_name);
 
         old_hfont = SelectObject(hdc, hfont);
         ret = GetTextMetricsA(hdc, &tm);
@@ -2076,7 +2096,7 @@ static void test_height_selection(void)
         {"", 0, 0, 0, 0, 0, 0, 0, 0, 0 }
     };
     HDC hdc = CreateCompatibleDC(0);
-    assert(hdc);
+    ok(hdc != NULL, "failed to create hdc\n");
 
     test_height( hdc, tahoma );
     test_height_selection_vdmx( hdc );
@@ -2084,6 +2104,34 @@ static void test_height_selection(void)
     DeleteDC(hdc);
 }
 
+static UINT get_font_fsselection(LOGFONTA *lf)
+{
+    OUTLINETEXTMETRICA *otm;
+    HFONT hfont, hfont_old;
+    DWORD ret, otm_size;
+    UINT fsSelection;
+    HDC hdc;
+
+    hdc = GetDC(0);
+    hfont = CreateFontIndirectA(lf);
+    ok(hfont != NULL, "failed to create a font\n");
+
+    hfont_old = SelectObject(hdc, hfont);
+
+    otm_size = GetOutlineTextMetricsA(hdc, 0, NULL);
+    otm = HeapAlloc(GetProcessHeap(), 0, otm_size);
+    otm->otmSize = sizeof(*otm);
+    ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
+    ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+    fsSelection = otm->otmfsSelection;
+    HeapFree(GetProcessHeap(), 0, otm);
+    SelectObject(hdc, hfont_old);
+    DeleteObject(hfont);
+    ReleaseDC(0, hdc);
+
+    return fsSelection;
+}
+
 static void test_GetOutlineTextMetrics(void)
 {
     OUTLINETEXTMETRICA *otm;
@@ -2092,6 +2140,38 @@ static void test_GetOutlineTextMetrics(void)
     HDC hdc;
     DWORD ret, otm_size;
     LPSTR unset_ptr;
+    UINT fsSelection;
+
+    /* check fsSelection field with bold simulation */
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "Wingdings");
+    lf.lfCharSet = SYMBOL_CHARSET;
+
+    /* regular face */
+    fsSelection = get_font_fsselection(&lf);
+    ok((fsSelection & (1 << 5)) == 0, "got 0x%x\n", fsSelection);
+
+    /* face with bold simulation */
+    lf.lfWeight = FW_BOLD;
+    fsSelection = get_font_fsselection(&lf);
+    ok((fsSelection & (1 << 5)) != 0, "got 0x%x\n", fsSelection);
+
+    /* check fsSelection field with oblique simulation */
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "Tahoma");
+    lf.lfHeight = -13;
+    lf.lfWeight = FW_NORMAL;
+    lf.lfPitchAndFamily = DEFAULT_PITCH;
+    lf.lfQuality = PROOF_QUALITY;
+
+    /* regular face */
+    fsSelection = get_font_fsselection(&lf);
+    ok((fsSelection & 1) == 0, "got 0x%x\n", fsSelection);
+
+    lf.lfItalic = 1;
+    /* face with oblique simulation */
+    fsSelection = get_font_fsselection(&lf);
+    ok((fsSelection & 1) == 1, "got 0x%x\n", fsSelection);
 
     if (!is_font_installed("Arial"))
     {
@@ -2108,7 +2188,7 @@ static void test_GetOutlineTextMetrics(void)
     lf.lfPitchAndFamily = DEFAULT_PITCH;
     lf.lfQuality = PROOF_QUALITY;
     hfont = CreateFontIndirectA(&lf);
-    assert(hfont != 0);
+    ok(hfont != NULL, "failed to create a font\n");
 
     hfont_old = SelectObject(hdc, hfont);
     otm_size = GetOutlineTextMetricsA(hdc, 0, NULL);
@@ -3782,11 +3862,7 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
         expect_default_A  = expect_default_W;
 
         /* Wine currently uses SYMBOL_CHARSET to identify whether the ANSI metrics need special handling */
-        if(cmap_type != cmap_ms_symbol && tmA.tmCharSet == SYMBOL_CHARSET && expect_first_A != 0x1e)
-            todo_wine ok(tmA.tmFirstChar == expect_first_A ||
-                         tmA.tmFirstChar == expect_first_A + 1 /* win9x */,
-                         "A: tmFirstChar for %s got %02x expected %02x\n", font_name, tmA.tmFirstChar, expect_first_A);
-        else
+        todo_wine_if(cmap_type != cmap_ms_symbol && tmA.tmCharSet == SYMBOL_CHARSET && expect_first_A != 0x1e)
             ok(tmA.tmFirstChar == expect_first_A ||
                tmA.tmFirstChar == expect_first_A + 1 /* win9x */,
                "A: tmFirstChar for %s got %02x expected %02x\n", font_name, tmA.tmFirstChar, expect_first_A);
@@ -3810,18 +3886,12 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
         if (ret)
         {
             /* Wine uses the os2 first char */
-            if(cmap_first != os2_first_char && cmap_type != cmap_ms_symbol)
-                todo_wine ok(tmW.tmFirstChar == expect_first_W, "W: tmFirstChar for %s got %02x expected %02x\n",
-                             font_name, tmW.tmFirstChar, expect_first_W);
-            else
+            todo_wine_if(cmap_first != os2_first_char && cmap_type != cmap_ms_symbol)
                 ok(tmW.tmFirstChar == expect_first_W, "W: tmFirstChar for %s got %02x expected %02x\n",
                    font_name, tmW.tmFirstChar, expect_first_W);
 
             /* Wine uses the os2 last char */
-            if(expect_last_W != os2_last_char && cmap_type != cmap_ms_symbol)
-                todo_wine ok(tmW.tmLastChar == expect_last_W, "W: tmLastChar for %s got %02x expected %02x\n",
-                             font_name, tmW.tmLastChar, expect_last_W);
-            else
+            todo_wine_if(expect_last_W != os2_last_char && cmap_type != cmap_ms_symbol)
                 ok(tmW.tmLastChar == expect_last_W, "W: tmLastChar for %s got %02x expected %02x\n",
                    font_name, tmW.tmLastChar, expect_last_W);
             ok(tmW.tmBreakChar == expect_break_W, "W: tmBreakChar for %s got %02x expected %02x\n",
@@ -6054,14 +6124,11 @@ static void test_stock_fonts(void)
             }
 
             /* FIXME: Remove once Wine is fixed */
-            if (td[i][j].dpi != 96 &&
+            todo_wine_if (td[i][j].dpi != 96 &&
                 /* MS Sans Serif for 120 dpi and higher should include 12 pixel bitmap set */
                 ((!strcmp(td[i][j].face_name, "MS Sans Serif") && td[i][j].height == 12) ||
                 /* System for 120 dpi and higher should include 20 pixel bitmap set */
                 (!strcmp(td[i][j].face_name, "System") && td[i][j].height > 16)))
-            todo_wine
-            ok(height == td[i][j].height_pixels, "%d(%d): expected height %d, got %d\n", i, j, td[i][j].height_pixels, height);
-            else
             ok(height == td[i][j].height_pixels, "%d(%d): expected height %d, got %d\n", i, j, td[i][j].height_pixels, height);
 
             ok(td[i][j].weight == lf.lfWeight, "%d(%d): expected lfWeight %d, got %d\n", i, j, td[i][j].weight, lf.lfWeight);
@@ -6281,13 +6348,18 @@ static void test_GetCharWidth32(void)
 
 static void test_fake_bold_font(void)
 {
+    static const MAT2 x2_mat = { {0,2}, {0,0}, {0,0}, {0,2} };
     HDC hdc;
-    HFONT hfont, hfont_old;
     LOGFONTA lf;
     BOOL ret;
-    TEXTMETRICA tm[2];
-    ABC abc[2];
-    INT w[2];
+    struct glyph_data {
+        TEXTMETRICA tm;
+        ABC abc;
+        INT w;
+        GLYPHMETRICS gm;
+    } data[2];
+    int i;
+    DWORD r;
 
     if (!pGetCharWidth32A || !pGetCharABCWidthsA) {
         win_skip("GetCharWidth32A/GetCharABCWidthA is not available on this platform\n");
@@ -6297,45 +6369,51 @@ static void test_fake_bold_font(void)
     /* Test outline font */
     memset(&lf, 0, sizeof(lf));
     strcpy(lf.lfFaceName, "Wingdings");
-    lf.lfWeight = FW_NORMAL;
     lf.lfCharSet = SYMBOL_CHARSET;
-    hfont = CreateFontIndirectA(&lf);
 
     hdc = GetDC(NULL);
-    hfont_old = SelectObject(hdc, hfont);
 
-    /* base metrics */
-    ret = GetTextMetricsA(hdc, &tm[0]);
-    ok(ret, "got %d\n", ret);
-    ret = pGetCharABCWidthsA(hdc, 0x76, 0x76, &abc[0]);
-    ok(ret, "got %d\n", ret);
+    for (i = 0; i <= 1; i++)
+    {
+        HFONT hfont, hfont_old;
 
-    lf.lfWeight = FW_BOLD;
-    hfont = CreateFontIndirectA(&lf);
-    DeleteObject(SelectObject(hdc, hfont));
+        lf.lfWeight = i ? FW_BOLD : FW_NORMAL;
+        hfont = CreateFontIndirectA(&lf);
+        hfont_old = SelectObject(hdc, hfont);
 
-    /* bold metrics */
-    ret = GetTextMetricsA(hdc, &tm[1]);
-    ok(ret, "got %d\n", ret);
-    ret = pGetCharABCWidthsA(hdc, 0x76, 0x76, &abc[1]);
-    ok(ret, "got %d\n", ret);
+        ret = GetTextMetricsA(hdc, &data[i].tm);
+        ok(ret, "got %d\n", ret);
+        ret = pGetCharABCWidthsA(hdc, 0x76, 0x76, &data[i].abc);
+        ok(ret, "got %d\n", ret);
+        data[i].w = data[i].abc.abcA + data[i].abc.abcB + data[i].abc.abcC;
+        r = GetGlyphOutlineA(hdc, 0x76, GGO_METRICS, &data[i].gm, 0, NULL, &x2_mat);
+        ok(r != GDI_ERROR, "got %d\n", ret);
 
-    DeleteObject(SelectObject(hdc, hfont_old));
+        SelectObject(hdc, hfont_old);
+        DeleteObject(hfont);
+    }
     ReleaseDC(NULL, hdc);
 
     /* compare results (outline) */
-    ok(tm[0].tmHeight == tm[1].tmHeight, "expected %d, got %d\n", tm[0].tmHeight, tm[1].tmHeight);
-    ok(tm[0].tmAscent == tm[1].tmAscent, "expected %d, got %d\n", tm[0].tmAscent, tm[1].tmAscent);
-    ok(tm[0].tmDescent == tm[1].tmDescent, "expected %d, got %d\n", tm[0].tmDescent, tm[1].tmDescent);
-    ok((tm[0].tmAveCharWidth + 1) == tm[1].tmAveCharWidth,
-       "expected %d, got %d\n", tm[0].tmAveCharWidth + 1, tm[1].tmAveCharWidth);
-    ok((tm[0].tmMaxCharWidth + 1) == tm[1].tmMaxCharWidth,
-       "expected %d, got %d\n", tm[0].tmMaxCharWidth + 1, tm[1].tmMaxCharWidth);
-    ok(tm[0].tmOverhang == tm[1].tmOverhang, "expected %d, got %d\n", tm[0].tmOverhang, tm[1].tmOverhang);
-    w[0] = abc[0].abcA + abc[0].abcB + abc[0].abcC;
-    w[1] = abc[1].abcA + abc[1].abcB + abc[1].abcC;
-    ok((w[0] + 1) == w[1], "expected %d, got %d\n", w[0] + 1, w[1]);
-
+    ok(data[0].tm.tmHeight == data[1].tm.tmHeight,
+       "expected %d, got %d\n", data[0].tm.tmHeight, data[1].tm.tmHeight);
+    ok(data[0].tm.tmAscent == data[1].tm.tmAscent,
+       "expected %d, got %d\n", data[0].tm.tmAscent, data[1].tm.tmAscent);
+    ok(data[0].tm.tmDescent == data[1].tm.tmDescent,
+       "expected %d, got %d\n", data[0].tm.tmDescent, data[1].tm.tmDescent);
+    ok(data[0].tm.tmAveCharWidth + 1 == data[1].tm.tmAveCharWidth,
+       "expected %d, got %d\n", data[0].tm.tmAveCharWidth + 1, data[1].tm.tmAveCharWidth);
+    ok(data[0].tm.tmMaxCharWidth + 1 == data[1].tm.tmMaxCharWidth,
+       "expected %d, got %d\n", data[0].tm.tmMaxCharWidth + 1, data[1].tm.tmMaxCharWidth);
+    ok(data[0].tm.tmOverhang == data[1].tm.tmOverhang,
+       "expected %d, got %d\n", data[0].tm.tmOverhang, data[1].tm.tmOverhang);
+    ok(data[0].w + 1 == data[1].w,
+       "expected %d, got %d\n", data[0].w + 1, data[1].w);
+
+    ok(data[0].gm.gmCellIncX + 1 == data[1].gm.gmCellIncX,
+       "expected %d, got %d\n", data[0].gm.gmCellIncX + 1, data[1].gm.gmCellIncX);
+    ok(data[0].gm.gmCellIncY == data[1].gm.gmCellIncY,
+       "expected %d, got %d\n", data[0].gm.gmCellIncY, data[1].gm.gmCellIncY);
 }
 
 static void test_bitmap_font_glyph_index(void)
index 4afae6b..6208090 100644 (file)
@@ -50,6 +50,12 @@ static void test_GetICMProfileA( HDC dc )
     size = MAX_PATH;
     ret = GetICMProfileA( dc, &size, NULL );
     ok( !ret, "GetICMProfileA succeeded\n" );
+    ok( size > 0, "got %u\n", size );
+
+    size = 0;
+    ret = GetICMProfileA( dc, &size, NULL );
+    ok( !ret, "GetICMProfileA succeeded\n" );
+    ok( size > 0, "got %u\n", size );
 
     size = MAX_PATH;
     ret = GetICMProfileA( NULL, &size, filename );
@@ -108,6 +114,11 @@ static void test_GetICMProfileW( HDC dc )
     ret = GetICMProfileW( NULL, &size, filename );
     ok( !ret, "GetICMProfileW succeeded\n" );
 
+    size = 0;
+    ret = GetICMProfileW( dc, &size, NULL );
+    ok( !ret, "GetICMProfileW succeeded\n" );
+    ok( size > 0, "got %u\n", size );
+
     size = 0;
     SetLastError(0xdeadbeef);
     ret = GetICMProfileW( dc, &size, filename );
index 6804a96..8b487e8 100755 (executable)
@@ -1101,6 +1101,44 @@ static const unsigned char EMF_TEXTOUT_ON_PATH_BITS[] =
     0x14, 0x00, 0x00, 0x00
 };
 
+static const unsigned char EMF_TEXTOUT_OUTLINE_ON_PATH_BITS[] =
+{
+    0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xdd, 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff,
+    0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+    0x0c, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x90, 0x06, 0x00, 0x00, 0x1a, 0x04, 0x00, 0x00,
+    0x51, 0x02, 0x00, 0x00, 0x72, 0x01, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x1a, 0x0b, 0x09, 0x00,
+    0xf0, 0xa6, 0x05, 0x00, 0x25, 0x00, 0x00, 0x00,
+    0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x80,
+    0x3b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+    0x54, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x01, 0x00, 0x00, 0x00, 0xc3, 0x30, 0x0d, 0x42,
+    0xcf, 0xf3, 0x0c, 0x42, 0x0b, 0x00, 0x00, 0x00,
+    0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+    0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x54, 0x00, 0x00, 0x00, 0x54, 0x00, 0x65, 0x00,
+    0x73, 0x00, 0x74, 0x00, 0x03, 0x00, 0x00, 0x00,
+    0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+    0x0c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
+    0x08, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00,
+    0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x80,
+    0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+    0x14, 0x00, 0x00, 0x00
+};
+
 static const unsigned char MF_LINETO_BITS[] = {
     0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x11, 0x00,
     0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
@@ -2224,6 +2262,8 @@ static void test_emf_ExtTextOut_on_path(void)
     HDC hdcDisplay, hdcMetafile;
     HENHMETAFILE hMetafile;
     BOOL ret;
+    LOGFONTA lf;
+    HFONT hFont;
     static const INT dx[4] = { 3, 5, 8, 12 };
 
     /* Win9x doesn't play EMFs on invisible windows */
@@ -2234,6 +2274,19 @@ static void test_emf_ExtTextOut_on_path(void)
     hdcDisplay = GetDC(hwnd);
     ok(hdcDisplay != 0, "GetDC error %d\n", GetLastError());
 
+    /* with default font */
+    ret = BeginPath(hdcDisplay);
+    ok(ret, "BeginPath error %d\n", GetLastError());
+
+    ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
+    ok(ret, "ExtTextOut error %d\n", GetLastError());
+
+    ret = EndPath(hdcDisplay);
+    ok(ret, "EndPath error %d\n", GetLastError());
+
+    ret = GetPath(hdcDisplay, NULL, NULL, 0);
+    ok(!ret, "expected 0, got %d\n", ret);
+
     hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
     ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
 
@@ -2246,6 +2299,9 @@ static void test_emf_ExtTextOut_on_path(void)
     ret = EndPath(hdcMetafile);
     ok(ret, "EndPath error %d\n", GetLastError());
 
+    ret = GetPath(hdcMetafile, NULL, NULL, 0);
+    ok(!ret, "expected 0, got %d\n", ret);
+
     hMetafile = CloseEnhMetaFile(hdcMetafile);
     ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
 
@@ -2261,6 +2317,66 @@ static void test_emf_ExtTextOut_on_path(void)
 
     ret = DeleteEnhMetaFile(hMetafile);
     ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+
+    /* with outline font */
+    memset(&lf, 0, sizeof(lf));
+    lf.lfCharSet = ANSI_CHARSET;
+    lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+    lf.lfWeight = FW_DONTCARE;
+    lf.lfHeight = 7;
+    lf.lfQuality = DEFAULT_QUALITY;
+    lstrcpyA(lf.lfFaceName, "Tahoma");
+    hFont = CreateFontIndirectA(&lf);
+    ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    hFont = SelectObject(hdcDisplay, hFont);
+
+    ret = BeginPath(hdcDisplay);
+    ok(ret, "BeginPath error %d\n", GetLastError());
+
+    ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
+    ok(ret, "ExtTextOut error %d\n", GetLastError());
+
+    ret = EndPath(hdcDisplay);
+    ok(ret, "EndPath error %d\n", GetLastError());
+
+    ret = GetPath(hdcDisplay, NULL, NULL, 0);
+    ok(ret != 0, "expected != 0\n");
+
+    SelectObject(hdcDisplay, hFont);
+
+    hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+
+    hFont = SelectObject(hdcMetafile, hFont);
+
+    ret = BeginPath(hdcMetafile);
+    ok(ret, "BeginPath error %d\n", GetLastError());
+
+    ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
+    ok(ret, "ExtTextOut error %d\n", GetLastError());
+
+    ret = EndPath(hdcMetafile);
+    ok(ret, "EndPath error %d\n", GetLastError());
+
+    ret = GetPath(hdcMetafile, NULL, NULL, 0);
+    ok(!ret, "expected 0, got %d\n", ret);
+
+    hFont = SelectObject(hdcMetafile, hFont);
+    DeleteObject(hFont);
+
+    hMetafile = CloseEnhMetaFile(hdcMetafile);
+    ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+
+    if (compare_emf_bits(hMetafile, EMF_TEXTOUT_OUTLINE_ON_PATH_BITS, sizeof(EMF_TEXTOUT_OUTLINE_ON_PATH_BITS),
+        "emf_TextOut_on_path", FALSE) != 0)
+    {
+        dump_emf_bits(hMetafile, "emf_TextOut_outline_on_path");
+        dump_emf_records(hMetafile, "emf_TextOut_outline_on_path");
+    }
+
+    ret = DeleteEnhMetaFile(hMetafile);
+    ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+
     ret = ReleaseDC(hwnd, hdcDisplay);
     ok(ret, "ReleaseDC error %d\n", GetLastError());
     DestroyWindow(hwnd);
@@ -3361,6 +3477,41 @@ static void test_emf_polybezier(void)
     DeleteEnhMetaFile(hemf);
 }
 
+static const unsigned char EMF_PATH_BITS[] =
+{
+    0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0xe6, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff,
+    0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
+    0xf8, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x80, 0x07, 0x00, 0x00, 0xd3, 0x03, 0x00, 0x00,
+    0xfc, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00,
+    0xd3, 0xf3, 0x03, 0x00, 0x3b, 0x00, 0x00, 0x00,
+    0x08, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00,
+    0x10, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+    0x32, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
+    0x10, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+    0x96, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
+    0x10, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
+    0x96, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
+    0x10, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
+    0x32, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
+    0x10, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+    0x32, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00,
+    0x18, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+    0x0a, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
+    0x13, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
+    0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
+    0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
+};
+
 static void test_emf_GetPath(void)
 {
     HDC hdcMetafile;
@@ -3383,14 +3534,21 @@ static void test_emf_GetPath(void)
     ok( ret, "LineTo error %d.\n", GetLastError());
     ret = LineTo(hdcMetafile, 50, 50);
     ok( ret, "LineTo error %d.\n", GetLastError());
+    Rectangle(hdcMetafile, 10, 10, 20, 20);
     EndPath(hdcMetafile);
 
     size = GetPath(hdcMetafile, NULL, NULL, 0);
-    todo_wine ok( size == 5, "GetPath returned %d.\n", size);
+    ok( size == 9, "GetPath returned %d.\n", size);
 
     hemf = CloseEnhMetaFile(hdcMetafile);
     ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
 
+    if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_GetPath", FALSE) != 0)
+    {
+        dump_emf_bits(hemf, "test_emf_GetPath");
+        dump_emf_records(hemf, "test_emf_GetPath");
+    }
+
     DeleteEnhMetaFile(hemf);
 }
 
index 0b350bc..223a027 100644 (file)
@@ -390,9 +390,7 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected,
     size = GetPath(hdc, pnt, types, size);
     assert(size > 0);
 
-    if (todo_size) todo_wine
-        ok(size == expected_size, "Path size %d does not match expected size %d\n", size, expected_size);
-    else
+    todo_wine_if (todo_size)
         ok(size == expected_size, "Path size %d does not match expected size %d\n", size, expected_size);
 
     if (winetest_debug > 2)
@@ -407,11 +405,7 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected,
             (pnt[idx].x >= expected[eidx].x-2 && pnt[idx].x <= expected[eidx].x+2) &&
             (pnt[idx].y >= expected[eidx].y-2 && pnt[idx].y <= expected[eidx].y+2);
 
-        if (expected[eidx].todo || numskip) todo_wine
-            ok(match, "Expected #%d: %s (%d,%d) but got %s (%d,%d)\n", eidx,
-               type_string[expected[eidx].type], expected[eidx].x, expected[eidx].y,
-               type_string[types[idx]], pnt[idx].x, pnt[idx].y);
-        else
+        todo_wine_if (expected[eidx].todo || numskip)
             ok(match, "Expected #%d: %s (%d,%d) but got %s (%d,%d)\n", eidx,
                type_string[expected[eidx].type], expected[eidx].x, expected[eidx].y,
                type_string[types[idx]], pnt[idx].x, pnt[idx].y);