mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
[GDI32_APITEST]
- Add tests for CreateDIBitmap - more tests for AddFontResource, GetPixel, SetSysColors svn path=/trunk/; revision=54106
This commit is contained in:
parent
caf14d848f
commit
f886d23efc
6 changed files with 122 additions and 5 deletions
|
@ -87,6 +87,36 @@ void Test_AddFontResourceA()
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileNameA);
|
||||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
|
|
||||||
|
GetCurrentDirectoryA(MAX_PATH, szFileNameA);
|
||||||
|
strcpy(szFileNameFont1A, szFileNameA);
|
||||||
|
strcat(szFileNameFont1A, "\\testdata\\test.pfm");
|
||||||
|
|
||||||
|
strcpy(szFileNameFont2A, szFileNameA);
|
||||||
|
strcat(szFileNameFont2A, "\\testdata\\test.pfb");
|
||||||
|
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
|
||||||
|
sprintf(szFileNameA,"%s|%s", szFileNameFont1A, szFileNameFont2A);
|
||||||
|
result = AddFontResourceA(szFileNameA);
|
||||||
|
ok(result == 1, "AddFontResourceA(\"%s|%s\") failed, result=%d\n",
|
||||||
|
szFileNameFont1A, szFileNameFont2A, result);
|
||||||
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
|
sprintf(szFileNameA,"%s | %s", szFileNameFont1A, szFileNameFont2A);
|
||||||
|
result = AddFontResourceA(szFileNameA);
|
||||||
|
ok(result == 0, "AddFontResourceA(\"%s | %s\") succeeded, result=%d\n",
|
||||||
|
szFileNameFont1A, szFileNameFont2A, result);
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
|
sprintf(szFileNameA,"%s|%s", szFileNameFont2A, szFileNameFont1A);
|
||||||
|
result = AddFontResourceA(szFileNameA);
|
||||||
|
ok(result == 0, "AddFontResourceA(\"%s|%s\") succeeded, result=%d\n",
|
||||||
|
szFileNameFont2A, szFileNameFont1A, result);
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(AddFontResource)
|
START_TEST(AddFontResource)
|
||||||
|
|
|
@ -8,6 +8,7 @@ list(APPEND SOURCE
|
||||||
CombineTransform.c
|
CombineTransform.c
|
||||||
CreateBitmapIndirect.c
|
CreateBitmapIndirect.c
|
||||||
CreateCompatibleDC.c
|
CreateCompatibleDC.c
|
||||||
|
CreateDIBitmap.c
|
||||||
CreateFont.c
|
CreateFont.c
|
||||||
CreateFontIndirect.c
|
CreateFontIndirect.c
|
||||||
CreatePen.c
|
CreatePen.c
|
||||||
|
|
77
rostests/apitests/gdi32/CreateDIBitmap.c
Normal file
77
rostests/apitests/gdi32/CreateDIBitmap.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS api tests
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* PURPOSE: Test for CreateDIBitmap
|
||||||
|
* PROGRAMMERS: Timo Kreuzer
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <wine/test.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
Test_CreateDIBitmap1(void)
|
||||||
|
{
|
||||||
|
BITMAPINFO bmi;
|
||||||
|
HBITMAP hbmp;
|
||||||
|
BITMAP bitmap;
|
||||||
|
ULONG bits[128] = {0};
|
||||||
|
BYTE rlebits[] = {2, 0, 0, 0, 2, 1, 0, 1};
|
||||||
|
HDC hdc;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
hdc = GetDC(0);
|
||||||
|
|
||||||
|
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
bmi.bmiHeader.biWidth = 2;
|
||||||
|
bmi.bmiHeader.biHeight = 2;
|
||||||
|
bmi.bmiHeader.biPlanes = 1;
|
||||||
|
bmi.bmiHeader.biBitCount = 16;
|
||||||
|
bmi.bmiHeader.biCompression = BI_RGB;
|
||||||
|
bmi.bmiHeader.biSizeImage = 0;
|
||||||
|
bmi.bmiHeader.biXPelsPerMeter = 1;
|
||||||
|
bmi.bmiHeader.biYPelsPerMeter = 1;
|
||||||
|
bmi.bmiHeader.biClrUsed = 0;
|
||||||
|
bmi.bmiHeader.biClrImportant = 0;
|
||||||
|
|
||||||
|
hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_INIT, bits, &bmi, DIB_RGB_COLORS);
|
||||||
|
ok(hbmp != 0, "failed\n");
|
||||||
|
|
||||||
|
ret = GetObject(hbmp, sizeof(bitmap), &bitmap);
|
||||||
|
ok(ret != 0, "failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 2, "\n");
|
||||||
|
ok(bitmap.bmHeight == 2, "\n");
|
||||||
|
ok(bitmap.bmWidthBytes == 8, "bmWidthBytes = %ld\n", bitmap.bmWidthBytes);
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == GetDeviceCaps(hdc, BITSPIXEL), "\n");
|
||||||
|
ok(bitmap.bmBits == 0, "\n");
|
||||||
|
|
||||||
|
SetLastError(0);
|
||||||
|
bmi.bmiHeader.biCompression = BI_RLE8;
|
||||||
|
bmi.bmiHeader.biBitCount = 8;
|
||||||
|
bmi.bmiHeader.biSizeImage = 8;
|
||||||
|
hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_INIT, rlebits, &bmi, DIB_RGB_COLORS);
|
||||||
|
ok(hbmp != 0, "failed\n");
|
||||||
|
ok(GetLastError() == 0, "GetLastError() == %ld\n", GetLastError());
|
||||||
|
|
||||||
|
ret = GetObject(hbmp, sizeof(bitmap), &bitmap);
|
||||||
|
ok(ret != 0, "failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 2, "\n");
|
||||||
|
ok(bitmap.bmHeight == 2, "\n");
|
||||||
|
ok(bitmap.bmWidthBytes == 8, "bmWidthBytes = %ld\n", bitmap.bmWidthBytes);
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == GetDeviceCaps(hdc, BITSPIXEL), "\n");
|
||||||
|
ok(bitmap.bmBits == 0, "\n");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
START_TEST(CreateDIBitmap)
|
||||||
|
{
|
||||||
|
Test_CreateDIBitmap1();
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,13 @@ void Test_GetPixel_1bpp()
|
||||||
color = GetPixel(hdc, 1, 0);
|
color = GetPixel(hdc, 1, 0);
|
||||||
ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
|
ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
|
||||||
|
|
||||||
|
SetBkColor(hdc, 0x12345678);
|
||||||
|
SetTextColor(hdc, 0x87654321);
|
||||||
|
color = GetPixel(hdc, 0, 0);
|
||||||
|
ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
|
||||||
|
color = GetPixel(hdc, 1, 0);
|
||||||
|
ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
|
||||||
|
|
||||||
hbmp = SelectObject(hdc, hbmp);
|
hbmp = SelectObject(hdc, hbmp);
|
||||||
DeleteObject(hbmp);
|
DeleteObject(hbmp);
|
||||||
DeleteDC(hdc);
|
DeleteDC(hdc);
|
||||||
|
|
|
@ -33,14 +33,14 @@ void Test_SetSysColors()
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok(SetSysColors(-1, nElements, crColors) == FALSE, "Expected FALSE, got TRUE\n");
|
ok(SetSysColors(-1, nElements, crColors) == FALSE, "Expected FALSE, got TRUE\n");
|
||||||
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %ld\n", GetLastError());
|
||||||
ok(SetSysColors(0, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
ok(SetSysColors(0, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
||||||
ok(SetSysColors(0, NULL, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
ok(SetSysColors(0, NULL, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
||||||
ok(SetSysColors(0, nElements, NULL) == TRUE, "Expected TRUE, got FALSE\n");
|
ok(SetSysColors(0, nElements, NULL) == TRUE, "Expected TRUE, got FALSE\n");
|
||||||
ok(SetSysColors(1, NULL, crColors) == FALSE, "Expected FALSE, got TRUE\n");
|
ok(SetSysColors(1, NULL, crColors) == FALSE, "Expected FALSE, got TRUE\n");
|
||||||
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %ld\n", GetLastError());
|
||||||
ok(SetSysColors(1, nElements, NULL) == FALSE, "Expected FALSE, got TRUE\n");
|
ok(SetSysColors(1, nElements, NULL) == FALSE, "Expected FALSE, got TRUE\n");
|
||||||
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_NOACCESS, got %ld\n", GetLastError());
|
||||||
ok(SetSysColors(1, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
ok(SetSysColors(1, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
||||||
ok(SetSysColors(NUM_SYSCOLORS, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
ok(SetSysColors(NUM_SYSCOLORS, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n");
|
||||||
for (i = 0; i < NUM_SYSCOLORS; i++)
|
for (i = 0; i < NUM_SYSCOLORS; i++)
|
||||||
|
|
|
@ -11,6 +11,7 @@ extern void func_BeginPath(void);
|
||||||
extern void func_CombineTransform(void);
|
extern void func_CombineTransform(void);
|
||||||
extern void func_CreateBitmapIndirect(void);
|
extern void func_CreateBitmapIndirect(void);
|
||||||
extern void func_CreateCompatibleDC(void);
|
extern void func_CreateCompatibleDC(void);
|
||||||
|
extern void func_CreateDIBitmap(void);
|
||||||
extern void func_CreateFont(void);
|
extern void func_CreateFont(void);
|
||||||
extern void func_CreateFontIndirect(void);
|
extern void func_CreateFontIndirect(void);
|
||||||
extern void func_CreatePen(void);
|
extern void func_CreatePen(void);
|
||||||
|
@ -59,6 +60,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "CombineTransform", func_CombineTransform },
|
{ "CombineTransform", func_CombineTransform },
|
||||||
{ "CreateBitmapIndirect", func_CreateBitmapIndirect },
|
{ "CreateBitmapIndirect", func_CreateBitmapIndirect },
|
||||||
{ "CreateCompatibleDC", func_CreateCompatibleDC },
|
{ "CreateCompatibleDC", func_CreateCompatibleDC },
|
||||||
|
{ "CreateDIBitmap", func_CreateDIBitmap },
|
||||||
{ "CreateFont", func_CreateFont },
|
{ "CreateFont", func_CreateFont },
|
||||||
{ "CreateFontIndirect", func_CreateFontIndirect },
|
{ "CreateFontIndirect", func_CreateFontIndirect },
|
||||||
{ "CreatePen", func_CreatePen },
|
{ "CreatePen", func_CreatePen },
|
||||||
|
|
Loading…
Reference in a new issue