2010-08-24 13:54:10 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS api tests
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* PURPOSE: Test for CreatePen
|
|
|
|
* PROGRAMMERS: Timo Kreuzer
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <wine/test.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winddi.h>
|
2012-04-02 10:52:54 +00:00
|
|
|
#include <include/ntgdityp.h>
|
|
|
|
#include <include/ntgdihdl.h>
|
2010-08-24 13:54:10 +00:00
|
|
|
|
|
|
|
void Test_CreatePen()
|
2008-06-01 18:06:22 +00:00
|
|
|
{
|
|
|
|
HPEN hPen;
|
|
|
|
LOGPEN logpen;
|
|
|
|
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hPen = CreatePen(PS_DASHDOT, 5, RGB(1,2,3));
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(hPen != 0, "CreatePen failed\n");
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
/* Test if we have a PEN */
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN, "Expected GDI_OBJECT_TYPE_PEN, got %lu\n", GDI_HANDLE_GET_TYPE(hPen));
|
2008-06-01 18:06:22 +00:00
|
|
|
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(GetObject(hPen, sizeof(logpen), &logpen), "GetObject failed\n");
|
|
|
|
ok(logpen.lopnStyle == PS_DASHDOT, "Expected PS_DASHDOT, got %u\n", logpen.lopnStyle);
|
|
|
|
ok(logpen.lopnWidth.x == 5, "Expected 5, got %lu\n", logpen.lopnWidth.x);
|
|
|
|
ok(logpen.lopnColor == RGB(1,2,3), "Expected %x, got %x\n", (unsigned)RGB(1,2,3), (unsigned)logpen.lopnColor);
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
|
|
|
if(hPen)
|
|
|
|
ok(DeleteObject(hPen), "DeleteObject failed\n");
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
/* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
|
2011-03-26 15:23:10 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
2008-06-01 18:06:22 +00:00
|
|
|
logpen.lopnStyle = 22;
|
|
|
|
hPen = CreatePen(PS_GEOMETRIC | PS_DASHDOT, 5, RGB(1,2,3));
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(hPen != 0, "CreatePen failed\n");
|
|
|
|
ok(GetObject(hPen, sizeof(logpen), &logpen), "GetObject failed\n");
|
|
|
|
ok(logpen.lopnStyle == PS_SOLID, "Expected PS_SOLID, got %u\n", logpen.lopnStyle);
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
|
|
|
if(hPen)
|
|
|
|
ok(DeleteObject(hPen), "DeleteObject failed\n");
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
/* PS_USERSTYLE will become PS_SOLID */
|
|
|
|
logpen.lopnStyle = 22;
|
2011-03-26 15:23:10 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
2008-06-01 18:06:22 +00:00
|
|
|
hPen = CreatePen(PS_USERSTYLE, 5, RGB(1,2,3));
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(hPen != 0, "CreatePen failed\n");
|
|
|
|
ok(GetObject(hPen, sizeof(logpen), &logpen), "GetObject failed\n");
|
|
|
|
ok(logpen.lopnStyle == PS_SOLID, "Expected PS_SOLID, got %u\n", logpen.lopnStyle);
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
|
|
|
if(hPen)
|
|
|
|
ok(DeleteObject(hPen), "DeleteObject failed\n");
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
/* PS_ALTERNATE will become PS_SOLID */
|
|
|
|
logpen.lopnStyle = 22;
|
2011-03-26 15:23:10 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
2008-06-01 18:06:22 +00:00
|
|
|
hPen = CreatePen(PS_ALTERNATE, 5, RGB(1,2,3));
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(hPen != 0, "CreatePen failed\n");
|
|
|
|
ok(GetObject(hPen, sizeof(logpen), &logpen), "GetObject failed\n");
|
|
|
|
ok(logpen.lopnStyle == PS_SOLID, "Expected PS_SOLID, got %u\n", logpen.lopnStyle);
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
|
|
|
if(hPen)
|
|
|
|
ok(DeleteObject(hPen), "DeleteObject failed\n");
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
2008-06-01 18:06:22 +00:00
|
|
|
|
|
|
|
/* PS_INSIDEFRAME is ok */
|
|
|
|
logpen.lopnStyle = 22;
|
2011-03-26 15:23:10 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
2008-06-01 18:06:22 +00:00
|
|
|
hPen = CreatePen(PS_INSIDEFRAME, 5, RGB(1,2,3));
|
2011-03-26 15:23:10 +00:00
|
|
|
ok(hPen != 0, "CreatePen failed\n");
|
|
|
|
ok(GetObject(hPen, sizeof(logpen), &logpen), "GetObject failed\n");
|
|
|
|
ok(logpen.lopnStyle == PS_INSIDEFRAME, "Expected PS_INSIDEFRAME, got %u\n", logpen.lopnStyle);
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
|
|
|
if(hPen)
|
|
|
|
ok(DeleteObject(hPen), "DeleteObject failed\n");
|
|
|
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
|
2010-08-24 13:54:10 +00:00
|
|
|
}
|
2008-06-01 18:06:22 +00:00
|
|
|
|
2010-08-24 13:54:10 +00:00
|
|
|
START_TEST(CreatePen)
|
|
|
|
{
|
|
|
|
Test_CreatePen();
|
2008-06-01 18:06:22 +00:00
|
|
|
}
|
|
|
|
|