e718fb324b
Since the current winpr implementation for overlapped operations is incomplete and buggy, all affected functions will now fail if they are called with a set FILE_FLAG_OVERLAPPED flag or a non-null pointer to a OVERLAPPED structure. winpr/nt: - use proper one-time initialization on win32 - fix TestNtCreateFile - fix broken/incomplete _RtlAnsiStringToUnicodeString - unimplemented functions return appropriate error codes winpr/pipe: - improved TestPipeCreateNamedPipe - rewrite the completely broken TestPipeCreateNamedPipeOverlapped test rdtk: - improve test and don't blindly return success winpr/synch: - fix race condition in TestSynchTimerQueue winpr/ssspi: - fix TestEnumerateSecurityPackages printf output - fix TestQuerySecurityPackageInfo printf output winpr/environment: - fix GetEnvironmentStrings printf output winpr/comm: - unimplemented functions return appropriate error codes winpr/io: - unimplemented functions return appropriate error codes winpr/thread: - implement SwitchToThread() via sched_yield()
56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
|
|
#include <rdtk/rdtk.h>
|
|
|
|
int TestRdTkNinePatch(int argc, char* argv[])
|
|
{
|
|
rdtkEngine* engine = NULL;
|
|
rdtkSurface* surface = NULL;
|
|
DWORD scanline;
|
|
DWORD width;
|
|
DWORD height;
|
|
BYTE* data = NULL;
|
|
int ret = -1;
|
|
|
|
if (!(engine = rdtk_engine_new()))
|
|
{
|
|
printf("%s: error creating rdtk engine (%u)\n", __FUNCTION__, GetLastError());
|
|
goto out;
|
|
}
|
|
|
|
width = 1024;
|
|
height = 768;
|
|
scanline = width * 4;
|
|
|
|
/* let rdtk allocate the surface buffer */
|
|
if (!(surface = rdtk_surface_new(engine, NULL, width, height, scanline)))
|
|
{
|
|
printf("%s: error creating auto-allocated surface (%u)\n", __FUNCTION__, GetLastError());
|
|
goto out;
|
|
}
|
|
rdtk_surface_free(surface);
|
|
surface = NULL;
|
|
|
|
|
|
/* test self-allocated buffer */
|
|
if (!(data = calloc(height, scanline)))
|
|
{
|
|
printf("%s: error allocating surface buffer (%u)\n", __FUNCTION__, GetLastError());
|
|
goto out;
|
|
}
|
|
|
|
if (!(surface = rdtk_surface_new(engine, data, width, height, scanline)))
|
|
{
|
|
printf("%s: error creating self-allocated surface (%u)\n", __FUNCTION__, GetLastError());
|
|
goto out;
|
|
}
|
|
|
|
ret = 0;
|
|
|
|
out:
|
|
rdtk_surface_free(surface);
|
|
rdtk_engine_free(engine);
|
|
free(data);
|
|
|
|
return ret;
|
|
}
|