From 70c9f307473b3993b6f18fd7acd5ab92f9e94d63 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 19 Jan 2018 00:20:03 +0100 Subject: [PATCH] [GDIPLUS_WINETEST] Sync with Wine 3.0. CORE-14225 --- .../rostests/winetests/gdiplus/CMakeLists.txt | 3 +- modules/rostests/winetests/gdiplus/brush.c | 113 ++++ modules/rostests/winetests/gdiplus/font.c | 134 ++++- modules/rostests/winetests/gdiplus/graphics.c | 139 ++++- modules/rostests/winetests/gdiplus/image.c | 502 ++++++------------ modules/rostests/winetests/gdiplus/matrix.c | 1 + modules/rostests/winetests/gdiplus/metafile.c | 422 ++++++++------- .../rostests/winetests/gdiplus/pathiterator.c | 15 +- .../rostests/winetests/gdiplus/resource.rc | 22 + .../winetests/gdiplus/wine_longname.sfd | 66 +++ .../winetests/gdiplus/wine_longname.ttf | Bin 0 -> 2216 bytes 11 files changed, 847 insertions(+), 570 deletions(-) create mode 100644 modules/rostests/winetests/gdiplus/resource.rc create mode 100644 modules/rostests/winetests/gdiplus/wine_longname.sfd create mode 100644 modules/rostests/winetests/gdiplus/wine_longname.ttf diff --git a/modules/rostests/winetests/gdiplus/CMakeLists.txt b/modules/rostests/winetests/gdiplus/CMakeLists.txt index 6bac596c78a..d73d3137ccc 100644 --- a/modules/rostests/winetests/gdiplus/CMakeLists.txt +++ b/modules/rostests/winetests/gdiplus/CMakeLists.txt @@ -19,7 +19,8 @@ list(APPEND SOURCE add_executable(gdiplus_winetest ${SOURCE} guid.c - testlist.c) + testlist.c + resource.rc) set_module_type(gdiplus_winetest win32cui) add_importlibs(gdiplus_winetest gdiplus user32 gdi32 ole32 msvcrt kernel32) diff --git a/modules/rostests/winetests/gdiplus/brush.c b/modules/rostests/winetests/gdiplus/brush.c index ec9a74ba152..c012b97933e 100644 --- a/modules/rostests/winetests/gdiplus/brush.c +++ b/modules/rostests/winetests/gdiplus/brush.c @@ -41,6 +41,95 @@ static void test_constructor_destructor(void) expect(Ok, status); } +static void test_createHatchBrush(void) +{ + GpStatus status; + GpHatch *brush; + + status = GdipCreateHatchBrush(HatchStyleMin, 1, 2, &brush); + expect(Ok, status); + ok(brush != NULL, "Expected the brush to be initialized.\n"); + + GdipDeleteBrush((GpBrush *)brush); + + status = GdipCreateHatchBrush(HatchStyleMax, 1, 2, &brush); + expect(Ok, status); + ok(brush != NULL, "Expected the brush to be initialized.\n"); + + GdipDeleteBrush((GpBrush *)brush); + + status = GdipCreateHatchBrush(HatchStyle05Percent, 1, 2, NULL); + expect(InvalidParameter, status); + + status = GdipCreateHatchBrush((HatchStyle)(HatchStyleMin - 1), 1, 2, &brush); + expect(InvalidParameter, status); + + status = GdipCreateHatchBrush((HatchStyle)(HatchStyleMax + 1), 1, 2, &brush); + expect(InvalidParameter, status); +} + +static void test_createLineBrushFromRectWithAngle(void) +{ + GpStatus status; + GpLineGradient *brush; + GpRectF rect1 = { 1, 3, 1, 2 }; + GpRectF rect2 = { 1, 3, -1, -2 }; + GpRectF rect3 = { 1, 3, 0, 1 }; + GpRectF rect4 = { 1, 3, 1, 0 }; + + status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 0, TRUE, WrapModeTile, &brush); + expect(Ok, status); + GdipDeleteBrush((GpBrush *) brush); + + status = GdipCreateLineBrushFromRectWithAngle(&rect2, 10, 11, 135, TRUE, (WrapMode)(WrapModeTile - 1), &brush); + expect(Ok, status); + GdipDeleteBrush((GpBrush *) brush); + + status = GdipCreateLineBrushFromRectWithAngle(&rect2, 10, 11, -225, FALSE, (WrapMode)(WrapModeTile - 1), &brush); + expect(Ok, status); + GdipDeleteBrush((GpBrush *) brush); + + status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 405, TRUE, (WrapMode)(WrapModeClamp + 1), &brush); + expect(Ok, status); + GdipDeleteBrush((GpBrush *) brush); + + status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 45, FALSE, (WrapMode)(WrapModeClamp + 1), &brush); + expect(Ok, status); + GdipDeleteBrush((GpBrush *) brush); + + status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 90, TRUE, WrapModeTileFlipX, &brush); + expect(Ok, status); + + status = GdipCreateLineBrushFromRectWithAngle(NULL, 10, 11, 90, TRUE, WrapModeTile, &brush); + expect(InvalidParameter, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect3, 10, 11, 90, TRUE, WrapModeTileFlipXY, &brush); + expect(OutOfMemory, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect4, 10, 11, 90, TRUE, WrapModeTileFlipXY, &brush); + expect(OutOfMemory, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect3, 10, 11, 90, TRUE, WrapModeTileFlipXY, NULL); + expect(InvalidParameter, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect4, 10, 11, 90, TRUE, WrapModeTileFlipXY, NULL); + expect(InvalidParameter, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect3, 10, 11, 90, TRUE, WrapModeClamp, &brush); + expect(InvalidParameter, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect4, 10, 11, 90, TRUE, WrapModeClamp, &brush); + expect(InvalidParameter, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 90, TRUE, WrapModeClamp, &brush); + expect(InvalidParameter, status); + + status = GdipCreateLineBrushFromRectWithAngle(&rect1, 10, 11, 90, TRUE, WrapModeTile, NULL); + expect(InvalidParameter, status); + + GdipDeleteBrush((GpBrush *) brush); +} + static void test_type(void) { GpStatus status; @@ -1525,6 +1614,27 @@ static void test_pathgradientblend(void) expect(Ok, status); } +static void test_getHatchStyle(void) +{ + GpStatus status; + GpHatch *brush; + GpHatchStyle hatchStyle; + + GdipCreateHatchBrush(HatchStyleHorizontal, 11, 12, &brush); + + status = GdipGetHatchStyle(NULL, &hatchStyle); + expect(InvalidParameter, status); + + status = GdipGetHatchStyle(brush, NULL); + expect(InvalidParameter, status); + + status = GdipGetHatchStyle(brush, &hatchStyle); + expect(Ok, status); + expect(HatchStyleHorizontal, hatchStyle); + + GdipDeleteBrush((GpBrush *)brush); +} + START_TEST(brush) { struct GdiplusStartupInput gdiplusStartupInput; @@ -1559,6 +1669,8 @@ START_TEST(brush) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); test_constructor_destructor(); + test_createHatchBrush(); + test_createLineBrushFromRectWithAngle(); test_type(); test_gradientblendcount(); test_getblend(); @@ -1574,6 +1686,7 @@ START_TEST(brush) test_pathgradientcenterpoint(); test_pathgradientpresetblend(); test_pathgradientblend(); + test_getHatchStyle(); GdiplusShutdown(gdiplusToken); DestroyWindow(hwnd); diff --git a/modules/rostests/winetests/gdiplus/font.c b/modules/rostests/winetests/gdiplus/font.c index b68c2ba5399..de8e64dc598 100644 --- a/modules/rostests/winetests/gdiplus/font.c +++ b/modules/rostests/winetests/gdiplus/font.c @@ -39,6 +39,78 @@ static void set_rect_empty(RectF *rc) rc->Height = 0.0; } +static void create_testfontfile(const WCHAR *filename, int resource, WCHAR pathW[MAX_PATH]) +{ + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempPathW(MAX_PATH, pathW); + lstrcatW(pathW, filename); + + file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW), GetLastError()); + + res = FindResourceA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(resource), (LPCSTR)RT_RCDATA); + ok(res != 0, "couldn't find resource\n"); + ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); + WriteFile(file, ptr, SizeofResource(GetModuleHandleA(NULL), res), &written, NULL); + ok(written == SizeofResource(GetModuleHandleA(NULL), res), "couldn't write resource\n"); + CloseHandle(file); +} + +#define DELETE_FONTFILE(filename) _delete_testfontfile(filename, __LINE__) +static void _delete_testfontfile(const WCHAR *filename, int line) +{ + BOOL ret = DeleteFileW(filename); + ok_(__FILE__,line)(ret, "failed to delete file %s, error %d\n", wine_dbgstr_w(filename), GetLastError()); +} + +static void test_long_name(void) +{ + WCHAR path[MAX_PATH]; + static const WCHAR path_longname[] = {'w','i','n','e','_','l','o','n','g','n','a','m','e','.','t','t','f',0}; + GpStatus stat; + GpFontCollection *fonts; + INT num_families; + GpFontFamily *family; + WCHAR family_name[LF_FACESIZE]; + GpFont *font; + + stat = GdipNewPrivateFontCollection(&fonts); + ok(stat == Ok, "GdipNewPrivateFontCollection failed: %d\n", stat); + + create_testfontfile(path_longname, 1, path); + + stat = GdipPrivateAddFontFile(fonts, path); + ok(stat == Ok, "GdipPrivateAddFontFile failed: %d\n", stat); + + stat = GdipGetFontCollectionFamilyCount(fonts, &num_families); + ok(stat == Ok, "GdipGetFontCollectionFamilyCount failed: %d\n", stat); + + ok(num_families == 1, "expected num_families to be 1, got %d\n", num_families); + + stat = GdipGetFontCollectionFamilyList(fonts, num_families, &family, &num_families); + ok(stat == Ok, "GdipGetFontCollectionFamilyList failed: %d\n", stat); + + stat = GdipGetFamilyName(family, family_name, LANG_NEUTRAL); + ok(stat == Ok, "GdipGetFamilyName failed: %d\n", stat); + + stat = GdipCreateFont(family, 256.0, FontStyleRegular, UnitPixel, &font); + ok(stat == Ok, "GdipCreateFont failed: %d\n", stat); + + /* Cleanup */ + + stat = GdipDeleteFont(font); + ok(stat == Ok, "GdipDeleteFont failed: %d\n", stat); + + stat = GdipDeletePrivateFontCollection(&fonts); + ok(stat == Ok, "GdipDeletePrivateFontCollection failed: %d\n", stat); + + DELETE_FONTFILE(path); +} + static void test_createfont(void) { GpFontFamily* fontfamily = NULL, *fontfamily2; @@ -79,7 +151,8 @@ static void test_createfont(void) for (i = UnitWorld; i <=UnitMillimeter; i++) { if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */ - GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font); + stat = GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font); + expect(Ok, stat); GdipGetFontSize (font, &size); ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i); GdipGetFontUnit (font, &unit); @@ -103,7 +176,8 @@ static void test_logfont(void) UINT16 em_height, line_spacing; Unit unit; - GdipCreateFromHDC(hdc, &graphics); + stat = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, stat); memset(&lfa, 0, sizeof(LOGFONTA)); memset(&lfa2, 0xff, sizeof(LOGFONTA)); @@ -1106,6 +1180,60 @@ todo_wine DeleteDC(hdc); } +static void test_GdipGetFontCollectionFamilyList(void) +{ + GpFontFamily *family, *family2; + GpFontCollection *collection; + INT found, count; + GpStatus status; + + status = GdipNewInstalledFontCollection(&collection); + ok(status == Ok, "Failed to get system collection, status %d.\n", status); + + count = 0; + status = GdipGetFontCollectionFamilyCount(collection, &count); + ok(status == Ok, "Failed to get family count, status %d.\n", status); + ok(count > 0, "Unexpected empty collection.\n"); + + status = GdipGetFontCollectionFamilyList(NULL, 0, NULL, NULL); + ok(status == InvalidParameter, "Unexpected status %d.\n", status); + + found = 123; + status = GdipGetFontCollectionFamilyList(NULL, 0, NULL, &found); + ok(status == InvalidParameter, "Unexpected status %d.\n", status); + ok(found == 123, "Unexpected list count %d.\n", found); + + status = GdipGetFontCollectionFamilyList(collection, 0, NULL, NULL); + ok(status == InvalidParameter, "Unexpected status %d.\n", status); + + found = 123; + status = GdipGetFontCollectionFamilyList(collection, 0, NULL, &found); + ok(status == InvalidParameter, "Unexpected status %d.\n", status); + ok(found == 123, "Unexpected list count %d.\n", found); + + found = 123; + status = GdipGetFontCollectionFamilyList(collection, 1, NULL, &found); + ok(status == InvalidParameter, "Unexpected status %d.\n", status); + ok(found == 123, "Unexpected list count %d.\n", found); + + family = NULL; + found = 0; + status = GdipGetFontCollectionFamilyList(collection, 1, &family, &found); + ok(status == Ok, "Failed to get family list, status %d.\n", status); + ok(found == 1, "Unexpected list count %d.\n", found); + ok(family != NULL, "Expected family instance.\n"); + + family = NULL; + found = 0; + status = GdipGetFontCollectionFamilyList(collection, 1, &family2, &found); + ok(status == Ok, "Failed to get family list, status %d.\n", status); + ok(found == 1, "Unexpected list count %d.\n", found); + ok(family2 != family, "Unexpected family instance.\n"); + + GdipDeleteFontFamily(family); + GdipDeleteFontFamily(family2); +} + START_TEST(font) { struct GdiplusStartupInput gdiplusStartupInput; @@ -1125,6 +1253,7 @@ START_TEST(font) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + test_long_name(); test_font_transform(); if (!winetest_interactive) skip("ROSTESTS-154: Skipping test_font_substitution because of improper error handling\n"); @@ -1138,6 +1267,7 @@ START_TEST(font) test_getgenerics(); test_installedfonts(); test_heightgivendpi(); + test_GdipGetFontCollectionFamilyList(); GdiplusShutdown(gdiplusToken); } diff --git a/modules/rostests/winetests/gdiplus/graphics.c b/modules/rostests/winetests/gdiplus/graphics.c index 2ea529b4960..2c0221c10cf 100644 --- a/modules/rostests/winetests/gdiplus/graphics.c +++ b/modules/rostests/winetests/gdiplus/graphics.c @@ -361,7 +361,8 @@ static void test_save_restore(void) log_state(state_a, &state_log); /* BeginContainer and SaveGraphics use the same stack. */ - GdipCreateFromHDC(hdc, &graphics1); + stat = GdipCreateFromHDC(hdc, &graphics1); + expect(Ok, stat); GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); stat = GdipBeginContainer2(graphics1, &state_a); expect(Ok, stat); @@ -727,7 +728,8 @@ static void test_BeginContainer2(void) status = GdipCreateMatrix(&transform); expect(Ok, status); GdipGetWorldTransform(graphics, transform); - GdipGetMatrixElements(transform, elems); + status = GdipGetMatrixElements(transform, elems); + expect(Ok, status); ok(fabs(defTrans[0] - elems[0]) < 0.0001 && fabs(defTrans[1] - elems[1]) < 0.0001 && fabs(defTrans[2] - elems[2]) < 0.0001 && @@ -1596,10 +1598,12 @@ static void test_Get_Release_DC(void) status = GdipCreateMatrix(&m); expect(Ok, status); - GdipCreateRegion(®ion); + status = GdipCreateRegion(®ion); + expect(Ok, status); GdipCreateSolidFill((ARGB)0xdeadbeef, &brush); GdipCreatePath(FillModeAlternate, &path); - GdipCreateRegion(&clip); + status = GdipCreateRegion(&clip); + expect(Ok, status); status = GdipCreateFromHDC(hdc, &graphics); expect(Ok, status); @@ -6221,11 +6225,6 @@ static DWORD* GetBitmapPixelBuffer(HDC hdc, HBITMAP hbmp, int width, int height) return buffer; } -static void ReleaseBitmapPixelBuffer(DWORD* buffer) -{ - if (buffer) GdipFree(buffer); -} - static void test_GdipFillRectanglesOnMemoryDCSolidBrush(void) { ARGB color[6] = {0,0,0,0,0,0}; @@ -6275,7 +6274,7 @@ static void test_GdipFillRectanglesOnMemoryDCSolidBrush(void) ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && color[3] == 0 && color[4] == 0 && color[5] == 0, "Expected GdipFillRectangleI take effect!\n" ); - ReleaseBitmapPixelBuffer(pixel); + GdipFree(pixel); SelectObject(hdc, old); DeleteObject(bmp); @@ -6360,7 +6359,7 @@ static void test_GdipFillRectanglesOnMemoryDCTextureBrush(void) ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && color[3] == 0 && color[4] == 0 && color[5] == 0, "Expected GdipFillRectangleI take effect!\n" ); - ReleaseBitmapPixelBuffer(pixel); + GdipFree(pixel); SelectObject(hdc, old); DeleteObject(bmp); @@ -6517,7 +6516,7 @@ static void test_GdipDrawImagePointsRectOnMemoryDC(void) ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && color[3] == 0 && color[4] == 0 && color[5] == 0, "Expected GdipDrawImageRectRectI take effect!\n" ); - ReleaseBitmapPixelBuffer(pixel); + GdipFree(pixel); SelectObject(hdc, old); DeleteObject(bmp); @@ -6525,6 +6524,120 @@ static void test_GdipDrawImagePointsRectOnMemoryDC(void) ReleaseDC(hwnd, dc); } +static void test_cliphrgn_transform(void) +{ + HDC hdc; + GpStatus status; + GpGraphics *graphics; + HRGN rgn; + RectF rectf; + BOOL res; + + hdc = GetDC(hwnd); + + SetViewportOrgEx(hdc, 10, 10, NULL); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + rgn = CreateRectRgn(0, 0, 100, 100); + + status = GdipSetClipHrgn(graphics, rgn, CombineModeReplace); + expect(Ok, status); + + status = GdipGetVisibleClipBounds(graphics, &rectf); + expect(Ok, status); + expectf(-10.0, rectf.X); + expectf(-10.0, rectf.Y); + expectf(100.0, rectf.Width); + expectf(100.0, rectf.Height); + + status = GdipIsVisiblePoint(graphics, 95, 95, &res); + expect(Ok, status); + expect(FALSE, res); + + status = GdipIsVisiblePoint(graphics, -5, -5, &res); + expect(Ok, status); + expect(TRUE, res); + + DeleteObject(rgn); + + GdipDeleteGraphics(graphics); + + SetViewportOrgEx(hdc, 0, 0, NULL); + + ReleaseDC(hwnd, hdc); +} + +static void test_hdc_caching(void) +{ + GpStatus status; + HDC hdc; + HBITMAP hbm; + GpGraphics *graphics; + ULONG *bits; + BITMAPINFO bmi; + HRGN hrgn; + GpBrush *brush; + + hdc = CreateCompatibleDC(0); + ok(hdc != NULL, "CreateCompatibleDC failed\n"); + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biHeight = -5; + bmi.bmiHeader.biWidth = 5; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biCompression = BI_RGB; + bmi.bmiHeader.biClrUsed = 0; + + hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); + ok(hbm != NULL, "CreateDIBSection failed\n"); + + SelectObject(hdc, hbm); + + SetViewportOrgEx(hdc, 1, 1, NULL); + + hrgn = CreateRectRgn(0, 0, 3, 3); + SelectClipRgn(hdc, hrgn); + DeleteObject(hrgn); + + status = GdipCreateSolidFill((ARGB)0xffaaaaaa, (GpSolidFill**)&brush); + expect(Ok, status); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + memset(bits, 0, sizeof(*bits) * 25); + status = GdipFillRectangleI(graphics, brush, 0, 0, 4, 4); + expect(Ok, status); + + expect(0, bits[0]); + expect(0xffaaaaaa, bits[6]); + expect(0xffaaaaaa, bits[12]); + expect(0, bits[18]); + expect(0, bits[24]); + + SetViewportOrgEx(hdc, 0, 0, NULL); + OffsetClipRgn(hdc, 2, 2); + + memset(bits, 0, sizeof(*bits) * 25); + status = GdipFillRectangleI(graphics, brush, 0, 0, 4, 4); + expect(Ok, status); + + expect(0, bits[0]); + expect(0xffaaaaaa, bits[6]); + expect(0xffaaaaaa, bits[12]); + expect(0, bits[18]); + expect(0, bits[24]); + + GdipDeleteGraphics(graphics); + + GdipDeleteBrush(brush); + + DeleteDC(hdc); + DeleteObject(hbm); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; @@ -6614,6 +6727,8 @@ START_TEST(graphics) test_GdipDrawImagePointsRectOnMemoryDC(); test_container_rects(); test_GdipGraphicsSetAbort(); + test_cliphrgn_transform(); + test_hdc_caching(); GdiplusShutdown(gdiplusToken); DestroyWindow( hwnd ); diff --git a/modules/rostests/winetests/gdiplus/image.c b/modules/rostests/winetests/gdiplus/image.c index d87df831277..96e988ccba6 100644 --- a/modules/rostests/winetests/gdiplus/image.c +++ b/modules/rostests/winetests/gdiplus/image.c @@ -2,7 +2,7 @@ * Unit test suite for images * * Copyright (C) 2007 Google (Evan Stade) - * Copyright (C) 2012,2016 Dmitry Timoshkov + * Copyright (C) 2012, 2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -41,8 +41,6 @@ static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat,UINT*); static GpStatus (WINAPI *pGdipBitmapGetHistogram)(GpBitmap*,HistogramFormat,UINT,UINT*,UINT*,UINT*,UINT*); static GpStatus (WINAPI *pGdipImageSetAbort)(GpImage*,GdiplusAbort*); -static GpStatus (WINGDIPAPI *pGdipInitializePalette)(ColorPalette*,PaletteType,INT,BOOL,GpBitmap*); - #define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got)) #define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got)) @@ -376,7 +374,8 @@ static void test_GdipImageGetFrameDimensionsCount(void) /* SelectActiveFrame has no effect on image data of memory bitmaps */ color = 0xdeadbeef; - GdipBitmapGetPixel(bm, 0, 0, &color); + stat = GdipBitmapGetPixel(bm, 0, 0, &color); + expect(Ok, stat); expect(0xffffffff, color); GdipDisposeImage((GpImage*)bm); @@ -1779,6 +1778,7 @@ static void test_createhbitmap(void) } /* create HBITMAP with bkgnd colour */ + /* gdiplus.dll 5.1 is broken and only applies the blue value */ stat = GdipCreateHBITMAPFromBitmap(bitmap, &hbitmap, 0xff00ff); expect(Ok, stat); @@ -1798,20 +1798,20 @@ static void test_createhbitmap(void) if (bm.bmBits) { DWORD val = *(DWORD*)bm.bmBits; - ok(val == 0x68c12ac1, "got %x, expected 0x682a2a2a\n", val); + ok(val == 0x68c12ac1 || broken(val == 0x682a2ac1), "got %x, expected 0x68c12ac1\n", val); val = *((DWORD*)bm.bmBits + (bm.bmHeight-1) * bm.bmWidthBytes/4 + 1); - ok(val == 0xff00ff, "got %x, expected 0x682a2a2a\n", val); + ok(val == 0xff00ff || broken(val == 0xff), "got %x, expected 0xff00ff\n", val); } hdc = CreateCompatibleDC(NULL); oldhbitmap = SelectObject(hdc, hbitmap); pixel = GetPixel(hdc, 5, 5); - expect(0xc12ac1, pixel); + ok(pixel == 0xc12ac1 || broken(pixel == 0xc12a2a), "got %x, expected 0xc12ac1\n", pixel); pixel = GetPixel(hdc, 1, 0); - expect(0xff00ff, pixel); + ok(pixel == 0xff00ff || broken(pixel == 0xff0000), "got %x, expected 0xff00ff\n", pixel); pixel = GetPixel(hdc, 2, 0); - expect(0xb12ac1, pixel); + ok(pixel == 0xb12ac1 || broken(pixel == 0xb12a2a), "got %x, expected 0xb12ac1\n", pixel); SelectObject(hdc, oldhbitmap); DeleteDC(hdc); @@ -1838,20 +1838,20 @@ static void test_createhbitmap(void) if (bm.bmBits) { DWORD val = *(DWORD*)bm.bmBits; - ok(val == 0x68c12ac1, "got %x, expected 0x682a2a2a\n", val); + ok(val == 0x68c12ac1 || broken(val == 0x682a2ac1), "got %x, expected 0x68c12ac1\n", val); val = *((DWORD*)bm.bmBits + (bm.bmHeight-1) * bm.bmWidthBytes/4 + 1); - ok(val == 0xff00ff, "got %x, expected 0x682a2a2a\n", val); + ok(val == 0xff00ff || broken(val == 0xff), "got %x, expected 0xff00ff\n", val); } hdc = CreateCompatibleDC(NULL); oldhbitmap = SelectObject(hdc, hbitmap); pixel = GetPixel(hdc, 5, 5); - expect(0xc12ac1, pixel); + ok(pixel == 0xc12ac1 || broken(pixel == 0xc12a2a), "got %x, expected 0xc12ac1\n", pixel); pixel = GetPixel(hdc, 1, 0); - expect(0xff00ff, pixel); + ok(pixel == 0xff00ff || broken(pixel == 0xff0000), "got %x, expected 0xff00ff\n", pixel); pixel = GetPixel(hdc, 2, 0); - expect(0xb12ac1, pixel); + ok(pixel == 0xb12ac1 || broken(pixel == 0xb12a2a), "got %x, expected 0xb12ac1\n", pixel); SelectObject(hdc, oldhbitmap); DeleteDC(hdc); @@ -2382,10 +2382,44 @@ static void test_colormatrix(void) expect(Ok, stat); ok(color_match(0xeeff40cc, color, 3), "expected 0xeeff40cc, got 0x%08x\n", color); + /* Toggle NoOp */ + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, FALSE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xfefe40cc, color, 3), "expected 0xfefe40cc, got 0x%08x\n", color); + + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, TRUE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color); + stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault); expect(Ok, stat); - stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1, + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, FALSE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, UnitPixel, imageattr, NULL, NULL); expect(Ok, stat); @@ -2393,6 +2427,101 @@ static void test_colormatrix(void) expect(Ok, stat); ok(color_match(0xff40ccee, color, 1), "Expected ff40ccee, got %.8x\n", color); + /* Disable adjustment, toggle NoOp */ + stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, + FALSE, &colormatrix, NULL, ColorMatrixFlagsDefault); + expect(Ok, stat); + + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, FALSE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color); + + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, TRUE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color); + + /* Reset with NoOp on, enable adjustment. */ + stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault); + expect(Ok, stat); + + stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault, + TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xfff24ace, color, 3), "expected 0xfff24ace, got 0x%08x\n", color); + + /* Now inhibit specific category. */ + stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault); + expect(Ok, stat); + + stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeBitmap, + TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xfffe41cc, color, 3), "expected 0xfffe41cc, got 0x%08x\n", color); + + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeBitmap, TRUE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color); + + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeBitmap, FALSE); + expect(Ok, stat); + + stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, TRUE); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xfff24ace, color, 3), "expected 0xfff24ace, got 0x%08x\n", color); + + stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeBitmap); + expect(Ok, stat); + + stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1, + UnitPixel, imageattr, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color); + expect(Ok, stat); + ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color); + GdipDeleteGraphics(graphics); GdipDisposeImage((GpImage*)bitmap1); GdipDisposeImage((GpImage*)bitmap2); @@ -2603,7 +2732,7 @@ static void test_multiframegif(void) expect(Ok, stat); color = 0xdeadbeef; - GdipBitmapGetPixel(bmp, 0, 0, &color); + stat = GdipBitmapGetPixel(bmp, 0, 0, &color); expect(Ok, stat); expect(0xffffffff, color); @@ -3119,6 +3248,8 @@ static GpImage *load_image(const BYTE *image_data, UINT image_size) ok(refcount == 1, "expected stream refcount 1, got %d\n", refcount); status = GdipLoadImageFromStream(stream, &image); + ok(status == Ok || broken(status == InvalidParameter), /* XP */ + "GdipLoadImageFromStream error %d\n", status); if (status != Ok) { IStream_Release(stream); @@ -4673,13 +4804,14 @@ static void test_supported_encoders(void) { LPCWSTR mime; const GUID *format; + BOOL todo; } td[] = { - { bmp_mimetype, &ImageFormatBMP }, - { jpeg_mimetype, &ImageFormatJPEG }, - { gif_mimetype, &ImageFormatGIF }, - { tiff_mimetype, &ImageFormatTIFF }, - { png_mimetype, &ImageFormatPNG } + { bmp_mimetype, &ImageFormatBMP, FALSE }, + { jpeg_mimetype, &ImageFormatJPEG, FALSE }, + { gif_mimetype, &ImageFormatGIF, TRUE }, + { tiff_mimetype, &ImageFormatTIFF, FALSE }, + { png_mimetype, &ImageFormatPNG, FALSE } }; GUID format, clsid; BOOL ret; @@ -4705,7 +4837,8 @@ static void test_supported_encoders(void) ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); status = GdipSaveImageToStream((GpImage *)bm, stream, &clsid, NULL); - ok(status == Ok, "GdipSaveImageToStream error %d\n", status); + todo_wine_if (td[i].todo) + ok(status == Ok, "GdipSaveImageToStream error %d\n", status); IStream_Release(stream); } @@ -5035,329 +5168,6 @@ static void test_png_color_formats(void) } } -static BYTE *init_bitmap(UINT *width, UINT *height, UINT *stride) -{ - BYTE *src; - UINT i, j, scale; - - *width = 256; - *height = 256; - *stride = (*width * 3 + 3) & ~3; - trace("width %d, height %d, stride %d\n", *width, *height, *stride); - - src = HeapAlloc(GetProcessHeap(), 0, *stride * *height); - - scale = 256 / *width; - if (!scale) scale = 1; - - for (i = 0; i < *height; i++) - { - for (j = 0; j < *width; j++) - { - src[i * *stride + j*3 + 0] = scale * i; - src[i * *stride + j*3 + 1] = scale * (255 - (i+j)/2); - src[i * *stride + j*3 + 2] = scale * j; - } - } - - return src; -} - -static void test_GdipInitializePalette(void) -{ - GpStatus status; - BYTE *data; - GpBitmap *bitmap; - ColorPalette *palette; - UINT width, height, stride; - - pGdipInitializePalette = (void *)GetProcAddress(GetModuleHandleA("gdiplus.dll"), "GdipInitializePalette"); - if (!pGdipInitializePalette) - { - win_skip("GdipInitializePalette is not supported on this platform\n"); - return; - } - - data = init_bitmap(&width, &height, &stride); - - status = GdipCreateBitmapFromScan0(width, height, stride, PixelFormat24bppRGB, data, &bitmap); - expect(Ok, status); - - palette = GdipAlloc(sizeof(*palette) + sizeof(ARGB) * 255); - - palette->Flags = 0; - palette->Count = 15; - status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, bitmap); - expect(GenericError, status); - - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, NULL); - expect(InvalidParameter, status); - - memset(palette->Entries, 0x11, sizeof(ARGB) * 256); - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeCustom, 16, FALSE, NULL); - expect(Ok, status); - expect(0, palette->Flags); - expect(256, palette->Count); - expect(0x11111111, palette->Entries[0]); - expect(0x11111111, palette->Entries[128]); - expect(0x11111111, palette->Entries[255]); - - memset(palette->Entries, 0x11, sizeof(ARGB) * 256); - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeFixedBW, 0, FALSE, bitmap); - expect(Ok, status); -todo_wine - expect(0x200, palette->Flags); - expect(2, palette->Count); - expect(0xff000000, palette->Entries[0]); - expect(0xffffffff, palette->Entries[1]); - - memset(palette->Entries, 0x11, sizeof(ARGB) * 256); - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone8, 1, FALSE, NULL); - expect(Ok, status); -todo_wine - expect(0x300, palette->Flags); - expect(16, palette->Count); - expect(0xff000000, palette->Entries[0]); - expect(0xffc0c0c0, palette->Entries[8]); - expect(0xff008080, palette->Entries[15]); - - memset(palette->Entries, 0x11, sizeof(ARGB) * 256); - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone8, 1, FALSE, bitmap); - expect(Ok, status); -todo_wine - expect(0x300, palette->Flags); - expect(16, palette->Count); - expect(0xff000000, palette->Entries[0]); - expect(0xffc0c0c0, palette->Entries[8]); - expect(0xff008080, palette->Entries[15]); - - memset(palette->Entries, 0x11, sizeof(ARGB) * 256); - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone252, 1, FALSE, bitmap); - expect(Ok, status); -todo_wine - expect(0x800, palette->Flags); - expect(252, palette->Count); - expect(0xff000000, palette->Entries[0]); - expect(0xff990066, palette->Entries[128]); - expect(0xffffffff, palette->Entries[251]); - - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeOptimal, 1, FALSE, bitmap); - expect(InvalidParameter, status); - - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeOptimal, 2, FALSE, bitmap); - expect(Ok, status); - expect(0, palette->Flags); - expect(2, palette->Count); - - palette->Flags = 0; - palette->Count = 256; - status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, bitmap); - expect(Ok, status); - expect(0, palette->Flags); - expect(16, palette->Count); - - /* passing invalid enumeration palette type crashes under most Windows versions */ - - GdipFree(palette); - GdipDisposeImage((GpImage *)bitmap); -} - -#include "pshpack2.h" -static const struct tiff_1x1_data -{ - USHORT byte_order; - USHORT version; - ULONG dir_offset; - USHORT number_of_entries; - struct IFD_entry entry[12]; - ULONG next_IFD; - struct IFD_rational res; - short palette_data[3][256]; - short bps_data[4]; - BYTE pixel_data[32]; -} tiff_1x1_data = -{ -#ifdef WORDS_BIGENDIAN - 'M' | 'M' << 8, -#else - 'I' | 'I' << 8, -#endif - 42, - FIELD_OFFSET(struct tiff_1x1_data, number_of_entries), - 12, - { - { 0xff, IFD_SHORT, 1, 0 }, /* SUBFILETYPE */ - { 0x100, IFD_LONG, 1, 1 }, /* IMAGEWIDTH */ - { 0x101, IFD_LONG, 1, 1 }, /* IMAGELENGTH */ - { 0x102, IFD_SHORT, 3, FIELD_OFFSET(struct tiff_1x1_data, bps_data) }, /* BITSPERSAMPLE */ - { 0x103, IFD_SHORT, 1, 1 }, /* COMPRESSION: XP doesn't accept IFD_LONG here */ - { 0x106, IFD_SHORT, 1, 2 }, /* PHOTOMETRIC */ - { 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_1x1_data, pixel_data) }, /* STRIPOFFSETS */ - { 0x115, IFD_SHORT, 1, 3 }, /* SAMPLESPERPIXEL */ - { 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) }, - { 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) }, - { 0x128, IFD_SHORT, 1, 2 }, /* RESOLUTIONUNIT */ - { 0x140, IFD_SHORT, 256*3, FIELD_OFFSET(struct tiff_1x1_data, palette_data) } /* COLORMAP */ - }, - 0, - { 96, 1 }, - { { 0 } }, - { 8,8,8,0 }, - { 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 } -}; -#include "poppack.h" - -static void test_tiff_color_formats(void) -{ - static const struct - { - int photometric; /* PhotometricInterpretation */ - int samples; /* SamplesPerPixel */ - int bps; /* BitsPerSample */ - PixelFormat format; - } td[] = - { - /* 2 - RGB */ - { 2, 3, 1, PixelFormat24bppRGB }, - { 2, 3, 4, PixelFormat24bppRGB }, - { 2, 3, 8, PixelFormat24bppRGB }, - { 2, 3, 16, PixelFormat48bppRGB }, - { 2, 3, 24, 0 }, -#if 0 /* FIXME */ - { 2, 3, 32, 0 }, -#endif - { 2, 4, 1, PixelFormat32bppARGB }, - { 2, 4, 4, PixelFormat32bppARGB }, - { 2, 4, 8, PixelFormat32bppARGB }, - { 2, 4, 16, PixelFormat48bppRGB }, - { 2, 4, 24, 0 }, - { 2, 4, 32, 0 }, - /* 1 - BlackIsZero (Bilevel) */ - { 1, 1, 1, PixelFormat1bppIndexed }, -#if 0 /* FIXME: PNG vs TIFF mismatch */ - { 1, 1, 4, PixelFormat8bppIndexed }, -#endif - { 1, 1, 8, PixelFormat8bppIndexed }, - { 1, 1, 16, PixelFormat32bppARGB }, - { 1, 1, 24, 0 }, - { 1, 1, 32, PixelFormat32bppARGB }, - /* 3 - Palette Color */ - { 3, 1, 1, PixelFormat1bppIndexed }, - { 3, 1, 4, PixelFormat4bppIndexed }, - { 3, 1, 8, PixelFormat8bppIndexed }, -#if 0 /* FIXME: for some reason libtiff replaces photometric 3 by 1 for bps > 8 */ - { 3, 1, 16, 0 }, - { 3, 1, 24, 0 }, - { 3, 1, 32, 0 }, -#endif - /* 5 - Separated */ - { 5, 4, 1, 0 }, - { 5, 4, 4, 0 }, - { 5, 4, 8, PixelFormat32bppCMYK }, - { 5, 4, 16, PixelFormat48bppRGB }, - { 5, 4, 24, 0 }, - { 5, 4, 32, 0 }, - }; - BYTE buf[sizeof(tiff_1x1_data)]; - GpStatus status; - GpImage *image; - UINT count, i; - struct IFD_entry *tag, *tag_photo = NULL, *tag_bps = NULL, *tag_samples = NULL, *tag_colormap = NULL; - short *bps; - ImageType type; - PixelFormat format; - - memcpy(buf, &tiff_1x1_data, sizeof(tiff_1x1_data)); - - count = *(short *)(buf + tiff_1x1_data.dir_offset); - tag = (struct IFD_entry *)(buf + tiff_1x1_data.dir_offset + sizeof(short)); - - /* verify the TIFF structure */ - for (i = 0; i < count; i++) - { - if (tag[i].id == 0x102) /* BitsPerSample */ - tag_bps = &tag[i]; - else if (tag[i].id == 0x106) /* PhotometricInterpretation */ - tag_photo = &tag[i]; - else if (tag[i].id == 0x115) /* SamplesPerPixel */ - tag_samples = &tag[i]; - else if (tag[i].id == 0x140) /* ColorMap */ - tag_colormap = &tag[i]; - } - - ok(tag_bps && tag_photo && tag_samples && tag_colormap, "tag 0x102,0x106,0x115 or 0x140 is missing\n"); - if (!tag_bps || !tag_photo || !tag_samples || !tag_colormap) return; - - ok(tag_bps->type == IFD_SHORT, "tag 0x102 should have type IFD_SHORT\n"); - bps = (short *)(buf + tag_bps->value); - ok(bps[0] == 8 && bps[1] == 8 && bps[2] == 8 && bps[3] == 0, - "expected bps 8,8,8,0 got %d,%d,%d,%d\n", bps[0], bps[1], bps[2], bps[3]); - - for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) - { - tag_colormap->count = (1 << td[i].bps) * 3; - tag_photo->value = td[i].photometric; - tag_bps->count = td[i].samples; - tag_samples->value = td[i].samples; - - if (td[i].samples == 1) - tag_bps->value = td[i].bps; - else if (td[i].samples == 2) - tag_bps->value = MAKELONG(td[i].bps, td[i].bps); - else if (td[i].samples == 3) - { - tag_bps->value = (BYTE *)bps - buf; - bps[0] = bps[1] = bps[2] = td[i].bps; - } - else if (td[i].samples == 4) - { - tag_bps->value = (BYTE *)bps - buf; - bps[0] = bps[1] = bps[2] = bps[3] = td[i].bps; - } - else - { - ok(0, "%u: unsupported samples count %d\n", i, td[i].samples); - continue; - } - - image = load_image(buf, sizeof(buf)); - if (!td[i].format) - ok(!image, - "%u: (%d,%d,%d) TIFF image loading should have failed\n", i, td[i].photometric, td[i].samples, td[i].bps); - else - ok(image != NULL || broken(!image) /* XP */, "%u: failed to load TIFF image data (%d,%d,%d)\n", - i, td[i].photometric, td[i].samples, td[i].bps); - if (!image) continue; - - status = GdipGetImageType(image, &type); - ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status); - ok(type == ImageTypeBitmap, "%u: wrong image type %d\n", i, type); - - status = GdipGetImagePixelFormat(image, &format); - expect(Ok, status); - ok(format == td[i].format, - "%u: expected %#x, got %#x\n", i, td[i].format, format); - - GdipDisposeImage(image); - } -} - START_TEST(image) { HMODULE mod = GetModuleHandleA("gdiplus.dll"); @@ -5382,8 +5192,6 @@ START_TEST(image) pGdipBitmapGetHistogram = (void*)GetProcAddress(mod, "GdipBitmapGetHistogram"); pGdipImageSetAbort = (void*)GetProcAddress(mod, "GdipImageSetAbort"); - test_tiff_color_formats(); - test_GdipInitializePalette(); test_png_color_formats(); test_supported_encoders(); test_CloneBitmapArea(); diff --git a/modules/rostests/winetests/gdiplus/matrix.c b/modules/rostests/winetests/gdiplus/matrix.c index b6c04f62ea8..719b6a02518 100644 --- a/modules/rostests/winetests/gdiplus/matrix.c +++ b/modules/rostests/winetests/gdiplus/matrix.c @@ -159,6 +159,7 @@ static void test_invert(void) GdipCreateMatrix2(2.0/16.0, 2.0/16.0, -5.0/16.0, 3.0/16.0, 3.0/16.0, -21.0/16.0, &inverted); GdipIsMatrixEqual(matrix, inverted, &equal); expect(TRUE, equal); + GdipDeleteMatrix(matrix); GdipCreateMatrix2(0.0006, 0, 0, 0.0006, 400, 400, &matrix); status = GdipInvertMatrix(matrix); diff --git a/modules/rostests/winetests/gdiplus/metafile.c b/modules/rostests/winetests/gdiplus/metafile.c index b4bf38a6fd0..49f06ca5aa8 100644 --- a/modules/rostests/winetests/gdiplus/metafile.c +++ b/modules/rostests/winetests/gdiplus/metafile.c @@ -29,11 +29,13 @@ static BOOL load_metafiles; typedef struct emfplus_record { + DWORD record_type; + DWORD flags; /* Used for EMF+ records only. */ BOOL todo; - ULONG record_type; BOOL playback_todo; void (*playback_fn)(GpMetafile* metafile, EmfPlusRecordType record_type, unsigned int flags, unsigned int dataSize, const unsigned char *pStr); + DWORD broken_flags; } emfplus_record; typedef struct emfplus_check_state @@ -46,10 +48,21 @@ typedef struct emfplus_check_state static void check_record(int count, const char *desc, const struct emfplus_record *expected, const struct emfplus_record *actual) { + if (actual->record_type > GDIP_EMFPLUS_RECORD_BASE) + { + todo_wine_if (expected->todo) + ok(expected->record_type == actual->record_type && (expected->flags == actual->flags || + broken(expected->broken_flags == actual->flags)), + "%s.%i: Expected record type 0x%x, got 0x%x. Expected flags %#x, got %#x.\n", desc, count, + expected->record_type, actual->record_type, expected->flags, actual->flags); + } + else + { todo_wine_if (expected->todo) ok(expected->record_type == actual->record_type, - "%s.%i: Expected record type 0x%x, got 0x%x\n", desc, count, + "%s.%i: Expected record type 0x%x, got 0x%x.\n", desc, count, expected->record_type, actual->record_type); + } } typedef struct EmfPlusRecordHeader @@ -124,6 +137,7 @@ static int CALLBACK enum_emf_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETAR { actual.todo = FALSE; actual.record_type = record->Type; + actual.flags = record->Flags; check_record(state->count, state->desc, &state->expected[state->count], &actual); state->count++; @@ -163,6 +177,7 @@ static int CALLBACK enum_emf_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETAR { actual.todo = FALSE; actual.record_type = lpEMFR->iType; + actual.flags = 0; check_record(state->count, state->desc, &state->expected[state->count], &actual); @@ -198,6 +213,7 @@ static BOOL CALLBACK enum_metafile_proc(EmfPlusRecordType record_type, unsigned actual.todo = FALSE; actual.record_type = record_type; + actual.flags = flags; if (dataSize == 0) ok(pStr == NULL, "non-NULL pStr\n"); @@ -338,11 +354,11 @@ static void sync_metafile(GpMetafile **metafile, const char *filename) } static const emfplus_record empty_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_empty(void) @@ -537,17 +553,17 @@ static void test_empty(void) } static const emfplus_record getdc_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeGetDC}, - {0, EMR_CREATEBRUSHINDIRECT}, - {0, EMR_SELECTOBJECT}, - {0, EMR_RECTANGLE}, - {0, EMR_SELECTOBJECT}, - {0, EMR_DELETEOBJECT}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeGetDC }, + { EMR_CREATEBRUSHINDIRECT }, + { EMR_SELECTOBJECT }, + { EMR_RECTANGLE }, + { EMR_SELECTOBJECT }, + { EMR_DELETEOBJECT }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_getdc(void) @@ -675,34 +691,34 @@ static void test_getdc(void) } static const emfplus_record emfonly_records[] = { - {0, EMR_HEADER}, - {0, EMR_CREATEBRUSHINDIRECT}, - {0, EMR_SELECTOBJECT}, - {0, EMR_RECTANGLE}, - {0, EMR_SELECTOBJECT}, - {0, EMR_DELETEOBJECT}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EMR_CREATEBRUSHINDIRECT }, + { EMR_SELECTOBJECT }, + { EMR_RECTANGLE }, + { EMR_SELECTOBJECT }, + { EMR_DELETEOBJECT }, + { EMR_EOF }, + { 0 } }; static const emfplus_record emfonly_draw_records[] = { - {0, EMR_HEADER}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_SETMITERLIMIT}, - {1, EMR_MODIFYWORLDTRANSFORM}, - {1, EMR_EXTCREATEPEN}, - {1, EMR_SELECTOBJECT}, - {1, EMR_SELECTOBJECT}, - {1, EMR_POLYLINE16}, - {1, EMR_SELECTOBJECT}, - {1, EMR_SELECTOBJECT}, - {1, EMR_MODIFYWORLDTRANSFORM}, - {1, EMR_DELETEOBJECT}, - {1, EMR_SETMITERLIMIT}, - {1, EMR_RESTOREDC}, - {0, EMR_EOF}, - {1} + { EMR_HEADER }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_SETMITERLIMIT, 0, 1 }, + { EMR_MODIFYWORLDTRANSFORM, 0, 1 }, + { EMR_EXTCREATEPEN, 0, 1 }, + { EMR_SELECTOBJECT, 0, 1 }, + { EMR_SELECTOBJECT, 0, 1 }, + { EMR_POLYLINE16, 0, 1 }, + { EMR_SELECTOBJECT, 0, 1 }, + { EMR_SELECTOBJECT, 0, 1 }, + { EMR_MODIFYWORLDTRANSFORM, 0, 1 }, + { EMR_DELETEOBJECT, 0, 1 }, + { EMR_SETMITERLIMIT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EMR_EOF }, + { 0, 0, 1 } }; static void test_emfonly(void) @@ -998,12 +1014,12 @@ static void test_emfonly(void) } static const emfplus_record fillrect_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_fillrect(void) @@ -1108,16 +1124,16 @@ static void test_fillrect(void) } static const emfplus_record clear_emf_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeClear}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_BITBLT}, - {1, EMR_RESTOREDC}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeClear }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_clear(void) @@ -1312,20 +1328,20 @@ static void test_nullframerect(void) { } static const emfplus_record pagetransform_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeSetPageTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeSetPageTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeSetPageTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeSetPageTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeSetPageTransform, UnitPixel }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeSetPageTransform, UnitPixel }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeSetPageTransform, UnitInch }, + { EmfPlusRecordTypeFillRects, 0x8000 }, + { EmfPlusRecordTypeSetPageTransform, UnitDisplay }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_pagetransform(void) @@ -1513,24 +1529,24 @@ static void test_pagetransform(void) } static const emfplus_record worldtransform_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeScaleWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeResetWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeMultiplyWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeRotateWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeSetWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeTranslateWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeScaleWorldTransform }, + { EmfPlusRecordTypeFillRects, 0x8000 }, + { EmfPlusRecordTypeResetWorldTransform }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeMultiplyWorldTransform }, + { EmfPlusRecordTypeFillRects, 0x8000 }, + { EmfPlusRecordTypeRotateWorldTransform, 0x2000 }, + { EmfPlusRecordTypeFillRects, 0x8000 }, + { EmfPlusRecordTypeSetWorldTransform }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeTranslateWorldTransform, 0x2000 }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_worldtransform(void) @@ -1938,29 +1954,29 @@ static void test_frameunit(void) } static const emfplus_record container_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeBeginContainerNoParams}, - {0, EmfPlusRecordTypeScaleWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeEndContainer}, - {0, EmfPlusRecordTypeScaleWorldTransform}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeSave}, - {0, EmfPlusRecordTypeRestore}, - {0, EmfPlusRecordTypeScaleWorldTransform}, - {0, EmfPlusRecordTypeBeginContainerNoParams}, - {0, EmfPlusRecordTypeScaleWorldTransform}, - {0, EmfPlusRecordTypeBeginContainerNoParams}, - {0, EmfPlusRecordTypeEndContainer}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeBeginContainer}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeEndContainer}, - {0, EmfPlusRecordTypeBeginContainerNoParams}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeBeginContainerNoParams }, + { EmfPlusRecordTypeScaleWorldTransform }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeEndContainer }, + { EmfPlusRecordTypeScaleWorldTransform }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeSave }, + { EmfPlusRecordTypeRestore }, + { EmfPlusRecordTypeScaleWorldTransform }, + { EmfPlusRecordTypeBeginContainerNoParams }, + { EmfPlusRecordTypeScaleWorldTransform }, + { EmfPlusRecordTypeBeginContainerNoParams }, + { EmfPlusRecordTypeEndContainer }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeBeginContainer, UnitInch }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeEndContainer }, + { EmfPlusRecordTypeBeginContainerNoParams }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_containers(void) @@ -2142,19 +2158,19 @@ static void test_containers(void) } static const emfplus_record clipping_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeSave}, - {0, EmfPlusRecordTypeSetClipRect}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeRestore}, - {0, EmfPlusRecordTypeSetClipRect}, - {0, EmfPlusRecordTypeFillRects}, - {0, EmfPlusRecordTypeObject, 1}, - {0, EmfPlusRecordTypeSetClipRegion, 1}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeSave }, + { EmfPlusRecordTypeSetClipRect }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeRestore }, + { EmfPlusRecordTypeSetClipRect, 0x300 }, + { EmfPlusRecordTypeFillRects, 0xc000 }, + { EmfPlusRecordTypeObject, ObjectTypeRegion << 8 }, + { EmfPlusRecordTypeSetClipRegion, 0x100 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_clipping(void) @@ -2291,14 +2307,14 @@ static void test_gditransform_cb(GpMetafile* metafile, EmfPlusRecordType record_ } static const emfplus_record gditransform_records[] = { - {0, EMR_HEADER}, - {0, EMR_CREATEBRUSHINDIRECT}, - {0, EMR_SELECTOBJECT}, - {0, EMR_GDICOMMENT, 0, test_gditransform_cb}, - {0, EMR_SELECTOBJECT}, - {0, EMR_DELETEOBJECT}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EMR_CREATEBRUSHINDIRECT }, + { EMR_SELECTOBJECT }, + { EMR_GDICOMMENT, 0, 0, 0, test_gditransform_cb }, + { EMR_SELECTOBJECT }, + { EMR_DELETEOBJECT }, + { EMR_EOF }, + { 0 } }; static void test_gditransform(void) @@ -2395,45 +2411,45 @@ static void test_gditransform(void) } static const emfplus_record draw_image_bitmap_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeDrawImagePoints}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_BITBLT}, - {1, EMR_RESTOREDC}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypeImage << 8 }, + { EmfPlusRecordTypeObject, (ObjectTypeImageAttributes << 8) | 1 }, + { EmfPlusRecordTypeDrawImagePoints, 0, 0, 0, NULL, 0x4000 }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static const emfplus_record draw_image_metafile_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeObject}, + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypeImage << 8 }, /* metafile object */ - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeDrawImagePoints}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_BITBLT}, - {1, EMR_RESTOREDC}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypeImage << 8 }, + { EmfPlusRecordTypeObject, (ObjectTypeImageAttributes << 8) | 1 }, + { EmfPlusRecordTypeDrawImagePoints }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, /* end of metafile object */ - {0, EmfPlusRecordTypeDrawImagePoints}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_BITBLT}, - {1, EMR_RESTOREDC}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EmfPlusRecordTypeDrawImagePoints }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_drawimage(void) @@ -2538,17 +2554,17 @@ static void test_drawimage(void) } static const emfplus_record properties_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeSetTextRenderingHint}, - {0, EmfPlusRecordTypeSetPixelOffsetMode}, - {0, EmfPlusRecordTypeSetAntiAliasMode}, - {0, EmfPlusRecordTypeSetCompositingMode}, - {0, EmfPlusRecordTypeSetCompositingQuality}, - {0, EmfPlusRecordTypeSetInterpolationMode}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeSetTextRenderingHint, TextRenderingHintAntiAlias }, + { EmfPlusRecordTypeSetPixelOffsetMode, PixelOffsetModeHighQuality }, + { EmfPlusRecordTypeSetAntiAliasMode, (SmoothingModeAntiAlias << 1) | 1, 0, 0, NULL, 0x1 }, + { EmfPlusRecordTypeSetCompositingMode, CompositingModeSourceCopy }, + { EmfPlusRecordTypeSetCompositingQuality, CompositingQualityHighQuality }, + { EmfPlusRecordTypeSetInterpolationMode, InterpolationModeHighQualityBicubic }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_properties(void) @@ -2615,18 +2631,18 @@ static void test_properties(void) } static const emfplus_record draw_path_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeDrawPath}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_BITBLT}, - {1, EMR_RESTOREDC}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypePen << 8 }, + { EmfPlusRecordTypeObject, (ObjectTypePath << 8) | 1 }, + { EmfPlusRecordTypeDrawPath, 1 }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_drawpath(void) @@ -2681,17 +2697,17 @@ static void test_drawpath(void) } static const emfplus_record fill_path_records[] = { - {0, EMR_HEADER}, - {0, EmfPlusRecordTypeHeader}, - {0, EmfPlusRecordTypeObject}, - {0, EmfPlusRecordTypeFillPath}, - {1, EMR_SAVEDC}, - {1, EMR_SETICMMODE}, - {1, EMR_BITBLT}, - {1, EMR_RESTOREDC}, - {0, EmfPlusRecordTypeEndOfFile}, - {0, EMR_EOF}, - {0} + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypePath << 8 }, + { EmfPlusRecordTypeFillPath, 0x8000 }, + { EMR_SAVEDC, 0, 1 }, + { EMR_SETICMMODE, 0, 1 }, + { EMR_BITBLT, 0, 1 }, + { EMR_RESTOREDC, 0, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } }; static void test_fillpath(void) diff --git a/modules/rostests/winetests/gdiplus/pathiterator.c b/modules/rostests/winetests/gdiplus/pathiterator.c index 753ea64cba2..bb8a1e7ed06 100644 --- a/modules/rostests/winetests/gdiplus/pathiterator.c +++ b/modules/rostests/winetests/gdiplus/pathiterator.c @@ -78,7 +78,8 @@ static void test_hascurve(void) GdipDeletePathIter(iter); - GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0); + stat = GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0); + expect(Ok, stat); stat = GdipCreatePathIter(&iter, path); expect(Ok, stat); @@ -328,9 +329,12 @@ static void test_isvalid(void) GdipDeletePathIter(iter); /* no markers */ - GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0); - GdipCreatePathIter(&iter, path); - GdipPathIterNextMarker(iter, &result, &start, &end); + stat = GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0); + expect(Ok, stat); + stat = GdipCreatePathIter(&iter, path); + expect(Ok, stat); + stat = GdipPathIterNextMarker(iter, &result, &start, &end); + expect(Ok, stat); isvalid = FALSE; stat = GdipPathIterIsValid(iter, &isvalid); expect(Ok, stat); @@ -525,7 +529,8 @@ static void test_nextpathtype(void) todo_wine expect(0, result); GdipDeletePathIter(iter); - GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0); + stat = GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0); + expect(Ok, stat); GdipCreatePathIter(&iter, path); start = end = result = (INT)0xdeadbeef; type = 255; /* out of range */ diff --git a/modules/rostests/winetests/gdiplus/resource.rc b/modules/rostests/winetests/gdiplus/resource.rc new file mode 100644 index 00000000000..d7d915ce001 --- /dev/null +++ b/modules/rostests/winetests/gdiplus/resource.rc @@ -0,0 +1,22 @@ +/* + * Resources for gdiplus test suite. + * + * Copyright 2017 Fabian Maurer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* @makedep: wine_longname.ttf */ +1 RCDATA wine_longname.ttf diff --git a/modules/rostests/winetests/gdiplus/wine_longname.sfd b/modules/rostests/winetests/gdiplus/wine_longname.sfd new file mode 100644 index 00000000000..998d7cc01fb --- /dev/null +++ b/modules/rostests/winetests/gdiplus/wine_longname.sfd @@ -0,0 +1,66 @@ +SplineFontDB: 3.0 +FontName: wine_1_this_is_a_very_long_name_that_might_be_too_long_for_gdi32 +FullName: wine_2_this_is_a_very_long_name_that_might_be_too_long_for_gdi32 +FamilyName: wine_3_this_is_a_very_long_name_that_might_be_too_long_for_gdi32 +Weight: Regular +Copyright: Copyright (c) 2017, Fabian Maurer +UComments: "2017-11-17: Created with FontForge (http://fontforge.org)" +Version: 001.000 +ItalicAngle: 0 +UnderlinePosition: -102.4 +UnderlineWidth: 51.2 +Ascent: 819 +Descent: 205 +InvalidEm: 0 +LayerCount: 2 +Layer: 0 0 "Back" 1 +Layer: 1 0 "Fore" 0 +XUID: [1021 48 28337276 3092883] +OS2Version: 0 +OS2_WeightWidthSlopeOnly: 0 +OS2_UseTypoMetrics: 1 +CreationTime: 1510948643 +ModificationTime: 1510949092 +OS2TypoAscent: 0 +OS2TypoAOffset: 1 +OS2TypoDescent: 0 +OS2TypoDOffset: 1 +OS2TypoLinegap: 0 +OS2WinAscent: 0 +OS2WinAOffset: 1 +OS2WinDescent: 0 +OS2WinDOffset: 1 +HheadAscent: 0 +HheadAOffset: 1 +HheadDescent: 0 +HheadDOffset: 1 +OS2Vendor: 'PfEd' +MarkAttachClasses: 1 +DEI: 91125 +Encoding: ISO8859-1 +UnicodeInterp: none +NameList: AGL For New Fonts +DisplaySize: -48 +AntiAlias: 1 +FitToEm: 0 +WinInfo: 64 16 4 +BeginPrivate: 0 +EndPrivate +BeginChars: 256 1 + +StartChar: at +Encoding: 64 64 0 +Width: 1024 +VWidth: 0 +Flags: HW +LayerCount: 2 +Fore +SplineSet +259 332 m 29 + 468 664 l 29 + 514 332 l 29 + 259 332 l 29 +EndSplineSet +EndChar +EndChars +EndSplineFont diff --git a/modules/rostests/winetests/gdiplus/wine_longname.ttf b/modules/rostests/winetests/gdiplus/wine_longname.ttf new file mode 100644 index 0000000000000000000000000000000000000000..1a519c64ad4e6d7b042f560c0a9495d7c6d19043 GIT binary patch literal 2216 zcmdT_O^6&t6#lBZXLh5@{#=CM5;~g%vtgO^bce)*IgI%kbJ)cth6ORu>7D86X_)CA zdU`h*@GwUY33^oY;6W4?5qA*13L$AkuWEXC67aTQuzITM`(C|Q z_1>#D-4Fm~F@S;Fwc5=!GD@cJabA4&>a`l?aE!c7e(bf^&pI0g|7)tW$Zyv>eiw7a z2joAoU#@Rw7MA4OfU(GRGxU4i(TF=^x9|Km@IAF`is zQBXKy7P!|*@{_Gjc6SEi6#4h$^X;VWV-q)NZ;?OO@$YtV9T&NNo!pB3PH=Sn%^9wL z$m2igCcSL5gY!K4Wv-u5k*PlO!zaIbbCo~vyh#D@)~PQB2lEmjrQ9K(hE!5E+GxqG zvA&dgr}5f&G_}M$uu+ym%c>}86_YCOg0ac>;#J;}9!KBinh?dw z0Yb&1`jhP`51(9^V0HZeyy;qI-Ka-ZkW@Jq4sXD~6iT}SXDh=g6OWwTV&Uh?(2#`K zHI%rZ#KWng__H!(3LiP{!tsTd+=UZMV*dBNJ-PGO#*%DuJ7I`bR@{3k$KplOA4_6Y ztp5F_O5Q9!-@g+a$JHDQRPkGmC8os192-~{zvS3NReqJ@0_KgQIWDq}K2w!os(QQ3 zKE?tAG;=I5E0%L?;3M%$j!g{Yxf~Z@$;UY^Vql!X6(s1Qj}#F?w2-mNPNR-x&JJvp zaRDpDHK>1a#4#pYurgzji(|MSpmNu1S^Gz=`KWLuXkoeJkLsd(lg z9X^B&-c!mFjP&hUye(Dg>ekd_0UJTui;~!~?Q+SsZAvClm!Hi=>Zr?yxw!o=!f3#M o#pGi_m^bwy64W}Ox!^Zu^3|Nh3zRAizVq~ZNocKq+b3W62d7DFwg3PC literal 0 HcmV?d00001 -- 2.17.1