Files
.github
CMakeModules
LICENSES
dist
externals
FidelityFX-FSR
SDL
.github
VisualC
VisualC-WinRT
Xcode
Xcode-iOS
acinclude
android-project
android-project-ant
build-scripts
cmake
debian
docs
include
src
test
emscripten
nacl
shapes
CMakeLists.txt
COPYING
Makefile.in
Makefile.os2
README
acinclude.m4
autogen.sh
axis.bmp
button.bmp
checkkeys.c
checkkeysthreads.c
configure
configure.ac
controllermap.bmp
controllermap.c
controllermap_back.bmp
gcc-fat.sh
icon.bmp
loopwave.c
loopwavequeue.c
moose.dat
picture.xbm
relative_mode.markdown
sample.bmp
sample.wav
testatomic.c
testaudiocapture.c
testaudiohotplug.c
testaudioinfo.c
testautomation.c
testautomation_audio.c
testautomation_clipboard.c
testautomation_events.c
testautomation_hints.c
testautomation_keyboard.c
testautomation_main.c
testautomation_mouse.c
testautomation_pixels.c
testautomation_platform.c
testautomation_rect.c
testautomation_render.c
testautomation_rwops.c
testautomation_sdltest.c
testautomation_stdlib.c
testautomation_suites.h
testautomation_surface.c
testautomation_syswm.c
testautomation_timer.c
testautomation_video.c
testbounds.c
testcustomcursor.c
testdisplayinfo.c
testdraw2.c
testdrawchessboard.c
testdropfile.c
testerror.c
testevdev.c
testfile.c
testfilesystem.c
testgamecontroller.c
testgeometry.c
testgesture.c
testgl2.c
testgles.c
testgles2.c
testgles2_sdf.c
testgles2_sdf_img_normal.bmp
testgles2_sdf_img_sdf.bmp
testhaptic.c
testhittesting.c
testhotplug.c
testiconv.c
testime.c
testintersections.c
testjoystick.c
testkeys.c
testloadso.c
testlocale.c
testlock.c
testmessage.c
testmouse.c
testmultiaudio.c
testnative.c
testnative.h
testnativecocoa.m
testnativeos2.c
testnativew32.c
testnativex11.c
testoffscreen.c
testoverlay2.c
testplatform.c
testpower.c
testqsort.c
testrelative.c
testrendercopyex.c
testrendertarget.c
testresample.c
testrumble.c
testscale.c
testsem.c
testsensor.c
testshader.c
testshape.c
testsprite2.c
testspriteminimal.c
teststreaming.c
testsurround.c
testthread.c
testtimer.c
testurl.c
testver.c
testviewport.c
testvulkan.c
testwm2.c
testyuv.bmp
testyuv.c
testyuv_cvt.c
testyuv_cvt.h
torturethread.c
unifont-13.0.06-license.txt
unifont-13.0.06.hex
utf8.txt
visualtest
wayland-protocols
.gitignore
Android.mk
BUGS.txt
CMakeLists.txt
CREDITS.txt
INSTALL.txt
LICENSE.txt
Makefile.in
Makefile.minimal
Makefile.os2
Makefile.pandora
Makefile.psp
Makefile.wiz
README-SDL.txt
README.md
SDL2.spec.in
SDL2Config.cmake
TODO.txt
WhatsNew.txt
autogen.sh
cmake_uninstall.cmake.in
configure
configure.ac
sdl2-config-version.cmake.in
sdl2-config.cmake.in
sdl2-config.in
sdl2.m4
sdl2.pc.in
Vulkan-Headers
cmake-modules
cpp-httplib
cpp-jwt
cubeb
discord-rpc
dynarmic
enet
ffmpeg
find-modules
getopt
glad
inih
libressl
libusb
mbedtls
microprofile
opus
sirit
vcpkg
xbyak
CMakeLists.txt
hooks
patches
src
CMakeLists.txt
CONTRIBUTING.md
Doxyfile
LICENSE.txt
README.md
license.txt
vcpkg.json
yuzu/externals/SDL/test/testautomation.c
2022-07-15 04:00:50 +02:00

125 lines
3.3 KiB
C
Executable File

/*
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "SDL.h"
#include "SDL_test.h"
#include "testautomation_suites.h"
static SDLTest_CommonState *state;
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void
quit(int rc)
{
SDLTest_CommonQuit(state);
exit(rc);
}
int
main(int argc, char *argv[])
{
int result;
int testIterations = 1;
Uint64 userExecKey = 0;
char *userRunSeed = NULL;
char *filter = NULL;
int i, done;
SDL_Event event;
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
if (!state) {
return 1;
}
/* Parse commandline */
for (i = 1; i < argc;) {
int consumed;
consumed = SDLTest_CommonArg(state, i);
if (consumed == 0) {
consumed = -1;
if (SDL_strcasecmp(argv[i], "--iterations") == 0) {
if (argv[i + 1]) {
testIterations = SDL_atoi(argv[i + 1]);
if (testIterations < 1) testIterations = 1;
consumed = 2;
}
}
else if (SDL_strcasecmp(argv[i], "--execKey") == 0) {
if (argv[i + 1]) {
SDL_sscanf(argv[i + 1], "%"SDL_PRIu64, &userExecKey);
consumed = 2;
}
}
else if (SDL_strcasecmp(argv[i], "--seed") == 0) {
if (argv[i + 1]) {
userRunSeed = SDL_strdup(argv[i + 1]);
consumed = 2;
}
}
else if (SDL_strcasecmp(argv[i], "--filter") == 0) {
if (argv[i + 1]) {
filter = SDL_strdup(argv[i + 1]);
consumed = 2;
}
}
}
if (consumed < 0) {
static const char *options[] = { "[--iterations #]", "[--execKey #]", "[--seed string]", "[--filter suite_name|test_name]", NULL };
SDLTest_CommonLogUsage(state, argv[0], options);
quit(1);
}
i += consumed;
}
/* Initialize common state */
if (!SDLTest_CommonInit(state)) {
quit(2);
}
/* Create the windows, initialize the renderers */
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(renderer);
}
/* Call Harness */
result = SDLTest_RunSuites(testSuites, (const char *)userRunSeed, userExecKey, (const char *)filter, testIterations);
/* Empty event queue */
done = 0;
for (i=0; i<100; i++) {
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
}
SDL_Delay(10);
}
/* Clean up */
SDL_free(userRunSeed);
SDL_free(filter);
/* Shutdown everything */
quit(result);
return(result);
}
/* vi: set ts=4 sw=4 expandtab: */