Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
5
third_party/FreeRDP/client/SDL/SDL3/dialogs/test/CMakeLists.txt
vendored
Normal file
5
third_party/FreeRDP/client/SDL/SDL3/dialogs/test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
set(NAMES "TestSDLDialogInput;TestSDLDialogSelectList")
|
||||
foreach(NAME ${NAMES})
|
||||
add_executable(${NAME} ${NAME}.cpp)
|
||||
target_link_libraries(${NAME} PRIVATE sdl3-dialogs freerdp-client freerdp)
|
||||
endforeach()
|
||||
59
third_party/FreeRDP/client/SDL/SDL3/dialogs/test/TestSDLDialogInput.cpp
vendored
Normal file
59
third_party/FreeRDP/client/SDL/SDL3/dialogs/test/TestSDLDialogInput.cpp
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "../sdl_dialogs.hpp"
|
||||
#include "../sdl_input_widget_pair_list.hpp"
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
typedef int (*fkt_t)(void);
|
||||
|
||||
BOOL sdl_log_error_ex(Sint32 res, wLog* log, const char* what, const char* file, size_t line,
|
||||
const char* fkt)
|
||||
{
|
||||
WINPR_UNUSED(file);
|
||||
|
||||
WLog_Print(log, WLOG_ERROR, "[%s:%" PRIuz "][%s]: %s", fkt, line, what, "xxx");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int auth_dialogs(void)
|
||||
{
|
||||
const std::string title = "sometitle";
|
||||
std::vector<std::string> result;
|
||||
|
||||
std::vector<std::string> initial{ "Smartcard", "abc", "def" };
|
||||
std::vector<Uint32> flags = { SdlInputWidgetPair::SDL_INPUT_READONLY,
|
||||
SdlInputWidgetPair::SDL_INPUT_MASK, 0 };
|
||||
|
||||
const std::vector<std::string>& labels{ "foo", "bar", "gaga" };
|
||||
|
||||
SdlInputWidgetPairList ilist(title.c_str(), labels, initial, flags);
|
||||
auto rc = ilist.run(result);
|
||||
|
||||
if ((result.size() < labels.size()))
|
||||
rc = -1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int runTest(fkt_t fkt)
|
||||
{
|
||||
int rc;
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
sdl_dialogs_init();
|
||||
try
|
||||
{
|
||||
rc = fkt();
|
||||
}
|
||||
catch (int e)
|
||||
{
|
||||
rc = e;
|
||||
}
|
||||
sdl_dialogs_uninit();
|
||||
SDL_Quit();
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
return runTest(auth_dialogs);
|
||||
}
|
||||
47
third_party/FreeRDP/client/SDL/SDL3/dialogs/test/TestSDLDialogSelectList.cpp
vendored
Normal file
47
third_party/FreeRDP/client/SDL/SDL3/dialogs/test/TestSDLDialogSelectList.cpp
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "../sdl_dialogs.hpp"
|
||||
#include "../sdl_select_list.hpp"
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
typedef int (*fkt_t)(void);
|
||||
|
||||
BOOL sdl_log_error_ex(Sint32 res, wLog* log, const char* what, const char* file, size_t line,
|
||||
const char* fkt)
|
||||
{
|
||||
WINPR_UNUSED(file);
|
||||
|
||||
WLog_Print(log, WLOG_ERROR, "[%s:%" PRIuz "][%s]: %s", fkt, line, what, "xxx");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int select_dialogs(void)
|
||||
{
|
||||
const std::vector<std::string> labels{ "foo", "bar", "gaga", "blabla" };
|
||||
SdlSelectList list{ "title", labels };
|
||||
return list.run();
|
||||
}
|
||||
|
||||
static int runTest(fkt_t fkt)
|
||||
{
|
||||
int rc;
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
sdl_dialogs_init();
|
||||
try
|
||||
{
|
||||
rc = fkt();
|
||||
}
|
||||
catch (int e)
|
||||
{
|
||||
rc = e;
|
||||
}
|
||||
sdl_dialogs_uninit();
|
||||
SDL_Quit();
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
return runTest(select_dialogs);
|
||||
}
|
||||
Reference in New Issue
Block a user