Add pixels test suite; add a test to pixel suite; minor updates to test code to make VisualStudio happy
This commit is contained in:
parent
e83262a725
commit
985951f70e
7 changed files with 226 additions and 54 deletions
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
@ -192,6 +192,7 @@
|
||||||
<ClCompile Include="..\..\..\test\testautomation_sdltest.c" />
|
<ClCompile Include="..\..\..\test\testautomation_sdltest.c" />
|
||||||
<ClCompile Include="..\..\..\test\testautomation_mouse.c" />
|
<ClCompile Include="..\..\..\test\testautomation_mouse.c" />
|
||||||
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
|
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
|
||||||
|
<ClCompile Include="..\..\..\test\testautomation_pixels.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
|
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
@ -196,6 +196,7 @@
|
||||||
<ClCompile Include="..\..\..\test\testautomation_sdltest.c" />
|
<ClCompile Include="..\..\..\test\testautomation_sdltest.c" />
|
||||||
<ClCompile Include="..\..\..\test\testautomation_mouse.c" />
|
<ClCompile Include="..\..\..\test\testautomation_mouse.c" />
|
||||||
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
|
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
|
||||||
|
<ClCompile Include="..\..\..\test\testautomation_pixels.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
|
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
|
||||||
|
|
|
@ -83,7 +83,8 @@ testautomation$(EXE): $(srcdir)/testautomation.c \
|
||||||
$(srcdir)/testautomation_syswm.c \
|
$(srcdir)/testautomation_syswm.c \
|
||||||
$(srcdir)/testautomation_sdltest.c \
|
$(srcdir)/testautomation_sdltest.c \
|
||||||
$(srcdir)/testautomation_mouse.c \
|
$(srcdir)/testautomation_mouse.c \
|
||||||
$(srcdir)/testautomation_timer.c
|
$(srcdir)/testautomation_timer.c \
|
||||||
|
$(srcdir)/testautomation_pixels.c
|
||||||
$(CC) -o $@ $^ $(CFLAGS) -lSDL2_test $(LIBS)
|
$(CC) -o $@ $^ $(CFLAGS) -lSDL2_test $(LIBS)
|
||||||
|
|
||||||
testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
|
testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c
|
||||||
|
|
|
@ -121,7 +121,6 @@ int audio_initOpenCloseQuitAudio()
|
||||||
int i, iMax, j;
|
int i, iMax, j;
|
||||||
const char* audioDriver;
|
const char* audioDriver;
|
||||||
SDL_AudioSpec desired;
|
SDL_AudioSpec desired;
|
||||||
SDL_AudioSpec obtained;
|
|
||||||
|
|
||||||
/* Stop SDL audio subsystem */
|
/* Stop SDL audio subsystem */
|
||||||
SDL_QuitSubSystem( SDL_INIT_AUDIO );
|
SDL_QuitSubSystem( SDL_INIT_AUDIO );
|
||||||
|
@ -347,17 +346,17 @@ int audio_printCurrentAudioDriver()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Definition of all formats, channels, and frequencies used to test audio conversions */
|
/* Definition of all formats, channels, and frequencies used to test audio conversions */
|
||||||
const int _numFormats = 18;
|
const int _numAudioFormats = 18;
|
||||||
SDL_AudioFormat _formats[] = { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S16SYS, AUDIO_S16, AUDIO_U16LSB,
|
SDL_AudioFormat _audioFormats[] = { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S16SYS, AUDIO_S16, AUDIO_U16LSB,
|
||||||
AUDIO_U16MSB, AUDIO_U16SYS, AUDIO_U16, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S32SYS, AUDIO_S32,
|
AUDIO_U16MSB, AUDIO_U16SYS, AUDIO_U16, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S32SYS, AUDIO_S32,
|
||||||
AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_F32SYS, AUDIO_F32 };
|
AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_F32SYS, AUDIO_F32 };
|
||||||
char *_formatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", "AUDIO_U16LSB",
|
char *_audioFormatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", "AUDIO_U16LSB",
|
||||||
"AUDIO_U16MSB", "AUDIO_U16SYS", "AUDIO_U16", "AUDIO_S32LSB", "AUDIO_S32MSB", "AUDIO_S32SYS", "AUDIO_S32",
|
"AUDIO_U16MSB", "AUDIO_U16SYS", "AUDIO_U16", "AUDIO_S32LSB", "AUDIO_S32MSB", "AUDIO_S32SYS", "AUDIO_S32",
|
||||||
"AUDIO_F32LSB", "AUDIO_F32MSB", "AUDIO_F32SYS", "AUDIO_F32" };
|
"AUDIO_F32LSB", "AUDIO_F32MSB", "AUDIO_F32SYS", "AUDIO_F32" };
|
||||||
const int _numChannels = 4;
|
const int _numAudioChannels = 4;
|
||||||
Uint8 _channels[] = { 1, 2, 4, 6 };
|
Uint8 _audioChannels[] = { 1, 2, 4, 6 };
|
||||||
const int _numFrequencies = 4;
|
const int _numAudioFrequencies = 4;
|
||||||
int _frequencies[] = { 11025, 22050, 44100, 48000 };
|
int _audioFrequencies[] = { 11025, 22050, 44100, 48000 };
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -395,22 +394,22 @@ int audio_buildAudioCVT()
|
||||||
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
|
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
|
||||||
|
|
||||||
/* All source conversions with random conversion targets, allow 'null' conversions */
|
/* All source conversions with random conversion targets, allow 'null' conversions */
|
||||||
for (i = 0; i < _numFormats; i++) {
|
for (i = 0; i < _numAudioFormats; i++) {
|
||||||
for (j = 0; j < _numChannels; j++) {
|
for (j = 0; j < _numAudioChannels; j++) {
|
||||||
for (k = 0; k < _numFrequencies; k++) {
|
for (k = 0; k < _numAudioFrequencies; k++) {
|
||||||
spec1.format = _formats[i];
|
spec1.format = _audioFormats[i];
|
||||||
spec1.channels = _channels[j];
|
spec1.channels = _audioChannels[j];
|
||||||
spec1.freq = _frequencies[k];
|
spec1.freq = _audioFrequencies[k];
|
||||||
ii = SDLTest_RandomIntegerInRange(0, _numFormats - 1);
|
ii = SDLTest_RandomIntegerInRange(0, _numAudioFormats - 1);
|
||||||
jj = SDLTest_RandomIntegerInRange(0, _numChannels - 1);
|
jj = SDLTest_RandomIntegerInRange(0, _numAudioChannels - 1);
|
||||||
kk = SDLTest_RandomIntegerInRange(0, _numFrequencies - 1);
|
kk = SDLTest_RandomIntegerInRange(0, _numAudioFrequencies - 1);
|
||||||
spec2.format = _formats[ii];
|
spec2.format = _audioFormats[ii];
|
||||||
spec2.channels = _channels[jj];
|
spec2.channels = _audioChannels[jj];
|
||||||
spec2.freq = _frequencies[kk];
|
spec2.freq = _audioFrequencies[kk];
|
||||||
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
|
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
|
||||||
spec2.format, spec2.channels, spec2.freq);
|
spec2.format, spec2.channels, spec2.freq);
|
||||||
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
|
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
|
||||||
i, _formatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _formatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
|
i, _audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
|
||||||
SDLTest_AssertCheck(result == 0 || result == 1, "Verify result value; expected: 0 or 1, got: %i", result);
|
SDLTest_AssertCheck(result == 0 || result == 1, "Verify result value; expected: 0 or 1, got: %i", result);
|
||||||
if (result<0) {
|
if (result<0) {
|
||||||
SDLTest_LogError(SDL_GetError());
|
SDLTest_LogError(SDL_GetError());
|
||||||
|
@ -691,39 +690,39 @@ int audio_convertAudio()
|
||||||
}
|
}
|
||||||
SDLTest_Log(message);
|
SDLTest_Log(message);
|
||||||
/* All source conversions with random conversion targets */
|
/* All source conversions with random conversion targets */
|
||||||
for (i = 0; i < _numFormats; i++) {
|
for (i = 0; i < _numAudioFormats; i++) {
|
||||||
for (j = 0; j < _numChannels; j++) {
|
for (j = 0; j < _numAudioChannels; j++) {
|
||||||
for (k = 0; k < _numFrequencies; k++) {
|
for (k = 0; k < _numAudioFrequencies; k++) {
|
||||||
spec1.format = _formats[i];
|
spec1.format = _audioFormats[i];
|
||||||
spec1.channels = _channels[j];
|
spec1.channels = _audioChannels[j];
|
||||||
spec1.freq = _frequencies[k];
|
spec1.freq = _audioFrequencies[k];
|
||||||
|
|
||||||
/* Ensure we have a different target format */
|
/* Ensure we have a different target format */
|
||||||
do {
|
do {
|
||||||
if (c & 1) {
|
if (c & 1) {
|
||||||
ii = SDLTest_RandomIntegerInRange(0, _numFormats - 1);
|
ii = SDLTest_RandomIntegerInRange(0, _numAudioFormats - 1);
|
||||||
} else {
|
} else {
|
||||||
ii = 1;
|
ii = 1;
|
||||||
}
|
}
|
||||||
if (c & 2) {
|
if (c & 2) {
|
||||||
jj = SDLTest_RandomIntegerInRange(0, _numChannels - 1);
|
jj = SDLTest_RandomIntegerInRange(0, _numAudioChannels - 1);
|
||||||
} else {
|
} else {
|
||||||
jj= j;
|
jj= j;
|
||||||
}
|
}
|
||||||
if (c & 4) {
|
if (c & 4) {
|
||||||
kk = SDLTest_RandomIntegerInRange(0, _numFrequencies - 1);
|
kk = SDLTest_RandomIntegerInRange(0, _numAudioFrequencies - 1);
|
||||||
} else {
|
} else {
|
||||||
kk = k;
|
kk = k;
|
||||||
}
|
}
|
||||||
} while ((i == ii) && (j == jj) && (k == kk));
|
} while ((i == ii) && (j == jj) && (k == kk));
|
||||||
spec2.format = _formats[ii];
|
spec2.format = _audioFormats[ii];
|
||||||
spec2.channels = _channels[jj];
|
spec2.channels = _audioChannels[jj];
|
||||||
spec2.freq = _frequencies[kk];
|
spec2.freq = _audioFrequencies[kk];
|
||||||
|
|
||||||
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
|
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
|
||||||
spec2.format, spec2.channels, spec2.freq);
|
spec2.format, spec2.channels, spec2.freq);
|
||||||
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
|
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
|
||||||
i, _formatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _formatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
|
i, _audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
|
||||||
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
|
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
SDLTest_LogError(SDL_GetError());
|
SDLTest_LogError(SDL_GetError());
|
||||||
|
|
168
test/testautomation_pixels.c
Normal file
168
test/testautomation_pixels.c
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
/**
|
||||||
|
* Pixels test suite
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "SDL.h"
|
||||||
|
#include "SDL_test.h"
|
||||||
|
|
||||||
|
/* Test case functions */
|
||||||
|
|
||||||
|
/* Definition of all RGB formats used to test pixel conversions */
|
||||||
|
const int _numRGBPixelFormats = 30;
|
||||||
|
Uint32 _RGBPixelFormats[] =
|
||||||
|
{
|
||||||
|
SDL_PIXELFORMAT_INDEX1LSB,
|
||||||
|
SDL_PIXELFORMAT_INDEX1MSB,
|
||||||
|
SDL_PIXELFORMAT_INDEX4LSB,
|
||||||
|
SDL_PIXELFORMAT_INDEX4MSB,
|
||||||
|
SDL_PIXELFORMAT_INDEX8,
|
||||||
|
SDL_PIXELFORMAT_RGB332,
|
||||||
|
SDL_PIXELFORMAT_RGB444,
|
||||||
|
SDL_PIXELFORMAT_RGB555,
|
||||||
|
SDL_PIXELFORMAT_BGR555,
|
||||||
|
SDL_PIXELFORMAT_ARGB4444,
|
||||||
|
SDL_PIXELFORMAT_RGBA4444,
|
||||||
|
SDL_PIXELFORMAT_ABGR4444,
|
||||||
|
SDL_PIXELFORMAT_BGRA4444,
|
||||||
|
SDL_PIXELFORMAT_ARGB1555,
|
||||||
|
SDL_PIXELFORMAT_RGBA5551,
|
||||||
|
SDL_PIXELFORMAT_ABGR1555,
|
||||||
|
SDL_PIXELFORMAT_BGRA5551,
|
||||||
|
SDL_PIXELFORMAT_RGB565,
|
||||||
|
SDL_PIXELFORMAT_BGR565,
|
||||||
|
SDL_PIXELFORMAT_RGB24,
|
||||||
|
SDL_PIXELFORMAT_BGR24,
|
||||||
|
SDL_PIXELFORMAT_RGB888,
|
||||||
|
SDL_PIXELFORMAT_RGBX8888,
|
||||||
|
SDL_PIXELFORMAT_BGR888,
|
||||||
|
SDL_PIXELFORMAT_BGRX8888,
|
||||||
|
SDL_PIXELFORMAT_ARGB8888,
|
||||||
|
SDL_PIXELFORMAT_RGBA8888,
|
||||||
|
SDL_PIXELFORMAT_ABGR8888,
|
||||||
|
SDL_PIXELFORMAT_BGRA8888,
|
||||||
|
SDL_PIXELFORMAT_ARGB2101010
|
||||||
|
};
|
||||||
|
char* _RGBPixelFormatsVerbose[] =
|
||||||
|
{
|
||||||
|
"SDL_PIXELFORMAT_INDEX1LSB",
|
||||||
|
"SDL_PIXELFORMAT_INDEX1MSB",
|
||||||
|
"SDL_PIXELFORMAT_INDEX4LSB",
|
||||||
|
"SDL_PIXELFORMAT_INDEX4MSB",
|
||||||
|
"SDL_PIXELFORMAT_INDEX8",
|
||||||
|
"SDL_PIXELFORMAT_RGB332",
|
||||||
|
"SDL_PIXELFORMAT_RGB444",
|
||||||
|
"SDL_PIXELFORMAT_RGB555",
|
||||||
|
"SDL_PIXELFORMAT_BGR555",
|
||||||
|
"SDL_PIXELFORMAT_ARGB4444",
|
||||||
|
"SDL_PIXELFORMAT_RGBA4444",
|
||||||
|
"SDL_PIXELFORMAT_ABGR4444",
|
||||||
|
"SDL_PIXELFORMAT_BGRA4444",
|
||||||
|
"SDL_PIXELFORMAT_ARGB1555",
|
||||||
|
"SDL_PIXELFORMAT_RGBA5551",
|
||||||
|
"SDL_PIXELFORMAT_ABGR1555",
|
||||||
|
"SDL_PIXELFORMAT_BGRA5551",
|
||||||
|
"SDL_PIXELFORMAT_RGB565",
|
||||||
|
"SDL_PIXELFORMAT_BGR565",
|
||||||
|
"SDL_PIXELFORMAT_RGB24",
|
||||||
|
"SDL_PIXELFORMAT_BGR24",
|
||||||
|
"SDL_PIXELFORMAT_RGB888",
|
||||||
|
"SDL_PIXELFORMAT_RGBX8888",
|
||||||
|
"SDL_PIXELFORMAT_BGR888",
|
||||||
|
"SDL_PIXELFORMAT_BGRX8888",
|
||||||
|
"SDL_PIXELFORMAT_ARGB8888",
|
||||||
|
"SDL_PIXELFORMAT_RGBA8888",
|
||||||
|
"SDL_PIXELFORMAT_ABGR8888",
|
||||||
|
"SDL_PIXELFORMAT_BGRA8888",
|
||||||
|
"SDL_PIXELFORMAT_ARGB2101010"
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Definition of all Non-RGB formats used to test pixel conversions */
|
||||||
|
const int _numNonRGBPixelFormats = 5;
|
||||||
|
Uint32 _nonRGBPixelFormats[] =
|
||||||
|
{
|
||||||
|
SDL_PIXELFORMAT_YV12,
|
||||||
|
SDL_PIXELFORMAT_IYUV,
|
||||||
|
SDL_PIXELFORMAT_YUY2,
|
||||||
|
SDL_PIXELFORMAT_UYVY,
|
||||||
|
SDL_PIXELFORMAT_YVYU
|
||||||
|
};
|
||||||
|
char* _nonRGBPixelFormatsVerbose[] =
|
||||||
|
{
|
||||||
|
"SDL_PIXELFORMAT_YV12",
|
||||||
|
"SDL_PIXELFORMAT_IYUV",
|
||||||
|
"SDL_PIXELFORMAT_YUY2",
|
||||||
|
"SDL_PIXELFORMAT_UYVY",
|
||||||
|
"SDL_PIXELFORMAT_YVYU"
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Test case functions */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Call to SDL_AllocFormat and SDL_FreeFormat
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
pixels_allocFreeFormat(void *arg)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Uint32 format;
|
||||||
|
Uint32 masks;
|
||||||
|
SDL_PixelFormat* result;
|
||||||
|
|
||||||
|
/* RGB formats */
|
||||||
|
for (i = 0; i < _numRGBPixelFormats; i++) {
|
||||||
|
format = _RGBPixelFormats[i];
|
||||||
|
SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format);
|
||||||
|
|
||||||
|
/* Allocate format */
|
||||||
|
result = SDL_AllocFormat(format);
|
||||||
|
SDLTest_AssertPass("Call to SDL_AllocFormat()");
|
||||||
|
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
||||||
|
if (result != NULL) {
|
||||||
|
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format);
|
||||||
|
SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel);
|
||||||
|
SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel);
|
||||||
|
if (result->palette != NULL) {
|
||||||
|
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
|
||||||
|
SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %u", masks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Deallocate again */
|
||||||
|
SDL_FreeFormat(result);
|
||||||
|
SDLTest_AssertPass("Call to SDL_FreeFormat()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Non-RGB formats */
|
||||||
|
for (i = 0; i < _numNonRGBPixelFormats; i++) {
|
||||||
|
format = _nonRGBPixelFormats[i];
|
||||||
|
SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format);
|
||||||
|
|
||||||
|
/* Try to allocate format */
|
||||||
|
result = SDL_AllocFormat(format);
|
||||||
|
SDLTest_AssertPass("Call to SDL_AllocFormat()");
|
||||||
|
SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TEST_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================= Test References ================== */
|
||||||
|
|
||||||
|
/* SysWM test cases */
|
||||||
|
static const SDLTest_TestCaseReference pixelsTest1 =
|
||||||
|
{ (SDLTest_TestCaseFp)pixels_allocFreeFormat, "pixels_allocFreeFormat", "Call to SDL_AllocFormat and SDL_FreeFormat", TEST_ENABLED };
|
||||||
|
|
||||||
|
/* Sequence of Pixels test cases */
|
||||||
|
static const SDLTest_TestCaseReference *pixelsTests[] = {
|
||||||
|
&pixelsTest1, NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Pixels test suite (global) */
|
||||||
|
SDLTest_TestSuiteReference pixelsTestSuite = {
|
||||||
|
"Pixels",
|
||||||
|
NULL,
|
||||||
|
pixelsTests,
|
||||||
|
NULL
|
||||||
|
};
|
|
@ -24,6 +24,7 @@ extern SDLTest_TestSuiteReference sdltestTestSuite;
|
||||||
extern SDLTest_TestSuiteReference videoTestSuite;
|
extern SDLTest_TestSuiteReference videoTestSuite;
|
||||||
extern SDLTest_TestSuiteReference mouseTestSuite;
|
extern SDLTest_TestSuiteReference mouseTestSuite;
|
||||||
extern SDLTest_TestSuiteReference timerTestSuite;
|
extern SDLTest_TestSuiteReference timerTestSuite;
|
||||||
|
extern SDLTest_TestSuiteReference pixelsTestSuite;
|
||||||
|
|
||||||
// All test suites
|
// All test suites
|
||||||
SDLTest_TestSuiteReference *testSuites[] = {
|
SDLTest_TestSuiteReference *testSuites[] = {
|
||||||
|
@ -42,6 +43,7 @@ SDLTest_TestSuiteReference *testSuites[] = {
|
||||||
&videoTestSuite,
|
&videoTestSuite,
|
||||||
&mouseTestSuite,
|
&mouseTestSuite,
|
||||||
&timerTestSuite,
|
&timerTestSuite,
|
||||||
|
&pixelsTestSuite,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1534,7 +1534,7 @@ video_getSetWindowData(void *arg)
|
||||||
returnValue = TEST_ABORTED;
|
returnValue = TEST_ABORTED;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
userdata2 = (char *)strdup(referenceUserdata2);
|
userdata2 = (char *)SDL_strdup(referenceUserdata2);
|
||||||
if (userdata2 == NULL) {
|
if (userdata2 == NULL) {
|
||||||
returnValue = TEST_ABORTED;
|
returnValue = TEST_ABORTED;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -1547,7 +1547,7 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
|
||||||
/* Set data */
|
/* Set data */
|
||||||
result = SDL_SetWindowData(window, name, userdata);
|
result = (char *)SDL_SetWindowData(window, name, userdata);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s)", name, userdata);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s)", name, userdata);
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1563,7 +1563,7 @@ video_getSetWindowData(void *arg)
|
||||||
|
|
||||||
/* Set data again twice */
|
/* Set data again twice */
|
||||||
for (iteration = 1; iteration <= 2; iteration++) {
|
for (iteration = 1; iteration <= 2; iteration++) {
|
||||||
result = SDL_SetWindowData(window, name, userdata);
|
result = (char *)SDL_SetWindowData(window, name, userdata);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [iteration %d]", name, userdata, iteration);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [iteration %d]", name, userdata, iteration);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1577,7 +1577,7 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
|
||||||
/* Set data with new data */
|
/* Set data with new data */
|
||||||
result = SDL_SetWindowData(window, name, userdata2);
|
result = (char *)SDL_SetWindowData(window, name, userdata2);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata]", name, userdata2);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata]", name, userdata2);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1585,7 +1585,7 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
||||||
|
|
||||||
/* Set data with new data again */
|
/* Set data with new data again */
|
||||||
result = SDL_SetWindowData(window, name, userdata2);
|
result = (char *)SDL_SetWindowData(window, name, userdata2);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata again]", name, userdata2);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata again]", name, userdata2);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1599,7 +1599,7 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
|
||||||
/* Set data with NULL to clear */
|
/* Set data with NULL to clear */
|
||||||
result = SDL_SetWindowData(window, name, NULL);
|
result = (char *)SDL_SetWindowData(window, name, NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL)", name, userdata);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL)", name, userdata);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1607,7 +1607,7 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
||||||
|
|
||||||
/* Set data with NULL to clear again */
|
/* Set data with NULL to clear again */
|
||||||
result = SDL_SetWindowData(window, name, NULL);
|
result = (char *)SDL_SetWindowData(window, name, NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL) [again]", name, userdata);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL) [again]", name, userdata);
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1627,7 +1627,7 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName2, name2) == 0, "Validate that name2 was not changed, expected: %s, got: %s", referenceName2, name2);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName2, name2) == 0, "Validate that name2 was not changed, expected: %s, got: %s", referenceName2, name2);
|
||||||
|
|
||||||
/* Set data (again) */
|
/* Set data (again) */
|
||||||
result = SDL_SetWindowData(window, name, userdata);
|
result = (char *)SDL_SetWindowData(window, name, userdata);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [again, after clear]", name, userdata);
|
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [again, after clear]", name, userdata);
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||||
|
@ -1644,49 +1644,49 @@ video_getSetWindowData(void *arg)
|
||||||
SDLTest_AssertPass("Call to SDL_ClearError()");
|
SDLTest_AssertPass("Call to SDL_ClearError()");
|
||||||
|
|
||||||
/* Set with invalid window */
|
/* Set with invalid window */
|
||||||
result = SDL_SetWindowData(NULL, name, userdata);
|
result = (char *)SDL_SetWindowData(NULL, name, userdata);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(window=NULL)");
|
SDLTest_AssertPass("Call to SDL_SetWindowData(window=NULL)");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidWindowError();
|
_checkInvalidWindowError();
|
||||||
|
|
||||||
/* Set data with NULL name, valid userdata */
|
/* Set data with NULL name, valid userdata */
|
||||||
result = SDL_SetWindowData(window, NULL, userdata);
|
result = (char *)SDL_SetWindowData(window, NULL, userdata);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL)");
|
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL)");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidParameterError();
|
_checkInvalidParameterError();
|
||||||
|
|
||||||
/* Set data with empty name, valid userdata */
|
/* Set data with empty name, valid userdata */
|
||||||
result = SDL_SetWindowData(window, "", userdata);
|
result = (char *)SDL_SetWindowData(window, "", userdata);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name='')");
|
SDLTest_AssertPass("Call to SDL_SetWindowData(name='')");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidParameterError();
|
_checkInvalidParameterError();
|
||||||
|
|
||||||
/* Set data with NULL name, NULL userdata */
|
/* Set data with NULL name, NULL userdata */
|
||||||
result = SDL_SetWindowData(window, NULL, NULL);
|
result = (char *)SDL_SetWindowData(window, NULL, NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL,userdata=NULL)");
|
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL,userdata=NULL)");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidParameterError();
|
_checkInvalidParameterError();
|
||||||
|
|
||||||
/* Set data with empty name, NULL userdata */
|
/* Set data with empty name, NULL userdata */
|
||||||
result = SDL_SetWindowData(window, "", NULL);
|
result = (char *)SDL_SetWindowData(window, "", NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name='',userdata=NULL)");
|
SDLTest_AssertPass("Call to SDL_SetWindowData(name='',userdata=NULL)");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidParameterError();
|
_checkInvalidParameterError();
|
||||||
|
|
||||||
/* Get with invalid window */
|
/* Get with invalid window */
|
||||||
result = SDL_GetWindowData(NULL, name);
|
result = (char *)SDL_GetWindowData(NULL, name);
|
||||||
SDLTest_AssertPass("Call to SDL_GetWindowData(window=NULL)");
|
SDLTest_AssertPass("Call to SDL_GetWindowData(window=NULL)");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidWindowError();
|
_checkInvalidWindowError();
|
||||||
|
|
||||||
/* Get data with NULL name */
|
/* Get data with NULL name */
|
||||||
result = SDL_GetWindowData(window, NULL);
|
result = (char *)SDL_GetWindowData(window, NULL);
|
||||||
SDLTest_AssertPass("Call to SDL_GetWindowData(name=NULL)");
|
SDLTest_AssertPass("Call to SDL_GetWindowData(name=NULL)");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidParameterError();
|
_checkInvalidParameterError();
|
||||||
|
|
||||||
/* Get data with empty name */
|
/* Get data with empty name */
|
||||||
result = SDL_GetWindowData(window, "");
|
result = (char *)SDL_GetWindowData(window, "");
|
||||||
SDLTest_AssertPass("Call to SDL_GetWindowData(name='')");
|
SDLTest_AssertPass("Call to SDL_GetWindowData(name='')");
|
||||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||||
_checkInvalidParameterError();
|
_checkInvalidParameterError();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue