test/testautomation_render.c
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 9254 6c469ea796e4
permissions -rw-r--r--
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     1
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     2
 * Original code: automated SDL platform test written by Edgar Simo "bobbens"
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     3
 * Extended and extensively updated by aschiffler at ferzkopp dot net
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     4
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     5
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     6
#include <stdio.h>
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     7
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     8
#include "SDL.h"
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     9
#include "SDL_test.h"
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    10
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    11
/* ================= Test Case Implementation ================== */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    12
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    13
#define TESTRENDER_SCREEN_W     80
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    14
#define TESTRENDER_SCREEN_H     60
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    15
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    16
#define RENDER_COMPARE_FORMAT  SDL_PIXELFORMAT_ARGB8888
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    17
#define RENDER_COMPARE_AMASK   0xff000000 /**< Alpha bit mask. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    18
#define RENDER_COMPARE_RMASK   0x00ff0000 /**< Red bit mask. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    19
#define RENDER_COMPARE_GMASK   0x0000ff00 /**< Green bit mask. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    20
#define RENDER_COMPARE_BMASK   0x000000ff /**< Blue bit mask. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    21
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    22
#define ALLOWABLE_ERROR_OPAQUE  0
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    23
#define ALLOWABLE_ERROR_BLENDED 64
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    24
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
    25
/* Test window and renderer */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    26
SDL_Window *window = NULL;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    27
SDL_Renderer *renderer = NULL;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    28
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    29
/* Prototypes for helper functions */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    30
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    31
static int _clearScreen (void);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
    32
static void _compare(SDL_Surface *reference, int allowable_error);
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    33
static int _hasTexAlpha(void);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    34
static int _hasTexColor(void);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    35
static SDL_Texture *_loadTestFace(void);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    36
static int _hasBlendModes(void);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    37
static int _hasDrawColor(void);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    38
static int _isSupported(int code);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    39
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    40
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    41
 * Create software renderer for tests
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    42
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    43
void InitCreateRenderer(void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    44
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    45
  int posX = 100, posY = 100, width = 320, height = 240;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    46
  renderer = NULL;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    47
  window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    48
  SDLTest_AssertPass("SDL_CreateWindow()");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    49
  SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    50
  if (window == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    51
      return;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    52
  }
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    53
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    54
  renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    55
  SDLTest_AssertPass("SDL_CreateRenderer()");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    56
  SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
    57
  if (renderer == NULL) {
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    58
      SDL_DestroyWindow(window);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    59
      return;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    60
  }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    61
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    62
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    63
/*
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    64
 * Destroy renderer for tests
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    65
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    66
void CleanupDestroyRenderer(void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    67
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    68
  if (renderer != NULL) {
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    69
     SDL_DestroyRenderer(renderer);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
    70
     renderer = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    71
     SDLTest_AssertPass("SDL_DestroyRenderer()");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    72
  }
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    73
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
    74
  if (window != NULL) {
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    75
     SDL_DestroyWindow(window);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
    76
     window = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    77
     SDLTest_AssertPass("SDL_DestroyWindow");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
  }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    81
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    82
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
 * @brief Tests call to SDL_GetNumRenderDrivers
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    84
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    86
 * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    88
int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    89
render_testGetNumRenderDrivers(void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    90
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    91
  int n;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    92
  n = SDL_GetNumRenderDrivers();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    93
  SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    94
  return TEST_COMPLETED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    95
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    96
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    97
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    99
 * @brief Tests the SDL primitives for rendering.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   100
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   101
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   102
 * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   103
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   104
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   105
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   106
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   107
int render_testPrimitives (void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   108
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   109
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   110
   int x, y;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   111
   SDL_Rect rect;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   112
   SDL_Surface *referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   113
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   114
   int checkFailCount2;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   115
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   116
   /* Clear surface. */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   117
   _clearScreen();
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   118
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   119
   /* Need drawcolor or just skip test. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   120
   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   121
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   122
   /* Draw a rectangle. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   123
   rect.x = 40;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   124
   rect.y = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   125
   rect.w = 40;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   126
   rect.h = 80;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   127
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   128
   ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   129
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   130
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   131
   ret = SDL_RenderFillRect(renderer, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   132
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   133
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   134
   /* Draw a rectangle. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   135
   rect.x = 10;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   136
   rect.y = 10;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   137
   rect.w = 60;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   138
   rect.h = 40;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   139
   ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   140
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   141
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   142
   ret = SDL_RenderFillRect(renderer, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   143
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   144
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   145
   /* Draw some points like so:
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   146
    * X.X.X.X..
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   147
    * .X.X.X.X.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   148
    * X.X.X.X.. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   149
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   150
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   151
   for (y=0; y<3; y++) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   152
      for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   153
         ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   154
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   155
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   156
         ret = SDL_RenderDrawPoint(renderer, x, y );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   157
         if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   158
      }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   159
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   160
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   161
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   162
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   163
   /* Draw some lines. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   164
   ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   165
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   166
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   167
   ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   168
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   169
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   170
   ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   171
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   172
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   173
   ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   174
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   175
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   176
   ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   177
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   178
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   179
   ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   180
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   181
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   182
   ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   183
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   184
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   185
   ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   186
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   187
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   188
   ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   189
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   190
   
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   191
   /* Make current */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   192
   SDL_RenderPresent(renderer);
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   193
   
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   194
   /* See if it's the same. */
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   195
   referenceSurface = SDLTest_ImagePrimitives();
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   196
   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   197
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   198
   /* Clean up. */
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   199
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   200
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   201
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   202
   return TEST_COMPLETED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   203
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   204
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   205
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   206
 * @brief Tests the SDL primitives with alpha for rendering.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   207
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   208
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   209
 * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   210
 * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   211
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   212
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   213
int render_testPrimitivesBlend (void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   214
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   215
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   216
   int i, j;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   217
   SDL_Rect rect;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   218
   SDL_Surface *referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   219
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   220
   int checkFailCount2;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   221
   int checkFailCount3;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   222
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   223
   /* Clear surface. */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   224
   _clearScreen();
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   225
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   226
   /* Need drawcolor and blendmode or just skip test. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   227
   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   228
   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   229
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   230
   /* Create some rectangles for each blend mode. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   231
   ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   232
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   233
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   234
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   235
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   236
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   237
   ret = SDL_RenderFillRect(renderer, NULL );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   238
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   239
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   240
   rect.x = 10;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   241
   rect.y = 25;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   242
   rect.w = 40;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   243
   rect.h = 25;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   244
   ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   245
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   246
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   247
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   248
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   249
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   250
   ret = SDL_RenderFillRect(renderer, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   251
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   252
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   253
   rect.x = 30;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   254
   rect.y = 40;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   255
   rect.w = 45;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   256
   rect.h = 15;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   257
   ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   258
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   259
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   260
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   261
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   262
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   263
   ret = SDL_RenderFillRect(renderer, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   264
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   265
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   266
   rect.x = 25;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   267
   rect.y = 25;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   268
   rect.w = 25;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   269
   rect.h = 25;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   270
   ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   271
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   272
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   273
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   274
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   275
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   276
   ret = SDL_RenderFillRect(renderer, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   277
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   278
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   279
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   280
   /* Draw blended lines, lines for everyone. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   281
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   282
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   283
   checkFailCount3 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   284
   for (i=0; i<TESTRENDER_SCREEN_W; i+=2)  {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   285
      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   286
      if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   287
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   288
      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   289
            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   290
      if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   291
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   292
      ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   293
      if (ret != 0) checkFailCount3++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   294
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   295
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   296
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   297
   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   298
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   299
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   300
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   301
   checkFailCount3 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   302
   for (i=0; i<TESTRENDER_SCREEN_H; i+=2)  {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   303
      ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   304
      if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   305
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   306
      ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   307
            (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   308
      if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   309
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   310
      ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   311
      if (ret != 0) checkFailCount3++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   312
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   313
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   314
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   315
   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   316
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   317
   /* Draw points. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   318
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   319
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   320
   checkFailCount3 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   321
   for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   322
      for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   323
         ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   324
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   325
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   326
         ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   327
               ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   328
         if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   329
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   330
         ret = SDL_RenderDrawPoint(renderer, i, j );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   331
         if (ret != 0) checkFailCount3++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   332
      }
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   333
   }
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   334
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   335
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   336
   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   337
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   338
   /* Make current */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   339
   SDL_RenderPresent(renderer);
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   340
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   341
   /* See if it's the same. */
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   342
   referenceSurface = SDLTest_ImagePrimitivesBlend();
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   343
   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   345
   /* Clean up. */
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   346
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   347
   referenceSurface = NULL;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   348
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   349
   return TEST_COMPLETED;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   350
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   351
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   352
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   353
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   354
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   355
 * @brief Tests some blitting routines.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   356
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   357
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   358
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   359
 * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   360
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   361
int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   362
render_testBlit(void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   363
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   364
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   365
   SDL_Rect rect;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   366
   SDL_Texture *tface;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   367
   SDL_Surface *referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   368
   Uint32 tformat;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   369
   int taccess, tw, th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   370
   int i, j, ni, nj;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   371
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   372
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   373
   /* Clear surface. */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   374
   _clearScreen();
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   375
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   376
   /* Need drawcolor or just skip test. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   377
   SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   378
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   379
   /* Create face surface. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   380
   tface = _loadTestFace();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   381
   SDLTest_AssertCheck(tface != NULL,  "Verify _loadTestFace() result");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   382
   if (tface == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   383
       return TEST_ABORTED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   384
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   385
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   386
   /* Constant values. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   387
   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   388
   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   389
   rect.w = tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   390
   rect.h = th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   391
   ni     = TESTRENDER_SCREEN_W - tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   392
   nj     = TESTRENDER_SCREEN_H - th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   393
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   394
   /* Loop blit. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   395
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   396
   for (j=0; j <= nj; j+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   397
      for (i=0; i <= ni; i+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   398
         /* Blitting. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   399
         rect.x = i;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   400
         rect.y = j;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   401
         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   402
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   403
      }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   404
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   405
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   406
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   407
   /* Make current */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   408
   SDL_RenderPresent(renderer);
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   409
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   410
   /* See if it's the same */
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   411
   referenceSurface = SDLTest_ImageBlit();
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   412
   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   413
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   414
   /* Clean up. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   415
   SDL_DestroyTexture( tface );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   416
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   417
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   418
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   419
   return TEST_COMPLETED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   420
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   421
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   422
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   423
/**
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   424
 * @brief Blits doing color tests.
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   425
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   426
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   427
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   428
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   429
 * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   430
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   431
int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   432
render_testBlitColor (void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   433
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   434
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   435
   SDL_Rect rect;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   436
   SDL_Texture *tface;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   437
   SDL_Surface *referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   438
   Uint32 tformat;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   439
   int taccess, tw, th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   440
   int i, j, ni, nj;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   441
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   442
   int checkFailCount2;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   443
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   444
   /* Clear surface. */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   445
   _clearScreen();
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   446
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   447
   /* Create face surface. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   448
   tface = _loadTestFace();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   449
   SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   450
   if (tface == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   451
       return TEST_ABORTED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   452
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   453
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   454
   /* Constant values. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   455
   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   456
   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   457
   rect.w = tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   458
   rect.h = th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   459
   ni     = TESTRENDER_SCREEN_W - tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   460
   nj     = TESTRENDER_SCREEN_H - th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   461
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   462
   /* Test blitting with color mod. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   463
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   464
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   465
   for (j=0; j <= nj; j+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   466
      for (i=0; i <= ni; i+=4) {
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   467
         /* Set color mod. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   468
         ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   469
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   470
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   471
         /* Blitting. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   472
         rect.x = i;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   473
         rect.y = j;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   474
         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   475
         if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   476
      }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   477
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   478
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   479
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   480
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   481
   /* Make current */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   482
   SDL_RenderPresent(renderer);
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   483
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   484
   /* See if it's the same. */
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   485
   referenceSurface = SDLTest_ImageBlitColor();
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   486
   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   487
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   488
   /* Clean up. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   489
   SDL_DestroyTexture( tface );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   490
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   491
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   492
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   493
   return TEST_COMPLETED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   494
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   495
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   496
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   497
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   498
 * @brief Tests blitting with alpha.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   499
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   500
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   501
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   502
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   503
 * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   504
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   505
int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   506
render_testBlitAlpha (void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   507
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   508
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   509
   SDL_Rect rect;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   510
   SDL_Texture *tface;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   511
   SDL_Surface *referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   512
   Uint32 tformat;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   513
   int taccess, tw, th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   514
   int i, j, ni, nj;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   515
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   516
   int checkFailCount2;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   517
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   518
   /* Clear surface. */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   519
   _clearScreen();
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   520
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   521
   /* Need alpha or just skip test. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   522
   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   523
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
   /* Create face surface. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   525
   tface = _loadTestFace();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   526
   SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
   if (tface == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   528
       return TEST_ABORTED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   529
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   530
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   531
   /* Constant values. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   532
   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   533
   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   534
   rect.w = tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   535
   rect.h = th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   536
   ni     = TESTRENDER_SCREEN_W - tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   537
   nj     = TESTRENDER_SCREEN_H - th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   538
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   539
   /* Test blitting with alpha mod. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   540
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   541
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   542
   for (j=0; j <= nj; j+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   543
      for (i=0; i <= ni; i+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   544
         /* Set alpha mod. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   545
         ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   546
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   547
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   548
         /* Blitting. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   549
         rect.x = i;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   550
         rect.y = j;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   551
         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   552
         if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   553
      }
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   554
   }
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   555
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   557
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   558
   /* Make current */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   559
   SDL_RenderPresent(renderer);
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   560
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   561
   /* See if it's the same. */
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   562
   referenceSurface = SDLTest_ImageBlitAlpha();
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   563
   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   564
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   565
   /* Clean up. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   566
   SDL_DestroyTexture( tface );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   567
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   568
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   569
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   570
   return TEST_COMPLETED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   571
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   572
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   573
/* Helper functions */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   574
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   575
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   576
 * @brief Tests a blend mode.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   577
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   578
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   579
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   580
 * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   581
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   582
static void
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   583
_testBlitBlendMode( SDL_Texture * tface, int mode )
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   584
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   585
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   586
   Uint32 tformat;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   587
   int taccess, tw, th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   588
   int i, j, ni, nj;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   589
   SDL_Rect rect;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   590
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   591
   int checkFailCount2;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   592
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   593
   /* Clear surface. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   594
   _clearScreen();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   595
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   596
   /* Constant values. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   597
   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   598
   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   599
   rect.w = tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   600
   rect.h = th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   601
   ni     = TESTRENDER_SCREEN_W - tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   602
   nj     = TESTRENDER_SCREEN_H - th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   603
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   604
   /* Test blend mode. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   605
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   606
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   607
   for (j=0; j <= nj; j+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   608
      for (i=0; i <= ni; i+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   609
         /* Set blend mode. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   610
         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   611
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   612
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   613
         /* Blitting. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   614
         rect.x = i;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   615
         rect.y = j;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   616
         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   617
         if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   618
      }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   619
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   620
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   621
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   622
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   623
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   624
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   625
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   626
 * @brief Tests some more blitting routines.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   627
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   628
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   629
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   630
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   631
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   632
 * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   633
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   634
int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   635
render_testBlitBlend (void *arg)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   636
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   637
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   638
   SDL_Rect rect;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   639
   SDL_Texture *tface;
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   640
   SDL_Surface *referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   641
   Uint32 tformat;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   642
   int taccess, tw, th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   643
   int i, j, ni, nj;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   644
   int mode;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   645
   int checkFailCount1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   646
   int checkFailCount2;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   647
   int checkFailCount3;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   648
   int checkFailCount4;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   649
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   650
   SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   651
   SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   652
   SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   653
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   654
   /* Create face surface. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   655
   tface = _loadTestFace();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   656
   SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   657
   if (tface == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   658
       return TEST_ABORTED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   659
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   660
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   661
   /* Constant values. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   662
   ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   663
   SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   664
   rect.w = tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   665
   rect.h = th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   666
   ni = TESTRENDER_SCREEN_W - tw;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   667
   nj = TESTRENDER_SCREEN_H - th;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   668
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   669
   /* Set alpha mod. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   670
   ret = SDL_SetTextureAlphaMod( tface, 100 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   671
   SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   672
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   673
   /* Test None. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   674
   _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   675
   referenceSurface = SDLTest_ImageBlitBlendNone();
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   676
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   677
   /* Make current and compare */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   678
   SDL_RenderPresent(renderer);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   679
   _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   680
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   681
   referenceSurface = NULL;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   682
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   683
   /* Test Blend. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   684
   _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   685
   referenceSurface = SDLTest_ImageBlitBlend();
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   686
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   687
   /* Make current and compare */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   688
   SDL_RenderPresent(renderer);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   689
   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   690
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   691
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   692
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   693
   /* Test Add. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   694
   _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   695
   referenceSurface = SDLTest_ImageBlitBlendAdd();
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   696
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   697
   /* Make current and compare */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   698
   SDL_RenderPresent(renderer);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   699
   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   700
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   701
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   702
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   703
   /* Test Mod. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   704
   _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   705
   referenceSurface = SDLTest_ImageBlitBlendMod();
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   706
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   707
   /* Make current and compare */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   708
   SDL_RenderPresent(renderer);
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   709
   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   710
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   711
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   712
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   713
   /* Clear surface. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   714
   _clearScreen();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   715
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   716
   /* Loop blit. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   717
   checkFailCount1 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   718
   checkFailCount2 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   719
   checkFailCount3 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   720
   checkFailCount4 = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   721
   for (j=0; j <= nj; j+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   722
      for (i=0; i <= ni; i+=4) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   723
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   724
         /* Set color mod. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   725
         ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   726
         if (ret != 0) checkFailCount1++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   727
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   728
         /* Set alpha mod. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   729
         ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   730
         if (ret != 0) checkFailCount2++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   731
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   732
         /* Crazy blending mode magic. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   733
         mode = (i/4*j/4) % 4;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   734
         if (mode==0) mode = SDL_BLENDMODE_NONE;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   735
         else if (mode==1) mode = SDL_BLENDMODE_BLEND;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   736
         else if (mode==2) mode = SDL_BLENDMODE_ADD;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   737
         else if (mode==3) mode = SDL_BLENDMODE_MOD;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   738
         ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   739
         if (ret != 0) checkFailCount3++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   740
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   741
         /* Blitting. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   742
         rect.x = i;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   743
         rect.y = j;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   744
         ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   745
         if (ret != 0) checkFailCount4++;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   746
      }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   747
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   748
   SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   749
   SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   750
   SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   751
   SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   752
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   753
   /* Clean up. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   754
   SDL_DestroyTexture( tface );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   755
9254
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   756
   /* Make current */
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   757
   SDL_RenderPresent(renderer);
6c469ea796e4 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7720
diff changeset
   758
6773
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   759
   /* Check to see if final image matches. */
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   760
   referenceSurface = SDLTest_ImageBlitBlendAll();
5ebc5a9e35b4 Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6772
diff changeset
   761
   _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
7720
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   762
   SDL_FreeSurface(referenceSurface);
f9a649383362 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x)
Sam Lantinga <slouken@libsdl.org>
parents: 7719
diff changeset
   763
   referenceSurface = NULL;
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   764
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   765
   return TEST_COMPLETED;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   766
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   767
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   768
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   769
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   770
 * @brief Checks to see if functionality is supported. Helper function.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   771
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   772
static int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   773
_isSupported( int code )
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   774
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   775
   return (code == 0);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   776
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   777
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   778
/**
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   779
 * @brief Test to see if we can vary the draw color. Helper function.
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   780
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   781
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   782
 * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   783
 * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   784
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   785
static int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   786
_hasDrawColor (void)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   787
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   788
   int ret, fail;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   789
   Uint8 r, g, b, a;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   790
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   791
   fail = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   792
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   793
   /* Set color. */
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   794
   ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   795
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   796
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   797
   ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   798
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   799
      fail = 1;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   800
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   801
   /* Restore natural. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   802
   ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   803
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   804
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   805
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   806
   /* Something failed, consider not available. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   807
   if (fail)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   808
      return 0;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   809
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   810
   /* Not set properly, consider failed. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   811
   else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   812
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   813
   return 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   814
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   815
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   816
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   817
 * @brief Test to see if we can vary the blend mode. Helper function.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   818
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   819
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   820
 * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   821
 * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   822
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   823
static int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   824
_hasBlendModes (void)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   825
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   826
   int fail;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   827
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   828
   SDL_BlendMode mode;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   829
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   830
   fail = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   831
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   832
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   833
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   834
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   835
   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   836
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   837
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   838
   ret = (mode != SDL_BLENDMODE_BLEND);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   839
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   840
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   841
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   842
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   843
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   844
   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   845
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   846
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   847
   ret = (mode != SDL_BLENDMODE_ADD);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   848
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   849
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   850
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   851
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   852
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   853
   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   854
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   855
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   856
   ret = (mode != SDL_BLENDMODE_MOD);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   857
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   858
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   859
   ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   860
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   861
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   862
   ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   863
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   864
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   865
   ret = (mode != SDL_BLENDMODE_NONE);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   866
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   867
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   868
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   869
   return !fail;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   870
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   871
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   872
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   873
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   874
 * @brief Loads the test image 'Face' as texture. Helper function.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   875
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   876
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   877
 * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   878
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   879
static SDL_Texture *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   880
_loadTestFace(void)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   881
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   882
   SDL_Surface *face;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   883
   SDL_Texture *tface;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   884
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   885
   face = SDLTest_ImageFace();
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   886
   if (face == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   887
      return NULL;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   888
   }
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7176
diff changeset
   889
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   890
   tface = SDL_CreateTextureFromSurface(renderer, face);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   891
   if (tface == NULL) {
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   892
       SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   893
   }
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   894
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   895
   SDL_FreeSurface(face);
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   896
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   897
   return tface;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   898
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   899
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   900
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   901
/**
7176
66cf9f85494e Changed spelling for consistency.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7172
diff changeset
   902
 * @brief Test to see if can set texture color mode. Helper function.
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   903
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   904
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   905
 * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   906
 * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   907
 * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   908
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   909
static int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   910
_hasTexColor (void)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   911
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   912
   int fail;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   913
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   914
   SDL_Texture *tface;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   915
   Uint8 r, g, b;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   916
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   917
   /* Get test face. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   918
   tface = _loadTestFace();
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   919
   if (tface == NULL)
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   920
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   921
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   922
   /* See if supported. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   923
   fail = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   924
   ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   925
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   926
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   927
   ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   928
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   929
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   930
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   931
   /* Clean up. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   932
   SDL_DestroyTexture( tface );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   933
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   934
   if (fail)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   935
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   936
   else if ((r != 100) || (g != 100) || (b != 100))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   937
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   938
   return 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   939
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   940
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   941
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   942
 * @brief Test to see if we can vary the alpha of the texture. Helper function.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   943
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   944
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   945
 *  http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   946
 *  http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   947
 *  http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   948
 */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   949
static int
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   950
_hasTexAlpha(void)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   951
{
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   952
   int fail;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   953
   int ret;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   954
   SDL_Texture *tface;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   955
   Uint8 a;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   956
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   957
   /* Get test face. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   958
   tface = _loadTestFace();
6772
5229a117ef97 Added audio test suite; minor code cleanups in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6769
diff changeset
   959
   if (tface == NULL)
6763
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   960
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   961
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   962
   /* See if supported. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   963
   fail = 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   964
   ret = SDL_SetTextureAlphaMod( tface, 100 );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   965
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   966
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   967
   ret = SDL_GetTextureAlphaMod( tface, &a );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   968
   if (!_isSupported(ret))
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   969
      fail = 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   970
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   971
   /* Clean up. */
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   972
   SDL_DestroyTexture( tface );
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   973
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   974
   if (fail)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   975
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   976
   else if (a != 100)
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   977
      return 0;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   978
   return 1;
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   979
}
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   980
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   981
/**
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   982
 * @brief Compares screen pixels with image pixels. Helper function.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   983
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   984
 * @param s Image to compare against.
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   985
 *
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   986
 * \sa
9cbd31a3450b Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset