gdiplus/tests: Check more return values (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-11-28 12:05:20 +03:00 committed by Alexandre Julliard
parent 89366f740f
commit b1ccf61f22
4 changed files with 25 additions and 13 deletions

View file

@ -155,7 +155,8 @@ static void test_createfont(void)
for (i = UnitWorld; i <=UnitMillimeter; i++) for (i = UnitWorld; i <=UnitMillimeter; i++)
{ {
if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */ 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); GdipGetFontSize (font, &size);
ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i); ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i);
GdipGetFontUnit (font, &unit); GdipGetFontUnit (font, &unit);
@ -179,7 +180,8 @@ static void test_logfont(void)
UINT16 em_height, line_spacing; UINT16 em_height, line_spacing;
Unit unit; Unit unit;
GdipCreateFromHDC(hdc, &graphics); stat = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, stat);
memset(&lfa, 0, sizeof(LOGFONTA)); memset(&lfa, 0, sizeof(LOGFONTA));
memset(&lfa2, 0xff, sizeof(LOGFONTA)); memset(&lfa2, 0xff, sizeof(LOGFONTA));

View file

@ -365,7 +365,8 @@ static void test_save_restore(void)
log_state(state_a, &state_log); log_state(state_a, &state_log);
/* BeginContainer and SaveGraphics use the same stack. */ /* BeginContainer and SaveGraphics use the same stack. */
GdipCreateFromHDC(hdc, &graphics1); stat = GdipCreateFromHDC(hdc, &graphics1);
expect(Ok, stat);
GdipSetInterpolationMode(graphics1, InterpolationModeBilinear); GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
stat = GdipBeginContainer2(graphics1, &state_a); stat = GdipBeginContainer2(graphics1, &state_a);
expect(Ok, stat); expect(Ok, stat);
@ -731,7 +732,8 @@ static void test_BeginContainer2(void)
status = GdipCreateMatrix(&transform); status = GdipCreateMatrix(&transform);
expect(Ok, status); expect(Ok, status);
GdipGetWorldTransform(graphics, transform); GdipGetWorldTransform(graphics, transform);
GdipGetMatrixElements(transform, elems); status = GdipGetMatrixElements(transform, elems);
expect(Ok, status);
ok(fabs(defTrans[0] - elems[0]) < 0.0001 && ok(fabs(defTrans[0] - elems[0]) < 0.0001 &&
fabs(defTrans[1] - elems[1]) < 0.0001 && fabs(defTrans[1] - elems[1]) < 0.0001 &&
fabs(defTrans[2] - elems[2]) < 0.0001 && fabs(defTrans[2] - elems[2]) < 0.0001 &&
@ -1600,10 +1602,12 @@ static void test_Get_Release_DC(void)
status = GdipCreateMatrix(&m); status = GdipCreateMatrix(&m);
expect(Ok, status); expect(Ok, status);
GdipCreateRegion(&region); status = GdipCreateRegion(&region);
expect(Ok, status);
GdipCreateSolidFill((ARGB)0xdeadbeef, &brush); GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
GdipCreatePath(FillModeAlternate, &path); GdipCreatePath(FillModeAlternate, &path);
GdipCreateRegion(&clip); status = GdipCreateRegion(&clip);
expect(Ok, status);
status = GdipCreateFromHDC(hdc, &graphics); status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status); expect(Ok, status);

View file

@ -367,7 +367,8 @@ static void test_GdipImageGetFrameDimensionsCount(void)
/* SelectActiveFrame has no effect on image data of memory bitmaps */ /* SelectActiveFrame has no effect on image data of memory bitmaps */
color = 0xdeadbeef; color = 0xdeadbeef;
GdipBitmapGetPixel(bm, 0, 0, &color); stat = GdipBitmapGetPixel(bm, 0, 0, &color);
expect(Ok, stat);
expect(0xffffffff, color); expect(0xffffffff, color);
GdipDisposeImage((GpImage*)bm); GdipDisposeImage((GpImage*)bm);
@ -2724,7 +2725,7 @@ static void test_multiframegif(void)
expect(Ok, stat); expect(Ok, stat);
color = 0xdeadbeef; color = 0xdeadbeef;
GdipBitmapGetPixel(bmp, 0, 0, &color); stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
expect(Ok, stat); expect(Ok, stat);
expect(0xffffffff, color); expect(0xffffffff, color);

View file

@ -80,7 +80,8 @@ static void test_hascurve(void)
GdipDeletePathIter(iter); 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); stat = GdipCreatePathIter(&iter, path);
expect(Ok, stat); expect(Ok, stat);
@ -330,9 +331,12 @@ static void test_isvalid(void)
GdipDeletePathIter(iter); GdipDeletePathIter(iter);
/* no markers */ /* no markers */
GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0); stat = GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
GdipCreatePathIter(&iter, path); expect(Ok, stat);
GdipPathIterNextMarker(iter, &result, &start, &end); stat = GdipCreatePathIter(&iter, path);
expect(Ok, stat);
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
isvalid = FALSE; isvalid = FALSE;
stat = GdipPathIterIsValid(iter, &isvalid); stat = GdipPathIterIsValid(iter, &isvalid);
expect(Ok, stat); expect(Ok, stat);
@ -527,7 +531,8 @@ static void test_nextpathtype(void)
todo_wine expect(0, result); todo_wine expect(0, result);
GdipDeletePathIter(iter); 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); GdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef; start = end = result = (INT)0xdeadbeef;
type = 255; /* out of range */ type = 255; /* out of range */