Author: tkreuzer Date: Thu Oct 13 12:52:25 2011 New Revision: 54106
URL: http://svn.reactos.org/svn/reactos?rev=54106&view=rev Log: [GDI32_APITEST] - Add tests for CreateDIBitmap - more tests for AddFontResource, GetPixel, SetSysColors
Added: trunk/rostests/apitests/gdi32/CreateDIBitmap.c (with props) Modified: trunk/rostests/apitests/gdi32/AddFontResource.c trunk/rostests/apitests/gdi32/CMakeLists.txt trunk/rostests/apitests/gdi32/GetPixel.c trunk/rostests/apitests/gdi32/SetSysColors.c trunk/rostests/apitests/gdi32/testlist.c
Modified: trunk/rostests/apitests/gdi32/AddFontResource.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/AddFontReso... ============================================================================== --- trunk/rostests/apitests/gdi32/AddFontResource.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/AddFontResource.c [iso-8859-1] Thu Oct 13 12:52:25 2011 @@ -87,6 +87,36 @@ result = AddFontResourceA(szFileNameA); ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result); 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)
Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists.... ============================================================================== --- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Thu Oct 13 12:52:25 2011 @@ -8,6 +8,7 @@ CombineTransform.c CreateBitmapIndirect.c CreateCompatibleDC.c + CreateDIBitmap.c CreateFont.c CreateFontIndirect.c CreatePen.c
Added: trunk/rostests/apitests/gdi32/CreateDIBitmap.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CreateDIBit... ============================================================================== --- trunk/rostests/apitests/gdi32/CreateDIBitmap.c (added) +++ trunk/rostests/apitests/gdi32/CreateDIBitmap.c [iso-8859-1] Thu Oct 13 12:52:25 2011 @@ -1,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(); +} +
Propchange: trunk/rostests/apitests/gdi32/CreateDIBitmap.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/apitests/gdi32/GetPixel.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetPixel.c?... ============================================================================== --- trunk/rostests/apitests/gdi32/GetPixel.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/GetPixel.c [iso-8859-1] Thu Oct 13 12:52:25 2011 @@ -28,6 +28,13 @@ color = GetPixel(hdc, 1, 0); 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); DeleteObject(hbmp); DeleteDC(hdc);
Modified: trunk/rostests/apitests/gdi32/SetSysColors.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetSysColor... ============================================================================== --- trunk/rostests/apitests/gdi32/SetSysColors.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/SetSysColors.c [iso-8859-1] Thu Oct 13 12:52:25 2011 @@ -26,21 +26,21 @@ nElements[i] = i; crOldColors[i] = GetSysColor(i); } - + for (i = 0; i < NUM_SYSCOLORS+1; i++) crColors[i] = RGB(i, 255-i, i*3); nElements[NUM_SYSCOLORS] = nElements[0]; - + SetLastError(0xdeadbeef); 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, NULL, crColors) == 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(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(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(NUM_SYSCOLORS, nElements, crColors) == TRUE, "Expected TRUE, got FALSE\n"); for (i = 0; i < NUM_SYSCOLORS; i++)
Modified: trunk/rostests/apitests/gdi32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c?... ============================================================================== --- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Thu Oct 13 12:52:25 2011 @@ -11,6 +11,7 @@ extern void func_CombineTransform(void); extern void func_CreateBitmapIndirect(void); extern void func_CreateCompatibleDC(void); +extern void func_CreateDIBitmap(void); extern void func_CreateFont(void); extern void func_CreateFontIndirect(void); extern void func_CreatePen(void); @@ -59,6 +60,7 @@ { "CombineTransform", func_CombineTransform }, { "CreateBitmapIndirect", func_CreateBitmapIndirect }, { "CreateCompatibleDC", func_CreateCompatibleDC }, + { "CreateDIBitmap", func_CreateDIBitmap }, { "CreateFont", func_CreateFont }, { "CreateFontIndirect", func_CreateFontIndirect }, { "CreatePen", func_CreatePen },