mirror of
https://github.com/reactos/reactos.git
synced 2024-08-28 06:08:23 +00:00
![Colin Finck](/assets/img/avatar_default.png)
Add an include directory for all printing components containing definitions not found in the public headers. For now, that's just PackStrings in spoolss.h. [SPOOLSS_APITEST] Use the new spoolss.h header. [WINPRINT_APITEST] Add an API-Test for the winprint Print Processor, so far for its EnumPrintProcessorDatatypesW function. Tests succeed in Windows Server 2003. winspool.drv also provides functions that go into winprint.dll, but as these tests show, they behave slightly different in terms of error codes due to the involved RPC and routing. Windows Server 2003 has winprint functions in localspl.dll, so you have to copy its localspl.dll to winprint.dll for testing. [WINPRINT] - Use PackStrings to simplify the code. - Fix test failures. svn path=/branches/colins-printing-for-freedom/; revision=68025
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
/*
|
|
* PROJECT: ReactOS Spooler Router API Tests
|
|
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
|
* PURPOSE: Tests for PackStrings
|
|
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
|
*/
|
|
|
|
#include <apitest.h>
|
|
|
|
#define WIN32_NO_STATUS
|
|
#include <windef.h>
|
|
#include <winbase.h>
|
|
#include <spoolss.h>
|
|
|
|
typedef struct _EXAMPLE_STRUCT
|
|
{
|
|
PWSTR String1;
|
|
PWSTR String2;
|
|
}
|
|
EXAMPLE_STRUCT, *PEXAMPLE_STRUCT;
|
|
|
|
START_TEST(PackStrings)
|
|
{
|
|
PCWSTR Source1[] = { L"Test", L"String" };
|
|
PCWSTR Source2[] = { L"Test", NULL };
|
|
|
|
BYTE Buffer[50];
|
|
PBYTE pEnd;
|
|
PEXAMPLE_STRUCT pStruct = (PEXAMPLE_STRUCT)Buffer;
|
|
DWORD Offsets[] = {
|
|
FIELD_OFFSET(EXAMPLE_STRUCT, String1),
|
|
FIELD_OFFSET(EXAMPLE_STRUCT, String2),
|
|
MAXDWORD
|
|
};
|
|
|
|
// Try a usual case with two strings. Verify that they are copied in reverse order.
|
|
pEnd = PackStrings(Source1, Buffer, Offsets, &Buffer[sizeof(Buffer)]);
|
|
ok(wcscmp(pStruct->String1, Source1[0]) == 0, "String1 and Source1[0] don't match!\n");
|
|
ok(wcscmp(pStruct->String2, Source1[1]) == 0, "String2 and Source1[1] don't match!\n");
|
|
ok(wcscmp((PWSTR)pEnd, Source1[1]) == 0, "pEnd and Source1[1] don't match!\n");
|
|
|
|
// Now verify that the corresponding pointer is set to NULL if a string is NULL.
|
|
pEnd = PackStrings(Source2, Buffer, Offsets, &Buffer[sizeof(Buffer)]);
|
|
ok(wcscmp(pStruct->String1, Source2[0]) == 0, "String1 and Source2[0] don't match!\n");
|
|
ok(!pStruct->String2, "String2 is %p!\n", pStruct->String2);
|
|
ok(wcscmp((PWSTR)pEnd, Source2[0]) == 0, "pEnd and Source2[0] don't match!\n");
|
|
}
|