mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 06:44:27 +08:00
testprograms: parse arguments using SDLTest_CommonState
This commit is contained in:
committed by
Anonymous Maarten
parent
8bea41f737
commit
4a6528e3f0
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="..\..\..\test\axis.bmp">
|
<CustomBuild Include="..\..\..\test\axis.bmp">
|
||||||
|
|||||||
@@ -194,6 +194,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\Test\loopwave.c" />
|
<ClCompile Include="..\..\..\Test\loopwave.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testatomic.c" />
|
<ClCompile Include="..\..\..\test\testatomic.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\Test\testfile.c" />
|
<ClCompile Include="..\..\..\Test\testfile.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="..\..\..\test\axis.bmp">
|
<CustomBuild Include="..\..\..\test\axis.bmp">
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testjoystick.c" />
|
<ClCompile Include="..\..\..\test\testjoystick.c" />
|
||||||
|
|||||||
@@ -216,6 +216,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\Test\testplatform.c" />
|
<ClCompile Include="..\..\..\Test\testplatform.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testpower.c" />
|
<ClCompile Include="..\..\..\test\testpower.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testrumble.c" />
|
<ClCompile Include="..\..\..\test\testrumble.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testsensor.c" />
|
<ClCompile Include="..\..\..\test\testsensor.c" />
|
||||||
|
|||||||
@@ -188,6 +188,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testshape.c" />
|
<ClCompile Include="..\..\..\test\testshape.c" />
|
||||||
|
|||||||
@@ -194,6 +194,12 @@
|
|||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\SDL_test\SDL_test.vcxproj">
|
||||||
|
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||||
|
<Private>false</Private>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\Test\testsurround.c" />
|
<ClCompile Include="..\..\..\Test\testsurround.c" />
|
||||||
|
|||||||
@@ -218,6 +218,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\test\testyuv.c" />
|
<ClCompile Include="..\..\..\test\testyuv.c" />
|
||||||
<ClCompile Include="..\..\..\test\testyuv_cvt.c" />
|
<ClCompile Include="..\..\..\test\testyuv_cvt.c" />
|
||||||
|
<ClCompile Include="..\..\..\test\testutils.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\test\testyuv_cvt.h" />
|
<ClInclude Include="..\..\..\test\testyuv_cvt.h" />
|
||||||
|
|||||||
+34
-24
@@ -136,9 +136,39 @@ add_sdl_test_executable(testdropfile testdropfile.c)
|
|||||||
add_sdl_test_executable(testerror NONINTERACTIVE testerror.c)
|
add_sdl_test_executable(testerror NONINTERACTIVE testerror.c)
|
||||||
|
|
||||||
if(LINUX AND TARGET sdl-build-options)
|
if(LINUX AND TARGET sdl-build-options)
|
||||||
|
set(build_options_dependent_tests )
|
||||||
|
|
||||||
add_sdl_test_executable(testevdev NONINTERACTIVE testevdev.c)
|
add_sdl_test_executable(testevdev NONINTERACTIVE testevdev.c)
|
||||||
target_include_directories(testevdev BEFORE PRIVATE $<TARGET_PROPERTY:sdl-build-options,INTERFACE_INCLUDE_DIRECTORIES>)
|
list(APPEND build_options_dependent_tests testevdev)
|
||||||
target_include_directories(testevdev BEFORE PRIVATE ${SDL3_SOURCE_DIR}/src)
|
|
||||||
|
if(APPLE)
|
||||||
|
add_sdl_test_executable(testnative NEEDS_RESOURCES TESTUTILS
|
||||||
|
testnative.c
|
||||||
|
testnativecocoa.m
|
||||||
|
testnativex11.c
|
||||||
|
)
|
||||||
|
target_compile_definitions(testnative PRIVATE TEST_NATIVE_COCOA)
|
||||||
|
|
||||||
|
cmake_push_check_state()
|
||||||
|
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
||||||
|
cmake_pop_check_state()
|
||||||
|
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
||||||
|
set_property(SOURCE "testnativecocoa.m" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-error=deprecated-declarations")
|
||||||
|
endif()
|
||||||
|
list(APPEND build_options_dependent_tests testnative)
|
||||||
|
elseif(WINDOWS)
|
||||||
|
add_sdl_test_executable(testnative NEEDS_RESOURCES TESTUTILS testnative.c testnativew32.c)
|
||||||
|
list(APPEND build_options_dependent_tests testnative)
|
||||||
|
elseif(HAVE_X11)
|
||||||
|
add_sdl_test_executable(testnative NEEDS_RESOURCES TESTUTILS testnative.c testnativex11.c)
|
||||||
|
target_link_libraries(testnative PRIVATE X11)
|
||||||
|
list(APPEND build_options_dependent_tests testnative)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(t ${build_options_dependent_tests})
|
||||||
|
target_include_directories(${t} BEFORE PRIVATE $<TARGET_PROPERTY:sdl-build-options,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
|
target_include_directories(${t} BEFORE PRIVATE ${SDL3_SOURCE_DIR}/src)
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_sdl_test_executable(testfile testfile.c)
|
add_sdl_test_executable(testfile testfile.c)
|
||||||
@@ -161,26 +191,6 @@ add_sdl_test_executable(testlocale NONINTERACTIVE testlocale.c)
|
|||||||
add_sdl_test_executable(testlock testlock.c)
|
add_sdl_test_executable(testlock testlock.c)
|
||||||
add_sdl_test_executable(testmouse testmouse.c)
|
add_sdl_test_executable(testmouse testmouse.c)
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
add_sdl_test_executable(testnative NEEDS_RESOURCES TESTUTILS
|
|
||||||
testnative.c
|
|
||||||
testnativecocoa.m
|
|
||||||
testnativex11.c
|
|
||||||
)
|
|
||||||
|
|
||||||
cmake_push_check_state()
|
|
||||||
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
|
||||||
cmake_pop_check_state()
|
|
||||||
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
|
||||||
set_property(SOURCE "testnativecocoa.m" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-error=deprecated-declarations")
|
|
||||||
endif()
|
|
||||||
elseif(WINDOWS)
|
|
||||||
add_sdl_test_executable(testnative NEEDS_RESOURCES TESTUTILS testnative.c testnativew32.c)
|
|
||||||
elseif(HAVE_X11)
|
|
||||||
add_sdl_test_executable(testnative NEEDS_RESOURCES TESTUTILS testnative.c testnativex11.c)
|
|
||||||
target_link_libraries(testnative PRIVATE X11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_sdl_test_executable(testoverlay NEEDS_RESOURCES TESTUTILS testoverlay.c)
|
add_sdl_test_executable(testoverlay NEEDS_RESOURCES TESTUTILS testoverlay.c)
|
||||||
add_sdl_test_executable(testplatform NONINTERACTIVE testplatform.c)
|
add_sdl_test_executable(testplatform NONINTERACTIVE testplatform.c)
|
||||||
add_sdl_test_executable(testpower NONINTERACTIVE testpower.c)
|
add_sdl_test_executable(testpower NONINTERACTIVE testpower.c)
|
||||||
@@ -189,7 +199,7 @@ add_sdl_test_executable(testrendertarget NEEDS_RESOURCES TESTUTILS testrendertar
|
|||||||
add_sdl_test_executable(testscale NEEDS_RESOURCES TESTUTILS testscale.c)
|
add_sdl_test_executable(testscale NEEDS_RESOURCES TESTUTILS testscale.c)
|
||||||
add_sdl_test_executable(testsem testsem.c)
|
add_sdl_test_executable(testsem testsem.c)
|
||||||
add_sdl_test_executable(testsensor testsensor.c)
|
add_sdl_test_executable(testsensor testsensor.c)
|
||||||
add_sdl_test_executable(testshader NEEDS_RESOURCES testshader.c)
|
add_sdl_test_executable(testshader NEEDS_RESOURCES TESTUTILS testshader.c)
|
||||||
add_sdl_test_executable(testshape NEEDS_RESOURCES testshape.c)
|
add_sdl_test_executable(testshape NEEDS_RESOURCES testshape.c)
|
||||||
add_sdl_test_executable(testsprite NEEDS_RESOURCES TESTUTILS testsprite.c)
|
add_sdl_test_executable(testsprite NEEDS_RESOURCES TESTUTILS testsprite.c)
|
||||||
add_sdl_test_executable(testspriteminimal NEEDS_RESOURCES TESTUTILS testspriteminimal.c)
|
add_sdl_test_executable(testspriteminimal NEEDS_RESOURCES TESTUTILS testspriteminimal.c)
|
||||||
@@ -199,7 +209,7 @@ add_sdl_test_executable(testurl testurl.c)
|
|||||||
add_sdl_test_executable(testver NONINTERACTIVE testver.c)
|
add_sdl_test_executable(testver NONINTERACTIVE testver.c)
|
||||||
add_sdl_test_executable(testviewport NEEDS_RESOURCES TESTUTILS testviewport.c)
|
add_sdl_test_executable(testviewport NEEDS_RESOURCES TESTUTILS testviewport.c)
|
||||||
add_sdl_test_executable(testwm testwm.c)
|
add_sdl_test_executable(testwm testwm.c)
|
||||||
add_sdl_test_executable(testyuv NEEDS_RESOURCES testyuv.c testyuv_cvt.c)
|
add_sdl_test_executable(testyuv NEEDS_RESOURCES TESTUTILS testyuv.c testyuv_cvt.c)
|
||||||
add_sdl_test_executable(torturethread torturethread.c)
|
add_sdl_test_executable(torturethread torturethread.c)
|
||||||
add_sdl_test_executable(testrendercopyex NEEDS_RESOURCES TESTUTILS testrendercopyex.c)
|
add_sdl_test_executable(testrendercopyex NEEDS_RESOURCES TESTUTILS testrendercopyex.c)
|
||||||
add_sdl_test_executable(testmessage testmessage.c)
|
add_sdl_test_executable(testmessage testmessage.c)
|
||||||
|
|||||||
+15
-1
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
#include <SDL3/SDL_test_font.h>
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
static SDL_Window *window;
|
static SDL_Window *window;
|
||||||
static SDL_Renderer *renderer;
|
static SDL_Renderer *renderer;
|
||||||
@@ -249,9 +249,22 @@ static void loop(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Disable mouse emulation */
|
/* Disable mouse emulation */
|
||||||
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
||||||
|
|
||||||
@@ -304,5 +317,6 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
static int done;
|
static int done;
|
||||||
|
|
||||||
@@ -240,10 +241,22 @@ int main(int argc, char *argv[])
|
|||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_Renderer *renderer;
|
SDL_Renderer *renderer;
|
||||||
SDL_Thread *thread;
|
SDL_Thread *thread;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL */
|
/* Initialize SDL */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -290,5 +303,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
SDL_WaitThread(thread, NULL);
|
SDL_WaitThread(thread, NULL);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-4
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
/* Define this for verbose output while mapping gamepads */
|
/* Define this for verbose output while mapping gamepads */
|
||||||
@@ -729,22 +730,45 @@ int main(int argc, char *argv[])
|
|||||||
SDL_JoystickID *joysticks;
|
SDL_JoystickID *joysticks;
|
||||||
int joystick_index;
|
int joystick_index;
|
||||||
SDL_Joystick *joystick = NULL;
|
SDL_Joystick *joystick = NULL;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (SDL_strcmp(argv[i], "--bind-touchpad") == 0) {
|
||||||
|
bind_touchpad = SDL_TRUE;
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[--bind-touchpad]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL (Note: video is required to start event loop) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[1] && SDL_strcmp(argv[1], "--bind-touchpad") == 0) {
|
|
||||||
bind_touchpad = SDL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a window to display joystick axis position */
|
/* Create a window to display joystick axis position */
|
||||||
window = SDL_CreateWindow("Game Controller Map", SCREEN_WIDTH, SCREEN_HEIGHT, 0);
|
window = SDL_CreateWindow("Game Controller Map", SCREEN_WIDTH, SCREEN_HEIGHT, 0);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
@@ -830,5 +854,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
|
||||||
|
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-1
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
@@ -113,17 +114,44 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (!filename) {
|
||||||
|
filename = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[sample.wav]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
|
filename = GetResourceFilename(filename, "sample.wav");
|
||||||
|
|
||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
||||||
@@ -174,5 +202,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_free(wave.sound);
|
SDL_free(wave.sound);
|
||||||
SDL_free(filename);
|
SDL_free(filename);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-2
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#if HAVE_SIGNAL_H
|
#if HAVE_SIGNAL_H
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -73,18 +74,46 @@ static void loop(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (!filename) {
|
||||||
|
filename = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[sample.wav]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
|
filename = GetResourceFilename(filename, "sample.wav");
|
||||||
|
|
||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
||||||
@@ -137,7 +166,7 @@ int main(int argc, char *argv[])
|
|||||||
while (!done && (SDL_GetAudioDeviceStatus(g_audio_id) == SDL_AUDIO_PLAYING)) {
|
while (!done && (SDL_GetAudioDeviceStatus(g_audio_id) == SDL_AUDIO_PLAYING)) {
|
||||||
loop();
|
loop();
|
||||||
|
|
||||||
SDL_Delay(100); /* let it play for awhile. */
|
SDL_Delay(100); /* let it play for a while. */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -146,5 +175,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_free(wave.sound);
|
SDL_free(wave.sound);
|
||||||
SDL_free(filename);
|
SDL_free(filename);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Absolutely basic tests just to see if we get the expected value
|
Absolutely basic tests just to see if we get the expected value
|
||||||
@@ -695,9 +696,22 @@ static void RunFIFOTest(SDL_bool lock_free)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
RunBasicTest();
|
RunBasicTest();
|
||||||
|
|
||||||
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
if (SDL_getenv("SDL_TESTS_QUICK") != NULL) {
|
||||||
@@ -711,5 +725,6 @@ int main(int argc, char *argv[])
|
|||||||
RunFIFOTest(SDL_FALSE);
|
RunFIFOTest(SDL_FALSE);
|
||||||
#endif
|
#endif
|
||||||
RunFIFOTest(SDL_TRUE);
|
RunFIFOTest(SDL_TRUE);
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-5
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
@@ -89,23 +90,52 @@ static void loop(void)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* (argv[1] == NULL means "open default device.") */
|
/* (NULL means "open default device.") */
|
||||||
const char *devname = argv[1];
|
const char *devname = NULL;
|
||||||
SDL_AudioSpec wanted;
|
SDL_AudioSpec wanted;
|
||||||
int devcount;
|
int devcount;
|
||||||
int i;
|
int i;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (!devname) {
|
||||||
|
devname = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[driver_name]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_CreateWindow("testaudiocapture", 320, 240, 0);
|
if (SDL_CreateWindowAndRenderer(320, 240, 0, &window, &renderer) < 0) {
|
||||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window and renderer: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
@@ -145,7 +175,7 @@ int main(int argc, char **argv)
|
|||||||
devname ? devname : "[[default]]",
|
devname ? devname : "[[default]]",
|
||||||
devname ? "'" : "");
|
devname ? "'" : "");
|
||||||
|
|
||||||
devid_in = SDL_OpenAudioDevice(argv[1], SDL_TRUE, &spec, &spec, 0);
|
devid_in = SDL_OpenAudioDevice(devname, SDL_TRUE, &spec, &spec, 0);
|
||||||
if (!devid_in) {
|
if (!devid_in) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for capture: %s!\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for capture: %s!\n", SDL_GetError());
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
@@ -162,6 +192,10 @@ int main(int argc, char **argv)
|
|||||||
SDL_Delay(16);
|
SDL_Delay(16);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/* SDL_DestroyRenderer(renderer); */
|
||||||
|
/* SDL_DestroyWindow(window); */
|
||||||
|
|
||||||
|
/* SDL_Quit(); */
|
||||||
|
/* SDLTest_CommonDestroyState(state); */
|
||||||
/* return 0; */
|
/* return 0; */
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-3
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
static SDL_AudioSpec spec;
|
static SDL_AudioSpec spec;
|
||||||
@@ -33,11 +34,14 @@ static Uint32 soundlen = 0; /* Length of wave data */
|
|||||||
static int posindex = 0;
|
static int posindex = 0;
|
||||||
static Uint32 positions[64];
|
static Uint32 positions[64];
|
||||||
|
|
||||||
|
static SDLTest_CommonState *state;
|
||||||
|
|
||||||
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
||||||
static void
|
static void
|
||||||
quit(int rc)
|
quit(int rc)
|
||||||
{
|
{
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
exit(rc);
|
exit(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,10 +138,37 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
|
SDL_Window *window;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (!filename) {
|
||||||
|
filename = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[sample.wav]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -145,9 +176,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */
|
/* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */
|
||||||
SDL_MinimizeWindow(SDL_CreateWindow("testaudiohotplug", 640, 480, 0));
|
window = SDL_CreateWindow("testaudiohotplug", 640, 480, 0);
|
||||||
|
if (window == NULL) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CreateWindow failed: %s\n", SDL_GetError());
|
||||||
|
quit(1);
|
||||||
|
}
|
||||||
|
SDL_MinimizeWindow(window);
|
||||||
|
|
||||||
filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
|
filename = GetResourceFilename(filename, "sample.wav");
|
||||||
|
|
||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
|
||||||
@@ -195,6 +231,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
SDL_free(sound);
|
SDL_free(sound);
|
||||||
SDL_free(filename);
|
SDL_free(filename);
|
||||||
SDL_Quit();
|
quit(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-1
@@ -11,6 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_devices(int iscapture)
|
print_devices(int iscapture)
|
||||||
@@ -49,11 +50,24 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
char *deviceName = NULL;
|
char *deviceName = NULL;
|
||||||
SDL_AudioSpec spec;
|
SDL_AudioSpec spec;
|
||||||
|
int i;
|
||||||
int n;
|
int n;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -65,7 +79,6 @@ int main(int argc, char **argv)
|
|||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
SDL_Log("No built-in audio drivers\n\n");
|
SDL_Log("No built-in audio drivers\n\n");
|
||||||
} else {
|
} else {
|
||||||
int i;
|
|
||||||
SDL_Log("Built-in audio drivers:\n");
|
SDL_Log("Built-in audio drivers:\n");
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
SDL_Log(" %d: %s\n", i, SDL_GetAudioDriver(i));
|
SDL_Log(" %d: %s\n", i, SDL_GetAudioDriver(i));
|
||||||
@@ -99,5 +112,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,24 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
SDL_DisplayID *displays;
|
SDL_DisplayID *displays;
|
||||||
int i;
|
int i;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
|
SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
|
||||||
@@ -38,5 +51,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_mode(const char *prefix, const SDL_DisplayMode *mode)
|
print_mode(const char *prefix, const SDL_DisplayMode *mode)
|
||||||
@@ -35,10 +36,22 @@ int main(int argc, char *argv[])
|
|||||||
const SDL_DisplayMode **modes;
|
const SDL_DisplayMode **modes;
|
||||||
const SDL_DisplayMode *mode;
|
const SDL_DisplayMode *mode;
|
||||||
int num_displays, i;
|
int num_displays, i;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -85,5 +98,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_free(displays);
|
SDL_free(displays);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
static SDL_Window *window;
|
static SDL_Window *window;
|
||||||
static SDL_Renderer *renderer;
|
static SDL_Renderer *renderer;
|
||||||
@@ -101,9 +102,22 @@ static void loop(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL */
|
/* Initialize SDL */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
|
||||||
@@ -138,5 +152,6 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -33,15 +33,15 @@ int main(int argc, char *argv[])
|
|||||||
float x = 0.0f, y = 0.0f;
|
float x = 0.0f, y = 0.0f;
|
||||||
unsigned int windowID = 0;
|
unsigned int windowID = 0;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
|
||||||
|
|
||||||
/* Initialize test framework */
|
/* Initialize test framework */
|
||||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable standard application logging */
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
for (i = 1; i < argc;) {
|
for (i = 1; i < argc;) {
|
||||||
int consumed;
|
int consumed;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
static int alive = 0;
|
static int alive = 0;
|
||||||
|
|
||||||
@@ -44,10 +45,22 @@ ThreadFunc(void *data)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_Thread *thread;
|
SDL_Thread *thread;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(0) < 0) {
|
if (SDL_Init(0) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -77,5 +90,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_Log("Main thread error string: %s\n", SDL_GetError());
|
SDL_Log("Main thread error string: %s\n", SDL_GetError());
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-1
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../src/SDL_internal.h"
|
#include "../src/SDL_internal.h"
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -1038,5 +1039,22 @@ run_test(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return run_test() ? 0 : 1;
|
int result;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = run_test() ? 0 : 1;
|
||||||
|
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
/* WARNING ! those 2 files will be destroyed by this test program */
|
/* WARNING ! those 2 files will be destroyed by this test program */
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@
|
|||||||
#define NULL ((void *)0)
|
#define NULL ((void *)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static SDLTest_CommonState *state;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
@@ -55,6 +58,7 @@ rwops_error_quit(unsigned line, SDL_RWops *rwops)
|
|||||||
rwops->close(rwops); /* This calls SDL_DestroyRW(rwops); */
|
rwops->close(rwops); /* This calls SDL_DestroyRW(rwops); */
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
exit(1); /* quit with rwops error (test failed) */
|
exit(1); /* quit with rwops error (test failed) */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +69,20 @@ int main(int argc, char *argv[])
|
|||||||
SDL_RWops *rwops = NULL;
|
SDL_RWops *rwops = NULL;
|
||||||
char test_buf[30];
|
char test_buf[30];
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
/* test 1 : basic argument test: all those calls to SDL_RWFromFile should fail */
|
/* test 1 : basic argument test: all those calls to SDL_RWFromFile should fail */
|
||||||
@@ -354,5 +369,6 @@ int main(int argc, char *argv[])
|
|||||||
rwops->close(rwops);
|
rwops->close(rwops);
|
||||||
SDL_Log("test5 OK\n");
|
SDL_Log("test5 OK\n");
|
||||||
cleanup();
|
cleanup();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0; /* all ok */
|
return 0; /* all ok */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,28 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
SDLTest_CommonState *state;
|
||||||
char *base_path;
|
char *base_path;
|
||||||
char *pref_path;
|
char *pref_path;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_Init(0) == -1) {
|
if (SDL_Init(0) == -1) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
|
||||||
return 1;
|
return 1;
|
||||||
@@ -55,5 +68,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-23
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
@@ -862,7 +863,14 @@ static void loop(void *arg)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int gamepad_index = 0;
|
int gamepad_index = -1;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
||||||
@@ -875,6 +883,47 @@ int main(int argc, char *argv[])
|
|||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (SDL_strcmp(argv[i], "--mappings") == 0) {
|
||||||
|
int map_i;
|
||||||
|
SDL_Log("Supported mappings:\n");
|
||||||
|
for (map_i = 0; map_i < SDL_GetNumGamepadMappings(); ++map_i) {
|
||||||
|
char *mapping = SDL_GetGamepadMappingForIndex(map_i);
|
||||||
|
if (mapping) {
|
||||||
|
SDL_Log("\t%s\n", mapping);
|
||||||
|
SDL_free(mapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_Log("\n");
|
||||||
|
consumed = 1;
|
||||||
|
} else if (SDL_strcmp(argv[i], "--virtual") == 0) {
|
||||||
|
OpenVirtualGamepad();
|
||||||
|
consumed = 1;
|
||||||
|
} else if (gamepad_index < 0) {
|
||||||
|
char *endptr = NULL;
|
||||||
|
gamepad_index = (int)SDL_strtol(argv[i], &endptr, 0);
|
||||||
|
if (endptr != argv[i] && *endptr == '\0' && gamepad_index >= 0) {
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[--mappings]", "[--virtual]", "[index]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
if (gamepad_index < 0) {
|
||||||
|
gamepad_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL (Note: video is required to start event loop) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -883,19 +932,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
SDL_AddGamepadMappingsFromFile("gamecontrollerdb.txt");
|
SDL_AddGamepadMappingsFromFile("gamecontrollerdb.txt");
|
||||||
|
|
||||||
/* Print information about the mappings */
|
|
||||||
if (argv[1] && SDL_strcmp(argv[1], "--mappings") == 0) {
|
|
||||||
SDL_Log("Supported mappings:\n");
|
|
||||||
for (i = 0; i < SDL_GetNumGamepadMappings(); ++i) {
|
|
||||||
char *mapping = SDL_GetGamepadMappingForIndex(i);
|
|
||||||
if (mapping) {
|
|
||||||
SDL_Log("\t%s\n", mapping);
|
|
||||||
SDL_free(mapping);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SDL_Log("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a window to display gamepad state */
|
/* Create a window to display gamepad state */
|
||||||
window = SDL_CreateWindow("Gamepad Test", SCREEN_WIDTH, SCREEN_HEIGHT, 0);
|
window = SDL_CreateWindow("Gamepad Test", SCREEN_WIDTH, SCREEN_HEIGHT, 0);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
@@ -935,15 +971,6 @@ int main(int argc, char *argv[])
|
|||||||
/* Process the initial gamepad list */
|
/* Process the initial gamepad list */
|
||||||
loop(NULL);
|
loop(NULL);
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i) {
|
|
||||||
if (SDL_strcmp(argv[i], "--virtual") == 0) {
|
|
||||||
OpenVirtualGamepad();
|
|
||||||
}
|
|
||||||
if (argv[i] && *argv[i] != '-') {
|
|
||||||
gamepad_index = SDL_atoi(argv[i]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (gamepad_index < num_gamepads) {
|
if (gamepad_index < num_gamepads) {
|
||||||
gamepad = gamepads[gamepad_index];
|
gamepad = gamepads[gamepad_index];
|
||||||
} else {
|
} else {
|
||||||
@@ -970,6 +997,7 @@ int main(int argc, char *argv[])
|
|||||||
SDL_DestroyRenderer(screen);
|
SDL_DestroyRenderer(screen);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD);
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -168,14 +168,15 @@ int main(int argc, char *argv[])
|
|||||||
Uint64 then, now;
|
Uint64 then, now;
|
||||||
Uint32 frames;
|
Uint32 frames;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
|
||||||
|
|
||||||
/* Initialize test framework */
|
/* Initialize test framework */
|
||||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable standard application logging */
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
for (i = 1; i < argc;) {
|
for (i = 1; i < argc;) {
|
||||||
int consumed;
|
int consumed;
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -45,7 +45,7 @@ static int LoadContext(GL_Context *data)
|
|||||||
#else
|
#else
|
||||||
#define SDL_PROC(ret, func, params) \
|
#define SDL_PROC(ret, func, params) \
|
||||||
do { \
|
do { \
|
||||||
data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
|
data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
|
||||||
if (!data->func) { \
|
if (!data->func) { \
|
||||||
return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
|
return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
|
||||||
} \
|
} \
|
||||||
@@ -210,9 +210,6 @@ int main(int argc, char *argv[])
|
|||||||
int interval = 0;
|
int interval = 0;
|
||||||
int ret_interval = 0;
|
int ret_interval = 0;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
|
||||||
|
|
||||||
/* Initialize parameters */
|
/* Initialize parameters */
|
||||||
fsaa = 0;
|
fsaa = 0;
|
||||||
accel = -1;
|
accel = -1;
|
||||||
@@ -222,6 +219,10 @@ int main(int argc, char *argv[])
|
|||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable standard application logging */
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
for (i = 1; i < argc;) {
|
for (i = 1; i < argc;) {
|
||||||
int consumed;
|
int consumed;
|
||||||
|
|
||||||
|
|||||||
+11
-5
@@ -103,9 +103,6 @@ int main(int argc, char *argv[])
|
|||||||
Uint32 then, now, frames;
|
Uint32 then, now, frames;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
|
||||||
|
|
||||||
/* Initialize parameters */
|
/* Initialize parameters */
|
||||||
fsaa = 0;
|
fsaa = 0;
|
||||||
accel = 0;
|
accel = 0;
|
||||||
@@ -115,6 +112,10 @@ int main(int argc, char *argv[])
|
|||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable standard application logging */
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
for (i = 1; i < argc;) {
|
for (i = 1; i < argc;) {
|
||||||
int consumed;
|
int consumed;
|
||||||
|
|
||||||
@@ -131,8 +132,13 @@ int main(int argc, char *argv[])
|
|||||||
if (!argv[i]) {
|
if (!argv[i]) {
|
||||||
consumed = -1;
|
consumed = -1;
|
||||||
} else {
|
} else {
|
||||||
depth = SDL_atoi(argv[i]);
|
char *endptr = NULL;
|
||||||
consumed = 1;
|
depth = (int)SDL_strtol(argv[i], &endptr, 0);
|
||||||
|
if (endptr != argv[i] && *endptr == '\0') {
|
||||||
|
consumed = 1;
|
||||||
|
} else {
|
||||||
|
consumed = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
consumed = -1;
|
consumed = -1;
|
||||||
|
|||||||
+7
-2
@@ -651,8 +651,13 @@ int main(int argc, char *argv[])
|
|||||||
if (!argv[i]) {
|
if (!argv[i]) {
|
||||||
consumed = -1;
|
consumed = -1;
|
||||||
} else {
|
} else {
|
||||||
depth = SDL_atoi(argv[i]);
|
char *endptr = NULL;
|
||||||
consumed = 1;
|
depth = (int)SDL_strtol(argv[i], &endptr, 0);
|
||||||
|
if (endptr != argv[i] && *endptr == '\0') {
|
||||||
|
consumed = 1;
|
||||||
|
} else {
|
||||||
|
consumed = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
consumed = -1;
|
consumed = -1;
|
||||||
|
|||||||
@@ -465,8 +465,13 @@ int main(int argc, char *argv[])
|
|||||||
if (!argv[i]) {
|
if (!argv[i]) {
|
||||||
consumed = -1;
|
consumed = -1;
|
||||||
} else {
|
} else {
|
||||||
depth = SDL_atoi(argv[i]);
|
char *endptr = NULL;
|
||||||
consumed = 1;
|
depth = (int)SDL_strtol(argv[i], &endptr, 0);
|
||||||
|
if (endptr != argv[i] && *endptr == '\0') {
|
||||||
|
consumed = 1;
|
||||||
|
} else {
|
||||||
|
consumed = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
consumed = -1;
|
consumed = -1;
|
||||||
|
|||||||
+36
-17
@@ -13,10 +13,12 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static SDL_Haptic *haptic;
|
static SDL_Haptic *haptic;
|
||||||
|
static SDLTest_CommonState *state;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* prototypes
|
* prototypes
|
||||||
@@ -32,33 +34,48 @@ static void HapticPrintSupported(SDL_Haptic *);
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *name;
|
char *name = NULL;
|
||||||
int index;
|
int index = -1;
|
||||||
SDL_HapticEffect efx[9];
|
SDL_HapticEffect efx[9];
|
||||||
int id[9];
|
int id[9];
|
||||||
int nefx;
|
int nefx;
|
||||||
unsigned int supported;
|
unsigned int supported;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
name = NULL;
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
index = -1;
|
if (!consumed) {
|
||||||
if (argc > 1) {
|
if (!name && index < 0) {
|
||||||
name = argv[1];
|
size_t len;
|
||||||
if ((SDL_strcmp(name, "--help") == 0) || (SDL_strcmp(name, "-h") == 0)) {
|
name = argv[i];
|
||||||
SDL_Log("USAGE: %s [device]\n"
|
len = SDL_strlen(name);
|
||||||
"If device is a two-digit number it'll use it as an index, otherwise\n"
|
if (len < 3 && SDL_isdigit(name[0]) && (len == 1 || SDL_isdigit(name[1]))) {
|
||||||
"it'll use it as if it were part of the device's name.\n",
|
index = SDL_atoi(name);
|
||||||
argv[0]);
|
name = NULL;
|
||||||
return 0;
|
}
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[device]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
SDL_Log("\n");
|
||||||
|
SDL_Log("If device is a two-digit number it'll use it as an index, otherwise\n"
|
||||||
|
"it'll use it as if it were part of the device's name.\n");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = (int)SDL_strlen(name);
|
i += consumed;
|
||||||
if ((i < 3) && SDL_isdigit(name[0]) && ((i == 1) || SDL_isdigit(name[1]))) {
|
|
||||||
index = SDL_atoi(name);
|
|
||||||
name = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the force feedbackness */
|
/* Initialize the force feedbackness */
|
||||||
@@ -281,6 +298,7 @@ int main(int argc, char **argv)
|
|||||||
SDL_HapticClose(haptic);
|
SDL_HapticClose(haptic);
|
||||||
}
|
}
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -295,6 +313,7 @@ abort_execution(void)
|
|||||||
|
|
||||||
SDL_HapticClose(haptic);
|
SDL_HapticClose(haptic);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-3
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -27,11 +28,35 @@ int main(int argc, char *argv[])
|
|||||||
int i;
|
int i;
|
||||||
SDL_bool enable_haptic = SDL_TRUE;
|
SDL_bool enable_haptic = SDL_TRUE;
|
||||||
Uint32 init_subsystems = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;
|
Uint32 init_subsystems = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i) {
|
/* Initialize test framework */
|
||||||
if (SDL_strcasecmp(argv[i], "--nohaptic") == 0) {
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
enable_haptic = SDL_FALSE;
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable standard application logging */
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (SDL_strcasecmp(argv[i], "--nohaptic") == 0) {
|
||||||
|
enable_haptic = SDL_FALSE;
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[--nohaptic]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_haptic) {
|
if (enable_haptic) {
|
||||||
@@ -132,6 +157,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-2
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
@@ -49,18 +50,45 @@ int main(int argc, char *argv[])
|
|||||||
"UCS-4",
|
"UCS-4",
|
||||||
};
|
};
|
||||||
|
|
||||||
char *fname;
|
char *fname = NULL;
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ];
|
||||||
char *ucs4;
|
char *ucs4;
|
||||||
char *test[2];
|
char *test[2];
|
||||||
int i;
|
int i;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
fname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "utf8.txt");
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (!fname) {
|
||||||
|
fname = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[utf8.txt]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
fname = GetResourceFilename(fname, "utf8.txt");
|
||||||
file = fopen(fname, "rb");
|
file = fopen(fname, "rb");
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname);
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname);
|
||||||
@@ -93,5 +121,6 @@ int main(int argc, char *argv[])
|
|||||||
(void)fclose(file);
|
(void)fclose(file);
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Total errors: %d\n", errors);
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Total errors: %d\n", errors);
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return errors ? errors + 1 : 0;
|
return errors ? errors + 1 : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-25
@@ -445,11 +445,6 @@ static Uint32 utf8_decode(char *p, size_t len)
|
|||||||
return codepoint;
|
return codepoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
|
||||||
{
|
|
||||||
SDL_Log("usage: testime [--font fontfile]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void InitInput(void)
|
static void InitInput(void)
|
||||||
{
|
{
|
||||||
/* Prepare a rect for text input */
|
/* Prepare a rect for text input */
|
||||||
@@ -647,42 +642,43 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i, done;
|
int i, done;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
const char *fontname = DEFAULT_FONT;
|
char *fontname = NULL;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
|
||||||
|
|
||||||
/* Initialize test framework */
|
/* Initialize test framework */
|
||||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (i = 1; i < argc; i++) {
|
|
||||||
SDLTest_CommonArg(state, i);
|
|
||||||
}
|
|
||||||
for (argc--, argv++; argc > 0; argc--, argv++) {
|
|
||||||
if (SDL_strcmp(argv[0], "--help") == 0) {
|
|
||||||
usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (SDL_strcmp(argv[0], "--font") == 0) {
|
/* Enable standard application logging */
|
||||||
argc--;
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
argv++;
|
|
||||||
|
|
||||||
if (argc > 0) {
|
/* Parse commandline */
|
||||||
fontname = argv[0];
|
for (i = 1; i < argc;) {
|
||||||
} else {
|
int consumed;
|
||||||
usage();
|
|
||||||
return 0;
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (SDL_strcmp(argv[i], "--font") == 0) {
|
||||||
|
if (*argv[i+1]) {
|
||||||
|
fontname = argv[i+1];
|
||||||
|
consumed = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[--font fontfile]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDLTest_CommonInit(state)) {
|
if (!SDLTest_CommonInit(state)) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fontname = GetResourceFilename(fontname, DEFAULT_FONT);
|
||||||
|
|
||||||
#ifdef HAVE_SDL_TTF
|
#ifdef HAVE_SDL_TTF
|
||||||
/* Initialize fonts */
|
/* Initialize fonts */
|
||||||
TTF_Init();
|
TTF_Init();
|
||||||
@@ -794,6 +790,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SDL_free(fontname);
|
||||||
CleanupVideo();
|
CleanupVideo();
|
||||||
SDLTest_CommonQuit(state);
|
SDLTest_CommonQuit(state);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+23
-5
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
@@ -32,7 +33,6 @@
|
|||||||
static SDL_Window *window = NULL;
|
static SDL_Window *window = NULL;
|
||||||
static SDL_Renderer *screen = NULL;
|
static SDL_Renderer *screen = NULL;
|
||||||
static SDL_Joystick *joystick = NULL;
|
static SDL_Joystick *joystick = NULL;
|
||||||
static SDL_bool done = SDL_FALSE;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintJoystick(SDL_Joystick *joy)
|
PrintJoystick(SDL_Joystick *joy)
|
||||||
@@ -103,6 +103,7 @@ static void loop(void *arg)
|
|||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
int i;
|
int i;
|
||||||
|
SDL_bool *done = (SDL_bool*)arg;
|
||||||
|
|
||||||
/* blank screen, set up for drawing this frame. */
|
/* blank screen, set up for drawing this frame. */
|
||||||
SDL_SetRenderDrawColor(screen, 0x0, 0x0, 0x0, SDL_ALPHA_OPAQUE);
|
SDL_SetRenderDrawColor(screen, 0x0, 0x0, 0x0, SDL_ALPHA_OPAQUE);
|
||||||
@@ -200,7 +201,7 @@ static void loop(void *arg)
|
|||||||
case SDL_EVENT_FINGER_DOWN:
|
case SDL_EVENT_FINGER_DOWN:
|
||||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||||
case SDL_EVENT_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
*done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -279,7 +280,7 @@ static void loop(void *arg)
|
|||||||
SDL_RenderPresent(screen);
|
SDL_RenderPresent(screen);
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
if (done) {
|
if (*done == SDL_TRUE) {
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -287,11 +288,25 @@ static void loop(void *arg)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
SDL_bool done;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL (Note: video is required to start event loop) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -316,12 +331,14 @@ int main(int argc, char *argv[])
|
|||||||
SDL_RenderClear(screen);
|
SDL_RenderClear(screen);
|
||||||
SDL_RenderPresent(screen);
|
SDL_RenderPresent(screen);
|
||||||
|
|
||||||
|
done = SDL_FALSE;
|
||||||
|
|
||||||
/* Loop, getting joystick events! */
|
/* Loop, getting joystick events! */
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_main_loop_arg(loop, NULL, 0, 1);
|
emscripten_set_main_loop_arg(loop, &done, 0, 1);
|
||||||
#else
|
#else
|
||||||
while (!done) {
|
while (!done) {
|
||||||
loop(NULL);
|
loop(&done);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -329,6 +346,7 @@ int main(int argc, char *argv[])
|
|||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,27 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_Scancode scancode;
|
SDL_Scancode scancode;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -33,5 +46,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_GetScancodeName(scancode));
|
SDL_GetScancodeName(scancode));
|
||||||
}
|
}
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-13
@@ -17,22 +17,67 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
typedef int (*fntype)(const char *);
|
typedef int (*fntype)(const char *);
|
||||||
|
|
||||||
|
static void log_usage(char *progname, SDLTest_CommonState *state) {
|
||||||
|
static const char *options[] = { "library", "functionname|--hello", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, progname, options);
|
||||||
|
SDL_Log("USAGE: %s <library> <functionname>\n", progname);
|
||||||
|
SDL_Log(" %s <lib with puts()> --hello\n", progname);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
int hello = 0;
|
int hello = 0;
|
||||||
const char *libname = NULL;
|
const char *libname = NULL;
|
||||||
const char *symname = NULL;
|
const char *symname = NULL;
|
||||||
void *lib = NULL;
|
void *lib = NULL;
|
||||||
fntype fn = NULL;
|
fntype fn = NULL;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
if (argc != 3) {
|
/* Initialize test framework */
|
||||||
const char *app = argv[0];
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
SDL_Log("USAGE: %s <library> <functionname>\n", app);
|
if (state == NULL) {
|
||||||
SDL_Log(" %s --hello <lib with puts()>\n", app);
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable standard application logging */
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (SDL_strcmp(argv[i], "--hello") == 0) {
|
||||||
|
if (!symname || SDL_strcmp(symname, "puts") == 0) {
|
||||||
|
symname = "puts";
|
||||||
|
consumed = 1;
|
||||||
|
hello = 1;
|
||||||
|
}
|
||||||
|
} else if (!libname) {
|
||||||
|
libname = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
} else if (!symname) {
|
||||||
|
symname = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
log_usage(argv[0], state);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!libname || !symname) {
|
||||||
|
log_usage(argv[0], state);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,15 +87,6 @@ int main(int argc, char *argv[])
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_strcmp(argv[1], "--hello") == 0) {
|
|
||||||
hello = 1;
|
|
||||||
libname = argv[2];
|
|
||||||
symname = "puts";
|
|
||||||
} else {
|
|
||||||
libname = argv[1];
|
|
||||||
symname = argv[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
lib = SDL_LoadObject(libname);
|
lib = SDL_LoadObject(libname);
|
||||||
if (lib == NULL) {
|
if (lib == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n",
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n",
|
||||||
@@ -74,5 +110,6 @@ int main(int argc, char *argv[])
|
|||||||
SDL_UnloadObject(lib);
|
SDL_UnloadObject(lib);
|
||||||
}
|
}
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-19
@@ -11,8 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
/* !!! FIXME: move this to the test framework */
|
|
||||||
|
|
||||||
static void log_locales(void)
|
static void log_locales(void)
|
||||||
{
|
{
|
||||||
@@ -35,31 +34,69 @@ static void log_locales(void)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
int listen = 0;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
/* Print locales and languages */
|
/* Parse commandline */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) != -1) {
|
for (i = 1; i < argc;) {
|
||||||
log_locales();
|
int consumed;
|
||||||
|
|
||||||
if ((argc == 2) && (SDL_strcmp(argv[1], "--listen") == 0)) {
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
SDL_bool keep_going = SDL_TRUE;
|
if (!consumed) {
|
||||||
while (keep_going) {
|
if (SDL_strcmp(argv[1], "--listen") == 0) {
|
||||||
SDL_Event e;
|
listen = 1;
|
||||||
while (SDL_PollEvent(&e)) {
|
consumed = 1;
|
||||||
if (e.type == SDL_EVENT_QUIT) {
|
|
||||||
keep_going = SDL_FALSE;
|
|
||||||
} else if (e.type == SDL_EVENT_LOCALE_CHANGED) {
|
|
||||||
SDL_Log("Saw SDL_EVENT_LOCALE_CHANGED event!");
|
|
||||||
log_locales();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SDL_Delay(10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[--listen]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
i += consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print locales and languages */
|
||||||
|
if (SDLTest_CommonInit(state) == SDL_FALSE) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_locales();
|
||||||
|
|
||||||
|
if (listen) {
|
||||||
|
int done = 0;
|
||||||
|
while (!done) {
|
||||||
|
SDL_Event e;
|
||||||
|
SDLTest_CommonEvent(state, &e, &done);
|
||||||
|
while (SDL_PollEvent(&e)) {
|
||||||
|
if (e.type == SDL_EVENT_QUIT) {
|
||||||
|
done = 1;
|
||||||
|
} else if (e.type == SDL_EVENT_LOCALE_CHANGED) {
|
||||||
|
SDL_Log("Saw SDL_EVENT_LOCALE_CHANGED event!");
|
||||||
|
log_locales();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < state->num_windows; i++) {
|
||||||
|
SDL_RenderPresent(state->renderers[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Delay(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDLTest_CommonQuit(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
||||||
static void
|
static void
|
||||||
@@ -81,10 +82,22 @@ button_messagebox(void *eventNumber)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int success;
|
int success;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||||
"Simple MessageBox",
|
"Simple MessageBox",
|
||||||
"This is a simple error MessageBox",
|
"This is a simple error MessageBox",
|
||||||
@@ -208,5 +221,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-14
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
@@ -49,7 +50,10 @@ static SDL_bool wheel_y_active = SDL_FALSE;
|
|||||||
static float wheel_x = SCREEN_WIDTH * 0.5f;
|
static float wheel_x = SCREEN_WIDTH * 0.5f;
|
||||||
static float wheel_y = SCREEN_HEIGHT * 0.5f;
|
static float wheel_y = SCREEN_HEIGHT * 0.5f;
|
||||||
|
|
||||||
static SDL_bool done = SDL_FALSE;
|
struct mouse_loop_data {
|
||||||
|
SDL_bool done;
|
||||||
|
SDL_Renderer *renderer;
|
||||||
|
};
|
||||||
|
|
||||||
static void DrawObject(SDL_Renderer *renderer, Object *object)
|
static void DrawObject(SDL_Renderer *renderer, Object *object)
|
||||||
{
|
{
|
||||||
@@ -104,8 +108,9 @@ static void AppendObject(Object *object)
|
|||||||
|
|
||||||
static void loop(void *arg)
|
static void loop(void *arg)
|
||||||
{
|
{
|
||||||
SDL_Renderer *renderer = (SDL_Renderer *)arg;
|
struct mouse_loop_data *loop_data = (struct mouse_loop_data *)arg;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
SDL_Renderer *renderer = loop_data->renderer;
|
||||||
|
|
||||||
/* Check for events */
|
/* Check for events */
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
@@ -212,7 +217,7 @@ static void loop(void *arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_EVENT_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
done = SDL_TRUE;
|
loop_data->done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -241,7 +246,7 @@ static void loop(void *arg)
|
|||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
if (done) {
|
if (loop_data->done) {
|
||||||
emscripten_cancel_main_loop();
|
emscripten_cancel_main_loop();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -249,11 +254,23 @@ static void loop(void *arg)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_Renderer *renderer;
|
struct mouse_loop_data loop_data;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL (Note: video is required to start event loop) */
|
/* Initialize SDL (Note: video is required to start event loop) */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -262,31 +279,34 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Create a window to display joystick axis position */
|
/* Create a window to display joystick axis position */
|
||||||
window = SDL_CreateWindow("Mouse Test", SCREEN_WIDTH, SCREEN_HEIGHT, 0);
|
window = SDL_CreateWindow("Mouse Test", SCREEN_WIDTH, SCREEN_HEIGHT, 0);
|
||||||
if (window == NULL) {
|
if (!window) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
|
||||||
return SDL_FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CreateRenderer(window, NULL, 0);
|
loop_data.done = SDL_FALSE;
|
||||||
if (renderer == NULL) {
|
|
||||||
|
loop_data.renderer = SDL_CreateRenderer(window, NULL, 0);
|
||||||
|
if (!loop_data.renderer) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
return SDL_FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main render loop */
|
/* Main render loop */
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_main_loop_arg(loop, renderer, 0, 1);
|
emscripten_set_main_loop_arg(loop, &loop_data, 0, 1);
|
||||||
#else
|
#else
|
||||||
while (!done) {
|
while (loop_data.done == SDL_FALSE) {
|
||||||
loop(renderer);
|
loop(&loop_data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(loop_data.renderer);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+40
-6
@@ -11,6 +11,9 @@
|
|||||||
*/
|
*/
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
#include <stdio.h> /* for fflush() and stdout */
|
#include <stdio.h> /* for fflush() and stdout */
|
||||||
|
|
||||||
@@ -166,10 +169,39 @@ test_multi_audio(int devcount)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int devcount = 0;
|
int devcount = 0;
|
||||||
|
int i;
|
||||||
|
char *filename = NULL;
|
||||||
|
SDLTest_CommonState *state;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
for (i = 1; i < argc;) {
|
||||||
|
int consumed;
|
||||||
|
|
||||||
|
consumed = SDLTest_CommonArg(state, i);
|
||||||
|
if (!consumed) {
|
||||||
|
if (!filename) {
|
||||||
|
filename = argv[i];
|
||||||
|
consumed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (consumed <= 0) {
|
||||||
|
static const char *options[] = { "[sample.wav]", NULL };
|
||||||
|
SDLTest_CommonLogUsage(state, argv[0], options);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += consumed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the SDL library */
|
/* Load the SDL library */
|
||||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||||
@@ -178,24 +210,26 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
|
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
|
||||||
|
|
||||||
|
filename = GetResourceFilename(filename, "sample.wav");
|
||||||
|
|
||||||
devcount = SDL_GetNumAudioDevices(0);
|
devcount = SDL_GetNumAudioDevices(0);
|
||||||
if (devcount < 1) {
|
if (devcount < 1) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n");
|
||||||
} else {
|
} else {
|
||||||
char *file = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
|
|
||||||
|
|
||||||
/* Load the wave file into memory */
|
/* Load the wave file into memory */
|
||||||
if (SDL_LoadWAV(file, &spec, &sound, &soundlen) == NULL) {
|
if (SDL_LoadWAV(filename, &spec, &sound, &soundlen) == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename,
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
} else {
|
} else {
|
||||||
test_multi_audio(devcount);
|
test_multi_audio(devcount);
|
||||||
SDL_free(sound);
|
SDL_free(sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_free(filename);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
|
||||||
#include <SDL3/SDL_main.h>
|
#include <SDL3/SDL_main.h>
|
||||||
|
#include <SDL3/SDL_test.h>
|
||||||
|
|
||||||
#define WINDOW_W 640
|
#define WINDOW_W 640
|
||||||
#define WINDOW_H 480
|
#define WINDOW_H 480
|
||||||
@@ -39,6 +40,7 @@ static NativeWindowFactory *factories[] = {
|
|||||||
static NativeWindowFactory *factory = NULL;
|
static NativeWindowFactory *factory = NULL;
|
||||||
static void *native_window;
|
static void *native_window;
|
||||||
static SDL_FRect *positions, *velocities;
|
static SDL_FRect *positions, *velocities;
|
||||||
|
static SDLTest_CommonState *state;
|
||||||
|
|
||||||
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
||||||
static void
|
static void
|
||||||
@@ -48,6 +50,7 @@ quit(int rc)
|
|||||||
if (native_window != NULL && factory != NULL) {
|
if (native_window != NULL && factory != NULL) {
|
||||||
factory->DestroyNativeWindow(native_window);
|
factory->DestroyNativeWindow(native_window);
|
||||||
}
|
}
|
||||||
|
SDLTest_CommonDestroyState(state);
|
||||||
exit(rc);
|
exit(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,9 +103,20 @@ int main(int argc, char *argv[])
|
|||||||
int sprite_w, sprite_h;
|
int sprite_w, sprite_h;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
|
/* Initialize test framework */
|
||||||
|
state = SDLTest_CommonCreateState(argv, 0);
|
||||||
|
if (state == NULL) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
||||||
|
/* Parse commandline */
|
||||||
|
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video: %s\n",
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video: %s\n",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
|
|||||||
@@ -15,6 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
/* Hack to avoid dynapi renaming */
|
||||||
|
#include "../src/dynapi/SDL_dynapi.h"
|
||||||
|
#ifdef SDL_DYNAMIC_API
|
||||||
|
#undef SDL_DYNAMIC_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../src/SDL_internal.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *tag;
|
const char *tag;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user