2015-06-21 09:33:46 -06:00
|
|
|
/*
|
|
|
|
Simple DirectMedia Layer
|
2024-01-01 14:15:26 -07:00
|
|
|
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
2015-06-21 09:33:46 -06:00
|
|
|
|
|
|
|
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, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file SDL_test_compare.h
|
|
|
|
*
|
2023-11-06 08:26:06 -07:00
|
|
|
* Comparison function of SDL test framework.
|
2015-06-21 09:33:46 -06:00
|
|
|
*
|
2022-11-21 21:28:58 -07:00
|
|
|
* This code is a part of the SDL test library, not the main SDL library.
|
2015-06-21 09:33:46 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Defines comparison functions (i.e. for surfaces).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-11-20 22:34:54 -07:00
|
|
|
#ifndef SDL_test_compare_h_
|
|
|
|
#define SDL_test_compare_h_
|
2015-06-21 09:33:46 -06:00
|
|
|
|
2022-11-26 21:43:38 -07:00
|
|
|
#include <SDL3/SDL.h>
|
2015-06-21 09:33:46 -06:00
|
|
|
|
2022-12-22 09:38:59 -07:00
|
|
|
#include <SDL3/SDL_begin_code.h>
|
2015-06-21 09:33:46 -06:00
|
|
|
/* Set up for C function definitions, even when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2023-11-06 08:26:06 -07:00
|
|
|
* Compares a surface and with reference image data for equality
|
2015-06-21 09:33:46 -06:00
|
|
|
*
|
|
|
|
* \param surface Surface used in comparison
|
|
|
|
* \param referenceSurface Test Surface used in comparison
|
|
|
|
* \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
|
|
|
|
*
|
|
|
|
* \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
|
|
|
|
*/
|
|
|
|
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);
|
|
|
|
|
2024-02-02 20:45:48 -07:00
|
|
|
/**
|
|
|
|
* Compares 2 memory blocks for equality
|
|
|
|
*
|
|
|
|
* \param actual Memory used in comparison, displayed on the left
|
|
|
|
* \param size_actual Size of actual in bytes
|
|
|
|
* \param reference Reference memory, displayed on the right
|
|
|
|
* \param size_reference Size of reference in bytes
|
|
|
|
*
|
|
|
|
* \returns 0 if the left and right memory block are equal, non-zero if they are non-equal.
|
|
|
|
*
|
|
|
|
* \since This function is available since SDL 3.0.0.
|
|
|
|
*/
|
|
|
|
extern int SDLTest_CompareMemory(const void *actual, size_t size_actual, const void *reference, size_t size_reference);
|
2015-06-21 09:33:46 -06:00
|
|
|
|
|
|
|
/* Ends C function definitions when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2022-12-22 09:38:59 -07:00
|
|
|
#include <SDL3/SDL_close_code.h>
|
2015-06-21 09:33:46 -06:00
|
|
|
|
2016-11-20 22:34:54 -07:00
|
|
|
#endif /* SDL_test_compare_h_ */
|