mirror of
https://github.com/reactos/reactos.git
synced 2024-11-02 21:09:15 +00:00
e3a2103631
svn path=/trunk/; revision=48617
69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
/*
|
|
* PROJECT: ReactOS api tests
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* PURPOSE: Test for SetDCPenColor
|
|
* PROGRAMMERS: Timo Kreuzer
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <wine/test.h>
|
|
#include <windows.h>
|
|
|
|
void Test_SetDCPenColor()
|
|
{
|
|
HDC hScreenDC, hDC;
|
|
HBITMAP hbmp;
|
|
|
|
// Test an incorrect DC
|
|
SetLastError(ERROR_SUCCESS);
|
|
ok(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID, "\n");
|
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
|
|
|
// Get the Screen DC
|
|
hScreenDC = GetDC(NULL);
|
|
ok(hScreenDC != 0, "GetDC failed, skipping tests\n");
|
|
if (hScreenDC == NULL) return;
|
|
|
|
// Test the screen DC
|
|
SetDCPenColor(hScreenDC, RGB(1,2,3));
|
|
ok(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3), "\n");
|
|
|
|
// Create a new DC
|
|
hDC = CreateCompatibleDC(hScreenDC);
|
|
ReleaseDC(0, hScreenDC);
|
|
ok(hDC != 0, "CreateCompatibleDC failed, skipping tests\n");
|
|
if (!hDC) return;
|
|
|
|
// Select the DC_PEN and check if the pen returned by a new call is DC_PEN
|
|
SelectObject(hDC, GetStockObject(DC_PEN));
|
|
ok(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN), "\n");
|
|
|
|
// Test an incorrect color, yes windows sets the color!
|
|
SetDCPenColor(hDC, 0x21123456);
|
|
ok(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456, "\n");
|
|
|
|
// Test CLR_INVALID, it sets CLR_INVALID!
|
|
SetDCPenColor(hDC, CLR_INVALID);
|
|
ok(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID, "\n");
|
|
|
|
hbmp = CreateBitmap(10, 10, 1, 32, NULL);
|
|
ok(hbmp != 0, "CreateBitmap failed, skipping tests\n");
|
|
if (!hbmp) return;
|
|
|
|
SelectObject(hDC, hbmp);
|
|
SelectObject(hDC, GetStockObject(DC_PEN));
|
|
SetDCPenColor(hDC, 0x123456);
|
|
MoveToEx(hDC, 0, 0, NULL);
|
|
LineTo(hDC, 10, 0);
|
|
ok(GetPixel(hDC, 5, 0) == 0x123456, "\n");
|
|
|
|
// Delete the DC
|
|
DeleteDC(hDC);
|
|
}
|
|
|
|
START_TEST(SetDCPenColor)
|
|
{
|
|
Test_SetDCPenColor();
|
|
}
|
|
|