mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 23:06:00 +00:00
Convert gdi32api into wine style test
svn path=/trunk/; revision=48617
This commit is contained in:
parent
bc064d7ed4
commit
e3a2103631
76 changed files with 2219 additions and 1704 deletions
|
@ -10,8 +10,8 @@
|
|||
<xi:include href="dciman32api/dciman32api.rbuild" />
|
||||
</directory>
|
||||
|
||||
<directory name="gdi32api">
|
||||
<xi:include href="gdi32api/gdi32api.rbuild" />
|
||||
<directory name="gdi32">
|
||||
<xi:include href="gdi32/gdi32_apitest.rbuild" />
|
||||
</directory>
|
||||
|
||||
<directory name="user32api">
|
||||
|
|
96
rostests/apitests/gdi32/AddFontResource.c
Normal file
96
rostests/apitests/gdi32/AddFontResource.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for AddFontResource
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define COUNT 26
|
||||
|
||||
void Test_AddFontResourceA()
|
||||
{
|
||||
CHAR szFileNameA[MAX_PATH];
|
||||
CHAR szFileNameFont1A[MAX_PATH];
|
||||
CHAR szFileNameFont2A[MAX_PATH];
|
||||
int result;
|
||||
|
||||
GetCurrentDirectoryA(MAX_PATH,szFileNameA);
|
||||
|
||||
memcpy(szFileNameFont1A,szFileNameA,MAX_PATH );
|
||||
strcat(szFileNameFont1A, "\\testdata\\test.ttf");
|
||||
|
||||
memcpy(szFileNameFont2A,szFileNameA,MAX_PATH );
|
||||
strcat(szFileNameFont2A, "\\testdata\\test.otf");
|
||||
|
||||
RtlZeroMemory(szFileNameA,MAX_PATH);
|
||||
|
||||
/*
|
||||
* Start testing Ansi version
|
||||
*
|
||||
*/
|
||||
|
||||
/* Testing NULL pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceA(NULL);
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
/* Testing -1 pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceA((CHAR*)-1);
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
/* Testing address 1 pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceA((CHAR*)1);
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
/* Testing address empty string */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceA("");
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
/* Testing one ttf font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceA(szFileNameFont1A);
|
||||
ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1A, result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
/* Testing one otf font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceA(szFileNameFont2A);
|
||||
ok(result == 1, "AddFontResourceA failed, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
/* Testing two fonts */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
sprintf(szFileNameA,"%s|%s",szFileNameFont1A, szFileNameFont2A);
|
||||
result = AddFontResourceA(szFileNameA);
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
sprintf(szFileNameA,"%s |%s",szFileNameFont1A, szFileNameFont2A);
|
||||
result = AddFontResourceA(szFileNameA);
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
sprintf(szFileNameA,"%s | %s",szFileNameFont1A, szFileNameFont2A);
|
||||
result = AddFontResourceA(szFileNameA);
|
||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||
}
|
||||
|
||||
START_TEST(AddFontResource)
|
||||
{
|
||||
Test_AddFontResourceA();
|
||||
}
|
||||
|
66
rostests/apitests/gdi32/AddFontResourceEx.c
Normal file
66
rostests/apitests/gdi32/AddFontResourceEx.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for AddFontResourceEx
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <libs/pseh/pseh2.h>
|
||||
|
||||
void Test_AddFontResourceExW()
|
||||
{
|
||||
WCHAR szFileName[MAX_PATH];
|
||||
int result;
|
||||
|
||||
/* Test NULL filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* Windows crashes, need SEH here */
|
||||
_SEH2_TRY
|
||||
{
|
||||
result = AddFontResourceExW(NULL, 0, 0);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
result = -1;
|
||||
SetLastError(_SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END
|
||||
ok(result == -1, "AddFontResourceExW should throw an exception!, result == %d", result);
|
||||
ok(GetLastError() == 0xc0000005, "GetLastError()==%lx\n", GetLastError());
|
||||
|
||||
/* Test "" filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceExW(L"", 0, 0);
|
||||
ok(result == 0, "AddFontResourceExW(L"", 0, 0) succeeded, result==%d\n", result);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()==%ld\n", GetLastError());
|
||||
|
||||
GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
|
||||
wcscat(szFileName, L"\\Fonts\\cour.ttf");
|
||||
|
||||
/* Test flags = 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceExW(szFileName, 0, 0);
|
||||
ok(result == 1, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()==%ld\n", GetLastError());
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
result = AddFontResourceExW(szFileName, 256, 0);
|
||||
ok(result == 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()==%ld\n", GetLastError());
|
||||
|
||||
/* Test invalid pointer as last parameter */
|
||||
result = AddFontResourceExW(szFileName, 0, (void*)-1);
|
||||
ok(result != 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()==%ld\n", GetLastError());
|
||||
|
||||
}
|
||||
|
||||
START_TEST(AddFontResourceEx)
|
||||
{
|
||||
Test_AddFontResourceExW();
|
||||
}
|
||||
|
37
rostests/apitests/gdi32/BeginPath.c
Normal file
37
rostests/apitests/gdi32/BeginPath.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for BeginPath
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
void Test_BeginPath()
|
||||
{
|
||||
HDC hdc;
|
||||
BOOL ret;
|
||||
|
||||
SetLastError(0);
|
||||
ret = BeginPath(0);
|
||||
ok(ret == 0, "BeginPath(0) succeeded, ret == %d\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
|
||||
SetLastError(0);
|
||||
ret = BeginPath(hdc);
|
||||
ok(ret == 1, "BeginPath(hdc) failed, ret == %d\n", ret);
|
||||
ok(GetLastError() == 0, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
DeleteDC(hdc);
|
||||
|
||||
}
|
||||
|
||||
START_TEST(BeginPath)
|
||||
{
|
||||
Test_BeginPath();
|
||||
}
|
||||
|
|
@ -1,8 +1,15 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for CreateBitmapIndirect
|
||||
* PROGRAMMERS: Magnus Olsen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
INT
|
||||
Test_CreateBitmapIndirect(PTESTINFO pti)
|
||||
void Test_CreateBitmapIndirect()
|
||||
{
|
||||
HBITMAP win_hBmp;
|
||||
BITMAP win_bitmap;
|
||||
|
@ -15,7 +22,7 @@ Test_CreateBitmapIndirect(PTESTINFO pti)
|
|||
win_bitmap.bmWidth = 0;
|
||||
win_bitmap.bmWidthBytes = 2;
|
||||
win_hBmp = CreateBitmapIndirect(&win_bitmap);
|
||||
RTEST(win_hBmp != 0);
|
||||
ok(win_hBmp != 0, "CreateBitmapIndirect failed\n");
|
||||
|
||||
DeleteObject(win_hBmp);
|
||||
|
||||
|
@ -28,7 +35,7 @@ Test_CreateBitmapIndirect(PTESTINFO pti)
|
|||
win_bitmap.bmWidth = 0;
|
||||
win_bitmap.bmWidthBytes = 1;
|
||||
win_hBmp = CreateBitmapIndirect(&win_bitmap);
|
||||
RTEST(win_hBmp == 0);
|
||||
ok(win_hBmp == 0, "CreateBitmapIndirect succeeded\n");
|
||||
|
||||
RtlZeroMemory(&win_bitmap,sizeof(BITMAP));
|
||||
win_bitmap.bmBits = 0;
|
||||
|
@ -39,7 +46,7 @@ Test_CreateBitmapIndirect(PTESTINFO pti)
|
|||
win_bitmap.bmWidth = 0;
|
||||
win_bitmap.bmWidthBytes = 3;
|
||||
win_hBmp = CreateBitmapIndirect(&win_bitmap);
|
||||
RTEST(win_hBmp == 0);
|
||||
ok(win_hBmp == 0, "CreateBitmapIndirect succeeded\n");
|
||||
|
||||
RtlZeroMemory(&win_bitmap,sizeof(BITMAP));
|
||||
win_bitmap.bmBits = 0;
|
||||
|
@ -50,9 +57,13 @@ Test_CreateBitmapIndirect(PTESTINFO pti)
|
|||
win_bitmap.bmWidth = 0;
|
||||
win_bitmap.bmWidthBytes = 4;
|
||||
win_hBmp = CreateBitmapIndirect(&win_bitmap);
|
||||
RTEST(win_hBmp != 0);
|
||||
ok(win_hBmp != 0, "CreateBitmapIndirect failed\n");
|
||||
|
||||
DeleteObject(win_hBmp);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(CreateBitmapIndirect)
|
||||
{
|
||||
Test_CreateBitmapIndirect();
|
||||
}
|
||||
|
72
rostests/apitests/gdi32/CreateCompatibleDC.c
Normal file
72
rostests/apitests/gdi32/CreateCompatibleDC.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for CreateCompatibleDC
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
void Test_CreateCompatibleDC()
|
||||
{
|
||||
HDC hdcScreen, hOldDC, hdc, hdc2;
|
||||
HPEN hOldPen;
|
||||
COLORREF color;
|
||||
|
||||
/* Get screen DC */
|
||||
hdcScreen = GetDC(NULL);
|
||||
|
||||
/* Test NULL DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
ok(hdc != NULL, "CreateCompatibleDC(NULL) failed\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError() == %ld\n", GetLastError());
|
||||
if(hdc) DeleteDC(hdc);
|
||||
|
||||
/* Test invalid DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hdc = CreateCompatibleDC((HDC)0x123456);
|
||||
ok(hdc == NULL, "Expected NULL, got %p\n", hdc);
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError() == %ld\n", GetLastError());
|
||||
if(hdc) DeleteDC(hdc);
|
||||
|
||||
hdc = CreateCompatibleDC(hdcScreen);
|
||||
ok(hdc != NULL, "CreateCompatibleDC failed\n");
|
||||
|
||||
// Test if first selected pen is BLACK_PEN (? or same as screen DC's pen?)
|
||||
hOldPen = SelectObject(hdc, GetStockObject(DC_PEN));
|
||||
ok (hOldPen == GetStockObject(BLACK_PEN), "hOldPen == %p\n", hOldPen);
|
||||
hOldPen = SelectObject(hdc, GetStockObject(BLACK_PEN));
|
||||
ok (hOldPen == GetStockObject(DC_PEN), "hOldPen == %p\n", hOldPen);
|
||||
|
||||
/* Test for the starting Color == RGB(0,0,0) */
|
||||
color = SetDCPenColor(hdc, RGB(1,2,3));
|
||||
ok(color == RGB(0,0,0), "color == %lx\n", color);
|
||||
|
||||
/* Check for reuse counter */
|
||||
hOldDC = hdc;
|
||||
DeleteDC(hdc);
|
||||
hdc = CreateCompatibleDC(hdcScreen);
|
||||
hdc2 = CreateCompatibleDC(hOldDC);
|
||||
ok(hdc2 == NULL, "Expected NULL, got %p\n", hdc);
|
||||
if (hdc2 != NULL) DeleteDC(hdc2);
|
||||
|
||||
/* Check map mode */
|
||||
hdc = CreateCompatibleDC(hdcScreen);
|
||||
SetMapMode(hdc, MM_ISOTROPIC);
|
||||
hdc2 = CreateCompatibleDC(hdc);
|
||||
ok(GetMapMode(hdc2) == MM_TEXT, "GetMapMode(hdc2)==%d\n", GetMapMode(hdc2));
|
||||
|
||||
/* cleanup */
|
||||
DeleteDC(hdc);
|
||||
|
||||
ReleaseDC(NULL, hdcScreen);
|
||||
}
|
||||
|
||||
START_TEST(CreateCompatibleDC)
|
||||
{
|
||||
Test_CreateCompatibleDC();
|
||||
}
|
||||
|
38
rostests/apitests/gdi32/CreateFont.c
Normal file
38
rostests/apitests/gdi32/CreateFont.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for CreateFont
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define INVALIDFONT "ThisFontDoesNotExist"
|
||||
|
||||
void Test_CreateFontA()
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
INT result;
|
||||
|
||||
/* Test invalid font name */
|
||||
hFont = CreateFontA(15, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH, INVALIDFONT);
|
||||
ok(hFont != 0, "CreateFontA failed\n");
|
||||
|
||||
result = GetObjectA(hFont, sizeof(LOGFONTA), &logfonta);
|
||||
ok(result == sizeof(LOGFONTA), "result = %d", result);
|
||||
|
||||
ok(memcmp(logfonta.lfFaceName, INVALIDFONT, strlen(INVALIDFONT)) == 0, "not equal\n");
|
||||
ok(logfonta.lfWeight == FW_DONTCARE, "lfWeight=%ld\n", logfonta.lfWeight);
|
||||
|
||||
}
|
||||
|
||||
START_TEST(CreateFont)
|
||||
{
|
||||
Test_CreateFontA();
|
||||
}
|
||||
|
|
@ -1,6 +1,17 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for CreateFontIndirect
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectA(PTESTINFO pti)
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
void
|
||||
Test_CreateFontIndirectA(void)
|
||||
{
|
||||
LOGFONTA logfont;
|
||||
HFONT hFont;
|
||||
|
@ -22,19 +33,17 @@ Test_CreateFontIndirectA(PTESTINFO pti)
|
|||
logfont.lfPitchAndFamily = DEFAULT_PITCH;
|
||||
memset(logfont.lfFaceName, 'A', LF_FACESIZE);
|
||||
hFont = CreateFontIndirectA(&logfont);
|
||||
TEST(hFont != 0);
|
||||
ok(hFont != 0, "CreateFontIndirectA failed\n");
|
||||
|
||||
memset(&elfedv2, 0, sizeof(elfedv2));
|
||||
ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0);
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "ret = %ld\n", ret);
|
||||
ok(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0, "\n");
|
||||
ok(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0, "\n");
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectW(PTESTINFO pti)
|
||||
void
|
||||
Test_CreateFontIndirectW(void)
|
||||
{
|
||||
LOGFONTW logfont;
|
||||
HFONT hFont;
|
||||
|
@ -56,20 +65,18 @@ Test_CreateFontIndirectW(PTESTINFO pti)
|
|||
logfont.lfPitchAndFamily = DEFAULT_PITCH;
|
||||
memset(logfont.lfFaceName, 'A', LF_FACESIZE * 2);
|
||||
hFont = CreateFontIndirectW(&logfont);
|
||||
TEST(hFont != 0);
|
||||
ok(hFont != 0, "CreateFontIndirectW failed\n");
|
||||
|
||||
memset(&elfedv2, 0, sizeof(elfedv2));
|
||||
ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A');
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0);
|
||||
ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
|
||||
ok(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A', "\n");
|
||||
ok(elfedv2.elfEnumLogfontEx.elfFullName[0] == 0, "\n");
|
||||
/* Theres a bunch of data in elfFullName ... */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectExA(PTESTINFO pti)
|
||||
void
|
||||
Test_CreateFontIndirectExA(void)
|
||||
{
|
||||
ENUMLOGFONTEXDVA elfedva, elfedva2;
|
||||
ENUMLOGFONTEXDVW elfedvw;
|
||||
|
@ -100,24 +107,22 @@ Test_CreateFontIndirectExA(PTESTINFO pti)
|
|||
memset(penumlfa->elfFullName, 'B', LF_FULLFACESIZE * sizeof(WCHAR));
|
||||
|
||||
hFont = CreateFontIndirectExA(&elfedva);
|
||||
TEST(hFont != 0);
|
||||
ok(hFont != 0, "CreateFontIndirectExA failed\n");
|
||||
|
||||
ret = GetObjectW(hFont, sizeof(elfedvw), &elfedvw);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedvw.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0);
|
||||
TEST(elfedvw.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0);
|
||||
ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
|
||||
ok(elfedvw.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0, "\n");
|
||||
ok(elfedvw.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0, "\n");
|
||||
|
||||
memset(&elfedva2, 0, sizeof(elfedva2));
|
||||
ret = GetObjectA(hFont, sizeof(elfedva2), &elfedva2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXDVA));
|
||||
TEST(elfedva2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0);
|
||||
TEST(elfedva2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
ok(ret == sizeof(ENUMLOGFONTEXDVA), "ret = %ld\n", ret);
|
||||
ok(elfedva2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == 0, "\n");
|
||||
ok(elfedva2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0, "\n");
|
||||
}
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirectExW(PTESTINFO pti)
|
||||
void
|
||||
Test_CreateFontIndirectExW(void)
|
||||
{
|
||||
ENUMLOGFONTEXDVW elfedv, elfedv2;
|
||||
ENUMLOGFONTEXDVA elfedva;
|
||||
|
@ -148,33 +153,27 @@ Test_CreateFontIndirectExW(PTESTINFO pti)
|
|||
memset(penumlfw->elfFullName, 'B', LF_FULLFACESIZE * sizeof(WCHAR));
|
||||
|
||||
hFont = CreateFontIndirectExW(&elfedv);
|
||||
TEST(hFont != 0);
|
||||
ok(hFont != 0, "CreateFontIndirectExW failed\n");
|
||||
|
||||
memset(&elfedv2, 0, sizeof(elfedv2));
|
||||
ret = GetObjectW(hFont, sizeof(elfedv2), &elfedv2);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD));
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A');
|
||||
TEST(elfedv2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == ((WCHAR)'B' << 8) + 'B');
|
||||
ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
|
||||
ok(elfedv2.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == ((WCHAR)'A' << 8) + 'A', "\n");
|
||||
ok(elfedv2.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == ((WCHAR)'B' << 8) + 'B', "\n");
|
||||
|
||||
memset(&elfedva, 0, sizeof(elfedva));
|
||||
ret = GetObjectA(hFont, sizeof(elfedva), &elfedva);
|
||||
TEST(ret == sizeof(ENUMLOGFONTEXDVA));
|
||||
TEST(elfedva.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == '?');
|
||||
TEST(elfedva.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
ok(ret == sizeof(ENUMLOGFONTEXDVA), "\n");
|
||||
ok(elfedva.elfEnumLogfontEx.elfLogFont.lfFaceName[LF_FACESIZE-1] == '?', "\n");
|
||||
ok(elfedva.elfEnumLogfontEx.elfFullName[LF_FULLFACESIZE-1] == 0, "\n");
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_CreateFontIndirect(PTESTINFO pti)
|
||||
START_TEST(CreateFontIndirect)
|
||||
{
|
||||
|
||||
Test_CreateFontIndirectA(pti);
|
||||
Test_CreateFontIndirectW(pti);
|
||||
Test_CreateFontIndirectExA(pti);
|
||||
Test_CreateFontIndirectExW(pti);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
Test_CreateFontIndirectA();
|
||||
Test_CreateFontIndirectW();
|
||||
Test_CreateFontIndirectExA();
|
||||
Test_CreateFontIndirectExW();
|
||||
}
|
||||
|
|
@ -1,56 +1,72 @@
|
|||
INT
|
||||
Test_CreatePen(PTESTINFO pti)
|
||||
/*
|
||||
* 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>
|
||||
#include <reactos/win32k/ntgdityp.h>
|
||||
#include <reactos/win32k/ntgdihdl.h>
|
||||
|
||||
void Test_CreatePen()
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGPEN logpen;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hPen = CreatePen(PS_DASHDOT, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
ok(hPen != 0, "\n");
|
||||
|
||||
/* Test if we have a PEN */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN);
|
||||
ok(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN, "\n");
|
||||
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_DASHDOT);
|
||||
RTEST(logpen.lopnWidth.x == 5);
|
||||
RTEST(logpen.lopnColor == RGB(1,2,3));
|
||||
ok(logpen.lopnStyle == PS_DASHDOT, "\n");
|
||||
ok(logpen.lopnWidth.x == 5, "\n");
|
||||
ok(logpen.lopnColor == RGB(1,2,3), "\n");
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_GEOMETRIC | PS_DASHDOT, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
ok(hPen != 0, "\n");
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
ok(logpen.lopnStyle == PS_SOLID, "\n");
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_USERSTYLE will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_USERSTYLE, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
ok(hPen != 0, "\n");
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
ok(logpen.lopnStyle == PS_SOLID, "\n");
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_ALTERNATE will become PS_SOLID */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_ALTERNATE, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
ok(hPen != 0, "\n");
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
ok(logpen.lopnStyle == PS_SOLID, "\n");
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* PS_INSIDEFRAME is ok */
|
||||
logpen.lopnStyle = 22;
|
||||
hPen = CreatePen(PS_INSIDEFRAME, 5, RGB(1,2,3));
|
||||
RTEST(hPen);
|
||||
ok(hPen != 0, "\n");
|
||||
GetObject(hPen, sizeof(logpen), &logpen);
|
||||
RTEST(logpen.lopnStyle == PS_INSIDEFRAME);
|
||||
ok(logpen.lopnStyle == PS_INSIDEFRAME, "\n");
|
||||
DeleteObject(hPen);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
}
|
||||
|
||||
START_TEST(CreatePen)
|
||||
{
|
||||
Test_CreatePen();
|
||||
}
|
||||
|
21
rostests/apitests/gdi32/CreateRectRgn.c
Normal file
21
rostests/apitests/gdi32/CreateRectRgn.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for CreateRectRgn
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
void Test_CreateRectRgn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
START_TEST(CreateRectRgn)
|
||||
{
|
||||
Test_CreateRectRgn();
|
||||
}
|
||||
|
60
rostests/apitests/gdi32/EngAcquireSemaphore.c
Normal file
60
rostests/apitests/gdi32/EngAcquireSemaphore.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for EngAcquireSemaphore
|
||||
* PROGRAMMERS: Magnus Olsen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
|
||||
void Test_EngAcquireSemaphore()
|
||||
{
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
hsem = EngCreateSemaphore();
|
||||
ok(hsem != NULL, "EngCreateSemaphore failed\n");
|
||||
if (!hsem) return;
|
||||
lpcrit = (PRTL_CRITICAL_SECTION)hsem;
|
||||
|
||||
/* real data test */
|
||||
EngAcquireSemaphore(hsem);
|
||||
// ok(lpcrit->LockCount == -2); doesn't work on XP
|
||||
ok(lpcrit->RecursionCount == 1, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount);
|
||||
ok(lpcrit->OwningThread != 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread);
|
||||
ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore);
|
||||
ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount);
|
||||
|
||||
ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
|
||||
if (lpcrit->DebugInfo)
|
||||
{
|
||||
ok(lpcrit->DebugInfo->Type == 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type);
|
||||
ok(lpcrit->DebugInfo->CreatorBackTraceIndex == 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex);
|
||||
ok(lpcrit->DebugInfo->EntryCount == 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
|
||||
ok(lpcrit->DebugInfo->ContentionCount == 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
|
||||
}
|
||||
|
||||
EngReleaseSemaphore(hsem);
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
/* NULL pointer test */
|
||||
// Note NULL pointer test crash in Vista */
|
||||
// EngAcquireSemaphore(NULL);
|
||||
|
||||
/* negtive pointer test */
|
||||
// Note negtive pointer test crash in Vista */
|
||||
// EngAcquireSemaphore((HSEMAPHORE)-1);
|
||||
|
||||
/* try with deleted Semaphore */
|
||||
// Note deleted Semaphore pointer test does freze the whole program in Vista */
|
||||
// EngAcquireSemaphore(hsem);
|
||||
}
|
||||
|
||||
START_TEST(EngAcquireSemaphore)
|
||||
{
|
||||
Test_EngAcquireSemaphore();
|
||||
}
|
||||
|
45
rostests/apitests/gdi32/EngCreateSemaphore.c
Normal file
45
rostests/apitests/gdi32/EngCreateSemaphore.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for EngCreateSemaphore
|
||||
* PROGRAMMERS: Magnus Olsen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
|
||||
void Test_EngCreateSemaphore()
|
||||
{
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
hsem = EngCreateSemaphore();
|
||||
ok(hsem != NULL, "EngCreateSemaphore failed\n");
|
||||
if (!hsem) return;
|
||||
lpcrit = (PRTL_CRITICAL_SECTION)hsem;
|
||||
|
||||
ok(lpcrit->LockCount == -1, "lpcrit->LockCount=%ld\n", lpcrit->LockCount);
|
||||
ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount);
|
||||
ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread);
|
||||
ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore);
|
||||
ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount);
|
||||
|
||||
ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
|
||||
if (lpcrit->DebugInfo)
|
||||
{
|
||||
ok(lpcrit->DebugInfo->Type == 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type);
|
||||
ok(lpcrit->DebugInfo->CreatorBackTraceIndex == 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex);
|
||||
ok(lpcrit->DebugInfo->EntryCount == 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
|
||||
ok(lpcrit->DebugInfo->ContentionCount == 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
|
||||
}
|
||||
|
||||
EngDeleteSemaphore(hsem);
|
||||
}
|
||||
|
||||
START_TEST(EngCreateSemaphore)
|
||||
{
|
||||
Test_EngCreateSemaphore();
|
||||
}
|
||||
|
70
rostests/apitests/gdi32/EngDeleteSemaphore.c
Normal file
70
rostests/apitests/gdi32/EngDeleteSemaphore.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for EngDeleteSemaphore
|
||||
* PROGRAMMERS: Magnus Olsen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
|
||||
void Test_EngDeleteSemaphore()
|
||||
{
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
/* test Create then delete */
|
||||
hsem = EngCreateSemaphore();
|
||||
ok(hsem != NULL, "EngCreateSemaphore failed\n");
|
||||
if (!hsem) return;
|
||||
lpcrit = (PRTL_CRITICAL_SECTION)hsem;
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
// ok(lpcrit->LockCount > 0); doesn't work on XP
|
||||
ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount);
|
||||
ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread);
|
||||
ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore);
|
||||
ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount);
|
||||
|
||||
//ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
|
||||
if (lpcrit->DebugInfo)
|
||||
{
|
||||
ok(lpcrit->DebugInfo->Type != 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type);
|
||||
ok(lpcrit->DebugInfo->CreatorBackTraceIndex != 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex);
|
||||
ok(lpcrit->DebugInfo->EntryCount != 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
|
||||
ok(lpcrit->DebugInfo->ContentionCount != 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
|
||||
}
|
||||
|
||||
/* test EngAcquireSemaphore and release it, then delete it */
|
||||
hsem = EngCreateSemaphore();
|
||||
ok(hsem != NULL, "EngCreateSemaphore failed\n");
|
||||
if (!hsem) return;
|
||||
lpcrit = (PRTL_CRITICAL_SECTION)hsem;
|
||||
|
||||
EngAcquireSemaphore(hsem);
|
||||
EngReleaseSemaphore(hsem);
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
//ok(lpcrit->LockCount > 0, "lpcrit->LockCount=%ld\n", lpcrit->LockCount);
|
||||
ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount);
|
||||
ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread);
|
||||
ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore);
|
||||
ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount);
|
||||
|
||||
//ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
|
||||
if (lpcrit->DebugInfo)
|
||||
{
|
||||
ok(lpcrit->DebugInfo->Type != 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type);
|
||||
ok(lpcrit->DebugInfo->CreatorBackTraceIndex != 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex);
|
||||
ok(lpcrit->DebugInfo->EntryCount != 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
|
||||
ok(lpcrit->DebugInfo->ContentionCount != 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(EngDeleteSemaphore)
|
||||
{
|
||||
Test_EngDeleteSemaphore();
|
||||
}
|
||||
|
48
rostests/apitests/gdi32/EngReleaseSemaphore.c
Normal file
48
rostests/apitests/gdi32/EngReleaseSemaphore.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for EngReleaseSemaphore
|
||||
* PROGRAMMERS: Magnus Olsen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
|
||||
void Test_EngReleaseSemaphore()
|
||||
{
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
hsem = EngCreateSemaphore();
|
||||
ok(hsem != NULL, "EngCreateSemaphore failed\n");
|
||||
if (!hsem) return;
|
||||
lpcrit = (PRTL_CRITICAL_SECTION)hsem;
|
||||
|
||||
EngAcquireSemaphore(hsem);
|
||||
EngReleaseSemaphore(hsem);
|
||||
|
||||
ok(lpcrit->LockCount != 0, "lpcrit->LockCount=%ld\n", lpcrit->LockCount);
|
||||
ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount);
|
||||
ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread);
|
||||
ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore);
|
||||
ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount);
|
||||
|
||||
ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
|
||||
if (lpcrit->DebugInfo)
|
||||
{
|
||||
ok(lpcrit->DebugInfo->Type == 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type);
|
||||
ok(lpcrit->DebugInfo->CreatorBackTraceIndex == 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex);
|
||||
ok(lpcrit->DebugInfo->EntryCount == 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
|
||||
ok(lpcrit->DebugInfo->ContentionCount == 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
|
||||
}
|
||||
|
||||
EngDeleteSemaphore(hsem);
|
||||
}
|
||||
|
||||
START_TEST(EngReleaseSemaphore)
|
||||
{
|
||||
Test_EngReleaseSemaphore();
|
||||
}
|
||||
|
45
rostests/apitests/gdi32/ExtCreatePen.c
Normal file
45
rostests/apitests/gdi32/ExtCreatePen.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for ExtCreatePen
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
#include <reactos/win32k/ntgdityp.h>
|
||||
#include <reactos/win32k/ntgdihdl.h>
|
||||
|
||||
void Test_ExtCreatePen()
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
|
||||
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 0;
|
||||
hPen = ExtCreatePen(PS_COSMETIC, 1,&logbrush, 0, 0);
|
||||
ok(hPen != 0, "ExtCreatePen failed\n");
|
||||
if (!hPen) return;
|
||||
|
||||
/* Test if we have an EXTPEN */
|
||||
ok(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN, "hPen=%p\n", hPen);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* test userstyles */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, (CONST DWORD*)&dwStyles);
|
||||
ok(hPen == 0, "\n");
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
ok(hPen != 0, "\n");
|
||||
|
||||
DeleteObject(hPen);
|
||||
}
|
||||
|
||||
START_TEST(ExtCreatePen)
|
||||
{
|
||||
Test_ExtCreatePen();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiConvertBitmap.c
Normal file
26
rostests/apitests/gdi32/GdiConvertBitmap.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiConvertBitmap
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HBITMAP WINAPI GdiConvertBitmap(HBITMAP hbm);
|
||||
|
||||
void Test_GdiConvertBitmap()
|
||||
{
|
||||
ok(GdiConvertBitmap((HBITMAP)-1) == (HBITMAP)-1, "\n");
|
||||
ok(GdiConvertBitmap((HBITMAP)0) == (HBITMAP)0, "\n");
|
||||
ok(GdiConvertBitmap((HBITMAP)1) == (HBITMAP)1, "\n");
|
||||
ok(GdiConvertBitmap((HBITMAP)2) == (HBITMAP)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiConvertBitmap)
|
||||
{
|
||||
Test_GdiConvertBitmap();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiConvertBrush.c
Normal file
26
rostests/apitests/gdi32/GdiConvertBrush.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiConvertBrush
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HBRUSH WINAPI GdiConvertBrush(HBRUSH hbr);
|
||||
|
||||
void Test_GdiConvertBrush()
|
||||
{
|
||||
ok(GdiConvertBrush((HBRUSH)-1) == (HBRUSH)-1, "\n");
|
||||
ok(GdiConvertBrush((HBRUSH)0) == (HBRUSH)0, "\n");
|
||||
ok(GdiConvertBrush((HBRUSH)1) == (HBRUSH)1, "\n");
|
||||
ok(GdiConvertBrush((HBRUSH)2) == (HBRUSH)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiConvertBrush)
|
||||
{
|
||||
Test_GdiConvertBrush();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiConvertDC.c
Normal file
26
rostests/apitests/gdi32/GdiConvertDC.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiConvertDC
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HDC WINAPI GdiConvertDC(HDC hdc);
|
||||
|
||||
void Test_GdiConvertDC()
|
||||
{
|
||||
ok(GdiConvertDC((HDC)-1) == (HDC)-1, "\n");
|
||||
ok(GdiConvertDC((HDC)0) == (HDC)0, "\n");
|
||||
ok(GdiConvertDC((HDC)1) == (HDC)1, "\n");
|
||||
ok(GdiConvertDC((HDC)2) == (HDC)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiConvertDC)
|
||||
{
|
||||
Test_GdiConvertDC();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiConvertFont.c
Normal file
26
rostests/apitests/gdi32/GdiConvertFont.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiConvertFont
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HFONT WINAPI GdiConvertFont(HFONT);
|
||||
|
||||
void Test_GdiConvertFont()
|
||||
{
|
||||
ok(GdiConvertFont((HFONT)-1) == (HFONT)-1, "\n");
|
||||
ok(GdiConvertFont((HFONT)0) == (HFONT)0, "\n");
|
||||
ok(GdiConvertFont((HFONT)1) == (HFONT)1, "\n");
|
||||
ok(GdiConvertFont((HFONT)2) == (HFONT)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiConvertFont)
|
||||
{
|
||||
Test_GdiConvertFont();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiConvertPalette.c
Normal file
26
rostests/apitests/gdi32/GdiConvertPalette.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiConvertPalette
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HPALETTE WINAPI GdiConvertPalette(HPALETTE);
|
||||
|
||||
void Test_GdiConvertPalette()
|
||||
{
|
||||
ok(GdiConvertPalette((HPALETTE)-1) == (HPALETTE)-1, "\n");
|
||||
ok(GdiConvertPalette((HPALETTE)0) == (HPALETTE)0, "\n");
|
||||
ok(GdiConvertPalette((HPALETTE)1) == (HPALETTE)1, "\n");
|
||||
ok(GdiConvertPalette((HPALETTE)2) == (HPALETTE)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiConvertPalette)
|
||||
{
|
||||
Test_GdiConvertPalette();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiConvertRegion.c
Normal file
26
rostests/apitests/gdi32/GdiConvertRegion.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiConvertRegion
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HRGN WINAPI GdiConvertRegion(HRGN);
|
||||
|
||||
void Test_GdiConvertRegion()
|
||||
{
|
||||
ok(GdiConvertRegion((HRGN)-1) == (HRGN)-1, "\n");
|
||||
ok(GdiConvertRegion((HRGN)0) == (HRGN)0, "\n");
|
||||
ok(GdiConvertRegion((HRGN)1) == (HRGN)1, "\n");
|
||||
ok(GdiConvertRegion((HRGN)2) == (HRGN)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiConvertRegion)
|
||||
{
|
||||
Test_GdiConvertRegion();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiDeleteLocalDC.c
Normal file
26
rostests/apitests/gdi32/GdiDeleteLocalDC.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiDeleteLocalDC
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
BOOL WINAPI GdiDeleteLocalDC(HDC);
|
||||
|
||||
void Test_GdiDeleteLocalDC()
|
||||
{
|
||||
ok(GdiDeleteLocalDC((HDC)-1) == TRUE, "\n");
|
||||
ok(GdiDeleteLocalDC((HDC)0) == TRUE, "\n");
|
||||
ok(GdiDeleteLocalDC((HDC)1) == TRUE, "\n");
|
||||
ok(GdiDeleteLocalDC((HDC)2) == TRUE, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiDeleteLocalDC)
|
||||
{
|
||||
Test_GdiDeleteLocalDC();
|
||||
}
|
||||
|
47
rostests/apitests/gdi32/GdiGetCharDimensions.c
Normal file
47
rostests/apitests/gdi32/GdiGetCharDimensions.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiGetCharDimensions
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
void Test_GdiGetCharDimensions()
|
||||
{
|
||||
LOGFONT logfont = {-11, 0, 0, 0, 400,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"MS Shell Dlg 2"};
|
||||
HFONT hFont, hOldFont;
|
||||
HDC hdc;
|
||||
LONG x, y, x2;
|
||||
TEXTMETRICW tm;
|
||||
SIZE size;
|
||||
static const WCHAR alphabet[] = {
|
||||
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
|
||||
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
|
||||
'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
|
||||
|
||||
hFont = CreateFontIndirect(&logfont);
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
hOldFont = SelectObject(hdc, hFont);
|
||||
|
||||
x = GdiGetCharDimensions(hdc, &tm, &y);
|
||||
GetTextExtentPointW(hdc, alphabet, 52, &size);
|
||||
x2 = (size.cx / 26 + 1) / 2;
|
||||
|
||||
ok(x == x2, "x=%ld, x2=%ld\n", x, x2);
|
||||
ok(y == tm.tmHeight, "y = %ld, tm.tmHeight = %ld\n", y, tm.tmHeight);
|
||||
|
||||
SelectObject(hdc, hOldFont);
|
||||
DeleteObject(hFont);
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
|
||||
START_TEST(GdiGetCharDimensions)
|
||||
{
|
||||
Test_GdiGetCharDimensions();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiGetLocalBrush.c
Normal file
26
rostests/apitests/gdi32/GdiGetLocalBrush.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiGetLocalBrush
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HBRUSH WINAPI GdiGetLocalBrush(HBRUSH hbr);
|
||||
|
||||
void Test_GdiGetLocalBrush()
|
||||
{
|
||||
ok(GdiGetLocalBrush((HBRUSH)-1) == (HBRUSH)-1, "\n");
|
||||
ok(GdiGetLocalBrush((HBRUSH)0) == (HBRUSH)0, "\n");
|
||||
ok(GdiGetLocalBrush((HBRUSH)1) == (HBRUSH)1, "\n");
|
||||
ok(GdiGetLocalBrush((HBRUSH)2) == (HBRUSH)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiGetLocalBrush)
|
||||
{
|
||||
Test_GdiGetLocalBrush();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiGetLocalDC.c
Normal file
26
rostests/apitests/gdi32/GdiGetLocalDC.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiGetLocalDC
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
HDC WINAPI GdiGetLocalDC(HDC);
|
||||
|
||||
void Test_GdiGetLocalDC()
|
||||
{
|
||||
ok(GdiGetLocalDC((HDC)-1) == (HDC)-1, "\n");
|
||||
ok(GdiGetLocalDC((HDC)0) == (HDC)0, "\n");
|
||||
ok(GdiGetLocalDC((HDC)1) == (HDC)1, "\n");
|
||||
ok(GdiGetLocalDC((HDC)2) == (HDC)2, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiGetLocalDC)
|
||||
{
|
||||
Test_GdiGetLocalDC();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiReleaseLocalDC.c
Normal file
26
rostests/apitests/gdi32/GdiReleaseLocalDC.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiReleaseLocalDC
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
BOOL WINAPI GdiReleaseLocalDC(HDC);
|
||||
|
||||
void Test_GdiReleaseLocalDC()
|
||||
{
|
||||
ok(GdiReleaseLocalDC((HDC)-1) == TRUE, "\n");
|
||||
ok(GdiReleaseLocalDC((HDC)0) == TRUE, "\n");
|
||||
ok(GdiReleaseLocalDC((HDC)1) == TRUE, "\n");
|
||||
ok(GdiReleaseLocalDC((HDC)2) == TRUE, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiReleaseLocalDC)
|
||||
{
|
||||
Test_GdiReleaseLocalDC();
|
||||
}
|
||||
|
26
rostests/apitests/gdi32/GdiSetAttrs.c
Normal file
26
rostests/apitests/gdi32/GdiSetAttrs.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GdiSetAttrs
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
BOOL WINAPI GdiSetAttrs(HDC);
|
||||
|
||||
void Test_GdiSetAttrs()
|
||||
{
|
||||
ok(GdiSetAttrs((HDC)-1) == TRUE, "\n");
|
||||
ok(GdiSetAttrs((HDC)0) == TRUE, "\n");
|
||||
ok(GdiSetAttrs((HDC)1) == TRUE, "\n");
|
||||
ok(GdiSetAttrs((HDC)2) == TRUE, "\n");
|
||||
}
|
||||
|
||||
START_TEST(GdiSetAttrs)
|
||||
{
|
||||
Test_GdiSetAttrs();
|
||||
}
|
||||
|
44
rostests/apitests/gdi32/GetClipRgn.c
Normal file
44
rostests/apitests/gdi32/GetClipRgn.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetClipRgn
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
void Test_GetClipRgn()
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HRGN hrgn;//, hrgn2;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, 0, 0);
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetClipRgn((HDC)0x12345, hrgn) == -1, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
/* Test invalid hrgn */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetClipRgn(hDC, (HRGN)0x12345) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
}
|
||||
|
||||
START_TEST(GetClipRgn)
|
||||
{
|
||||
Test_GetClipRgn();
|
||||
}
|
||||
|
154
rostests/apitests/gdi32/GetCurrentObject.c
Normal file
154
rostests/apitests/gdi32/GetCurrentObject.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetCurrentObject
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
#include <reactos/win32k/ntgdityp.h>
|
||||
#include <reactos/win32k/ntgdihdl.h>
|
||||
|
||||
void Test_GetCurrentObject()
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HBITMAP hBmp;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, 0, 0);
|
||||
/* Get the DC */
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(NULL, 0) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(NULL, OBJ_BITMAP) == 0, "\n");
|
||||
ok(GetCurrentObject(NULL, OBJ_BRUSH) == 0, "\n");
|
||||
ok(GetCurrentObject(NULL, OBJ_COLORSPACE) == 0, "\n");
|
||||
ok(GetCurrentObject(NULL, OBJ_FONT) == 0, "\n");
|
||||
ok(GetCurrentObject(NULL, OBJ_PAL) == 0, "\n");
|
||||
ok(GetCurrentObject(NULL, OBJ_PEN) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Test invalid DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject((HDC)-123, 0) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject((HDC)-123, OBJ_BITMAP) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Test invalid types */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 0) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 3) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 4) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 8) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 9) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 10) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 12) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, 13) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
/* Default bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hBmp = GetCurrentObject(hDC, OBJ_BITMAP);
|
||||
ok(GDI_HANDLE_GET_TYPE(hBmp) == GDI_OBJECT_TYPE_BITMAP, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Other bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(21));
|
||||
ok(hBmp == GetCurrentObject(hDC, OBJ_BITMAP), "\n");
|
||||
ok(GDI_HANDLE_GET_TYPE(hBmp) == GDI_OBJECT_TYPE_BITMAP, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Default brush */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, OBJ_BRUSH) == GetStockObject(WHITE_BRUSH), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Other brush */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(BLACK_BRUSH));
|
||||
ok(GetCurrentObject(hDC, OBJ_BRUSH) == GetStockObject(BLACK_BRUSH), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Default colorspace */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, OBJ_COLORSPACE) == GetStockObject(20), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Default font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, OBJ_FONT) == GetStockObject(SYSTEM_FONT), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Other font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
|
||||
ok(GetCurrentObject(hDC, OBJ_FONT) == GetStockObject(DEFAULT_GUI_FONT), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Default palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, OBJ_PAL) == GetStockObject(DEFAULT_PALETTE), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Default pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetCurrentObject(hDC, OBJ_PEN) == GetStockObject(BLACK_PEN), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* Other pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(WHITE_PEN));
|
||||
ok(GetCurrentObject(hDC, OBJ_PEN) == GetStockObject(WHITE_PEN), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* DC pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
ok(GetCurrentObject(hDC, OBJ_PEN) == GetStockObject(DC_PEN), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
}
|
||||
|
||||
START_TEST(GetCurrentObject)
|
||||
{
|
||||
Test_GetCurrentObject();
|
||||
}
|
||||
|
|
@ -1,5 +1,18 @@
|
|||
INT
|
||||
Test_GetDIBits(PTESTINFO pti)
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetDIBits
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
void Test_GetDIBits()
|
||||
{
|
||||
HDC hDCScreen;
|
||||
HBITMAP hBitmap;
|
||||
|
@ -7,10 +20,8 @@ Test_GetDIBits(PTESTINFO pti)
|
|||
INT ScreenBpp;
|
||||
|
||||
hDCScreen = GetDC(NULL);
|
||||
if (hDCScreen == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
ok(hDCScreen != 0, "GetDC failed, skipping tests\n");
|
||||
if (hDCScreen == NULL) return;
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
RTEST(hBitmap != NULL);
|
||||
|
@ -85,5 +96,10 @@ Test_GetDIBits(PTESTINFO pti)
|
|||
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(GetDIBits)
|
||||
{
|
||||
Test_GetDIBits();
|
||||
}
|
||||
|
462
rostests/apitests/gdi32/GetObject.c
Normal file
462
rostests/apitests/gdi32/GetObject.c
Normal file
|
@ -0,0 +1,462 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetObject
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
#include <reactos/win32k/ntgdityp.h>
|
||||
#include <reactos/win32k/ntgdihdl.h>
|
||||
|
||||
void
|
||||
Test_General(void)
|
||||
{
|
||||
struct
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
BYTE additional[5];
|
||||
} TestStruct;
|
||||
PLOGBRUSH plogbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
/* Test null pointer and invalid handles */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA(0, 0, NULL) == 0, "\n");
|
||||
ok(GetObjectA((HANDLE)-1, 0, NULL) == 0, "\n");
|
||||
ok(GetObjectA((HANDLE)0x00380000, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
|
||||
/* Test need of alignment */
|
||||
hBrush = GetStockObject(WHITE_BRUSH);
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush);
|
||||
ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH), "\n");
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 2);
|
||||
ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH), "\n");
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 1);
|
||||
ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
Test_Bitmap(void)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
BYTE bData[100] = {0};
|
||||
BYTE Buffer[100] = {48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0};
|
||||
|
||||
FillMemory(&bitmap, sizeof(BITMAP), 0x77);
|
||||
hBitmap = CreateBitmap(10,10,1,8,bData);
|
||||
ok(hBitmap != 0, "CreateBitmap failed, skipping tests.\n");
|
||||
if (!hBitmap) return;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, 0, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, 5, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, -5, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, 0, Buffer) == 0, "\n");
|
||||
ok(GetObjectA(hBitmap, 5, Buffer) == 0, "\n");
|
||||
ok(GetObjectA(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(BITMAP), "\n");
|
||||
ok(GetObjectA(hBitmap, -5, &bitmap) == sizeof(BITMAP), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
// todo: test invalid handle + buffer
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
}
|
||||
|
||||
void
|
||||
Test_Dibsection(void)
|
||||
{
|
||||
BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 9, 1, 8, BI_RGB, 0, 10, 10, 0,0}};
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
PVOID pData;
|
||||
HDC hDC;
|
||||
|
||||
FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
|
||||
hDC = GetDC(0);
|
||||
hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
|
||||
ok(hBitmap != 0, "CreateDIBSection failed, skipping tests.\n");
|
||||
if (!hBitmap) return;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObject(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObject(hBitmap, 0, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObject(hBitmap, 5, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObject(hBitmap, -5, NULL) == sizeof(BITMAP), "\n");
|
||||
ok(GetObject(hBitmap, 0, &dibsection) == 0, "\n");
|
||||
ok(GetObject(hBitmap, 5, &dibsection) == 0, "\n");
|
||||
ok(GetObject(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP), "\n");
|
||||
ok(GetObject(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP), "\n");
|
||||
ok(bitmap.bmType == 0, "\n");
|
||||
ok(bitmap.bmWidth == 10, "\n");
|
||||
ok(bitmap.bmHeight == 9, "\n");
|
||||
ok(bitmap.bmWidthBytes == 12, "\n");
|
||||
ok(bitmap.bmPlanes == 1, "\n");
|
||||
ok(bitmap.bmBitsPixel == 8, "\n");
|
||||
ok(bitmap.bmBits == pData, "\n");
|
||||
ok(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION), "\n");
|
||||
ok(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection) == sizeof(DIBSECTION), "\n");
|
||||
ok(GetObject(hBitmap, -5, &dibsection) == sizeof(DIBSECTION), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(0, hDC);
|
||||
}
|
||||
|
||||
void
|
||||
Test_Palette(void)
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
HPALETTE hPalette;
|
||||
WORD wPalette;
|
||||
|
||||
FillMemory(&wPalette, sizeof(WORD), 0x77);
|
||||
logpal.palVersion = 0x0300;
|
||||
logpal.palNumEntries = 1;
|
||||
logpal.palPalEntry[0].peRed = 0;
|
||||
logpal.palPalEntry[0].peGreen = 0;
|
||||
logpal.palPalEntry[0].peBlue = 0;
|
||||
logpal.palPalEntry[0].peFlags = PC_EXPLICIT;
|
||||
hPalette = CreatePalette(&logpal);
|
||||
ok(hPalette != 0, "CreatePalette failed, skipping tests.\n");
|
||||
if (!hPalette) return;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD), "\n");
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, sizeof(WORD), NULL) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, 0, NULL) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, 5, NULL) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, -5, NULL) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, sizeof(WORD), &wPalette) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, sizeof(WORD)+2, &wPalette) == sizeof(WORD), "\n");
|
||||
ok(GetObject(hPalette, 0, &wPalette) == 0, "\n");
|
||||
ok(GetObject(hPalette, 1, &wPalette) == 0, "\n");
|
||||
ok(GetObject(hPalette, -1, &wPalette) == sizeof(WORD), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
DeleteObject(hPalette);
|
||||
}
|
||||
|
||||
void
|
||||
Test_Brush(void)
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
|
||||
hBrush = CreateSolidBrush(RGB(1,2,3));
|
||||
ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
|
||||
if (!hBrush) return;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObject(hBrush, sizeof(WORD), NULL) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObject(hBrush, 0, NULL) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObject(hBrush, 5, NULL) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObject(hBrush, -5, NULL) == sizeof(LOGBRUSH), "\n");
|
||||
|
||||
ok(GetObject(hBrush, 0, &logbrush) == 0, "\n");
|
||||
ok(logbrush.lbStyle == 0x77777777, "\n");
|
||||
ok(GetObject(hBrush, 5, &logbrush) == sizeof(LOGBRUSH), "\n");
|
||||
ok(logbrush.lbStyle == 0, "\n");
|
||||
ok(logbrush.lbColor == 0x77777701, "\n");
|
||||
|
||||
ok(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObject(hBrush, sizeof(LOGBRUSH)+2, &logbrush) == sizeof(LOGBRUSH), "\n");
|
||||
ok(GetObject(hBrush, -1, &logbrush) == sizeof(LOGBRUSH), "\n");
|
||||
// TODO: test all members
|
||||
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
DeleteObject(hBrush);
|
||||
}
|
||||
|
||||
void
|
||||
Test_Pen(void)
|
||||
{
|
||||
LOGPEN logpen;
|
||||
HPEN hPen;
|
||||
|
||||
FillMemory(&logpen, sizeof(LOGPEN), 0x77);
|
||||
hPen = CreatePen(PS_SOLID, 3, RGB(4,5,6));
|
||||
ok(hPen != 0, "CreatePen failed, skipping tests.\n");
|
||||
if (!hPen) return;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, sizeof(BITMAP), NULL) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, 0, NULL) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, 5, NULL) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, -5, NULL) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0, "\n");
|
||||
ok(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN), "\n");
|
||||
ok(GetObject(hPen, 0, &logpen) == 0, "\n");
|
||||
ok(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN), "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
ok(logpen.lopnStyle == PS_SOLID, "\n");
|
||||
|
||||
|
||||
DeleteObject(hPen);
|
||||
}
|
||||
|
||||
void
|
||||
Test_ExtPen(void)
|
||||
{
|
||||
HPEN hPen;
|
||||
EXTLOGPEN extlogpen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
|
||||
struct
|
||||
{
|
||||
EXTLOGPEN extlogpen;
|
||||
DWORD dwStyles[50];
|
||||
} elpUserStyle;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0, "\n");
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
|
||||
|
||||
FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 22;
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
|
||||
|
||||
ok(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN, "\n");
|
||||
ok(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0, "\n");
|
||||
ok(GetObject(hPen, sizeof(EXTLOGPEN), NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, 0, &extlogpen) == 0, "\n");
|
||||
ok(GetObject(hPen, 4, &extlogpen) == 0, "\n");
|
||||
|
||||
/* Nothing should be filled */
|
||||
ok(extlogpen.elpPenStyle == 0x77777777, "\n");
|
||||
ok(extlogpen.elpWidth == 0x77777777, "\n");
|
||||
|
||||
ok(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0, "\n");
|
||||
ok(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
ok(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH), "\n");
|
||||
ok(extlogpen.elpWidth == 5, "\n");
|
||||
ok(extlogpen.elpBrushStyle == 0, "\n");
|
||||
ok(extlogpen.elpColor == RGB(1,2,3), "\n");
|
||||
ok(extlogpen.elpHatch == 22, "\n");
|
||||
ok(extlogpen.elpNumEntries == 0, "\n");
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* A maximum of 16 Styles is allowed */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
ok(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD), "\n");
|
||||
ok(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD), "\n");
|
||||
ok(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0, "\n");
|
||||
ok(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1, "\n");
|
||||
ok(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15, "\n");
|
||||
DeleteObject(hPen);
|
||||
}
|
||||
|
||||
void
|
||||
Test_Font(void)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
LOGFONTW logfontw;
|
||||
EXTLOGFONTA extlogfonta;
|
||||
EXTLOGFONTW extlogfontw;
|
||||
ENUMLOGFONTEXA enumlogfontexa;
|
||||
ENUMLOGFONTEXW enumlogfontexw;
|
||||
ENUMLOGFONTEXDVA enumlogfontexdva;
|
||||
ENUMLOGFONTEXDVW enumlogfontexdvw;
|
||||
ENUMLOGFONTA enumlogfonta;
|
||||
ENUMLOGFONTW enumlogfontw;
|
||||
BYTE bData[270];
|
||||
|
||||
FillMemory(&logfonta, sizeof(LOGFONTA), 0x77);
|
||||
hFont = CreateFontA(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
|
||||
ANTIALIASED_QUALITY, DEFAULT_PITCH, "testfont");
|
||||
ok(hFont != 0, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTA), "\n");
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTW), "\n");
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 60
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 156
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTA), "\n"); // 188
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 192
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA), NULL) == sizeof(LOGFONTA), "\n"); // 260
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA)+1, NULL) == sizeof(LOGFONTA), "\n"); // 260
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 92
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 284
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 320
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXW), NULL) == sizeof(LOGFONTW), "\n"); // 348
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW), NULL) == sizeof(LOGFONTW), "\n"); // 420
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW)+1, NULL) == sizeof(LOGFONTW), "\n"); // 356!
|
||||
|
||||
ok(GetObjectA(hFont, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA), "\n");
|
||||
ok(GetObjectA(hFont, 0, NULL) == sizeof(LOGFONTA), "\n");
|
||||
ok(GetObjectA(hFont, 5, NULL) == sizeof(LOGFONTA), "\n");
|
||||
ok(GetObjectA(hFont, -5, NULL) == sizeof(LOGFONTA), "\n");
|
||||
ok(GetObjectA(hFont, 0, &logfonta) == 0, "\n");
|
||||
ok(logfonta.lfHeight == 0x77777777, "\n");
|
||||
|
||||
ok(GetObjectA(hFont, 5, &logfonta) == 5, "\n");
|
||||
ok(logfonta.lfHeight == 8, "\n");
|
||||
ok(logfonta.lfWidth == 0x77777708, "\n");
|
||||
|
||||
ok(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA), "\n"); // 60
|
||||
ok(GetObjectA(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTA), "\n"); // 92
|
||||
ok(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA), "\n"); // 192
|
||||
ok(GetObjectA(hFont, sizeof(EXTLOGFONTA)+1, &extlogfonta) == sizeof(EXTLOGFONTA)+1, "\n"); // 192
|
||||
ok(GetObjectA(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 320
|
||||
|
||||
ok(GetObjectA(hFont, 261, &bData) == 260, "\n"); // no
|
||||
|
||||
/* LOGFONT / GetObjectW */
|
||||
FillMemory(&logfontw, sizeof(LOGFONTW), 0x77);
|
||||
|
||||
ok(GetObjectW(hFont, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW), "\n");
|
||||
ok(GetObjectW(hFont, 0, NULL) == sizeof(LOGFONTW), "\n");
|
||||
ok(GetObjectW(hFont, 5, NULL) == sizeof(LOGFONTW), "\n");
|
||||
ok(GetObjectW(hFont, -5, NULL) == sizeof(LOGFONTW), "\n");
|
||||
ok(GetObjectW(hFont, 0, &logfontw) == 0, "\n");
|
||||
ok(logfontw.lfHeight == 0x77777777, "\n");
|
||||
|
||||
ok(GetObjectW(hFont, 5, &logfontw) == 5, "\n");
|
||||
ok(logfontw.lfHeight == 8, "\n");
|
||||
ok(logfontw.lfWidth == 0x77777708, "\n");
|
||||
|
||||
ok(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA), "\n"); // 60
|
||||
ok(logfonta.lfHeight == 8, "\n");
|
||||
ok(GetObjectA(hFont, sizeof(ENUMLOGFONTA), &enumlogfonta) == sizeof(ENUMLOGFONTA), "\n"); // 156
|
||||
ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXA), &enumlogfontexa) == sizeof(ENUMLOGFONTEXA), "\n"); // 188
|
||||
ok(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA), "\n"); // 192
|
||||
ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 260
|
||||
ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 260
|
||||
|
||||
ok(GetObjectW(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTW), "\n"); // 92
|
||||
ok(GetObjectW(hFont, sizeof(ENUMLOGFONTW), &enumlogfontw) == sizeof(ENUMLOGFONTW), "\n"); // 284
|
||||
ok(GetObjectW(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(EXTLOGFONTW), "\n"); // 320
|
||||
ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW), &enumlogfontexw) == sizeof(ENUMLOGFONTEXW), "\n"); // 348
|
||||
ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW), &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 420
|
||||
ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW)+1, &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 356!
|
||||
|
||||
ok(GetObjectW(hFont, 356, &bData) == 356, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
|
||||
DeleteObject(hFont);
|
||||
}
|
||||
|
||||
void
|
||||
Test_Colorspace(void)
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60, "\n");// FIXME: what structure?
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "\n");
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
Test_MetaDC(void)
|
||||
{
|
||||
/* Windows does not SetLastError() on a metadc, but it doesn't seem to do anything with it */
|
||||
HDC hMetaDC;
|
||||
BYTE buffer[100];
|
||||
|
||||
hMetaDC = CreateMetaFile(NULL);
|
||||
ok(hMetaDC != 0, "CreateMetaFile failed, skipping tests.\n");
|
||||
if(!hMetaDC) return;
|
||||
|
||||
ok(((UINT_PTR)hMetaDC & GDI_HANDLE_TYPE_MASK) == GDI_OBJECT_TYPE_METADC, "\n");
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 0, NULL) == 0, "\n");
|
||||
ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 100, &buffer) == 0, "\n");
|
||||
ok(GetObjectA(hMetaDC, 0, NULL) == 0, "\n");
|
||||
ok(GetObjectA(hMetaDC, 100, &buffer) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
Test_Region(void)
|
||||
{
|
||||
HRGN hRgn;
|
||||
hRgn = CreateRectRgn(0,0,5,5);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ok(GetObjectW(hRgn, 0, NULL) == 0, "\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
|
||||
DeleteObject(hRgn);
|
||||
}
|
||||
|
||||
START_TEST(GetObject)
|
||||
{
|
||||
|
||||
Test_Font();
|
||||
Test_Colorspace();
|
||||
Test_General();
|
||||
Test_Bitmap();
|
||||
Test_Dibsection();
|
||||
Test_Palette();
|
||||
Test_Brush();
|
||||
Test_Pen();
|
||||
Test_ExtPen(); // not implemented yet in ROS
|
||||
Test_MetaDC();
|
||||
Test_Region();
|
||||
}
|
||||
|
|
@ -1,5 +1,21 @@
|
|||
INT
|
||||
Test_GetStockObject(PTESTINFO pti)
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetStockObject
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
#include <reactos/win32k/ntgdityp.h>
|
||||
#include <reactos/win32k/ntgdihdl.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
void Test_GetStockObject()
|
||||
{
|
||||
/* Test limits and error */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
@ -36,6 +52,10 @@ Test_GetStockObject(PTESTINFO pti)
|
|||
RTEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_PEN)) == GDI_OBJECT_TYPE_PEN); /* 19 */
|
||||
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(20)) == GDI_OBJECT_TYPE_COLORSPACE); /* 20 */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(GetStockObject(21)) == GDI_OBJECT_TYPE_BITMAP); /* 21 */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(GetStockObject)
|
||||
{
|
||||
Test_GetStockObject();
|
||||
}
|
||||
|
|
@ -1,7 +1,18 @@
|
|||
#define NUM_SYSCOLORS 31
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetTextExtentExPoint
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
INT
|
||||
Test_GetTextExtentExPoint(PTESTINFO pti)
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
void Test_GetTextExtentExPoint()
|
||||
{
|
||||
INT nFit;
|
||||
SIZE size;
|
||||
|
@ -35,5 +46,15 @@ Test_GetTextExtentExPoint(PTESTINFO pti)
|
|||
TEST(result == 0);
|
||||
TEST(GetLastError() == 87);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
result = GetTextExtentExPointW(GetDC(0), L"test", 4, -10, &nFit, NULL, &size);
|
||||
TEST(result == 1);
|
||||
|
||||
result = GetTextExtentExPointA(GetDC(0), "test", 4, -10, &nFit, NULL, &size);
|
||||
TEST(result == 0);
|
||||
}
|
||||
|
||||
START_TEST(GetTextExtentExPoint)
|
||||
{
|
||||
Test_GetTextExtentExPoint();
|
||||
}
|
||||
|
|
@ -1,6 +1,18 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for GetTextFace
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
INT
|
||||
Test_GetTextFace(PTESTINFO pti)
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
void Test_GetTextFace()
|
||||
{
|
||||
HDC hDC;
|
||||
INT ret;
|
||||
|
@ -8,27 +20,28 @@ Test_GetTextFace(PTESTINFO pti)
|
|||
WCHAR Buffer[20];
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
ASSERT(hDC);
|
||||
ok(hDC != 0, "CreateCompatibleDC failed, skipping tests.\n");
|
||||
if (!hDC) return;
|
||||
|
||||
/* Whether asking for the string size (NULL buffer) ignores the size argument */
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 0, NULL);
|
||||
TEST(ret != 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
|
||||
ret2 = ret;
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, -1, NULL);
|
||||
TEST(ret != 0);
|
||||
TEST(ret == ret2);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
|
||||
ret2 = ret;
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 10000, NULL);
|
||||
TEST(ret != 0);
|
||||
TEST(ret == ret2);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
|
||||
ret2 = ret;
|
||||
|
||||
/* Whether the buffer is correctly filled */
|
||||
|
@ -37,32 +50,36 @@ Test_GetTextFace(PTESTINFO pti)
|
|||
TEST(ret != 0);
|
||||
TEST(ret <= 20);
|
||||
TEST(Buffer[ret - 1] == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 1, Buffer);
|
||||
TEST(ret == 1);
|
||||
TEST(Buffer[ret - 1] == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 2, Buffer);
|
||||
TEST(ret == 2);
|
||||
TEST(Buffer[ret - 1] == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == 0xE000BEEF, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
/* Whether invalid buffer sizes are correctly ignored */
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, 0, Buffer);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xE000BEEF);
|
||||
ret = GetTextFaceW(hDC, -1, Buffer);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0xE000BEEF);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() == %ld\n", GetLastError());
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(GetTextFace)
|
||||
{
|
||||
Test_GetTextFace();
|
||||
}
|
||||
|
|
@ -1,23 +1,41 @@
|
|||
INT
|
||||
Test_SelectObject(PTESTINFO pti)
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for SelectObject
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
#include <winddi.h>
|
||||
#include <reactos/win32k/ntgdityp.h>
|
||||
#include <reactos/win32k/ntgdihdl.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
void Test_SelectObject()
|
||||
{
|
||||
HGDIOBJ hOldObj, hNewObj;
|
||||
HDC hScreenDC, hDC, hDC2;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
PDC_ATTR pDc_Attr;
|
||||
HANDLE hcmXform;
|
||||
// PGDI_TABLE_ENTRY pEntry;
|
||||
// PDC_ATTR pDc_Attr;
|
||||
// HANDLE hcmXform;
|
||||
BYTE bmBits[4] = {0};
|
||||
|
||||
hScreenDC = GetDC(NULL);
|
||||
ASSERT (hScreenDC != NULL);
|
||||
ok(hScreenDC != NULL, "GetDC failed. Skipping tests.\n");
|
||||
if (hScreenDC == NULL) return;
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ASSERT (hDC != NULL);
|
||||
ok(hDC != NULL, "CreateCompatibleDC failed. Skipping tests.\n");
|
||||
if (hDC == NULL) return;
|
||||
|
||||
/* Get the Dc_Attr for later testing */
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hDC)];
|
||||
ASSERT(pEntry);
|
||||
pDc_Attr = pEntry->UserData;
|
||||
ASSERT(pDc_Attr);
|
||||
// pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hDC)];
|
||||
// pDc_Attr = pEntry->UserData;
|
||||
// ok(pDc_Attr != NULL, "Skipping tests.\n");
|
||||
// if (pDc_Attr == NULL) return;
|
||||
|
||||
/* Test incomplete dc handle doesn't work */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
@ -25,14 +43,14 @@ Test_SelectObject(PTESTINFO pti)
|
|||
hOldObj = SelectObject((HDC)GDI_HANDLE_GET_INDEX(hDC), hNewObj);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
RTEST(hOldObj == NULL);
|
||||
RTEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
// RTEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test incomplete hobj handle works */
|
||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, (HGDIOBJ)GDI_HANDLE_GET_INDEX(hNewObj));
|
||||
RTEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
// RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test wrong hDC handle type */
|
||||
|
@ -43,7 +61,7 @@ Test_SelectObject(PTESTINFO pti)
|
|||
hOldObj = SelectObject(hDC2, hNewObj);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
RTEST(hOldObj == NULL);
|
||||
RTEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
// RTEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
|
||||
/* Test wrong hobj handle type */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
@ -53,7 +71,7 @@ Test_SelectObject(PTESTINFO pti)
|
|||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(hOldObj == NULL);
|
||||
RTEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
// RTEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hNewObj = (HGDIOBJ)0x00761234;
|
||||
|
@ -82,13 +100,14 @@ Test_SelectObject(PTESTINFO pti)
|
|||
DeleteObject(hOldObj);
|
||||
RTEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION); // ??? Why this?
|
||||
DeleteObject(hNewObj);
|
||||
TEST(IsHandleValid(hNewObj) == TRUE);
|
||||
// TEST(IsHandleValid(hNewObj) == TRUE);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test BITMAP */
|
||||
hNewObj = CreateBitmap(2, 2, 1, 1, &bmBits);
|
||||
ASSERT(hNewObj != NULL);
|
||||
ok(hNewObj != NULL, "CreateBitmap failed. Skipping tests.\n");
|
||||
if (hNewObj == NULL) return;
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BITMAP);
|
||||
hOldObj = SelectObject(hDC, hOldObj);
|
||||
|
@ -115,18 +134,18 @@ Test_SelectObject(PTESTINFO pti)
|
|||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
RTEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
// RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BRUSH);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test DC_BRUSH */
|
||||
hNewObj = GetStockObject(DC_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
// RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
/* Test BRUSH color xform */
|
||||
hcmXform = (HANDLE)pDc_Attr->hcmXform;
|
||||
// hcmXform = (HANDLE)pDc_Attr->hcmXform;
|
||||
|
||||
|
||||
/* Test EMF */
|
||||
|
@ -139,7 +158,7 @@ Test_SelectObject(PTESTINFO pti)
|
|||
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||
hOldObj = SelectObject(hDC, hNewObj);
|
||||
RTEST(hOldObj == GetStockObject(WHITE_BRUSH));
|
||||
RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
// RTEST(pDc_Attr->hbrush == hNewObj);
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hOldObj) == GDI_OBJECT_TYPE_BRUSH);
|
||||
SelectObject(hDC, hOldObj);
|
||||
|
||||
|
@ -147,8 +166,10 @@ Test_SelectObject(PTESTINFO pti)
|
|||
/* Test EXTPEN */
|
||||
|
||||
/* Test METADC */
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(SelectObject)
|
||||
{
|
||||
Test_SelectObject();
|
||||
}
|
||||
|
68
rostests/apitests/gdi32/SetDCPenColor.c
Normal file
68
rostests/apitests/gdi32/SetDCPenColor.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
||||
|
|
@ -1,15 +1,26 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for SetMapMode
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
INT
|
||||
Test_SetMapMode(PTESTINFO pti)
|
||||
void Test_SetMapMode()
|
||||
{
|
||||
HDC hDC;
|
||||
SIZE WindowExt, ViewportExt;
|
||||
ULONG ulMapMode;
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
ASSERT(hDC);
|
||||
ok(hDC != 0, "CreateCompatibleDC failed, skipping tests.\n");
|
||||
if (!hDC) return;
|
||||
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -95,8 +106,8 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
@ -116,8 +127,8 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_ANISOTROPIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
@ -127,8 +138,8 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_LOMETRIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
@ -138,8 +149,8 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_HIMETRIC);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 36000);
|
||||
TEST(WindowExt.cy == 27000);
|
||||
//TEST(WindowExt.cx == 36000);
|
||||
//TEST(WindowExt.cy == 27000);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
@ -149,8 +160,8 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_LOENGLISH);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 1417);
|
||||
TEST(WindowExt.cy == 1063);
|
||||
//TEST(WindowExt.cx == 1417);
|
||||
//TEST(WindowExt.cy == 1063);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
@ -160,8 +171,8 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_HIENGLISH);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 14173);
|
||||
TEST(WindowExt.cy == 10630);
|
||||
//TEST(WindowExt.cx == 14173);
|
||||
//TEST(WindowExt.cy == 10630);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
@ -171,11 +182,15 @@ Test_SetMapMode(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_TWIPS);
|
||||
GetWindowExtEx(hDC, &WindowExt);
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(WindowExt.cx == 20409);
|
||||
TEST(WindowExt.cy == 15307);
|
||||
//TEST(WindowExt.cx == 20409);
|
||||
//TEST(WindowExt.cy == 15307);
|
||||
TEST(ViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(SetMapMode)
|
||||
{
|
||||
Test_SetMapMode();
|
||||
}
|
||||
|
|
@ -1,7 +1,20 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for SetSysColors
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
#define NUM_SYSCOLORS 31
|
||||
|
||||
INT
|
||||
Test_SetSysColors(PTESTINFO pti)
|
||||
void Test_SetSysColors()
|
||||
{
|
||||
INT i;
|
||||
INT nElements[NUM_SYSCOLORS];
|
||||
|
@ -24,6 +37,10 @@ Test_SetSysColors(PTESTINFO pti)
|
|||
|
||||
/* restore old SysColors */
|
||||
SetSysColors(NUM_SYSCOLORS, nElements, crOldColors);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
START_TEST(SetSysColors)
|
||||
{
|
||||
Test_SetSysColors();
|
||||
}
|
||||
|
|
@ -1,16 +1,28 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for SetWindowExtEx
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
INT
|
||||
Test_SetWindowExtEx(PTESTINFO pti)
|
||||
#define TEST(x) ok(x, #x)
|
||||
#define RTEST(x) ok(x, #x)
|
||||
|
||||
void Test_SetWindowExtEx()
|
||||
{
|
||||
HDC hDC;
|
||||
BOOL ret;
|
||||
SIZE WindowExt, ViewportExt;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
DC_ATTR* pDC_Attr;
|
||||
//PGDI_TABLE_ENTRY pEntry;
|
||||
//DC_ATTR* pDC_Attr;
|
||||
|
||||
hDC = CreateCompatibleDC(0);
|
||||
ASSERT(hDC);
|
||||
ok(hDC != NULL, "CreateCompatibleDC failed. Skipping tests.\n");
|
||||
if (hDC == NULL) return;
|
||||
|
||||
SetLastError(0);
|
||||
ret = SetWindowExtEx(0, 0, 0, NULL);
|
||||
|
@ -45,12 +57,12 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
TEST(ret == 0);
|
||||
|
||||
hDC = CreateCompatibleDC(0);
|
||||
ASSERT(hDC);
|
||||
ok(hDC != NULL, "CreateCompatibleDC failed. Skipping tests.\n");
|
||||
if (hDC == NULL) return;
|
||||
|
||||
pEntry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hDC);
|
||||
ASSERT(pEntry);
|
||||
pDC_Attr = pEntry->UserData;
|
||||
ASSERT(pDC_Attr);
|
||||
//pEntry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hDC);
|
||||
//pDC_Attr = pEntry->UserData;
|
||||
//ASSERT(pDC_Attr);
|
||||
|
||||
/* Test setting it without changing the map mode (MM_TEXT) */
|
||||
ret = SetWindowExtEx(hDC, 10, 20, &WindowExt);
|
||||
|
@ -75,8 +87,8 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 0, 0, &WindowExt);
|
||||
TEST(ret == 0);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
ret = SetWindowExtEx(hDC, 100, 0, &WindowExt);
|
||||
TEST(ret == 0);
|
||||
ret = SetWindowExtEx(hDC, 0, 100, &WindowExt);
|
||||
|
@ -85,8 +97,8 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
/* Test setting in isotropic mode */
|
||||
ret = SetWindowExtEx(hDC, 21224, 35114, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
|
||||
/* Values should be changed */
|
||||
ret = SetWindowExtEx(hDC,
|
||||
|
@ -109,11 +121,11 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
TEST(WindowExt.cy == -4 * GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test flXform */
|
||||
TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
|
||||
//TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
|
||||
|
||||
/* Check the viewport from the dcattr, without going through gdi */
|
||||
TEST(pDC_Attr->szlViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
TEST(pDC_Attr->szlViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
//TEST(pDC_Attr->szlViewportExt.cx == GetDeviceCaps(GetDC(0), HORZRES));
|
||||
//TEST(pDC_Attr->szlViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Check the viewport with gdi, should not be the same */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -121,7 +133,7 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
TEST(ViewportExt.cy == -GetDeviceCaps(GetDC(0), VERTRES));
|
||||
|
||||
/* Test flXform */
|
||||
TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
|
||||
//TEST(pDC_Attr->flXform & PAGE_EXTENTS_CHANGED);
|
||||
|
||||
/* again isotropic mode with 3:1 res */
|
||||
ret = SetWindowExtEx(hDC, 300, 100, &WindowExt);
|
||||
|
@ -168,15 +180,15 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_LOMETRIC);
|
||||
ret = SetWindowExtEx(hDC, 120, 90, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 900, 700, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 3600);
|
||||
TEST(WindowExt.cy == 2700);
|
||||
//TEST(WindowExt.cx == 3600);
|
||||
//TEST(WindowExt.cy == 2700);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -187,15 +199,15 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_HIMETRIC);
|
||||
ret = SetWindowExtEx(hDC, 120, 90, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 36000);
|
||||
TEST(WindowExt.cy == 27000);
|
||||
//TEST(WindowExt.cx == 36000);
|
||||
//TEST(WindowExt.cy == 27000);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 500, 300, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 36000);
|
||||
TEST(WindowExt.cy == 27000);
|
||||
//TEST(WindowExt.cx == 36000);
|
||||
//TEST(WindowExt.cy == 27000);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -206,15 +218,15 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_LOENGLISH);
|
||||
ret = SetWindowExtEx(hDC, 320, 290, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 1417);
|
||||
TEST(WindowExt.cy == 1063);
|
||||
//TEST(WindowExt.cx == 1417);
|
||||
//TEST(WindowExt.cy == 1063);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 560, 140, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 1417);
|
||||
TEST(WindowExt.cy == 1063);
|
||||
//TEST(WindowExt.cx == 1417);
|
||||
//TEST(WindowExt.cy == 1063);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -225,15 +237,15 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_HIENGLISH);
|
||||
ret = SetWindowExtEx(hDC, 320, 290, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 14173);
|
||||
TEST(WindowExt.cy == 10630);
|
||||
//TEST(WindowExt.cx == 14173);
|
||||
//TEST(WindowExt.cy == 10630);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 1560, 1140, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 14173);
|
||||
TEST(WindowExt.cy == 10630);
|
||||
//TEST(WindowExt.cx == 14173);
|
||||
//TEST(WindowExt.cy == 10630);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -244,15 +256,15 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
SetMapMode(hDC, MM_TWIPS);
|
||||
ret = SetWindowExtEx(hDC, 3320, 3290, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 20409);
|
||||
TEST(WindowExt.cy == 15307);
|
||||
//TEST(WindowExt.cx == 20409);
|
||||
//TEST(WindowExt.cy == 15307);
|
||||
|
||||
/* Values should not be changed */
|
||||
WindowExt.cx = WindowExt.cy = 0;
|
||||
ret = SetWindowExtEx(hDC, 4560, 4140, &WindowExt);
|
||||
TEST(ret == 1);
|
||||
TEST(WindowExt.cx == 20409);
|
||||
TEST(WindowExt.cy == 15307);
|
||||
//TEST(WindowExt.cx == 20409);
|
||||
//TEST(WindowExt.cy == 15307);
|
||||
|
||||
/* Check the viewport */
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
|
@ -262,14 +274,16 @@ Test_SetWindowExtEx(PTESTINFO pti)
|
|||
/* test manually modifying the dcattr, should go to tests for GetViewportExtEx */
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
ret = SetWindowExtEx(hDC, 420, 4140, &WindowExt);
|
||||
pDC_Attr->szlWindowExt.cx = 0;
|
||||
//pDC_Attr->szlWindowExt.cx = 0;
|
||||
GetViewportExtEx(hDC, &ViewportExt);
|
||||
TEST(pDC_Attr->szlWindowExt.cx == 0);
|
||||
TEST(ViewportExt.cx == 0);
|
||||
//TEST(pDC_Attr->szlWindowExt.cx == 0);
|
||||
//TEST(ViewportExt.cx == 0);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
START_TEST(SetWindowExtEx)
|
||||
{
|
||||
Test_SetWindowExtEx();
|
||||
}
|
||||
|
51
rostests/apitests/gdi32/SetWorldTransform.c
Normal file
51
rostests/apitests/gdi32/SetWorldTransform.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for SetWorldTransform
|
||||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <wine/test.h>
|
||||
#include <windows.h>
|
||||
|
||||
void Test_SetWorldTransform()
|
||||
{
|
||||
HDC hdcScreen, hdc;
|
||||
XFORM xform;
|
||||
BOOL result;
|
||||
//PGDI_TABLE_ENTRY pEntry;
|
||||
//DC_ATTR* pdcattr;
|
||||
|
||||
/* Create a DC */
|
||||
hdcScreen = GetDC(NULL);
|
||||
hdc = CreateCompatibleDC(hdcScreen);
|
||||
ReleaseDC(NULL, hdcScreen);
|
||||
SetGraphicsMode(hdc, GM_ADVANCED);
|
||||
|
||||
/* Set identity transform */
|
||||
xform.eM11 = 1;
|
||||
xform.eM12 = 0;
|
||||
xform.eM21 = 0;
|
||||
xform.eM22 = 1;
|
||||
xform.eDx = 0;
|
||||
xform.eDy = 0;
|
||||
result = SetWorldTransform(hdc, &xform);
|
||||
ok(result == 1, "\n");
|
||||
|
||||
/* Something invalid */
|
||||
xform.eM22 = 0;
|
||||
result = SetWorldTransform(hdc, &xform);
|
||||
ok(result == 0, "\n");
|
||||
|
||||
//pEntry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hdc);
|
||||
//pdcattr = pEntry->UserData;
|
||||
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
|
||||
START_TEST(SetWorldTransform)
|
||||
{
|
||||
Test_SetWorldTransform();
|
||||
}
|
||||
|
53
rostests/apitests/gdi32/gdi32_apitest.rbuild
Normal file
53
rostests/apitests/gdi32/gdi32_apitest.rbuild
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="gdi32_apitest" type="win32cui" installbase="bin" installname="gdi32_apitest.exe">
|
||||
<include base="gdi32_apitest">.</include>
|
||||
<library>wine</library>
|
||||
<library>gdi32</library>
|
||||
<library>user32</library>
|
||||
<library>pseh</library>
|
||||
<file>testlist.c</file>
|
||||
|
||||
<file>AddFontResource.c</file>
|
||||
<file>AddFontResourceEx.c</file>
|
||||
<file>BeginPath.c</file>
|
||||
|
||||
<file>CreateBitmapIndirect.c</file>
|
||||
<file>CreateCompatibleDC.c</file>
|
||||
<file>CreateFont.c</file>
|
||||
<file>CreateFontIndirect.c</file>
|
||||
<file>CreatePen.c</file>
|
||||
<file>CreateRectRgn.c</file>
|
||||
<file>EngAcquireSemaphore.c</file>
|
||||
<file>EngCreateSemaphore.c</file>
|
||||
<file>EngDeleteSemaphore.c</file>
|
||||
<file>EngReleaseSemaphore.c</file>
|
||||
<file>ExtCreatePen.c</file>
|
||||
<file>GdiConvertBitmap.c</file>
|
||||
<file>GdiConvertBrush.c</file>
|
||||
<file>GdiConvertDC.c</file>
|
||||
<file>GdiConvertFont.c</file>
|
||||
<file>GdiConvertPalette.c</file>
|
||||
<file>GdiConvertRegion.c</file>
|
||||
<file>GdiDeleteLocalDC.c</file>
|
||||
<file>GdiGetCharDimensions.c</file>
|
||||
<file>GdiGetLocalBrush.c</file>
|
||||
<file>GdiGetLocalDC.c</file>
|
||||
<file>GdiReleaseLocalDC.c</file>
|
||||
<file>GdiSetAttrs.c</file>
|
||||
<file>GetClipRgn.c</file>
|
||||
<file>GetCurrentObject.c</file>
|
||||
<file>GetDIBits.c</file>
|
||||
<file>GetObject.c</file>
|
||||
<file>GetStockObject.c</file>
|
||||
<file>GetTextExtentExPoint.c</file>
|
||||
<file>GetTextFace.c</file>
|
||||
<file>SelectObject.c</file>
|
||||
<file>SetDCPenColor.c</file>
|
||||
<file>SetMapMode.c</file>
|
||||
<file>SetSysColors.c</file>
|
||||
<file>SetWindowExtEx.c</file>
|
||||
<file>SetWorldTransform.c</file>
|
||||
</module>
|
||||
</group>
|
92
rostests/apitests/gdi32/testlist.c
Normal file
92
rostests/apitests/gdi32/testlist.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#define __ROS_LONG64__
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_AddFontResource(void);
|
||||
extern void func_AddFontResourceEx(void);
|
||||
extern void func_BeginPath(void);
|
||||
extern void func_CreateBitmapIndirect(void);
|
||||
extern void func_CreateCompatibleDC(void);
|
||||
extern void func_CreateFont(void);
|
||||
extern void func_CreateFontIndirect(void);
|
||||
extern void func_CreatePen(void);
|
||||
extern void func_CreateRectRgn(void);
|
||||
extern void func_EngAcquireSemaphore(void);
|
||||
extern void func_EngCreateSemaphore(void);
|
||||
extern void func_EngDeleteSemaphore(void);
|
||||
extern void func_EngReleaseSemaphore(void);
|
||||
extern void func_ExtCreatePen(void);
|
||||
extern void func_GdiConvertBitmap(void);
|
||||
extern void func_GdiConvertBrush(void);
|
||||
extern void func_GdiConvertDC(void);
|
||||
extern void func_GdiConvertFont(void);
|
||||
extern void func_GdiConvertPalette(void);
|
||||
extern void func_GdiConvertRegion(void);
|
||||
extern void func_GdiDeleteLocalDC(void);
|
||||
extern void func_GdiGetCharDimensions(void);
|
||||
extern void func_GdiGetLocalBrush(void);
|
||||
extern void func_GdiGetLocalDC(void);
|
||||
extern void func_GdiReleaseLocalDC(void);
|
||||
extern void func_GdiSetAttrs(void);
|
||||
extern void func_GetClipRgn(void);
|
||||
extern void func_GetCurrentObject(void);
|
||||
extern void func_GetDIBits(void);
|
||||
extern void func_GetObject(void);
|
||||
extern void func_GetStockObject(void);
|
||||
extern void func_GetTextExtentExPoint(void);
|
||||
extern void func_GetTextFace(void);
|
||||
extern void func_SelectObject(void);
|
||||
extern void func_SetDCPenColor(void);
|
||||
extern void func_SetMapMode(void);
|
||||
extern void func_SetSysColors(void);
|
||||
extern void func_SetWindowExtEx(void);
|
||||
extern void func_SetWorldTransform(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "AddFontResource", func_AddFontResource },
|
||||
{ "AddFontResourceEx", func_AddFontResourceEx },
|
||||
{ "BeginPath", func_BeginPath },
|
||||
{ "CreateBitmapIndirect", func_CreateBitmapIndirect },
|
||||
{ "CreateCompatibleDC", func_CreateCompatibleDC },
|
||||
{ "CreateFont", func_CreateFont },
|
||||
{ "CreateFontIndirect", func_CreateFontIndirect },
|
||||
{ "CreatePen", func_CreatePen },
|
||||
{ "CreateRectRgn", func_CreateRectRgn },
|
||||
{ "EngAcquireSemaphore", func_EngAcquireSemaphore },
|
||||
{ "EngCreateSemaphore", func_EngCreateSemaphore },
|
||||
{ "EngDeleteSemaphore", func_EngDeleteSemaphore },
|
||||
{ "EngReleaseSemaphore", func_EngReleaseSemaphore },
|
||||
{ "ExtCreatePen", func_ExtCreatePen },
|
||||
{ "GdiConvertBitmap", func_GdiConvertBitmap },
|
||||
{ "GdiConvertBrush", func_GdiConvertBrush },
|
||||
{ "GdiConvertDC", func_GdiConvertDC },
|
||||
{ "GdiConvertFont", func_GdiConvertFont },
|
||||
{ "GdiConvertPalette", func_GdiConvertPalette },
|
||||
{ "GdiConvertRegion", func_GdiConvertRegion },
|
||||
{ "GdiDeleteLocalDC", func_GdiDeleteLocalDC },
|
||||
{ "GdiGetCharDimensions", func_GdiGetCharDimensions },
|
||||
{ "GdiGetLocalBrush", func_GdiGetLocalBrush },
|
||||
{ "GdiGetLocalDC", func_GdiGetLocalDC },
|
||||
{ "GdiReleaseLocalDC", func_GdiReleaseLocalDC },
|
||||
{ "GdiSetAttrs", func_GdiSetAttrs },
|
||||
{ "GetClipRgn", func_GetClipRgn },
|
||||
{ "GetCurrentObject", func_GetCurrentObject },
|
||||
{ "GetDIBits", func_GetDIBits },
|
||||
{ "GetObject", func_GetObject },
|
||||
{ "GetStockObject", func_GetStockObject },
|
||||
{ "GetTextExtentExPoint", func_GetTextExtentExPoint },
|
||||
{ "GetTextFace", func_GetTextFace },
|
||||
{ "SelectObject", func_SelectObject },
|
||||
{ "SetDCPenColor", func_SetDCPenColor },
|
||||
{ "SetMapMode", func_SetMapMode },
|
||||
{ "SetSysColors", func_SetSysColors },
|
||||
{ "SetWindowExtEx", func_SetWindowExtEx },
|
||||
{ "SetWorldTransform", func_SetWorldTransform },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
AddFontResource
|
||||
it seam any type of pfm/pfb/fon/fnt been genreate by fontforge
|
||||
does not be accpected by Windows
|
||||
|
||||
Notes Loading two font same times does not working
|
||||
as msdn desc how todo it
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
|
||||
typedef PGDI_TABLE_ENTRY (CALLBACK * GDIQUERYPROC) (void);
|
||||
|
||||
/* GDI handle table can hold 0x4000 handles */
|
||||
#define GDI_HANDLE_COUNT 0x10000
|
||||
#define GDI_GLOBAL_PROCESS (0x0)
|
||||
|
||||
/* Handle Masks and shifts */
|
||||
#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
|
||||
#define GDI_HANDLE_TYPE_MASK 0x007f0000
|
||||
#define GDI_HANDLE_STOCK_MASK 0x00800000
|
||||
#define GDI_HANDLE_REUSE_MASK 0xff000000
|
||||
#define GDI_HANDLE_REUSECNT_SHIFT 24
|
||||
|
||||
|
||||
#define GDI_OBJECT_TYPE_DC 0x00010000
|
||||
#define GDI_OBJECT_TYPE_REGION 0x00040000
|
||||
#define GDI_OBJECT_TYPE_BITMAP 0x00050000
|
||||
#define GDI_OBJECT_TYPE_PALETTE 0x00080000
|
||||
#define GDI_OBJECT_TYPE_FONT 0x000a0000
|
||||
#define GDI_OBJECT_TYPE_BRUSH 0x00100000
|
||||
#define GDI_OBJECT_TYPE_EMF 0x00210000
|
||||
#define GDI_OBJECT_TYPE_PEN 0x00300000
|
||||
#define GDI_OBJECT_TYPE_EXTPEN 0x00500000
|
||||
#define GDI_OBJECT_TYPE_COLORSPACE 0x00090000
|
||||
#define GDI_OBJECT_TYPE_METADC 0x00660000
|
||||
#define GDI_OBJECT_TYPE_METAFILE 0x00260000
|
||||
#define GDI_OBJECT_TYPE_ENHMETAFILE 0x00460000
|
||||
/* Following object types made up for ROS */
|
||||
#define GDI_OBJECT_TYPE_ENHMETADC 0x00740000
|
||||
#define GDI_OBJECT_TYPE_MEMDC 0x00750000
|
||||
#define GDI_OBJECT_TYPE_DCE 0x00770000
|
||||
#define GDI_OBJECT_TYPE_DONTCARE 0x007f0000
|
||||
/** Not really an object type. Forces GDI_FreeObj to be silent. */
|
||||
#define GDI_OBJECT_TYPE_SILENT 0x80000000
|
||||
|
||||
HDC WINAPI GdiConvertBitmap(HDC hdc);
|
||||
HBRUSH WINAPI GdiConvertBrush(HBRUSH hbr);
|
||||
HDC WINAPI GdiConvertDC(HDC hdc);
|
||||
HFONT WINAPI GdiConvertFont(HFONT hfont);
|
||||
HPALETTE WINAPI GdiConvertPalette(HPALETTE hpal);
|
||||
HRGN WINAPI GdiConvertRegion(HRGN hregion);
|
||||
HBRUSH WINAPI GdiGetLocalBrush(HBRUSH hbr);
|
||||
HDC WINAPI GdiGetLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiDeleteLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiReleaseLocalDC(HDC hdc);
|
||||
BOOL WINAPI GdiSetAttrs(HDC hdc);
|
||||
|
||||
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#include "gdi32api.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
|
||||
BOOL
|
||||
IsFunctionPresent(LPWSTR lpszFunction)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
PGDI_TABLE_ENTRY
|
||||
MyGdiQueryTable()
|
||||
{
|
||||
PTEB pTeb = NtCurrentTeb();
|
||||
PPEB pPeb = pTeb->ProcessEnvironmentBlock;
|
||||
return pPeb->GdiSharedHandleTable;
|
||||
}
|
||||
|
||||
BOOL
|
||||
IsHandleValid(HGDIOBJ hobj)
|
||||
{
|
||||
USHORT Index = (ULONG_PTR)hobj;
|
||||
PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index];
|
||||
|
||||
if (pentry->KernelData == NULL ||
|
||||
pentry->KernelData < (PVOID)0x80000000 ||
|
||||
(USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
|
||||
GdiHandleTable = MyGdiQueryTable();
|
||||
if(!GdiHandleTable)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return TestMain(L"gdi32api", L"gdi32.dll");
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef _GDITEST_H
|
||||
#define _GDITEST_H
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <d3dnthal.h>
|
||||
#include <prntfont.h>
|
||||
|
||||
/* Public Win32K Headers */
|
||||
#include <win32k/ntgdityp.h>
|
||||
#include <ntgdi.h>
|
||||
#include <win32k/ntgdihdl.h>
|
||||
|
||||
#include "../apitest.h"
|
||||
#include "gdi.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||
BOOL IsHandleValid(HGDIOBJ hobj);
|
||||
|
||||
#endif /* _GDITEST_H */
|
||||
|
||||
/* EOF */
|
|
@ -1,9 +0,0 @@
|
|||
<module name="gdi32api" type="win32cui">
|
||||
<include base="gdi32api">.</include>
|
||||
<library>apitest</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>shell32</library>
|
||||
<file>gdi32api.c</file>
|
||||
<file>testlist.c</file>
|
||||
</module>
|
|
@ -1,100 +0,0 @@
|
|||
#ifndef _GDITESTLIST_H
|
||||
#define _GDITESTLIST_H
|
||||
|
||||
#include "gdi32api.h"
|
||||
|
||||
/* include the tests */
|
||||
#include "tests/AddFontResource.c"
|
||||
#include "tests/AddFontResourceEx.c"
|
||||
#include "tests/BeginPath.c"
|
||||
#include "tests/CreateBitmapIndirect.c"
|
||||
#include "tests/CreateCompatibleDC.c"
|
||||
#include "tests/CreateFontIndirect.c"
|
||||
#include "tests/CreateFont.c"
|
||||
#include "tests/CreatePen.c"
|
||||
#include "tests/CreateRectRgn.c"
|
||||
#include "tests/EngCreateSemaphore.c"
|
||||
#include "tests/EngAcquireSemaphore.c"
|
||||
#include "tests/EngDeleteSemaphore.c"
|
||||
#include "tests/EngReleaseSemaphore.c"
|
||||
#include "tests/ExtCreatePen.c"
|
||||
#include "tests/GdiConvertBitmap.c"
|
||||
#include "tests/GdiConvertBrush.c"
|
||||
#include "tests/GdiConvertDC.c"
|
||||
#include "tests/GdiConvertFont.c"
|
||||
#include "tests/GdiConvertPalette.c"
|
||||
#include "tests/GdiConvertRegion.c"
|
||||
#include "tests/GdiDeleteLocalDC.c"
|
||||
#include "tests/GdiGetCharDimensions.c"
|
||||
#include "tests/GdiGetLocalBrush.c"
|
||||
#include "tests/GdiGetLocalDC.c"
|
||||
#include "tests/GdiReleaseLocalDC.c"
|
||||
#include "tests/GdiSetAttrs.c"
|
||||
#include "tests/GetClipRgn.c"
|
||||
#include "tests/GetCurrentObject.c"
|
||||
#include "tests/GetDIBits.c"
|
||||
#include "tests/GetObject.c"
|
||||
#include "tests/GetStockObject.c"
|
||||
#include "tests/GetTextExtentExPoint.c"
|
||||
#include "tests/GetTextFace.c"
|
||||
#include "tests/SelectObject.c"
|
||||
#include "tests/SetDCPenColor.c"
|
||||
#include "tests/SetMapMode.c"
|
||||
#include "tests/SetSysColors.c"
|
||||
#include "tests/SetWindowExtEx.c"
|
||||
#include "tests/SetWorldTransform.c"
|
||||
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
{
|
||||
{ L"AddFontResourceA", Test_AddFontResourceA },
|
||||
{ L"AddFontResourceEx", Test_AddFontResourceEx },
|
||||
{ L"BeginPath", Test_BeginPath },
|
||||
{ L"CreateBitmapIndirect", Test_CreateBitmapIndirect },
|
||||
{ L"CreateCompatibleDC", Test_CreateCompatibleDC },
|
||||
{ L"CreateFontIndirect", Test_CreateFontIndirect },
|
||||
{ L"CreateFont", Test_CreateFont },
|
||||
{ L"CreatePen", Test_CreatePen },
|
||||
{ L"EngCreateSemaphore", Test_EngCreateSemaphore },
|
||||
{ L"EngAcquireSemaphore", Test_EngAcquireSemaphore },
|
||||
{ L"EngDeleteSemaphore", Test_EngDeleteSemaphore },
|
||||
{ L"EngReleaseSemaphore", Test_EngReleaseSemaphore },
|
||||
{ L"CreateRectRgn", Test_CreateRectRgn },
|
||||
{ L"ExtCreatePen", Test_ExtCreatePen },
|
||||
{ L"GdiConvertBitmap", Test_GdiConvertBitmap },
|
||||
{ L"GdiConvertBrush", Test_GdiConvertBrush },
|
||||
{ L"GdiConvertDC", Test_GdiConvertDC },
|
||||
{ L"GdiConvertFont", Test_GdiConvertFont },
|
||||
{ L"GdiConvertPalette", Test_GdiConvertPalette },
|
||||
{ L"GdiConvertRegion", Test_GdiConvertRegion },
|
||||
{ L"GdiDeleteLocalDC", Test_GdiDeleteLocalDC },
|
||||
{ L"GdiGetCharDimensions", Test_GdiGetCharDimensions },
|
||||
{ L"GdiGetLocalBrush", Test_GdiGetLocalBrush },
|
||||
{ L"GdiGetLocalDC", Test_GdiGetLocalDC },
|
||||
{ L"GdiReleaseLocalDC", Test_GdiReleaseLocalDC },
|
||||
{ L"GdiSetAttrs", Test_GdiSetAttrs },
|
||||
{ L"GetClipRgn", Test_GetClipRgn },
|
||||
{ L"GetCurrentObject", Test_GetCurrentObject },
|
||||
{ L"GetDIBits", Test_GetDIBits },
|
||||
{ L"GetObject", Test_GetObject },
|
||||
{ L"GetStockObject", Test_GetStockObject },
|
||||
{ L"GetTextExtentExPoint", Test_GetTextExtentExPoint },
|
||||
{ L"GetTextFace", Test_GetTextFace },
|
||||
{ L"SelectObject", Test_SelectObject },
|
||||
{ L"SetDCPenColor", Test_SetDCPenColor },
|
||||
{ L"SetMapMode", Test_SetMapMode },
|
||||
{ L"SetSysColors", Test_SetSysColors },
|
||||
{ L"SetWindowExtEx", Test_SetWindowExtEx },
|
||||
{ L"SetWorldTransform", Test_SetWorldTransform },
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
INT NumTests(void)
|
||||
{
|
||||
return sizeof(TestList) / sizeof(TESTENTRY);
|
||||
}
|
||||
|
||||
#endif /* _GDITESTLIST_H */
|
||||
|
||||
/* EOF */
|
|
@ -1,74 +0,0 @@
|
|||
|
||||
INT
|
||||
Test_AddFontResourceA(PTESTINFO pti)
|
||||
{
|
||||
CHAR szFileNameA[MAX_PATH];
|
||||
CHAR szFileNameFont1A[MAX_PATH];
|
||||
CHAR szFileNameFont2A[MAX_PATH];
|
||||
|
||||
GetCurrentDirectoryA(MAX_PATH,szFileNameA);
|
||||
|
||||
memcpy(szFileNameFont1A,szFileNameA,MAX_PATH );
|
||||
strcat(szFileNameFont1A, "\\testdata\\test.ttf");
|
||||
|
||||
memcpy(szFileNameFont2A,szFileNameA,MAX_PATH );
|
||||
strcat(szFileNameFont2A, "\\testdata\\test.otf");
|
||||
|
||||
RtlZeroMemory(szFileNameA,MAX_PATH);
|
||||
|
||||
/*
|
||||
* Start testing Ansi version
|
||||
*
|
||||
*/
|
||||
|
||||
/* Testing NULL pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(AddFontResourceA(NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Testing -1 pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(AddFontResourceA((CHAR*)-1) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Testing address 1 pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(AddFontResourceA((CHAR*)1) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Testing address empty string */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(AddFontResourceA("") == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Testing one ttf font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceA(szFileNameFont1A) == 1);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Testing one otf font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceA(szFileNameFont2A) == 1);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Testing two fonts */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
sprintf(szFileNameA,"%s|%s",szFileNameFont1A, szFileNameFont2A);
|
||||
TEST(AddFontResourceA(szFileNameA) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
sprintf(szFileNameA,"%s |%s",szFileNameFont1A, szFileNameFont2A);
|
||||
TEST(AddFontResourceA(szFileNameA) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
sprintf(szFileNameA,"%s | %s",szFileNameFont1A, szFileNameFont2A);
|
||||
TEST(AddFontResourceA(szFileNameA) == 0);
|
||||
TEST(GetLastError() == ERROR_FILE_NOT_FOUND);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8))
|
||||
|
||||
INT
|
||||
Test_AddFontResourceEx(PTESTINFO pti)
|
||||
{
|
||||
WCHAR szFileName[MAX_PATH];
|
||||
|
||||
/* Test NULL filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
/* Windows crashes, would need SEH here */
|
||||
// TEST(AddFontResourceExW(NULL, 0, 0) != 0);
|
||||
// TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test "" filename */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(AddFontResourceExW(L"", 0, 0) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
|
||||
wcscat(szFileName, L"\\Fonts\\cour.ttf");
|
||||
|
||||
/* Test flags = 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(AddFontResourceExW(szFileName, 0, 0) != 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(AddFontResourceExW(szFileName, 256, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid pointer as last parameter */
|
||||
TEST(AddFontResourceExW(szFileName, 0, (void*)-1) != 0);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
|
||||
INT
|
||||
Test_BeginPath(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
BOOL ret;
|
||||
|
||||
SetLastError(0);
|
||||
ret = BeginPath(0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
|
||||
SetLastError(0);
|
||||
ret = BeginPath(hDC);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
INT
|
||||
Test_CreateCompatibleDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hDCScreen, hOldDC, hDC, hDC2;
|
||||
|
||||
/* Get screen DC */
|
||||
hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
/* Test NULL DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
RTEST(hDC != NULL);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
if(hDC) DeleteDC(hDC);
|
||||
|
||||
/* Test invalid DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hDC = CreateCompatibleDC((HDC)0x123456);
|
||||
RTEST(hDC == NULL);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
if(hDC) DeleteDC(hDC);
|
||||
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
RTEST(hDC != NULL);
|
||||
|
||||
// Test if first selected pen is BLACK_PEN (? or same as screen DC's pen?)
|
||||
RTEST(SelectObject(hDC, GetStockObject(DC_PEN)) == GetStockObject(BLACK_PEN));
|
||||
RTEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
||||
|
||||
// Test for the starting Color == RGB(0,0,0)
|
||||
RTEST(SetDCPenColor(hDC, RGB(1,2,3)) == RGB(0,0,0));
|
||||
|
||||
// Check for reuse counter
|
||||
hOldDC = hDC;
|
||||
DeleteDC(hDC);
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
hDC2 = CreateCompatibleDC(hOldDC);
|
||||
RTEST(hDC2 == NULL);
|
||||
if (hDC2 != NULL) DeleteDC(hDC2);
|
||||
|
||||
/* Check map mode */
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
SetMapMode(hDC, MM_ISOTROPIC);
|
||||
hDC2 = CreateCompatibleDC(hDC);
|
||||
TEST(GetMapMode(hDC2) == MM_TEXT);
|
||||
|
||||
// cleanup
|
||||
DeleteDC(hDC);
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#define INVALIDFONT "ThisFontDoesNotExist"
|
||||
|
||||
INT
|
||||
Test_CreateFont(PTESTINFO pti)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
|
||||
/* Test invalid font name */
|
||||
hFont = CreateFontA(15, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH, INVALIDFONT);
|
||||
RTEST(hFont);
|
||||
RTEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA));
|
||||
RTEST(memcmp(logfonta.lfFaceName, INVALIDFONT, strlen(INVALIDFONT)) == 0);
|
||||
RTEST(logfonta.lfWeight == FW_DONTCARE);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
INT
|
||||
Test_CreateRectRgn(PTESTINFO pti)
|
||||
{
|
||||
// HRGN hRgn;
|
||||
|
||||
// hRgn = CreateRectRgn(
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/* Simple test of EngAcquireSemaphore only check if we got a lock or not */
|
||||
INT
|
||||
Test_EngAcquireSemaphore(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
hsem = EngCreateSemaphore();
|
||||
RTEST ( hsem != NULL );
|
||||
ASSERT(hsem != NULL);
|
||||
lpcrit = (PRTL_CRITICAL_SECTION) hsem;
|
||||
|
||||
/* real data test */
|
||||
EngAcquireSemaphore(hsem);
|
||||
// RTEST (lpcrit->LockCount == -2); doesn't work on XP
|
||||
RTEST (lpcrit->RecursionCount == 1);
|
||||
RTEST (lpcrit->OwningThread != 0);
|
||||
RTEST (lpcrit->LockSemaphore == 0);
|
||||
RTEST (lpcrit->SpinCount == 0);
|
||||
|
||||
ASSERT(lpcrit->DebugInfo != NULL);
|
||||
RTEST (lpcrit->DebugInfo->Type == 0);
|
||||
RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex == 0);
|
||||
RTEST (lpcrit->DebugInfo->EntryCount == 0);
|
||||
RTEST (lpcrit->DebugInfo->ContentionCount == 0);
|
||||
|
||||
EngReleaseSemaphore(hsem);
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
/* NULL pointer test */
|
||||
// Note NULL pointer test crash in Vista */
|
||||
// EngAcquireSemaphore(NULL);
|
||||
|
||||
/* negtive pointer test */
|
||||
// Note negtive pointer test crash in Vista */
|
||||
// EngAcquireSemaphore((HSEMAPHORE)-1);
|
||||
|
||||
/* try with deleted Semaphore */
|
||||
// Note deleted Semaphore pointer test does freze the whole program in Vista */
|
||||
// EngAcquireSemaphore(hsem);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/* Simple test of EngAcquireSemaphore only check if we got a lock or not */
|
||||
INT
|
||||
Test_EngCreateSemaphore(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
hsem = EngCreateSemaphore();
|
||||
RTEST ( hsem != NULL );
|
||||
ASSERT(hsem != NULL);
|
||||
|
||||
lpcrit = (PRTL_CRITICAL_SECTION) hsem;
|
||||
RTEST ( lpcrit->DebugInfo != NULL);
|
||||
RTEST (lpcrit->LockCount == -1);
|
||||
RTEST (lpcrit->RecursionCount == 0);
|
||||
RTEST (lpcrit->OwningThread == 0);
|
||||
RTEST (lpcrit->LockSemaphore == 0);
|
||||
RTEST (lpcrit->SpinCount == 0);
|
||||
|
||||
ASSERT(lpcrit->DebugInfo != NULL);
|
||||
RTEST (lpcrit->DebugInfo->Type == 0);
|
||||
RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex == 0);
|
||||
RTEST (lpcrit->DebugInfo->EntryCount == 0);
|
||||
RTEST (lpcrit->DebugInfo->ContentionCount == 0);
|
||||
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
INT
|
||||
Test_EngDeleteSemaphore(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
/* test Create then delete */
|
||||
hsem = EngCreateSemaphore();
|
||||
ASSERT(hsem != NULL);
|
||||
lpcrit = (PRTL_CRITICAL_SECTION) hsem;
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
// RTEST (lpcrit->LockCount > 0); doesn't work on XP
|
||||
RTEST (lpcrit->RecursionCount == 0);
|
||||
RTEST (lpcrit->OwningThread == 0);
|
||||
RTEST (lpcrit->LockSemaphore == 0);
|
||||
RTEST (lpcrit->SpinCount == 0);
|
||||
|
||||
// ASSERT(lpcrit->DebugInfo != NULL); doesn't work on XP
|
||||
RTEST (lpcrit->DebugInfo->Type != 0);
|
||||
RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0);
|
||||
RTEST (lpcrit->DebugInfo->EntryCount != 0);
|
||||
RTEST (lpcrit->DebugInfo->ContentionCount != 0);
|
||||
|
||||
|
||||
/* test EngAcquireSemaphore and release it, then delete it */
|
||||
hsem = EngCreateSemaphore();
|
||||
ASSERT(hsem != NULL);
|
||||
lpcrit = (PRTL_CRITICAL_SECTION) hsem;
|
||||
|
||||
EngAcquireSemaphore(hsem);
|
||||
EngReleaseSemaphore(hsem);
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
RTEST (lpcrit->LockCount > 0);
|
||||
RTEST (lpcrit->RecursionCount == 0);
|
||||
RTEST (lpcrit->OwningThread == 0);
|
||||
RTEST (lpcrit->LockSemaphore == 0);
|
||||
RTEST (lpcrit->SpinCount == 0);
|
||||
|
||||
ASSERT(lpcrit->DebugInfo != NULL);
|
||||
RTEST (lpcrit->DebugInfo->Type != 0);
|
||||
RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0);
|
||||
RTEST (lpcrit->DebugInfo->EntryCount != 0);
|
||||
RTEST (lpcrit->DebugInfo->ContentionCount != 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/* Simple test of EngAcquireSemaphore only check if we got a lock or not */
|
||||
INT
|
||||
Test_EngReleaseSemaphore(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HSEMAPHORE hsem;
|
||||
PRTL_CRITICAL_SECTION lpcrit;
|
||||
|
||||
hsem = EngCreateSemaphore();
|
||||
ASSERT(hsem != NULL);
|
||||
|
||||
lpcrit = (PRTL_CRITICAL_SECTION) hsem;
|
||||
|
||||
EngAcquireSemaphore(hsem);
|
||||
EngReleaseSemaphore(hsem);
|
||||
|
||||
RTEST (lpcrit->LockCount != 0);
|
||||
RTEST (lpcrit->RecursionCount == 0);
|
||||
RTEST (lpcrit->OwningThread == 0);
|
||||
RTEST (lpcrit->LockSemaphore == 0);
|
||||
RTEST (lpcrit->SpinCount == 0);
|
||||
|
||||
ASSERT(lpcrit->DebugInfo != NULL);
|
||||
RTEST (lpcrit->DebugInfo->Type == 0);
|
||||
RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex == 0);
|
||||
RTEST (lpcrit->DebugInfo->EntryCount == 0);
|
||||
RTEST (lpcrit->DebugInfo->ContentionCount == 0);
|
||||
|
||||
EngDeleteSemaphore(hsem);
|
||||
|
||||
/* try with deleted Semaphore */
|
||||
// EngReleaseSemaphore(hsem); -> this leads to heap correuption
|
||||
// RTEST (lpcrit->LockCount > 0);
|
||||
// RTEST (lpcrit->RecursionCount != 0);
|
||||
// RTEST (lpcrit->OwningThread == 0);
|
||||
// RTEST (lpcrit->LockSemaphore == 0);
|
||||
// RTEST (lpcrit->SpinCount == 0);
|
||||
|
||||
// ASSERT(lpcrit->DebugInfo != NULL);
|
||||
// RTEST (lpcrit->DebugInfo->Type != 0);
|
||||
// RTEST (lpcrit->DebugInfo->CreatorBackTraceIndex != 0);
|
||||
// RTEST (lpcrit->DebugInfo->EntryCount != 0);
|
||||
// RTEST (lpcrit->DebugInfo->ContentionCount != 0);
|
||||
|
||||
/* NULL pointer test */
|
||||
// Note NULL pointer test crash in Vista */
|
||||
// EngReleaseSemaphore(NULL);
|
||||
|
||||
/* negtive pointer test */
|
||||
// Note negtive pointer test crash in Vista */
|
||||
// EngReleaseSemaphore((HSEMAPHORE)-1);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
INT
|
||||
Test_ExtCreatePen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
|
||||
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 0;
|
||||
hPen = ExtCreatePen(PS_COSMETIC, 1,&logbrush, 0, 0);
|
||||
if (!hPen) return FALSE;
|
||||
|
||||
/* Test if we have an EXTPEN */
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* test userstyles */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, (CONST DWORD*)&dwStyles);
|
||||
RTEST(hPen == 0);
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
RTEST(hPen != 0);
|
||||
|
||||
DeleteObject(hPen);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
INT
|
||||
Test_GdiConvertBitmap(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiConvertBitmap((HDC)-1) == (HDC)-1);
|
||||
RTEST(GdiConvertBitmap((HDC)0) == (HDC)0);
|
||||
RTEST(GdiConvertBitmap((HDC)1) == (HDC)1);
|
||||
RTEST(GdiConvertBitmap((HDC)2) == (HDC)2);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
INT
|
||||
Test_GdiConvertBrush(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiConvertBrush((HBRUSH)-1) == (HBRUSH)-1);
|
||||
RTEST(GdiConvertBrush((HBRUSH)0) == (HBRUSH)0);
|
||||
RTEST(GdiConvertBrush((HBRUSH)1) == (HBRUSH)1);
|
||||
RTEST(GdiConvertBrush((HBRUSH)2) == (HBRUSH)2);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
INT
|
||||
Test_GdiConvertDC(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiConvertDC((HDC)-1) == (HDC)-1);
|
||||
RTEST(GdiConvertDC((HDC)0) == (HDC)0);
|
||||
RTEST(GdiConvertDC((HDC)1) == (HDC)1);
|
||||
RTEST(GdiConvertDC((HDC)2) == (HDC)2);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
INT
|
||||
Test_GdiConvertFont(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiConvertFont((HFONT)-1) == (HFONT)-1);
|
||||
RTEST(GdiConvertFont((HFONT)0) == (HFONT)0);
|
||||
RTEST(GdiConvertFont((HFONT)1) == (HFONT)1);
|
||||
RTEST(GdiConvertFont((HFONT)2) == (HFONT)2);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
INT
|
||||
Test_GdiConvertPalette(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiConvertPalette((HPALETTE)-1) == (HPALETTE)-1);
|
||||
RTEST(GdiConvertPalette((HPALETTE)0) == (HPALETTE)0);
|
||||
RTEST(GdiConvertPalette((HPALETTE)1) == (HPALETTE)1);
|
||||
RTEST(GdiConvertPalette((HPALETTE)2) == (HPALETTE)2);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
INT
|
||||
Test_GdiConvertRegion(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiConvertRegion((HRGN)-1) == (HRGN)-1);
|
||||
RTEST(GdiConvertRegion((HRGN)0) == (HRGN)0);
|
||||
RTEST(GdiConvertRegion((HRGN)1) == (HRGN)1);
|
||||
RTEST(GdiConvertRegion((HRGN)2) == (HRGN)2);
|
||||
RTEST(GdiConvertRegion((HRGN)3) == (HRGN)3);
|
||||
RTEST(GdiConvertRegion((HRGN)4) == (HRGN)4);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
INT
|
||||
Test_GdiDeleteLocalDC(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiDeleteLocalDC((HDC)-1) == TRUE);
|
||||
RTEST(GdiDeleteLocalDC((HDC)0) == TRUE);
|
||||
RTEST(GdiDeleteLocalDC((HDC)1) == TRUE);
|
||||
RTEST(GdiDeleteLocalDC((HDC)2) == TRUE);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *);
|
||||
|
||||
INT
|
||||
Test_GdiGetCharDimensions(PTESTINFO pti)
|
||||
{
|
||||
LOGFONT logfont = {-11, 0, 0, 0, 400,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"MS Shell Dlg 2"};
|
||||
HFONT hFont, hOldFont;
|
||||
HDC hDC;
|
||||
LONG x,y;
|
||||
TEXTMETRICW tm;
|
||||
|
||||
hFont = CreateFontIndirect(&logfont);
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
hOldFont = SelectObject(hDC, hFont);
|
||||
|
||||
x = GdiGetCharDimensions(hDC, &tm, &y);
|
||||
|
||||
RTEST(y == tm.tmHeight);
|
||||
|
||||
SelectObject(hDC, hOldFont);
|
||||
DeleteObject(hFont);
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
INT
|
||||
Test_GdiGetLocalBrush(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiGetLocalBrush((HBRUSH)-1) == (HBRUSH)-1);
|
||||
RTEST(GdiGetLocalBrush((HBRUSH)0) == (HBRUSH)0);
|
||||
RTEST(GdiGetLocalBrush((HBRUSH)1) == (HBRUSH)1);
|
||||
RTEST(GdiGetLocalBrush((HBRUSH)2) == (HBRUSH)2);
|
||||
RTEST(GdiGetLocalBrush((HBRUSH)3) == (HBRUSH)3);
|
||||
RTEST(GdiGetLocalBrush((HBRUSH)4) == (HBRUSH)4);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
INT
|
||||
Test_GdiGetLocalDC(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiGetLocalDC((HDC)-1) == (HDC)-1);
|
||||
RTEST(GdiGetLocalDC((HDC)0) == (HDC)0);
|
||||
RTEST(GdiGetLocalDC((HDC)1) == (HDC)1);
|
||||
RTEST(GdiGetLocalDC((HDC)2) == (HDC)2);
|
||||
RTEST(GdiGetLocalDC((HDC)3) == (HDC)3);
|
||||
RTEST(GdiGetLocalDC((HDC)4) == (HDC)4);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
INT
|
||||
Test_GdiReleaseLocalDC(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiReleaseLocalDC((HDC)-1) == TRUE);
|
||||
RTEST(GdiReleaseLocalDC((HDC)0) == TRUE);
|
||||
RTEST(GdiReleaseLocalDC((HDC)1) == TRUE);
|
||||
RTEST(GdiReleaseLocalDC((HDC)2) == TRUE);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
INT
|
||||
Test_GdiSetAttrs(PTESTINFO pti)
|
||||
{
|
||||
RTEST(GdiSetAttrs((HDC)-1) == TRUE);
|
||||
RTEST(GdiSetAttrs((HDC)0) == TRUE);
|
||||
RTEST(GdiSetAttrs((HDC)1) == TRUE);
|
||||
RTEST(GdiSetAttrs((HDC)2) == TRUE);
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
INT
|
||||
Test_GetClipRgn(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HRGN hrgn;//, hrgn2;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetClipRgn((HDC)0x12345, hrgn) == -1);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test invalid hrgn */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetClipRgn(hDC, (HRGN)0x12345) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
|
||||
INT
|
||||
Test_GetCurrentObject(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HBITMAP hBmp;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
/* Get the DC */
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(NULL, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(NULL, OBJ_BITMAP) == 0);
|
||||
RTEST(GetCurrentObject(NULL, OBJ_BRUSH) == 0);
|
||||
RTEST(GetCurrentObject(NULL, OBJ_COLORSPACE) == 0);
|
||||
RTEST(GetCurrentObject(NULL, OBJ_FONT) == 0);
|
||||
RTEST(GetCurrentObject(NULL, OBJ_PAL) == 0);
|
||||
RTEST(GetCurrentObject(NULL, OBJ_PEN) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject((HDC)-123, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject((HDC)-123, OBJ_BITMAP) == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid types */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 3) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 4) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 8) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 9) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 10) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 12) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, 13) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Default bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hBmp = GetCurrentObject(hDC, OBJ_BITMAP);
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hBmp) == GDI_OBJECT_TYPE_BITMAP);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Other bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(21));
|
||||
RTEST(hBmp == GetCurrentObject(hDC, OBJ_BITMAP));
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hBmp) == GDI_OBJECT_TYPE_BITMAP);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Default brush */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, OBJ_BRUSH) == GetStockObject(WHITE_BRUSH));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Other brush */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(BLACK_BRUSH));
|
||||
RTEST(GetCurrentObject(hDC, OBJ_BRUSH) == GetStockObject(BLACK_BRUSH));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Default colorspace */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, OBJ_COLORSPACE) == GetStockObject(20));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Default font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, OBJ_FONT) == GetStockObject(SYSTEM_FONT));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Other font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
|
||||
RTEST(GetCurrentObject(hDC, OBJ_FONT) == GetStockObject(DEFAULT_GUI_FONT));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Default palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, OBJ_PAL) == GetStockObject(DEFAULT_PALETTE));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Default pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetCurrentObject(hDC, OBJ_PEN) == GetStockObject(BLACK_PEN));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Other pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(WHITE_PEN));
|
||||
RTEST(GetCurrentObject(hDC, OBJ_PEN) == GetStockObject(WHITE_PEN));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* DC pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
RTEST(GetCurrentObject(hDC, OBJ_PEN) == GetStockObject(DC_PEN));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -1,453 +0,0 @@
|
|||
static INT
|
||||
Test_General(PTESTINFO pti)
|
||||
{
|
||||
struct
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
BYTE additional[5];
|
||||
} TestStruct;
|
||||
PLOGBRUSH plogbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
/* Test null pointer and invalid handles */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA(0, 0, NULL) == 0);
|
||||
RTEST(GetObjectA((HANDLE)-1, 0, NULL) == 0);
|
||||
RTEST(GetObjectA((HANDLE)0x00380000, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test need of alignment */
|
||||
hBrush = GetStockObject(WHITE_BRUSH);
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush);
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH));
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 2);
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH));
|
||||
plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 1);
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Bitmap(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
BYTE bData[100] = {0};
|
||||
BYTE Buffer[100] = {48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0};
|
||||
|
||||
FillMemory(&bitmap, sizeof(BITMAP), 0x77);
|
||||
hBitmap = CreateBitmap(10,10,1,8,bData);
|
||||
if (!hBitmap) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, 0, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, 5, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, 0, Buffer) == 0);
|
||||
RTEST(GetObjectA(hBitmap, 5, Buffer) == 0);
|
||||
RTEST(GetObjectA(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(BITMAP));
|
||||
RTEST(GetObjectA(hBitmap, -5, &bitmap) == sizeof(BITMAP));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
// todo: test invalid handle + buffer
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Dibsection(PTESTINFO pti)
|
||||
{
|
||||
BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 9, 1, 8, BI_RGB, 0, 10, 10, 0,0}};
|
||||
HBITMAP hBitmap;
|
||||
BITMAP bitmap;
|
||||
DIBSECTION dibsection;
|
||||
PVOID pData;
|
||||
HDC hDC;
|
||||
|
||||
FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
|
||||
hDC = GetDC(0);
|
||||
hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
|
||||
ASSERT(hBitmap);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObject(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, 0, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, 5, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, -5, NULL) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, 0, &dibsection) == 0);
|
||||
RTEST(GetObject(hBitmap, 5, &dibsection) == 0);
|
||||
RTEST(GetObject(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
RTEST(GetObject(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 10);
|
||||
TEST(bitmap.bmHeight == 9);
|
||||
TEST(bitmap.bmWidthBytes == 12);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
TEST(bitmap.bmBits == pData);
|
||||
RTEST(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(DIBSECTION));
|
||||
RTEST(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection) == sizeof(DIBSECTION));
|
||||
RTEST(GetObject(hBitmap, -5, &dibsection) == sizeof(DIBSECTION));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBitmap);
|
||||
ReleaseDC(0, hDC);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Palette(PTESTINFO pti)
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
HPALETTE hPalette;
|
||||
WORD wPalette;
|
||||
|
||||
FillMemory(&wPalette, sizeof(WORD), 0x77);
|
||||
logpal.palVersion = 0x0300;
|
||||
logpal.palNumEntries = 1;
|
||||
logpal.palPalEntry[0].peRed = 0;
|
||||
logpal.palPalEntry[0].peGreen = 0;
|
||||
logpal.palPalEntry[0].peBlue = 0;
|
||||
logpal.palPalEntry[0].peFlags = PC_EXPLICIT;
|
||||
hPalette = CreatePalette(&logpal);
|
||||
if (!hPalette) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, sizeof(WORD), NULL) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, 0, NULL) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, 5, NULL) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, -5, NULL) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, sizeof(WORD), &wPalette) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, sizeof(WORD)+2, &wPalette) == sizeof(WORD));
|
||||
RTEST(GetObject(hPalette, 0, &wPalette) == 0);
|
||||
RTEST(GetObject(hPalette, 1, &wPalette) == 0);
|
||||
RTEST(GetObject(hPalette, -1, &wPalette) == sizeof(WORD));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hPalette);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Brush(PTESTINFO pti)
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
HBRUSH hBrush;
|
||||
|
||||
FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
|
||||
hBrush = CreateSolidBrush(RGB(1,2,3));
|
||||
if (!hBrush) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, sizeof(WORD), NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, 0, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, 5, NULL) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, -5, NULL) == sizeof(LOGBRUSH));
|
||||
|
||||
RTEST(GetObject(hBrush, 0, &logbrush) == 0);
|
||||
RTEST(logbrush.lbStyle == 0x77777777);
|
||||
RTEST(GetObject(hBrush, 5, &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(logbrush.lbStyle == 0);
|
||||
RTEST(logbrush.lbColor == 0x77777701);
|
||||
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, sizeof(LOGBRUSH)+2, &logbrush) == sizeof(LOGBRUSH));
|
||||
RTEST(GetObject(hBrush, -1, &logbrush) == sizeof(LOGBRUSH));
|
||||
// TODO: test all members
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBrush);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Pen(PTESTINFO pti)
|
||||
{
|
||||
LOGPEN logpen;
|
||||
HPEN hPen;
|
||||
|
||||
FillMemory(&logpen, sizeof(LOGPEN), 0x77);
|
||||
hPen = CreatePen(PS_SOLID, 3, RGB(4,5,6));
|
||||
if (!hPen) return FALSE;
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(BITMAP), NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 5, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, -5, NULL) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetObject(hPen, 0, &logpen) == 0);
|
||||
RTEST(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN));
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
RTEST(logpen.lopnStyle == PS_SOLID);
|
||||
|
||||
|
||||
DeleteObject(hPen);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_ExtPen(PTESTINFO pti)
|
||||
{
|
||||
HPEN hPen;
|
||||
EXTLOGPEN extlogpen;
|
||||
LOGBRUSH logbrush;
|
||||
DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
|
||||
struct
|
||||
{
|
||||
EXTLOGPEN extlogpen;
|
||||
DWORD dwStyles[50];
|
||||
} elpUserStyle;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(1,2,3);
|
||||
logbrush.lbHatch = 22;
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
|
||||
|
||||
RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
|
||||
RTEST(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN), NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, 0, &extlogpen) == 0);
|
||||
RTEST(GetObject(hPen, 4, &extlogpen) == 0);
|
||||
|
||||
/* Nothing should be filled */
|
||||
RTEST(extlogpen.elpPenStyle == 0x77777777);
|
||||
RTEST(extlogpen.elpWidth == 0x77777777);
|
||||
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0);
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
|
||||
|
||||
/* test if the fields are filled correctly */
|
||||
RTEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
|
||||
RTEST(extlogpen.elpWidth == 5);
|
||||
RTEST(extlogpen.elpBrushStyle == 0);
|
||||
RTEST(extlogpen.elpColor == RGB(1,2,3));
|
||||
RTEST(extlogpen.elpHatch == 22);
|
||||
RTEST(extlogpen.elpNumEntries == 0);
|
||||
DeleteObject(hPen);
|
||||
|
||||
/* A maximum of 16 Styles is allowed */
|
||||
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
|
||||
RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
|
||||
RTEST(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0);
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1);
|
||||
RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15);
|
||||
DeleteObject(hPen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Font(PTESTINFO pti)
|
||||
{
|
||||
HFONT hFont;
|
||||
LOGFONTA logfonta;
|
||||
LOGFONTW logfontw;
|
||||
EXTLOGFONTA extlogfonta;
|
||||
EXTLOGFONTW extlogfontw;
|
||||
ENUMLOGFONTEXA enumlogfontexa;
|
||||
ENUMLOGFONTEXW enumlogfontexw;
|
||||
ENUMLOGFONTEXDVA enumlogfontexdva;
|
||||
ENUMLOGFONTEXDVW enumlogfontexdvw;
|
||||
ENUMLOGFONTA enumlogfonta;
|
||||
ENUMLOGFONTW enumlogfontw;
|
||||
BYTE bData[270];
|
||||
|
||||
FillMemory(&logfonta, sizeof(LOGFONTA), 0x77);
|
||||
hFont = CreateFontA(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
|
||||
ANTIALIASED_QUALITY, DEFAULT_PITCH, "testfont");
|
||||
RTEST(hFont);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTA));
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTW));
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA)); // 60
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTA), NULL) == sizeof(LOGFONTA)); // 156
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTA)); // 188
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTA), NULL) == sizeof(LOGFONTA)); // 192
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA), NULL) == sizeof(LOGFONTA)); // 260
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA)+1, NULL) == sizeof(LOGFONTA)); // 260
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW)); // 92
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTW), NULL) == sizeof(LOGFONTW)); // 284
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTW), NULL) == sizeof(LOGFONTW)); // 320
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXW), NULL) == sizeof(LOGFONTW)); // 348
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW), NULL) == sizeof(LOGFONTW)); // 420
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW)+1, NULL) == sizeof(LOGFONTW)); // 356!
|
||||
|
||||
RTEST(GetObjectA(hFont, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA));
|
||||
RTEST(GetObjectA(hFont, 0, NULL) == sizeof(LOGFONTA));
|
||||
RTEST(GetObjectA(hFont, 5, NULL) == sizeof(LOGFONTA));
|
||||
RTEST(GetObjectA(hFont, -5, NULL) == sizeof(LOGFONTA));
|
||||
RTEST(GetObjectA(hFont, 0, &logfonta) == 0);
|
||||
RTEST(logfonta.lfHeight == 0x77777777);
|
||||
|
||||
TEST(GetObjectA(hFont, 5, &logfonta) == 5);
|
||||
TEST(logfonta.lfHeight == 8);
|
||||
TEST(logfonta.lfWidth == 0x77777708);
|
||||
|
||||
RTEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA)); // 60
|
||||
TEST(GetObjectA(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTA)); // 92
|
||||
RTEST(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA)); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTA)+1, &extlogfonta) == sizeof(EXTLOGFONTA)+1); // 192
|
||||
TEST(GetObjectA(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(ENUMLOGFONTEXDVA)); // 320
|
||||
|
||||
TEST(GetObjectA(hFont, 261, &bData) == 260); // no
|
||||
|
||||
/* LOGFONT / GetObjectW */
|
||||
FillMemory(&logfontw, sizeof(LOGFONTW), 0x77);
|
||||
|
||||
RTEST(GetObjectW(hFont, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW));
|
||||
RTEST(GetObjectW(hFont, 0, NULL) == sizeof(LOGFONTW));
|
||||
RTEST(GetObjectW(hFont, 5, NULL) == sizeof(LOGFONTW));
|
||||
RTEST(GetObjectW(hFont, -5, NULL) == sizeof(LOGFONTW));
|
||||
RTEST(GetObjectW(hFont, 0, &logfontw) == 0);
|
||||
RTEST(logfontw.lfHeight == 0x77777777);
|
||||
|
||||
TEST(GetObjectW(hFont, 5, &logfontw) == 5);
|
||||
TEST(logfontw.lfHeight == 8);
|
||||
TEST(logfontw.lfWidth == 0x77777708);
|
||||
|
||||
RTEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA)); // 60
|
||||
RTEST(logfonta.lfHeight == 8);
|
||||
RTEST(GetObjectA(hFont, sizeof(ENUMLOGFONTA), &enumlogfonta) == sizeof(ENUMLOGFONTA)); // 156
|
||||
RTEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXA), &enumlogfontexa) == sizeof(ENUMLOGFONTEXA)); // 188
|
||||
RTEST(GetObjectA(hFont, sizeof(EXTLOGFONTA), &extlogfonta) == sizeof(EXTLOGFONTA)); // 192
|
||||
RTEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA)); // 260
|
||||
TEST(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA)); // 260
|
||||
|
||||
RTEST(GetObjectW(hFont, sizeof(LOGFONTW), &logfontw) == sizeof(LOGFONTW)); // 92
|
||||
RTEST(GetObjectW(hFont, sizeof(ENUMLOGFONTW), &enumlogfontw) == sizeof(ENUMLOGFONTW)); // 284
|
||||
RTEST(GetObjectW(hFont, sizeof(EXTLOGFONTW), &extlogfontw) == sizeof(EXTLOGFONTW)); // 320
|
||||
RTEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW), &enumlogfontexw) == sizeof(ENUMLOGFONTEXW)); // 348
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW), &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD)); // 420
|
||||
TEST(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW)+1, &enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD)); // 356!
|
||||
|
||||
TEST(GetObjectW(hFont, 356, &bData) == 356);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hFont);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_Colorspace(PTESTINFO pti)
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60);// FIXME: what structure?
|
||||
TEST(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 0);
|
||||
TEST(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT
|
||||
Test_MetaDC(PTESTINFO pti)
|
||||
{
|
||||
/* Windows does not SetLastError() on a metadc, but it doesn't seem to do anything with it */
|
||||
HDC hMetaDC;
|
||||
BYTE buffer[100];
|
||||
|
||||
hMetaDC = CreateMetaFile(NULL);
|
||||
if(!hMetaDC) return FALSE;
|
||||
if(((UINT_PTR)hMetaDC & GDI_HANDLE_TYPE_MASK) != GDI_OBJECT_TYPE_METADC) return FALSE;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 0, NULL) == 0);
|
||||
RTEST(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 100, &buffer) == 0);
|
||||
RTEST(GetObjectA(hMetaDC, 0, NULL) == 0);
|
||||
RTEST(GetObjectA(hMetaDC, 100, &buffer) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_GetObject(PTESTINFO pti)
|
||||
{
|
||||
|
||||
HRGN hRgn;
|
||||
hRgn = CreateRectRgn(0,0,5,5);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(GetObjectW(hRgn, 0, NULL) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hRgn);
|
||||
|
||||
Test_Font(pti);
|
||||
Test_Colorspace(pti);
|
||||
Test_General(pti);
|
||||
Test_Bitmap(pti);
|
||||
Test_Dibsection(pti);
|
||||
Test_Palette(pti);
|
||||
Test_Brush(pti);
|
||||
Test_Pen(pti);
|
||||
Test_ExtPen(pti); // not implemented yet in ROS
|
||||
Test_MetaDC(pti);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
INT
|
||||
Test_SetDCPenColor(PTESTINFO pti)
|
||||
{
|
||||
HDC hScreenDC, hDC;
|
||||
HBITMAP hbmp;
|
||||
|
||||
// Test an incorrect DC
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
|
||||
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
// Get the Screen DC
|
||||
hScreenDC = GetDC(NULL);
|
||||
if (hScreenDC == NULL) return FALSE;
|
||||
|
||||
// Test the screen DC
|
||||
SetDCPenColor(hScreenDC, RGB(1,2,3));
|
||||
RTEST(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3));
|
||||
|
||||
// Create a new DC
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ReleaseDC(0, hScreenDC);
|
||||
ASSERT(hDC);
|
||||
|
||||
// Select the DC_PEN and check if the pen returned by a new call is DC_PEN
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
RTEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
||||
|
||||
// Test an incorrect color, yes windows sets the color!
|
||||
SetDCPenColor(hDC, 0x21123456);
|
||||
RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456);
|
||||
|
||||
// Test CLR_INVALID, it sets CLR_INVALID!
|
||||
SetDCPenColor(hDC, CLR_INVALID);
|
||||
RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
|
||||
|
||||
hbmp = CreateBitmap(10, 10, 1, 32, NULL);
|
||||
ASSERT(hbmp);
|
||||
|
||||
SelectObject(hDC, hbmp);
|
||||
SelectObject(hDC, GetStockObject(DC_PEN));
|
||||
SetDCPenColor(hDC, 0x123456);
|
||||
MoveToEx(hDC, 0, 0, NULL);
|
||||
LineTo(hDC, 10, 0);
|
||||
TEST(GetPixel(hDC, 5, 0) == 0x123456);
|
||||
|
||||
// Delete the DC
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
INT
|
||||
Test_SetWorldTransform(PTESTINFO pti)
|
||||
{
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
HDC hScreenDC, hDC;
|
||||
DC_ATTR* pDC_Attr;
|
||||
|
||||
/* Create a DC */
|
||||
hScreenDC = GetDC(NULL);
|
||||
hDC = CreateCompatibleDC(hScreenDC);
|
||||
ReleaseDC(NULL, hScreenDC);
|
||||
SetGraphicsMode(hDC, GM_ADVANCED);
|
||||
|
||||
pEntry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hDC);
|
||||
pDC_Attr = pEntry->UserData;
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue