gdiplus/tests: Add some missing return value checks (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-01-06 18:27:58 +03:00 committed by Alexandre Julliard
parent 3bacfc3005
commit a3ed938e4a
4 changed files with 33 additions and 17 deletions

View file

@ -159,7 +159,8 @@ static void test_createfont(void)
expect(Ok, stat);
GdipGetFontSize (font, &size);
ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i);
GdipGetFontUnit (font, &unit);
stat = GdipGetFontUnit (font, &unit);
ok (stat == Ok, "Failed to get font unit, %d.\n", stat);
expect (i, unit);
GdipDeleteFont(font);
}

View file

@ -347,7 +347,8 @@ static void test_save_restore(void)
log_state(state_a, &state_log);
/* A state created by BeginContainer cannot be restored with RestoreGraphics. */
GdipCreateFromHDC(hdc, &graphics1);
stat = GdipCreateFromHDC(hdc, &graphics1);
expect(Ok, stat);
GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
stat = GdipBeginContainer2(graphics1, &state_a);
expect(Ok, stat);
@ -703,7 +704,8 @@ static void test_BeginContainer2(void)
GdipGetTextContrast(graphics, &contrast);
ok(defContrast == contrast, "Expected Text Contrast to be restored to %d, got %d\n", defContrast, contrast);
GdipGetTextRenderingHint(graphics, &texthint);
status = GdipGetTextRenderingHint(graphics, &texthint);
expect(Ok, status);
ok(defTexthint == texthint, "Expected Text Hint to be restored to %d, got %d\n", defTexthint, texthint);
/* test world transform */
@ -722,7 +724,8 @@ static void test_BeginContainer2(void)
status = GdipCreateMatrix2(10, 20, 30, 40, 50, 60, &transform);
expect(Ok, status);
GdipSetWorldTransform(graphics, transform);
status = GdipSetWorldTransform(graphics, transform);
expect(Ok, status);
GdipDeleteMatrix(transform);
transform = NULL;
@ -731,7 +734,8 @@ static void test_BeginContainer2(void)
status = GdipCreateMatrix(&transform);
expect(Ok, status);
GdipGetWorldTransform(graphics, transform);
status = GdipGetWorldTransform(graphics, transform);
expect(Ok, status);
status = GdipGetMatrixElements(transform, elems);
expect(Ok, status);
ok(fabs(defTrans[0] - elems[0]) < 0.0001 &&
@ -753,12 +757,14 @@ static void test_BeginContainer2(void)
status = GdipBeginContainer2(graphics, &cont1);
expect(Ok, status);
GdipSetClipRect(graphics, defClip[0], defClip[1], defClip[2], defClip[3], CombineModeReplace);
status = GdipSetClipRect(graphics, defClip[0], defClip[1], defClip[2], defClip[3], CombineModeReplace);
expect(Ok, status);
status = GdipBeginContainer2(graphics, &cont2);
expect(Ok, status);
GdipSetClipRect(graphics, 2, 4, 6, 8, CombineModeReplace);
status = GdipSetClipRect(graphics, 2, 4, 6, 8, CombineModeReplace);
expect(Ok, status);
status = GdipEndContainer(graphics, cont2);
expect(Ok, status);
@ -6572,12 +6578,18 @@ static void test_GdipFillRectanglesOnBitmapTextureBrush(void)
GdipDeleteBrush((GpBrush*)brush);
GdipDeleteGraphics(graphics);
GdipBitmapGetPixel(dst_img.bitmap, 0, 0, &color[0]);
GdipBitmapGetPixel(dst_img.bitmap, 0, 1, &color[1]);
GdipBitmapGetPixel(dst_img.bitmap, 1, 0, &color[2]);
GdipBitmapGetPixel(dst_img.bitmap, width/2, 0, &color[3]);
GdipBitmapGetPixel(dst_img.bitmap, width/2, height/2, &color[4]);
GdipBitmapGetPixel(dst_img.bitmap, 0, height/2, &color[5]);
status = GdipBitmapGetPixel(dst_img.bitmap, 0, 0, &color[0]);
expect(Ok, status);
status = GdipBitmapGetPixel(dst_img.bitmap, 0, 1, &color[1]);
expect(Ok, status);
status = GdipBitmapGetPixel(dst_img.bitmap, 1, 0, &color[2]);
expect(Ok, status);
status = GdipBitmapGetPixel(dst_img.bitmap, width/2, 0, &color[3]);
expect(Ok, status);
status = GdipBitmapGetPixel(dst_img.bitmap, width/2, height/2, &color[4]);
expect(Ok, status);
status = GdipBitmapGetPixel(dst_img.bitmap, 0, height/2, &color[5]);
expect(Ok, status);
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,

View file

@ -2717,7 +2717,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(0xff000000, color);

View file

@ -814,7 +814,8 @@ static void test_isinfinite(void)
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
GdipCreateRegion(&region);
status = GdipCreateRegion(&region);
expect(Ok, status);
GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m);
@ -860,7 +861,8 @@ static void test_isempty(void)
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
GdipCreateRegion(&region);
status = GdipCreateRegion(&region);
expect(Ok, status);
/* NULL arguments */
status = GdipIsEmptyRegion(NULL, NULL, NULL);
@ -1779,7 +1781,8 @@ static void test_getbounds(void)
ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
/* the world and page transforms are ignored */
GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
ok(status == Ok, "status %08x\n", status);
GdipSetPageUnit(graphics, UnitInch);
GdipSetPageScale(graphics, 2.0);
status = GdipGetRegionBounds(region, graphics, &rectf);