gdiplus: GdipGetLineGammaCorrection should check result pointer. Test added.

This commit is contained in:
Nikolay Sivov 2008-09-03 00:25:39 +04:00 committed by Alexandre Julliard
parent 26ccb33f86
commit 69e17d6a6a
2 changed files with 26 additions and 1 deletions

View File

@ -631,7 +631,7 @@ GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *line,
{
TRACE("(%p, %p)\n", line, usinggamma);
if(!line)
if(!line || !usinggamma)
return InvalidParameter;
*usinggamma = line->gamma;

View File

@ -145,6 +145,30 @@ static void test_getbounds(void)
GdipDeleteBrush((GpBrush*) brush);
}
static void test_getgamma(void)
{
GpStatus status;
GpLineGradient *line;
GpPointF start, end;
BOOL gamma;
start.X = start.Y = 0.0;
end.X = end.Y = 100.0;
status = GdipCreateLineBrush(&start, &end, (ARGB)0xdeadbeef, 0xdeadbeef, WrapModeTile, &line);
expect(Ok, status);
/* NULL arguments */
status = GdipGetLineGammaCorrection(NULL, NULL);
expect(InvalidParameter, status);
status = GdipGetLineGammaCorrection(line, NULL);
expect(InvalidParameter, status);
status = GdipGetLineGammaCorrection(NULL, &gamma);
expect(InvalidParameter, status);
GdipDeleteBrush((GpBrush*)line);
}
START_TEST(brush)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -162,6 +186,7 @@ START_TEST(brush)
test_gradientblendcount();
test_getblend();
test_getbounds();
test_getgamma();
GdiplusShutdown(gdiplusToken);
}