Module: wine Branch: master Commit: d84210f00aac49ba478077e1885987072f6b5efd URL: https://gitlab.winehq.org/wine/wine/-/commit/d84210f00aac49ba478077e18859870...
Author: Jeff Smith whydoubt@gmail.com Date: Wed Jul 12 16:58:35 2023 -0500
gdiplus/tests: Pare down image property tests that are not run for Wine.
---
dlls/gdiplus/tests/image.c | 102 ++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 61 deletions(-)
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 27b60d740cd..a2dcd448143 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -3679,7 +3679,7 @@ static void test_image_properties(void) { gifimage, sizeof(gifimage), ImageTypeBitmap, 1, 4, 4, ~0, 0x5100, ~0, 16 }, { wmfimage, sizeof(wmfimage), ImageTypeMetafile, 0, ~0, 0, ~0, 0, ~0, -GenericError } }; - GpStatus status; + GpStatus status, expected; GpImage *image; UINT prop_count, prop_size, i; PROPID prop_id[16] = { 0 }; @@ -3750,78 +3750,58 @@ static void test_image_properties(void) else expect(PropertyNotFound, status);
- /* FIXME: remove once Wine is fixed */ - if (!(td[i].prop_count == prop_count || (td[i].prop_count2 != ~0 && td[i].prop_count2 == prop_count))) - { - GdipDisposeImage(image); - winetest_pop_context(); - continue; - } - status = GdipGetPropertyIdList(NULL, prop_count, prop_id); expect(InvalidParameter, status); status = GdipGetPropertyIdList(image, prop_count, NULL); expect(InvalidParameter, status); - status = GdipGetPropertyIdList(image, 0, prop_id); - if (image_type == ImageTypeMetafile) - expect(NotImplemented, status); - else if (prop_count == 0) - expect(Ok, status); - else - expect(InvalidParameter, status); + expected = (image_type == ImageTypeMetafile) ? NotImplemented : InvalidParameter; status = GdipGetPropertyIdList(image, prop_count - 1, prop_id); - if (image_type == ImageTypeMetafile) - expect(NotImplemented, status); - else - expect(InvalidParameter, status); + expect(expected, status); status = GdipGetPropertyIdList(image, prop_count + 1, prop_id); - if (image_type == ImageTypeMetafile) - expect(NotImplemented, status); - else - expect(InvalidParameter, status); + expect(expected, status); + if (image_type != ImageTypeMetafile && prop_count == 0) + expected = Ok; + status = GdipGetPropertyIdList(image, 0, prop_id); + expect(expected, status); + expected = (image_type == ImageTypeMetafile) ? NotImplemented : Ok; status = GdipGetPropertyIdList(image, prop_count, prop_id); + expect(expected, status); + + status = GdipGetPropertyItemSize(image, prop_id[0], &prop_size); if (image_type == ImageTypeMetafile) expect(NotImplemented, status); - else + else if (prop_count == 0) + expect(PropertyNotFound, status); + /* FIXME: remove condition once Wine is fixed, i.e. this should just be an else */ + else if (td[i].prop_count == prop_count || (td[i].prop_count2 != ~0 && td[i].prop_count2 == prop_count)) { - expect(Ok, status); - if (prop_count != 0) - ok(td[i].prop_id == prop_id[0] || (td[i].prop_id2 != ~0 && td[i].prop_id2 == prop_id[0]), - "expected property id %#x or %#x, got %#lx\n", - td[i].prop_id, td[i].prop_id2, prop_id[0]); - } + ok(td[i].prop_id == prop_id[0] || (td[i].prop_id2 != ~0 && td[i].prop_id2 == prop_id[0]), + "expected property id %#x or %#x, got %#lx\n", + td[i].prop_id, td[i].prop_id2, prop_id[0]);
- if (status == Ok) - { - status = GdipGetPropertyItemSize(image, prop_id[0], &prop_size); - if (prop_count == 0) - expect(PropertyNotFound, status); - else - { - expect(Ok, status); + expect(Ok, status);
- assert(sizeof(item) >= prop_size); - ok(prop_size > sizeof(PropertyItem), "got too small prop_size %u\n", - prop_size); - ok(td[i].prop_size + sizeof(PropertyItem) == prop_size || - (td[i].prop_size2 != ~0 && td[i].prop_size2 + sizeof(PropertyItem) == prop_size), - "expected property size (%u or %u)+%u, got %u\n", - td[i].prop_size, td[i].prop_size2, (UINT) sizeof(PropertyItem), prop_size); - - status = GdipGetPropertyItem(image, prop_id[0], 0, &item.data); - ok(status == InvalidParameter || status == GenericError /* Win7 */, - "expected InvalidParameter, got %d\n", status); - status = GdipGetPropertyItem(image, prop_id[0], prop_size - 1, &item.data); - ok(status == InvalidParameter || status == GenericError /* Win7 */, - "expected InvalidParameter, got %d\n", status); - status = GdipGetPropertyItem(image, prop_id[0], prop_size + 1, &item.data); - ok(status == InvalidParameter || status == GenericError /* Win7 */, - "expected InvalidParameter, got %d\n", status); - status = GdipGetPropertyItem(image, prop_id[0], prop_size, &item.data); - expect(Ok, status); - ok(prop_id[0] == item.data.id, - "expected property id %#lx, got %#lx\n", prop_id[0], item.data.id); - } + assert(sizeof(item) >= prop_size); + ok(prop_size > sizeof(PropertyItem), "got too small prop_size %u\n", + prop_size); + ok(td[i].prop_size + sizeof(PropertyItem) == prop_size || + (td[i].prop_size2 != ~0 && td[i].prop_size2 + sizeof(PropertyItem) == prop_size), + "expected property size (%u or %u)+%u, got %u\n", + td[i].prop_size, td[i].prop_size2, (UINT) sizeof(PropertyItem), prop_size); + + status = GdipGetPropertyItem(image, prop_id[0], 0, &item.data); + ok(status == InvalidParameter || status == GenericError /* Win7 */, + "expected InvalidParameter, got %d\n", status); + status = GdipGetPropertyItem(image, prop_id[0], prop_size - 1, &item.data); + ok(status == InvalidParameter || status == GenericError /* Win7 */, + "expected InvalidParameter, got %d\n", status); + status = GdipGetPropertyItem(image, prop_id[0], prop_size + 1, &item.data); + ok(status == InvalidParameter || status == GenericError /* Win7 */, + "expected InvalidParameter, got %d\n", status); + status = GdipGetPropertyItem(image, prop_id[0], prop_size, &item.data); + expect(Ok, status); + ok(prop_id[0] == item.data.id, + "expected property id %#lx, got %#lx\n", prop_id[0], item.data.id); }
GdipDisposeImage(image);