mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
- a bunch of tests for NtUserEnumDisplaySettings
- one test for NtGdiGetFontResourceInfoInternalW svn path=/trunk/; revision=33452
This commit is contained in:
parent
906bec0223
commit
e7657c026b
4 changed files with 148 additions and 1 deletions
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
INT
|
||||||
|
Test_NtGdiGetFontResourceInfoInternalW(PTESTINFO pti)
|
||||||
|
{
|
||||||
|
WCHAR szFullFileName[MAX_PATH+1];
|
||||||
|
BOOL bRet;
|
||||||
|
DWORD dwBufSize;
|
||||||
|
LOGFONTW logfont;
|
||||||
|
UNICODE_STRING NtFileName;
|
||||||
|
|
||||||
|
GetCurrentDirectoryW(MAX_PATH, szFullFileName);
|
||||||
|
wcscat(szFullFileName, L"\\test.otf");
|
||||||
|
|
||||||
|
ASSERT(AddFontResourceW(szFullFileName) != 0);
|
||||||
|
|
||||||
|
ASSERT(RtlDosPathNameToNtPathName_U(szFullFileName,
|
||||||
|
&NtFileName,
|
||||||
|
NULL,
|
||||||
|
NULL));
|
||||||
|
|
||||||
|
dwBufSize = sizeof(logfont);
|
||||||
|
memset(&logfont, 0x0, dwBufSize);
|
||||||
|
|
||||||
|
bRet = NtGdiGetFontResourceInfoInternalW(
|
||||||
|
NtFileName.Buffer,
|
||||||
|
(NtFileName.Length / sizeof(WCHAR)) +1,
|
||||||
|
1,
|
||||||
|
dwBufSize,
|
||||||
|
&dwBufSize,
|
||||||
|
&logfont,
|
||||||
|
2);
|
||||||
|
|
||||||
|
TEST(bRet != FALSE);
|
||||||
|
|
||||||
|
printf("lfHeight = %ld\n", logfont.lfHeight);
|
||||||
|
printf("lfWidth = %ld\n", logfont.lfWidth);
|
||||||
|
printf("lfFaceName = %ls\n", logfont.lfFaceName);
|
||||||
|
|
||||||
|
RemoveFontResourceW(szFullFileName);
|
||||||
|
|
||||||
|
return APISTATUS_NORMAL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
DEVMODEW devmode;
|
||||||
|
CHAR buffer[0xffff];
|
||||||
|
} data;
|
||||||
|
|
||||||
|
INT
|
||||||
|
TEST_NtUserEnumDisplaySettings(PTESTINFO pti)
|
||||||
|
{
|
||||||
|
UNICODE_STRING usDeviceName;
|
||||||
|
WCHAR szName[] = L"DISPLAY";
|
||||||
|
NTSTATUS Status;
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 0, 0, 0);
|
||||||
|
TEST(Status == STATUS_ACCESS_VIOLATION);
|
||||||
|
TEST(GetLastError() == ERROR_SUCCESS);
|
||||||
|
|
||||||
|
data.devmode.dmDriverExtra = 0;
|
||||||
|
for (i = 0; i < 2 * sizeof(DEVMODEW); i++)
|
||||||
|
{
|
||||||
|
data.devmode.dmSize = i;
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 1000, (DEVMODEW*)&data, 0);
|
||||||
|
if (i != sizeof(DEVMODEW))
|
||||||
|
{
|
||||||
|
TEST(Status == STATUS_BUFFER_TOO_SMALL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TEST(GetLastError() == ERROR_SUCCESS);
|
||||||
|
|
||||||
|
usDeviceName.Buffer = NULL;
|
||||||
|
usDeviceName.Length = 0;
|
||||||
|
usDeviceName.MaximumLength = 0;
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_BUFFER_TOO_SMALL);
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_BUFFER_TOO_SMALL);
|
||||||
|
|
||||||
|
data.devmode.dmSize = sizeof(DEVMODEW);
|
||||||
|
data.devmode.dmDriverExtra = 0xffff;
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
data.devmode.dmSize = sizeof(DEVMODEW);
|
||||||
|
data.devmode.dmDriverExtra = 0;
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
usDeviceName.Buffer = NULL;
|
||||||
|
usDeviceName.Length = 0;
|
||||||
|
usDeviceName.MaximumLength = 0;
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_1);
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, -4, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_1);
|
||||||
|
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 0, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 1, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 2, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 4, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 8, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 247, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, 248, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_2);
|
||||||
|
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, -1, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, -2, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, -3, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_SUCCESS);
|
||||||
|
Status = NtUserEnumDisplaySettings(NULL, -4, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_2);
|
||||||
|
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_1);
|
||||||
|
|
||||||
|
usDeviceName.Buffer = szName;
|
||||||
|
usDeviceName.Length = wcslen(szName);
|
||||||
|
usDeviceName.MaximumLength = usDeviceName.Length;
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, ENUM_CURRENT_SETTINGS, (DEVMODEW*)&data, 0);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_1);
|
||||||
|
|
||||||
|
Status = NtUserEnumDisplaySettings(&usDeviceName, 1000, (DEVMODEW*)&data, 123456);
|
||||||
|
TEST(Status == STATUS_INVALID_PARAMETER_1);
|
||||||
|
|
||||||
|
TEST(GetLastError() == ERROR_SUCCESS);
|
||||||
|
|
||||||
|
return APISTATUS_NORMAL;
|
||||||
|
}
|
|
@ -15,6 +15,7 @@
|
||||||
//#include "ntgdi/NtGdiEnumFontChunk.c"
|
//#include "ntgdi/NtGdiEnumFontChunk.c"
|
||||||
#include "ntgdi/NtGdiEnumFontOpen.c"
|
#include "ntgdi/NtGdiEnumFontOpen.c"
|
||||||
#include "ntgdi/NtGdiGetBitmapBits.c"
|
#include "ntgdi/NtGdiGetBitmapBits.c"
|
||||||
|
#include "ntgdi/NtGdiGetFontResourceInfoInternalW.c"
|
||||||
#include "ntgdi/NtGdiGetRandomRgn.c"
|
#include "ntgdi/NtGdiGetRandomRgn.c"
|
||||||
#include "ntgdi/NtGdiSelectBitmap.c"
|
#include "ntgdi/NtGdiSelectBitmap.c"
|
||||||
#include "ntgdi/NtGdiSelectBrush.c"
|
#include "ntgdi/NtGdiSelectBrush.c"
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
#include "ntuser/NtUserCallOneParam.c"
|
#include "ntuser/NtUserCallOneParam.c"
|
||||||
#include "ntuser/NtUserCountClipboardFormats.c"
|
#include "ntuser/NtUserCountClipboardFormats.c"
|
||||||
//#include "ntuser/NtUserCreateWindowEx.c"
|
//#include "ntuser/NtUserCreateWindowEx.c"
|
||||||
|
#include "ntuser/NtUserEnumDisplaySettings.c"
|
||||||
#include "ntuser/NtUserFindExistingCursorIcon.c"
|
#include "ntuser/NtUserFindExistingCursorIcon.c"
|
||||||
#include "ntuser/NtUserRedrawWindow.c"
|
#include "ntuser/NtUserRedrawWindow.c"
|
||||||
#include "ntuser/NtUserScrollDC.c"
|
#include "ntuser/NtUserScrollDC.c"
|
||||||
|
@ -51,13 +53,14 @@ TESTENTRY TestList[] =
|
||||||
/* ntgdi */
|
/* ntgdi */
|
||||||
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
|
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
|
||||||
{ L"NtGdiBitBlt", Test_NtGdiBitBlt },
|
{ L"NtGdiBitBlt", Test_NtGdiBitBlt },
|
||||||
{ L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
|
{ L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
|
||||||
{ L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
|
{ L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
|
||||||
{ L"NtGdiDoPalette", Test_NtGdiDoPalette },
|
{ L"NtGdiDoPalette", Test_NtGdiDoPalette },
|
||||||
{ L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette },
|
{ L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette },
|
||||||
// { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk },
|
// { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk },
|
||||||
{ L"NtGdiEnumFontOpen", Test_NtGdiEnumFontOpen },
|
{ L"NtGdiEnumFontOpen", Test_NtGdiEnumFontOpen },
|
||||||
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
||||||
|
{ L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW },
|
||||||
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
||||||
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
||||||
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
||||||
|
@ -78,6 +81,7 @@ TESTENTRY TestList[] =
|
||||||
{ L"NtUserCallOneParam", Test_NtUserCallOneParam },
|
{ L"NtUserCallOneParam", Test_NtUserCallOneParam },
|
||||||
{ L"NtUserCountClipboardFormats", Test_NtUserCountClipboardFormats },
|
{ L"NtUserCountClipboardFormats", Test_NtUserCountClipboardFormats },
|
||||||
// { L"NtUserCreateWindowEx", Test_NtUserCreateWindowEx },
|
// { L"NtUserCreateWindowEx", Test_NtUserCreateWindowEx },
|
||||||
|
{ L"NtUserEnumDisplaySettings", TEST_NtUserEnumDisplaySettings },
|
||||||
{ L"NtUserFindExistingCursorIcon", Test_NtUserFindExistingCursoricon },
|
{ L"NtUserFindExistingCursorIcon", Test_NtUserFindExistingCursoricon },
|
||||||
{ L"NtUserRedrawWindow", Test_NtUserRedrawWindow },
|
{ L"NtUserRedrawWindow", Test_NtUserRedrawWindow },
|
||||||
{ L"NtUserScrollDC", Test_NtUserScrollDC },
|
{ L"NtUserScrollDC", Test_NtUserScrollDC },
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<define name="_WIN32_WINNT">0x0501</define>
|
<define name="_WIN32_WINNT">0x0501</define>
|
||||||
<define name="WINVER">0x501</define>
|
<define name="WINVER">0x501</define>
|
||||||
<library>apitest</library>
|
<library>apitest</library>
|
||||||
|
<library>ntdll</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>gdi32</library>
|
<library>gdi32</library>
|
||||||
|
|
Loading…
Reference in a new issue