gdiplus/tests: Create a window for graphics tests instead of painting over the desktop.
This commit is contained in:
parent
c83ea46e1a
commit
be748e0d71
|
@ -28,11 +28,13 @@
|
||||||
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
||||||
#define TABLE_LEN (23)
|
#define TABLE_LEN (23)
|
||||||
|
|
||||||
|
static HWND hwnd;
|
||||||
|
|
||||||
static void test_constructor_destructor(void)
|
static void test_constructor_destructor(void)
|
||||||
{
|
{
|
||||||
GpStatus stat;
|
GpStatus stat;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
stat = GdipCreateFromHDC(NULL, &graphics);
|
stat = GdipCreateFromHDC(NULL, &graphics);
|
||||||
expect(OutOfMemory, stat);
|
expect(OutOfMemory, stat);
|
||||||
|
@ -56,7 +58,7 @@ static void test_constructor_destructor(void)
|
||||||
|
|
||||||
stat = GdipDeleteGraphics(NULL);
|
stat = GdipDeleteGraphics(NULL);
|
||||||
expect(InvalidParameter, stat);
|
expect(InvalidParameter, stat);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct node{
|
typedef struct node{
|
||||||
|
@ -115,7 +117,7 @@ static void test_save_restore(void)
|
||||||
InterpolationMode mode;
|
InterpolationMode mode;
|
||||||
GpGraphics *graphics1, *graphics2;
|
GpGraphics *graphics1, *graphics2;
|
||||||
node * state_log = NULL;
|
node * state_log = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
state_a = state_b = state_c = 0xdeadbeef;
|
state_a = state_b = state_c = 0xdeadbeef;
|
||||||
|
|
||||||
/* Invalid saving. */
|
/* Invalid saving. */
|
||||||
|
@ -224,7 +226,7 @@ static void test_save_restore(void)
|
||||||
todo_wine
|
todo_wine
|
||||||
check_no_duplicates(state_log);
|
check_no_duplicates(state_log);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawArc(void)
|
static void test_GdipDrawArc(void)
|
||||||
|
@ -232,7 +234,7 @@ static void test_GdipDrawArc(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
/* make a graphics object and pen object */
|
/* make a graphics object and pen object */
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
@ -268,7 +270,7 @@ static void test_GdipDrawArc(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawArcI(void)
|
static void test_GdipDrawArcI(void)
|
||||||
|
@ -276,7 +278,7 @@ static void test_GdipDrawArcI(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
/* make a graphics object and pen object */
|
/* make a graphics object and pen object */
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
@ -312,7 +314,7 @@ static void test_GdipDrawArcI(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_BeginContainer2(void)
|
static void test_BeginContainer2(void)
|
||||||
|
@ -334,7 +336,7 @@ static void test_BeginContainer2(void)
|
||||||
|
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
|
||||||
|
@ -497,7 +499,7 @@ static void test_BeginContainer2(void)
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawBezierI(void)
|
static void test_GdipDrawBezierI(void)
|
||||||
|
@ -505,7 +507,7 @@ static void test_GdipDrawBezierI(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
/* make a graphics object and pen object */
|
/* make a graphics object and pen object */
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
@ -535,7 +537,7 @@ static void test_GdipDrawBezierI(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawCurve3(void)
|
static void test_GdipDrawCurve3(void)
|
||||||
|
@ -543,7 +545,7 @@ static void test_GdipDrawCurve3(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPointF points[3];
|
GpPointF points[3];
|
||||||
|
|
||||||
points[0].X = 0;
|
points[0].X = 0;
|
||||||
|
@ -615,7 +617,7 @@ static void test_GdipDrawCurve3(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawCurve3I(void)
|
static void test_GdipDrawCurve3I(void)
|
||||||
|
@ -623,7 +625,7 @@ static void test_GdipDrawCurve3I(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPoint points[3];
|
GpPoint points[3];
|
||||||
|
|
||||||
points[0].X = 0;
|
points[0].X = 0;
|
||||||
|
@ -695,7 +697,7 @@ static void test_GdipDrawCurve3I(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawCurve2(void)
|
static void test_GdipDrawCurve2(void)
|
||||||
|
@ -703,7 +705,7 @@ static void test_GdipDrawCurve2(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPointF points[3];
|
GpPointF points[3];
|
||||||
|
|
||||||
points[0].X = 0;
|
points[0].X = 0;
|
||||||
|
@ -762,7 +764,7 @@ static void test_GdipDrawCurve2(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawCurve2I(void)
|
static void test_GdipDrawCurve2I(void)
|
||||||
|
@ -770,7 +772,7 @@ static void test_GdipDrawCurve2I(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPoint points[3];
|
GpPoint points[3];
|
||||||
|
|
||||||
points[0].X = 0;
|
points[0].X = 0;
|
||||||
|
@ -829,7 +831,7 @@ static void test_GdipDrawCurve2I(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawCurve(void)
|
static void test_GdipDrawCurve(void)
|
||||||
|
@ -837,7 +839,7 @@ static void test_GdipDrawCurve(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPointF points[3];
|
GpPointF points[3];
|
||||||
|
|
||||||
points[0].X = 0;
|
points[0].X = 0;
|
||||||
|
@ -890,7 +892,7 @@ static void test_GdipDrawCurve(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawCurveI(void)
|
static void test_GdipDrawCurveI(void)
|
||||||
|
@ -898,7 +900,7 @@ static void test_GdipDrawCurveI(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPoint points[3];
|
GpPoint points[3];
|
||||||
|
|
||||||
points[0].X = 0;
|
points[0].X = 0;
|
||||||
|
@ -951,7 +953,7 @@ static void test_GdipDrawCurveI(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawLineI(void)
|
static void test_GdipDrawLineI(void)
|
||||||
|
@ -959,7 +961,7 @@ static void test_GdipDrawLineI(void)
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
/* make a graphics object and pen object */
|
/* make a graphics object and pen object */
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
@ -989,7 +991,7 @@ static void test_GdipDrawLineI(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawLinesI(void)
|
static void test_GdipDrawLinesI(void)
|
||||||
|
@ -998,7 +1000,7 @@ static void test_GdipDrawLinesI(void)
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpPen *pen = NULL;
|
GpPen *pen = NULL;
|
||||||
GpPoint *ptf = NULL;
|
GpPoint *ptf = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
/* make a graphics object and pen object */
|
/* make a graphics object and pen object */
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
@ -1041,7 +1043,7 @@ static void test_GdipDrawLinesI(void)
|
||||||
GdipDeletePen(pen);
|
GdipDeletePen(pen);
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_Get_Release_DC(void)
|
static void test_Get_Release_DC(void)
|
||||||
|
@ -1051,7 +1053,7 @@ static void test_Get_Release_DC(void)
|
||||||
GpPen *pen;
|
GpPen *pen;
|
||||||
GpSolidFill *brush;
|
GpSolidFill *brush;
|
||||||
GpPath *path;
|
GpPath *path;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
HDC retdc;
|
HDC retdc;
|
||||||
REAL r;
|
REAL r;
|
||||||
CompositingQuality quality;
|
CompositingQuality quality;
|
||||||
|
@ -1345,14 +1347,14 @@ static void test_Get_Release_DC(void)
|
||||||
GdipDeleteMatrix(m);
|
GdipDeleteMatrix(m);
|
||||||
DeleteObject(hrgn);
|
DeleteObject(hrgn);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_transformpoints(void)
|
static void test_transformpoints(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpPointF ptf[2];
|
GpPointF ptf[2];
|
||||||
GpPoint pt[2];
|
GpPoint pt[2];
|
||||||
|
|
||||||
|
@ -1465,14 +1467,14 @@ static void test_transformpoints(void)
|
||||||
expect(18, pt[1].Y);
|
expect(18, pt[1].Y);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_set_clip(void)
|
static void test_get_set_clip(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpRegion *clip;
|
GpRegion *clip;
|
||||||
GpRectF rect;
|
GpRectF rect;
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
@ -1544,14 +1546,14 @@ static void test_get_set_clip(void)
|
||||||
GdipDeleteRegion(clip);
|
GdipDeleteRegion(clip);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_isempty(void)
|
static void test_isempty(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpRegion *clip;
|
GpRegion *clip;
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
|
@ -1578,7 +1580,7 @@ static void test_isempty(void)
|
||||||
GdipDeleteRegion(clip);
|
GdipDeleteRegion(clip);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_clear(void)
|
static void test_clear(void)
|
||||||
|
@ -1592,7 +1594,7 @@ static void test_clear(void)
|
||||||
static void test_textcontrast(void)
|
static void test_textcontrast(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpGraphics *graphics;
|
GpGraphics *graphics;
|
||||||
UINT contrast;
|
UINT contrast;
|
||||||
|
|
||||||
|
@ -1608,7 +1610,7 @@ static void test_textcontrast(void)
|
||||||
expect(4, contrast);
|
expect(4, contrast);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipDrawString(void)
|
static void test_GdipDrawString(void)
|
||||||
|
@ -1620,7 +1622,7 @@ static void test_GdipDrawString(void)
|
||||||
GpStringFormat *format;
|
GpStringFormat *format;
|
||||||
GpBrush *brush;
|
GpBrush *brush;
|
||||||
LOGFONTA logfont;
|
LOGFONTA logfont;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
static const WCHAR string[] = {'T','e','s','t',0};
|
static const WCHAR string[] = {'T','e','s','t',0};
|
||||||
|
|
||||||
memset(&logfont,0,sizeof(logfont));
|
memset(&logfont,0,sizeof(logfont));
|
||||||
|
@ -1658,7 +1660,7 @@ static void test_GdipDrawString(void)
|
||||||
GdipDeleteFont(fnt);
|
GdipDeleteFont(fnt);
|
||||||
GdipDeleteStringFormat(format);
|
GdipDeleteStringFormat(format);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipGetVisibleClipBounds_screen(void)
|
static void test_GdipGetVisibleClipBounds_screen(void)
|
||||||
|
@ -1758,36 +1760,10 @@ static void test_GdipGetVisibleClipBounds_window(void)
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
GpRectF rectf, window, exp, clipr;
|
GpRectF rectf, window, exp, clipr;
|
||||||
GpRect recti;
|
GpRect recti;
|
||||||
HWND hwnd;
|
|
||||||
WNDCLASSA class;
|
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
|
||||||
RECT wnd_rect;
|
RECT wnd_rect;
|
||||||
|
|
||||||
window.X = 0;
|
|
||||||
window.Y = 0;
|
|
||||||
window.Width = 200;
|
|
||||||
window.Height = 300;
|
|
||||||
|
|
||||||
class.lpszClassName = "ClipBoundsTestClass";
|
|
||||||
class.style = CS_HREDRAW | CS_VREDRAW;
|
|
||||||
class.lpfnWndProc = DefWindowProcA;
|
|
||||||
class.hInstance = hInstance;
|
|
||||||
class.hIcon = LoadIcon(0, IDI_APPLICATION);
|
|
||||||
class.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
||||||
class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
||||||
class.lpszMenuName = 0;
|
|
||||||
class.cbClsExtra = 0;
|
|
||||||
class.cbWndExtra = 0;
|
|
||||||
RegisterClass(&class);
|
|
||||||
|
|
||||||
hwnd = CreateWindow(class.lpszClassName, "ClipboundsTest",
|
|
||||||
WS_OVERLAPPEDWINDOW, window.X, window.Y, window.Width, window.Height,
|
|
||||||
NULL, NULL, hInstance, NULL);
|
|
||||||
|
|
||||||
ok(hwnd != NULL, "Expected window to be created\n");
|
|
||||||
|
|
||||||
/* get client area size */
|
/* get client area size */
|
||||||
ok(GetClientRect(hwnd, &wnd_rect), "GetClientRect should have succeeded\n");
|
ok(GetClientRect(hwnd, &wnd_rect), "GetClientRect should have succeeded\n");
|
||||||
window.X = wnd_rect.left;
|
window.X = wnd_rect.left;
|
||||||
|
@ -1870,7 +1846,6 @@ static void test_GdipGetVisibleClipBounds_window(void)
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
DestroyWindow(hwnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipGetVisibleClipBounds(void)
|
static void test_GdipGetVisibleClipBounds(void)
|
||||||
|
@ -1878,7 +1853,7 @@ static void test_GdipGetVisibleClipBounds(void)
|
||||||
GpGraphics* graphics = NULL;
|
GpGraphics* graphics = NULL;
|
||||||
GpRectF rectf;
|
GpRectF rectf;
|
||||||
GpRect rect;
|
GpRect rect;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
|
|
||||||
status = GdipCreateFromHDC(hdc, &graphics);
|
status = GdipCreateFromHDC(hdc, &graphics);
|
||||||
|
@ -1899,7 +1874,7 @@ static void test_GdipGetVisibleClipBounds(void)
|
||||||
expect(InvalidParameter, status);
|
expect(InvalidParameter, status);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
|
|
||||||
test_GdipGetVisibleClipBounds_screen();
|
test_GdipGetVisibleClipBounds_screen();
|
||||||
test_GdipGetVisibleClipBounds_window();
|
test_GdipGetVisibleClipBounds_window();
|
||||||
|
@ -1933,7 +1908,7 @@ static void test_GdipIsVisiblePoint(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
REAL x, y;
|
REAL x, y;
|
||||||
BOOL val;
|
BOOL val;
|
||||||
|
|
||||||
|
@ -2105,14 +2080,14 @@ static void test_GdipIsVisiblePoint(void)
|
||||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipIsVisibleRect(void)
|
static void test_GdipIsVisibleRect(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
REAL x, y, width, height;
|
REAL x, y, width, height;
|
||||||
BOOL val;
|
BOOL val;
|
||||||
|
|
||||||
|
@ -2267,7 +2242,7 @@ static void test_GdipIsVisibleRect(void)
|
||||||
ok(val == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, width, height);
|
ok(val == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, width, height);
|
||||||
|
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GdipGetNearestColor(void)
|
static void test_GdipGetNearestColor(void)
|
||||||
|
@ -2276,7 +2251,7 @@ static void test_GdipGetNearestColor(void)
|
||||||
GpGraphics *graphics;
|
GpGraphics *graphics;
|
||||||
GpBitmap *bitmap;
|
GpBitmap *bitmap;
|
||||||
ARGB color = 0xdeadbeef;
|
ARGB color = 0xdeadbeef;
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC( hwnd );
|
||||||
|
|
||||||
/* create a graphics object */
|
/* create a graphics object */
|
||||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||||
|
@ -2422,13 +2397,27 @@ static void test_GdipGetNearestColor(void)
|
||||||
GdipDeleteGraphics(graphics);
|
GdipDeleteGraphics(graphics);
|
||||||
GdipDisposeImage((GpImage*)bitmap);
|
GdipDisposeImage((GpImage*)bitmap);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(graphics)
|
START_TEST(graphics)
|
||||||
{
|
{
|
||||||
struct GdiplusStartupInput gdiplusStartupInput;
|
struct GdiplusStartupInput gdiplusStartupInput;
|
||||||
ULONG_PTR gdiplusToken;
|
ULONG_PTR gdiplusToken;
|
||||||
|
WNDCLASSA class;
|
||||||
|
|
||||||
|
memset( &class, 0, sizeof(class) );
|
||||||
|
class.lpszClassName = "gdiplus_test";
|
||||||
|
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
class.lpfnWndProc = DefWindowProcA;
|
||||||
|
class.hInstance = GetModuleHandleA(0);
|
||||||
|
class.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||||
|
class.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||||
|
RegisterClassA( &class );
|
||||||
|
hwnd = CreateWindowA( "gdiplus_test", "graphics test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, 0, 0, GetModuleHandleA(0), 0 );
|
||||||
|
ok(hwnd != NULL, "Expected window to be created\n");
|
||||||
|
|
||||||
gdiplusStartupInput.GdiplusVersion = 1;
|
gdiplusStartupInput.GdiplusVersion = 1;
|
||||||
gdiplusStartupInput.DebugEventCallback = NULL;
|
gdiplusStartupInput.DebugEventCallback = NULL;
|
||||||
|
@ -2465,4 +2454,5 @@ START_TEST(graphics)
|
||||||
test_fromMemoryBitmap();
|
test_fromMemoryBitmap();
|
||||||
|
|
||||||
GdiplusShutdown(gdiplusToken);
|
GdiplusShutdown(gdiplusToken);
|
||||||
|
DestroyWindow( hwnd );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue