Sweden-Number/dlls/gdiplus/tests/pen.c

93 lines
2.7 KiB
C

/*
* Unit test suite for pens (and init)
*
* Copyright (C) 2007 Google (Evan Stade)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "gdiplus.h"
#include "wine/test.h"
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
static void test_startup(void)
{
GpPen *pen;
Status status;
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
expect(Ok, status);
GdiplusShutdown(gdiplusToken);
gdiplusStartupInput.GdiplusVersion = 2;
status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
expect(UnsupportedGdiplusVersion, status);
GdiplusShutdown(gdiplusToken);
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
todo_wine
expect(GdiplusNotInitialized, status);
GdipDeletePen(pen);
}
static void test_constructor_destructor(void)
{
GpStatus status;
GpPen *pen = NULL;
status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
status = GdipDeletePen(NULL);
expect(InvalidParameter, status);
status = GdipDeletePen(pen);
expect(Ok, status);
}
START_TEST(pen)
{
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
test_startup();
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
GdiplusShutdown(gdiplusToken);
}