Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
23
third_party/FreeRDP/rdtk/librdtk/test/CMakeLists.txt
vendored
Normal file
23
third_party/FreeRDP/rdtk/librdtk/test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
set(MODULE_NAME "TestRdTk")
|
||||
set(MODULE_PREFIX "TEST_RDTK")
|
||||
|
||||
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
||||
|
||||
set(${MODULE_PREFIX}_TESTS TestRdTkNinePatch.c)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} winpr rdtk)
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||
|
||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||
get_filename_component(TestName ${test} NAME_WE)
|
||||
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "RdTk/Test")
|
||||
62
third_party/FreeRDP/rdtk/librdtk/test/TestRdTkNinePatch.c
vendored
Normal file
62
third_party/FreeRDP/rdtk/librdtk/test/TestRdTkNinePatch.c
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <rdtk/rdtk.h>
|
||||
#include <winpr/error.h>
|
||||
|
||||
int TestRdTkNinePatch(int argc, char* argv[])
|
||||
{
|
||||
rdtkEngine* engine = nullptr;
|
||||
rdtkSurface* surface = nullptr;
|
||||
uint32_t scanline = 0;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
uint8_t* data = nullptr;
|
||||
int ret = -1;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
if (!(engine = rdtk_engine_new()))
|
||||
{
|
||||
printf("%s: error creating rdtk engine (%" PRIu32 ")\n", __func__, GetLastError());
|
||||
goto out;
|
||||
}
|
||||
|
||||
width = 1024;
|
||||
height = 768;
|
||||
scanline = width * 4;
|
||||
|
||||
/* let rdtk allocate the surface buffer */
|
||||
if (!(surface = rdtk_surface_new(engine, nullptr, width, height, scanline)))
|
||||
{
|
||||
printf("%s: error creating auto-allocated surface (%" PRIu32 ")\n", __func__,
|
||||
GetLastError());
|
||||
goto out;
|
||||
}
|
||||
rdtk_surface_free(surface);
|
||||
surface = nullptr;
|
||||
|
||||
/* test self-allocated buffer */
|
||||
if (!(data = calloc(height, scanline)))
|
||||
{
|
||||
printf("%s: error allocating surface buffer (%" PRIu32 ")\n", __func__, GetLastError());
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(surface = rdtk_surface_new(engine, data, width, height, scanline)))
|
||||
{
|
||||
printf("%s: error creating self-allocated surface (%" PRIu32 ")\n", __func__,
|
||||
GetLastError());
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
rdtk_surface_free(surface);
|
||||
rdtk_engine_free(engine);
|
||||
free(data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user