FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
TestSDLDialogSelectList.cpp
1#include "../sdl_dialogs.hpp"
2#include "../sdl_select_list.hpp"
3
4#include <freerdp/api.h>
5#include <winpr/wlog.h>
6
7typedef int (*fkt_t)(void);
8
9BOOL sdl_log_error_ex(Sint32 res, wLog* log, const char* what, const char* file, size_t line,
10 const char* fkt)
11{
12 WINPR_UNUSED(file);
13
14 WLog_Print(log, WLOG_ERROR, "[%s:%" PRIuz "][%s]: %s", fkt, line, what, "xxx");
15 return TRUE;
16}
17
18static int select_dialogs(void)
19{
20 const std::vector<std::string> labels{ "foo", "bar", "gaga", "blabla" };
21 SdlSelectList list{ "title", labels };
22 return list.run();
23}
24
25static int runTest(fkt_t fkt)
26{
27 int rc;
28
29 SDL_Init(SDL_INIT_VIDEO);
30 sdl_dialogs_init();
31 try
32 {
33 rc = fkt();
34 }
35 catch (int e)
36 {
37 rc = e;
38 }
39 sdl_dialogs_uninit();
40 SDL_Quit();
41 return rc;
42}
43
44int main(int argc, char* argv[])
45{
46 int rc = 0;
47
48 (void)argc;
49 (void)argv;
50
51 rc = runTest(select_dialogs);
52
53 return rc;
54}