Commit 741037ca authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

gdiplus/tests: Use the available ARRAY_SIZE() macro.

parent 07277ae1
...@@ -3721,7 +3721,7 @@ static void test_GdipMeasureString(void) ...@@ -3721,7 +3721,7 @@ static void test_GdipMeasureString(void)
expect(Ok, status); expect(Ok, status);
expect(UnitPixel, font_unit); expect(UnitPixel, font_unit);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
GpImage *image; GpImage *image;
...@@ -3799,7 +3799,7 @@ todo_wine ...@@ -3799,7 +3799,7 @@ todo_wine
expect(Ok, status); expect(Ok, status);
expect(unit, font_unit); expect(unit, font_unit);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
REAL unit_scale; REAL unit_scale;
GpImage *image; GpImage *image;
...@@ -3883,7 +3883,7 @@ todo_wine ...@@ -3883,7 +3883,7 @@ todo_wine
} }
/* Font with units = UnitWorld */ /* Font with units = UnitWorld */
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
GpPointF pt = {0.0, 100.0}; GpPointF pt = {0.0, 100.0};
GpImage* image; GpImage* image;
...@@ -3972,7 +3972,7 @@ static void test_transform(void) ...@@ -3972,7 +3972,7 @@ static void test_transform(void)
GpPointF ptf[2]; GpPointF ptf[2];
UINT i; UINT i;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale, &image); graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale, &image);
ptf[0].X = td[i].in[0].X; ptf[0].X = td[i].in[0].X;
...@@ -4032,7 +4032,7 @@ static void test_pen_thickness(void) ...@@ -4032,7 +4032,7 @@ static void test_pen_thickness(void)
BitmapData bd; BitmapData bd;
INT min, max, size; INT min, max, size;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &u.bitmap); status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &u.bitmap);
expect(Ok, status); expect(Ok, status);
......
...@@ -55,10 +55,10 @@ static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo) ...@@ -55,10 +55,10 @@ static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo)
char buffer[39]; char buffer[39];
char buffer2[39]; char buffer2[39];
StringFromGUID2(got, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); StringFromGUID2(got, bufferW, ARRAY_SIZE(bufferW));
WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL); WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL);
StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); StringFromGUID2(expected, bufferW, ARRAY_SIZE(bufferW));
WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL); WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer2, sizeof(buffer2), NULL, NULL);
todo_wine_if (todo) todo_wine_if (todo)
ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer); ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
} }
...@@ -3311,7 +3311,7 @@ static void test_image_properties(void) ...@@ -3311,7 +3311,7 @@ static void test_image_properties(void)
char buf[256]; char buf[256];
} item; } item;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
image = load_image(td[i].image_data, td[i].image_size); image = load_image(td[i].image_data, td[i].image_size);
if (!image) if (!image)
...@@ -3629,9 +3629,9 @@ static void test_tiff_properties(void) ...@@ -3629,9 +3629,9 @@ static void test_tiff_properties(void)
prop_count = 0xdeadbeef; prop_count = 0xdeadbeef;
status = GdipGetPropertyCount(image, &prop_count); status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status); expect(Ok, status);
ok(prop_count == sizeof(td)/sizeof(td[0]) || ok(prop_count == ARRAY_SIZE(td) ||
broken(prop_count == sizeof(td)/sizeof(td[0]) - 1) /* Win7 SP0 */, broken(prop_count == ARRAY_SIZE(td) - 1) /* Win7 SP0 */,
"expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count); "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id)); prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
...@@ -3739,8 +3739,8 @@ static void test_GdipGetAllPropertyItems(void) ...@@ -3739,8 +3739,8 @@ static void test_GdipGetAllPropertyItems(void)
prop_count = 0xdeadbeef; prop_count = 0xdeadbeef;
status = GdipGetPropertyCount(image, &prop_count); status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status); expect(Ok, status);
ok(prop_count == sizeof(td)/sizeof(td[0]), ok(prop_count == ARRAY_SIZE(td),
"expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count); "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id)); prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
...@@ -4014,7 +4014,7 @@ static void test_bitmapbits(void) ...@@ -4014,7 +4014,7 @@ static void test_bitmapbits(void)
} palette; } palette;
ARGB *entries = palette.pal.Entries; ARGB *entries = palette.pal.Entries;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
BYTE pixels[sizeof(pixels_24)]; BYTE pixels[sizeof(pixels_24)];
memcpy(pixels, pixels_24, sizeof(pixels_24)); memcpy(pixels, pixels_24, sizeof(pixels_24));
...@@ -4283,7 +4283,7 @@ static void test_image_format(void) ...@@ -4283,7 +4283,7 @@ static void test_image_format(void)
BitmapData data; BitmapData data;
UINT i, ret; UINT i, ret;
for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++) for (i = 0; i < ARRAY_SIZE(fmt); i++)
{ {
status = GdipCreateBitmapFromScan0(1, 1, 0, fmt[i], NULL, &bitmap); status = GdipCreateBitmapFromScan0(1, 1, 0, fmt[i], NULL, &bitmap);
ok(status == Ok || broken(status == InvalidParameter) /* before win7 */, ok(status == Ok || broken(status == InvalidParameter) /* before win7 */,
...@@ -4435,7 +4435,7 @@ static void test_DrawImage_scale(void) ...@@ -4435,7 +4435,7 @@ static void test_DrawImage_scale(void)
status = GdipSetInterpolationMode(graphics, InterpolationModeNearestNeighbor); status = GdipSetInterpolationMode(graphics, InterpolationModeNearestNeighbor);
expect(Ok, status); expect(Ok, status);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
status = GdipSetPixelOffsetMode(graphics, td[i].pixel_offset_mode); status = GdipSetPixelOffsetMode(graphics, td[i].pixel_offset_mode);
expect(Ok, status); expect(Ok, status);
...@@ -4541,10 +4541,10 @@ static void test_gif_properties(void) ...@@ -4541,10 +4541,10 @@ static void test_gif_properties(void)
status = GdipGetPropertyCount(image, &prop_count); status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status); expect(Ok, status);
ok(prop_count == sizeof(td)/sizeof(td[0]) || broken(prop_count == 1) /* before win7 */, ok(prop_count == ARRAY_SIZE(td) || broken(prop_count == 1) /* before win7 */,
"expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count); "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
if (prop_count != sizeof(td)/sizeof(td[0])) if (prop_count != ARRAY_SIZE(td))
{ {
GdipDisposeImage(image); GdipDisposeImage(image);
return; return;
...@@ -4818,7 +4818,7 @@ static void test_supported_encoders(void) ...@@ -4818,7 +4818,7 @@ static void test_supported_encoders(void)
status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bm); status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bm);
ok(status == Ok, "GdipCreateBitmapFromScan0 error %d\n", status); ok(status == Ok, "GdipCreateBitmapFromScan0 error %d\n", status);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
ret = get_encoder_clsid(td[i].mime, &format, &clsid); ret = get_encoder_clsid(td[i].mime, &format, &clsid);
ok(ret, "%s encoder is not in the list\n", wine_dbgstr_w(td[i].mime)); ok(ret, "%s encoder is not in the list\n", wine_dbgstr_w(td[i].mime));
...@@ -4868,7 +4868,7 @@ static void test_createeffect(void) ...@@ -4868,7 +4868,7 @@ static void test_createeffect(void)
stat = pGdipCreateEffect(noneffect, &effect); stat = pGdipCreateEffect(noneffect, &effect);
todo_wine expect(Win32Error, stat); todo_wine expect(Win32Error, stat);
for(i=0; i < sizeof(effectlist) / sizeof(effectlist[0]); i++) for(i=0; i < ARRAY_SIZE(effectlist); i++)
{ {
stat = pGdipCreateEffect(*effectlist[i], &effect); stat = pGdipCreateEffect(*effectlist[i], &effect);
todo_wine expect(Ok, stat); todo_wine expect(Ok, stat);
...@@ -4981,7 +4981,7 @@ static void test_histogram(void) ...@@ -4981,7 +4981,7 @@ static void test_histogram(void)
expect(Ok, stat); expect(Ok, stat);
expect(256, num); expect(256, num);
for (i = 0; i < sizeof(test_formats)/sizeof(test_formats[0]); i++) for (i = 0; i < ARRAY_SIZE(test_formats); i++)
{ {
num = 0; num = 0;
stat = pGdipBitmapGetHistogramSize(test_formats[i], &num); stat = pGdipBitmapGetHistogramSize(test_formats[i], &num);
...@@ -5131,7 +5131,7 @@ static void test_png_color_formats(void) ...@@ -5131,7 +5131,7 @@ static void test_png_color_formats(void)
UINT flags; UINT flags;
int i; int i;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) for (i = 0; i < ARRAY_SIZE(td); i++)
{ {
memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); memcpy(buf, png_1x1_data, sizeof(png_1x1_data));
buf[24] = td[i].bit_depth; buf[24] = td[i].bit_depth;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment