remove obsolete files

This commit is contained in:
mgthepro
2022-07-31 12:49:57 +02:00
parent 117076fd71
commit de846fb71e
3631 changed files with 0 additions and 9433291 deletions

View File

@@ -1,16 +0,0 @@
# Open Watcom makefile to build SDL2 tests for Win32
# wmake -f Makefile.w32
SYSTEM = nt
INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"../src/video/khronos"
CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei
CFLAGS+= -wx -wcd=303
CFLAGS+= -DSDL_MAIN_HANDLED
CFLAGS+= -DHAVE_OPENGL
GLLIBS = opengl32.lib
TNSRCS = testnative.c testnativew32.c
!include watcom.mif

View File

@@ -1,3 +0,0 @@
[Test]
Type=session
Exec=@installedtestsdir@/@exe@

File diff suppressed because it is too large Load Diff

View File

@@ -1,169 +0,0 @@
/*
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
/**
* Automated tests for GUID processing
*/
#include <stdio.h>
#include "SDL.h"
/* Helpers */
static int _error_count = 0;
static int
_require_eq(Uint64 expected, Uint64 actual, int line, char *msg)
{
if (expected != actual) {
_error_count += 1;
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "[%s, L%d] %s: Actual %ld (0x%lx) != expected %ld (0x%lx)",
__FILE__, line, msg, actual, actual, expected, expected);
return 0;
}
return 1;
}
#define ASSERT_EQ(MSG, EXPECTED, ACTUAL) _require_eq((EXPECTED), (ACTUAL), __LINE__, (MSG))
/* Helpers */
#define NUM_TEST_GUIDS 5
static struct {
char *str;
Uint64 upper, lower;
} test_guids[NUM_TEST_GUIDS] = {
{ "0000000000000000" "ffffffffffffffff",
0x0000000000000000, 0xfffffffffffffffflu },
{ "0011223344556677" "8091a2b3c4d5e6f0",
0x0011223344556677lu, 0x8091a2b3c4d5e6f0lu },
{ "a011223344556677" "8091a2b3c4d5e6f0",
0xa011223344556677lu, 0x8091a2b3c4d5e6f0lu },
{ "a011223344556677" "8091a2b3c4d5e6f1",
0xa011223344556677lu, 0x8091a2b3c4d5e6f1lu },
{ "a011223344556677" "8191a2b3c4d5e6f0",
0xa011223344556677lu, 0x8191a2b3c4d5e6f0lu },
};
static void
upper_lower_to_bytestring(Uint8* out, Uint64 upper, Uint64 lower)
{
Uint64 values[2];
int i, k;
values[0] = upper;
values [1] = lower;
for (i = 0; i < 2; ++i) {
Uint64 v = values[i];
for (k = 0; k < 8; ++k) {
*out++ = v >> 56;
v <<= 8;
}
}
}
/* ================= Test Case Implementation ================== */
/**
* @brief Check String-to-GUID conversion
*
* @sa SDL_GUIDFromString
*/
static void
TestGuidFromString(void)
{
int i;
for (i = 0; i < NUM_TEST_GUIDS; ++i) {
Uint8 expected[16];
SDL_GUID guid;
upper_lower_to_bytestring(expected,
test_guids[i].upper, test_guids[i].lower);
guid = SDL_GUIDFromString(test_guids[i].str);
if (!ASSERT_EQ("GUID from string", 0, SDL_memcmp(expected, guid.data, 16))) {
SDL_Log(" GUID was: '%s'", test_guids[i].str);
}
}
}
/**
* @brief Check GUID-to-String conversion
*
* @sa SDL_GUIDToString
*/
static void
TestGuidToString(void)
{
int i;
for (i = 0; i < NUM_TEST_GUIDS; ++i) {
const int guid_str_offset = 4;
char guid_str_buf[64];
char *guid_str = guid_str_buf + guid_str_offset;
SDL_GUID guid;
int size;
upper_lower_to_bytestring(guid.data,
test_guids[i].upper, test_guids[i].lower);
/* Serialise to limited-length buffers */
for (size = 0; size <= 36; ++size) {
const Uint8 fill_char = size + 0xa0;
Uint32 expected_prefix;
Uint32 actual_prefix;
int written_size;
SDL_memset(guid_str_buf, fill_char, sizeof(guid_str_buf));
SDL_GUIDToString(guid, guid_str, size);
/* Check bytes before guid_str_buf */
expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (fill_char << 24);
SDL_memcpy(&actual_prefix, guid_str_buf, 4);
if (!ASSERT_EQ("String buffer memory before output untouched: ", expected_prefix, actual_prefix)) {
SDL_Log(" at size=%d", size);
}
/* Check that we did not overwrite too much */
written_size = 0;
while ((guid_str[written_size] & 0xff) != fill_char && written_size < 256) {
++written_size;
}
if (!ASSERT_EQ("Output length is within expected bounds", 1, written_size <= size)) {
SDL_Log(" with length %d: wrote %d of %d permitted bytes",
size, written_size, size);
}
if (size >= 33) {
if (!ASSERT_EQ("GUID string equality", 0, SDL_strcmp(guid_str, test_guids[i].str))) {
SDL_Log(" from string: %s", test_guids[i].str);
}
}
}
}
}
int
main(int argc, char *argv[])
{
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
TestGuidFromString();
TestGuidToString();
return _error_count > 0;
}

View File

@@ -1,153 +0,0 @@
/*
Copyright 1997-2022 Sam Lantinga
Copyright 2022 Collabora Ltd.
SPDX-License-Identifier: Zlib
*/
#include "testutils.h"
/*
* Return the absolute path to def in the SDL_GetBasePath() if possible, or
* the relative path to def on platforms that don't have a working
* SDL_GetBasePath(). Free the result with SDL_free.
*
* Fails and returns NULL if out of memory.
*/
char *
GetNearbyFilename(const char *file)
{
char *base;
char *path;
base = SDL_GetBasePath();
if (base != NULL) {
SDL_RWops *rw;
size_t len = SDL_strlen(base) + SDL_strlen(file) + 1;
path = SDL_malloc(len);
if (path == NULL) {
SDL_free(base);
SDL_OutOfMemory();
return NULL;
}
SDL_snprintf(path, len, "%s%s", base, file);
SDL_free(base);
rw = SDL_RWFromFile(path, "rb");
if (rw) {
SDL_RWclose(rw);
return path;
}
/* Couldn't find the file in the base path */
SDL_free(path);
}
path = SDL_strdup(file);
if (path == NULL) {
SDL_OutOfMemory();
}
return path;
}
/*
* If user_specified is non-NULL, return a copy of it. Free with SDL_free.
*
* Otherwise, return the absolute path to def in the SDL_GetBasePath() if
* possible, or the relative path to def on platforms that don't have a
* working SDL_GetBasePath(). Free the result with SDL_free.
*
* Fails and returns NULL if out of memory.
*/
char *
GetResourceFilename(const char *user_specified, const char *def)
{
if (user_specified != NULL) {
char *ret = SDL_strdup(user_specified);
if (ret == NULL) {
SDL_OutOfMemory();
}
return ret;
} else {
return GetNearbyFilename(def);
}
}
/*
* Load the .bmp file whose name is file, from the SDL_GetBasePath() if
* possible or the current working directory if not.
*
* If transparent is true, set the transparent colour from the top left pixel.
*
* If width_out is non-NULL, set it to the texture width.
*
* If height_out is non-NULL, set it to the texture height.
*/
SDL_Texture *
LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
int *width_out, int *height_out)
{
SDL_Surface *temp = NULL;
SDL_Texture *texture = NULL;
char *path;
path = GetNearbyFilename(file);
if (path != NULL) {
file = path;
}
temp = SDL_LoadBMP(file);
if (temp == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
} else {
/* Set transparent pixel as the pixel at (0,0) */
if (transparent) {
if (temp->format->palette) {
SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels);
} else {
switch (temp->format->BitsPerPixel) {
case 15:
SDL_SetColorKey(temp, SDL_TRUE,
(*(Uint16 *) temp->pixels) & 0x00007FFF);
break;
case 16:
SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels);
break;
case 24:
SDL_SetColorKey(temp, SDL_TRUE,
(*(Uint32 *) temp->pixels) & 0x00FFFFFF);
break;
case 32:
SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels);
break;
}
}
}
if (width_out != NULL) {
*width_out = temp->w;
}
if (height_out != NULL) {
*height_out = temp->h;
}
texture = SDL_CreateTextureFromSurface(renderer, temp);
if (!texture) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
}
}
if (temp) {
SDL_FreeSurface(temp);
}
if (path) {
SDL_free(path);
}
return texture;
}

View File

@@ -1,17 +0,0 @@
/*
Copyright 1997-2022 Sam Lantinga
Copyright 2022 Collabora Ltd.
SPDX-License-Identifier: Zlib
*/
#ifndef TESTUTILS_H
#define TESTUTILS_H
#include "SDL.h"
SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
int *width_out, int *height_out);
char *GetNearbyFilename(const char *file);
char *GetResourceFilename(const char *user_specified, const char *def);
#endif

View File

@@ -1,162 +0,0 @@
#!/bin/sh
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: Zlib
set -eu
ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h)
ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h)
ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h)
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
tests=0
failed=0
ok () {
tests=$(( tests + 1 ))
echo "ok - $*"
}
not_ok () {
tests=$(( tests + 1 ))
echo "not ok - $*"
failed=1
}
major=$(sed -ne 's/^SDL_MAJOR_VERSION=//p' configure.ac)
minor=$(sed -ne 's/^SDL_MINOR_VERSION=//p' configure.ac)
micro=$(sed -ne 's/^SDL_MICRO_VERSION=//p' configure.ac)
version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "configure.ac $version"
else
not_ok "configure.ac $version disagrees with SDL_version.h $ref_version"
fi
major=$(sed -ne 's/^set(SDL_MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
minor=$(sed -ne 's/^set(SDL_MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
micro=$(sed -ne 's/^set(SDL_MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "CMakeLists.txt $version"
else
not_ok "CMakeLists.txt $version disagrees with SDL_version.h $ref_version"
fi
major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2)
minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2)
micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2)
version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "Makefile.os2 $version"
else
not_ok "Makefile.os2 $version disagrees with SDL_version.h $ref_version"
fi
major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.w32)
minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.w32)
micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.w32)
version="${major}.${minor}.${micro}"
if [ "$ref_version" = "$version" ]; then
ok "Makefile.w32 $version"
else
not_ok "Makefile.w32 $version disagrees with SDL_version.h $ref_version"
fi
version=$(sed -Ene 's/^[$]SDLVersion = "([0-9.]*)"\r?$/\1/p' build-scripts/winrtbuild.ps1)
if [ "$ref_version" = "$version" ]; then
ok "winrtbuild.ps1 $version"
else
not_ok "winrtbuild.ps1 $version disagrees with SDL_version.h $ref_version"
fi
tuple=$(sed -ne 's/^ *FILEVERSION *//p' src/main/windows/version.rc | tr -d '\r')
ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
if [ "$ref_tuple" = "$tuple" ]; then
ok "version.rc FILEVERSION $tuple"
else
not_ok "version.rc FILEVERSION $tuple disagrees with SDL_version.h $ref_tuple"
fi
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' src/main/windows/version.rc | tr -d '\r')
if [ "$ref_tuple" = "$tuple" ]; then
ok "version.rc PRODUCTVERSION $tuple"
else
not_ok "version.rc PRODUCTVERSION $tuple disagrees with SDL_version.h $ref_tuple"
fi
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/main/windows/version.rc | tr -d '\r')
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
if [ "$ref_tuple" = "$tuple" ]; then
ok "version.rc FileVersion $tuple"
else
not_ok "version.rc FileVersion $tuple disagrees with SDL_version.h $ref_tuple"
fi
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/main/windows/version.rc | tr -d '\r')
if [ "$ref_tuple" = "$tuple" ]; then
ok "version.rc ProductVersion $tuple"
else
not_ok "version.rc ProductVersion $tuple disagrees with SDL_version.h $ref_tuple"
fi
version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist)
if [ "$ref_version" = "$version" ]; then
ok "Info-Framework.plist CFBundleShortVersionString $version"
else
not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_version.h $ref_version"
fi
version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist)
if [ "$ref_version" = "$version" ]; then
ok "Info-Framework.plist CFBundleVersion $version"
else
not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version"
fi
# For simplicity this assumes we'll never break ABI before SDL 3.
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
ref='1.0.0
1.0.0'
if [ "$ref" = "$dylib_compat" ]; then
ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
else
not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent"
fi
dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
case "$ref_minor" in
(*[02468])
major="$(( ref_minor * 100 + 1 ))"
minor="$ref_micro"
;;
(*)
major="$(( ref_minor * 100 + ref_micro + 1 ))"
minor="0"
;;
esac
ref="${major}.${minor}.0
${major}.${minor}.0"
if [ "$ref" = "$dylib_cur" ]; then
ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
else
not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent"
fi
echo "1..$tests"
exit "$failed"

View File

@@ -1,116 +0,0 @@
INCPATH+= -I"../include"
LIBPATH = ..
LIBS = SDL2.lib SDL2test.lib testutils.lib
#CFLAGS+= -DHAVE_SDL_TTF
#TTFLIBS = SDL2ttf.lib
CFLAGS+= $(INCPATH)
TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe &
testdrawchessboard.exe testdropfile.exe testerror.exe testfile.exe &
testfilesystem.exe testgamecontroller.exe testgeometry.exe testgesture.exe &
testhittesting.exe testhotplug.exe testiconv.exe testime.exe testlocale.exe &
testguid.exe testintersections.exe testjoystick.exe testkeys.exe testloadso.exe &
testlock.exe testmessage.exe testoverlay2.exe testplatform.exe &
testpower.exe testsensor.exe testrelative.exe testrendercopyex.exe &
testrendertarget.exe testrumble.exe testscale.exe testsem.exe &
testshader.exe testshape.exe testsprite2.exe testspriteminimal.exe &
teststreaming.exe testthread.exe testtimer.exe testver.exe &
testviewport.exe testwm2.exe torturethread.exe checkkeys.exe &
checkkeysthreads.exe testmouse.exe testgles.exe testgles2.exe &
controllermap.exe testhaptic.exe testqsort.exe testresample.exe &
testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe &
testsurround.exe testyuv.exe testgl2.exe testvulkan.exe testnative.exe &
testautomation.exe testaudiohotplug.exe testcustomcursor.exe testmultiaudio.exe &
testoffscreen.exe testurl.exe
noninteractive = &
testatomic.exe &
testerror.exe &
testfilesystem.exe &
testkeys.exe &
testlocale.exe &
testplatform.exe &
testpower.exe &
testqsort.exe &
testthread.exe &
testtimer.exe &
testver.exe
needs_audio = &
testaudioinfo.exe &
testsurround.exe
needs_display = &
testbounds.exe &
testdisplayinfo.exe
TESTS = $(noninteractive) $(needs_audio) $(needs_display)
# testautomation sources
TASRCS = testautomation.c testautomation_audio.c testautomation_clipboard.c &
testautomation_events.c testautomation_hints.c &
testautomation_keyboard.c testautomation_main.c &
testautomation_mouse.c testautomation_pixels.c &
testautomation_platform.c testautomation_rect.c &
testautomation_render.c testautomation_rwops.c &
testautomation_sdltest.c testautomation_stdlib.c &
testautomation_surface.c testautomation_syswm.c &
testautomation_timer.c testautomation_video.c &
testautomation_math.c
OBJS = $(TARGETS:.exe=.obj)
COBJS = $(CSRCS:.c=.obj)
TAOBJS = $(TASRCS:.c=.obj)
TNOBJS = $(TNSRCS:.c=.obj)
all: testutils.lib $(TARGETS)
.c: ../src/test
.obj.exe:
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
.c.obj:
wcc386 $(CFLAGS) -fo=$^@ $<
# specials
testautomation.exe: $(TAOBJS)
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
testnative.exe: $(TNOBJS)
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
testyuv.exe: testyuv.obj testyuv_cvt.obj
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@
testshader.exe: testshader.obj
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(GLLIBS)} op q op el file {$<} name $@
testime.exe: testime.obj
wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@
testutils.lib: testutils.obj
wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $<
check: .SYMBOLIC $(TESTS)
@set SDL_AUDIODRIVER=dummy
@set SDL_VIDEODRIVER=dummy
@copy "../SDL2.dll" .
@for %exe in ($(TESTS)) do %exe
check-quick: .SYMBOLIC $(TESTS)
@set SDL_TESTS_QUICK=1
@set SDL_AUDIODRIVER=dummy
@set SDL_VIDEODRIVER=dummy
@copy "../SDL2.dll" .
@for %exe in ($(TESTS)) do %exe
clean: .SYMBOLIC
rm -f *.obj *.err
distclean: .SYMBOLIC clean
rm -f *.exe *.lib