Merge commit 'a22ac9e1c8e7b1cd78aa197bf1727a9f97f74b5e' into dev
This commit is contained in:
1
external/SDL/test/testaudio.c
vendored
1
external/SDL/test/testaudio.c
vendored
@@ -1119,6 +1119,7 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||
Thing *thing = NULL;
|
||||
|
||||
saw_event = true;
|
||||
SDL_ConvertEventToRenderCoordinates(SDL_GetRenderer(SDL_GetWindowFromEvent(event)), event);
|
||||
|
||||
switch (event->type) {
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
|
||||
@@ -184,6 +184,20 @@ static const char *AudioChansToStr(const int channels)
|
||||
return "?";
|
||||
}
|
||||
|
||||
static void scale_mouse_coords(SDL_FPoint *p)
|
||||
{
|
||||
SDL_Window *window = SDL_GetMouseFocus();
|
||||
if (window) {
|
||||
int w, p_w;
|
||||
float scale;
|
||||
SDL_GetWindowSize(window, &w, NULL);
|
||||
SDL_GetWindowSizeInPixels(window, &p_w, NULL);
|
||||
scale = (float)p_w / (float)w;
|
||||
p->x *= scale;
|
||||
p->y *= scale;
|
||||
}
|
||||
}
|
||||
|
||||
static void loop(void)
|
||||
{
|
||||
int i, j;
|
||||
@@ -228,6 +242,7 @@ static void loop(void)
|
||||
}
|
||||
|
||||
if (SDL_GetMouseState(&p.x, &p.y) & SDL_BUTTON_LMASK) {
|
||||
scale_mouse_coords(&p);
|
||||
if (active_slider == -1) {
|
||||
for (i = 0; i < NUM_SLIDERS; ++i) {
|
||||
if (SDL_PointInRectFloat(&p, &sliders[i].area)) {
|
||||
|
||||
47
external/SDL/test/testautomation_stdlib.c
vendored
47
external/SDL/test/testautomation_stdlib.c
vendored
@@ -714,6 +714,9 @@ static int SDLCALL stdlib_getsetenv(void *arg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FMT_PRILLd "%" SDL_PRILLd
|
||||
#define FMT_PRILLu "%" SDL_PRILLu
|
||||
|
||||
/**
|
||||
* Call to SDL_sscanf
|
||||
*/
|
||||
@@ -781,7 +784,7 @@ static int SDLCALL stdlib_sscanf(void *arg)
|
||||
|
||||
SIZED_TEST_CASE(short, short, "%hd")
|
||||
SIZED_TEST_CASE(long, long, "%ld")
|
||||
SIZED_TEST_CASE(long long, long_long, "%lld")
|
||||
SIZED_TEST_CASE(long long, long_long, FMT_PRILLd)
|
||||
|
||||
size_output = 123;
|
||||
expected_size_output = ~((size_t)0);
|
||||
@@ -1301,26 +1304,26 @@ static int SDLCALL stdlib_strtox(void *arg)
|
||||
} while (0)
|
||||
|
||||
// infer decimal
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "\t 123abcxyz", 0, 123, 6); // skip leading space
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "+123abcxyz", 0, 123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "+123abcxyz", 0, 123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "-123abcxyz", 0, -123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "9999999999999999999999999999999999999999abcxyz", 0, ullong_max, 40);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "\t 123abcxyz", 0, 123, 6); // skip leading space
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "+123abcxyz", 0, 123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "+123abcxyz", 0, 123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-123abcxyz", 0, -123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "9999999999999999999999999999999999999999abcxyz", 0, ullong_max, 40);
|
||||
|
||||
// infer hexadecimal
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "0x123abcxyz", 0, 0x123abc, 8);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "0X123ABCXYZ", 0, 0x123abc, 8); // uppercase X
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "0x123abcxyz", 0, 0x123abc, 8);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "0X123ABCXYZ", 0, 0x123abc, 8); // uppercase X
|
||||
|
||||
// infer octal
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "0123abcxyz", 0, 0123, 4);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "0123abcxyz", 0, 0123, 4);
|
||||
|
||||
// arbitrary bases
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "00110011", 2, 51, 8);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "-uvwxyz", 32, -991, 3);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "ZzZzZzZzZzZzZzZzZzZzZzZzZ", 36, ullong_max, 25);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "00110011", 2, 51, 8);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-uvwxyz", 32, -991, 3);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "ZzZzZzZzZzZzZzZzZzZzZzZzZ", 36, ullong_max, 25);
|
||||
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "-0", 10, 0, 2);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", " - 1", 0, 0, 0); // invalid input
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, "-0", 10, 0, 2);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLu, " - 1", 0, 0, 0); // invalid input
|
||||
|
||||
// We know that SDL_strtol, SDL_strtoul and SDL_strtoll share the same code path as SDL_strtoull under the hood,
|
||||
// so the most interesting test cases are those close to the bounds of the integer type.
|
||||
@@ -1342,15 +1345,15 @@ static int SDLCALL stdlib_strtox(void *arg)
|
||||
}
|
||||
|
||||
if (sizeof(long long) == 8) {
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, "%lld", "9223372036854775807", 10, 9223372036854775807LL, 19);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, "%lld", "9223372036854775808", 10, 9223372036854775807LL, 19);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, "%lld", "-9223372036854775808", 10, -9223372036854775807LL - 1, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, "%lld", "-9223372036854775809", 10, -9223372036854775807LL - 1, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, "%lld", "-9999999999999999999999999999999999999999", 10, -9223372036854775807LL - 1, 41);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "9223372036854775807", 10, 9223372036854775807LL, 19);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "9223372036854775808", 10, 9223372036854775807LL, 19);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-9223372036854775808", 10, -9223372036854775807LL - 1, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-9223372036854775809", 10, -9223372036854775807LL - 1, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoll, long long, FMT_PRILLd, "-9999999999999999999999999999999999999999", 10, -9223372036854775807LL - 1, 41);
|
||||
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "18446744073709551615", 10, 18446744073709551615ULL, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "18446744073709551616", 10, 18446744073709551615ULL, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, "%llu", "-18446744073709551615", 10, 1, 21);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLd, "18446744073709551615", 10, 18446744073709551615ULL, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLd, "18446744073709551616", 10, 18446744073709551615ULL, 20);
|
||||
STRTOX_TEST_CASE(SDL_strtoull, unsigned long long, FMT_PRILLd, "-18446744073709551615", 10, 1, 21);
|
||||
}
|
||||
|
||||
#undef STRTOX_TEST_CASE
|
||||
|
||||
2
external/SDL/test/testcamera.c
vendored
2
external/SDL/test/testcamera.c
vendored
@@ -97,8 +97,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||
return SDL_APP_FAILURE;
|
||||
}
|
||||
|
||||
SDL_SetLogPriorities(SDL_LOG_PRIORITY_VERBOSE);
|
||||
|
||||
renderer = state->renderers[0];
|
||||
if (!renderer) {
|
||||
/* SDL_Log("Couldn't create renderer: %s", SDL_GetError()); */
|
||||
|
||||
16
external/SDL/test/testhittesting.c
vendored
16
external/SDL/test/testhittesting.c
vendored
@@ -33,17 +33,25 @@ static SDL_HitTestResult SDLCALL
|
||||
hitTest(SDL_Window *window, const SDL_Point *pt, void *data)
|
||||
{
|
||||
int i;
|
||||
int w, h;
|
||||
int w, h, p_w;
|
||||
SDL_Point adj_pt;
|
||||
float scale;
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetWindowSizeInPixels(window, &p_w, NULL);
|
||||
|
||||
scale = (float)p_w / (float)w;
|
||||
|
||||
adj_pt.x = (int)SDL_floorf(pt->x * scale);
|
||||
adj_pt.y = (int)SDL_floorf(pt->y * scale);
|
||||
|
||||
for (i = 0; i < numareas; i++) {
|
||||
if (SDL_PointInRect(pt, &areas[i])) {
|
||||
if (SDL_PointInRect(&adj_pt, &areas[i])) {
|
||||
SDL_Log("HIT-TEST: DRAGGABLE\n");
|
||||
return SDL_HITTEST_DRAGGABLE;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
|
||||
#define REPORT_RESIZE_HIT(name) \
|
||||
{ \
|
||||
SDL_Log("HIT-TEST: RESIZE_" #name "\n"); \
|
||||
|
||||
1
external/SDL/test/testintersections.c
vendored
1
external/SDL/test/testintersections.c
vendored
@@ -211,6 +211,7 @@ static void loop(void *arg)
|
||||
/* Check for events */
|
||||
while (SDL_PollEvent(&event)) {
|
||||
SDLTest_CommonEvent(state, &event, done);
|
||||
SDL_ConvertEventToRenderCoordinates(SDL_GetRenderer(SDL_GetWindowFromEvent(&event)), &event);
|
||||
switch (event.type) {
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
mouse_begin_x = event.button.x;
|
||||
|
||||
4
external/SDL/test/testmanymouse.c
vendored
4
external/SDL/test/testmanymouse.c
vendored
@@ -184,7 +184,7 @@ static void HandleMouseAdded(SDL_MouseID instance_id)
|
||||
SDL_Window *window = state->windows[0];
|
||||
int i, w = 0, h = 0;
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
|
||||
for (i = 0; i < SDL_arraysize(mice); ++i) {
|
||||
MouseState *mouse_state = &mice[i];
|
||||
@@ -237,7 +237,7 @@ static void HandleMouseMotion(SDL_MouseMotionEvent *event)
|
||||
|
||||
ActivateMouse(event->which);
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
|
||||
for (i = 0; i < SDL_arraysize(mice); ++i) {
|
||||
MouseState *mouse_state = &mice[i];
|
||||
|
||||
1
external/SDL/test/testoverlay.c
vendored
1
external/SDL/test/testoverlay.c
vendored
@@ -255,6 +255,7 @@ static void loop(void)
|
||||
/* Check for events */
|
||||
while (SDL_PollEvent(&event)) {
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
SDL_ConvertEventToRenderCoordinates(SDL_GetRenderer(SDL_GetWindowFromEvent(&event)), &event);
|
||||
|
||||
switch (event.type) {
|
||||
case SDL_EVENT_WINDOW_RESIZED:
|
||||
|
||||
1
external/SDL/test/testwm.c
vendored
1
external/SDL/test/testwm.c
vendored
@@ -165,6 +165,7 @@ static void loop(void)
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
SDLTest_CommonEvent(state, &event, &done);
|
||||
SDL_ConvertEventToRenderCoordinates(SDL_GetRenderer(SDL_GetWindowFromEvent(&event)), &event);
|
||||
|
||||
if (event.type == SDL_EVENT_WINDOW_RESIZED) {
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(&event);
|
||||
|
||||
Reference in New Issue
Block a user