test/testautomation_video.c
author Andreas Schiffler <aschiffler@ferzkopp.net>
Mon, 25 Feb 2013 08:05:26 -0800
changeset 6921 9a29af9de577
parent 6891 177f29ae5279
child 6936 76d9c31e823d
permissions -rw-r--r--
Add tests to video suite
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     1
/**
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     2
 * Video test suite
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     3
 */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     4
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     5
#include <stdio.h>
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     6
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     7
#include "SDL.h"
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     8
#include "SDL_test.h"
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     9
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    10
/* Private helpers */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    11
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    12
/* 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    13
 * Create a test window
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    14
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    15
SDL_Window *_createVideoSuiteTestWindow(const char *title)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    16
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    17
  SDL_Window* window;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    18
  int x, y, w, h;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    19
  SDL_WindowFlags flags;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    20
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    21
  /* Standard window */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    22
  x = SDLTest_RandomIntegerInRange(1, 100);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    23
  y = SDLTest_RandomIntegerInRange(1, 100);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    24
  w = SDLTest_RandomIntegerInRange(320, 1024);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    25
  h = SDLTest_RandomIntegerInRange(320, 768);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    26
  flags = SDL_WINDOW_SHOWN;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    27
  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    28
  window = SDL_CreateWindow(title, x, y, w, h, flags);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    29
  SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    30
  SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    31
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    32
  return window;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    33
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    34
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    35
/*
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    36
 * Destroy test window  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    37
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    38
void _destroyVideoSuiteTestWindow(SDL_Window *window)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    39
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    40
  if (window != NULL) {  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    41
     SDL_DestroyWindow(window);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    42
     window = NULL;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    43
     SDLTest_AssertPass("Call to SDL_DestroyWindow");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    44
  }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    45
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
    46
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    47
/* Test case functions */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    48
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    49
/**
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    50
 * @brief Enable and disable screensaver while checking state
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    51
 */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    52
int
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    53
video_enableDisableScreensaver(void *arg)
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    54
{
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    55
	SDL_bool initialResult;
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    56
	SDL_bool result;
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    57
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    58
	/* Get current state and proceed according to current state */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    59
	initialResult = SDL_IsScreenSaverEnabled();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    60
	SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    61
	if (initialResult == SDL_TRUE) {
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    62
	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    63
	  /* Currently enabled: disable first, then enable again */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    64
	  
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    65
	  /* Disable screensaver and check */	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    66
	  SDL_DisableScreenSaver();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    67
	  SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    68
	  result = SDL_IsScreenSaverEnabled();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    69
	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    70
	  SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    71
	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    72
	  /* Enable screensaver and check */	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    73
	  SDL_EnableScreenSaver();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    74
	  SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    75
	  result = SDL_IsScreenSaverEnabled();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    76
	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    77
	  SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
	} else {
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    81
	  /* Currently disabled: enable first, then disable again */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    82
	  
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
	  /* Enable screensaver and check */	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    84
	  SDL_EnableScreenSaver();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
	  SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    86
	  result = SDL_IsScreenSaverEnabled();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    88
	  SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    89
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    90
	  /* Disable screensaver and check */	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    91
	  SDL_DisableScreenSaver();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    92
	  SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    93
	  result = SDL_IsScreenSaverEnabled();
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    94
	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    95
	  SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    96
	}	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    97
	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
	return TEST_COMPLETED;
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    99
}
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   100
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   101
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   102
 * @brief Tests the functionality of the SDL_CreateWindow function using different positions
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   103
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   104
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   105
video_createWindowVariousPositions(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   106
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   107
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   108
  const char* title = "video_createWindowVariousPositions Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   109
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   110
  int xVariation, yVariation;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   111
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   112
  for (xVariation = 0; xVariation < 6; xVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   113
   for (yVariation = 0; yVariation < 6; yVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   114
    switch(xVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   115
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   116
      /* Zero X Position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   117
      x = 0;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   118
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   119
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   120
      /* Random X position inside screen */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   121
      x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   122
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   123
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   124
      /* Random X position outside screen (positive) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   125
      x = SDLTest_RandomIntegerInRange(10000, 11000);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   126
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   127
     case 3:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   128
      /* Random X position outside screen (negative) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   129
      x = SDLTest_RandomIntegerInRange(-1000, -100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   130
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   131
     case 4:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   132
      /* Centered X position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   133
      x = SDL_WINDOWPOS_CENTERED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   134
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   135
     case 5:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   136
      /* Undefined X position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   137
      x = SDL_WINDOWPOS_UNDEFINED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   138
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   139
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   140
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   141
    switch(yVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   142
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   143
      /* Zero X Position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   144
      y = 0;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   145
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   146
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   147
      /* Random X position inside screen */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   148
      y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   149
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   150
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   151
      /* Random X position outside screen (positive) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   152
      y = SDLTest_RandomIntegerInRange(10000, 11000);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   153
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   154
     case 3:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   155
      /* Random Y position outside screen (negative) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   156
      y = SDLTest_RandomIntegerInRange(-1000, -100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   157
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   158
     case 4:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   159
      /* Centered Y position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   160
      y = SDL_WINDOWPOS_CENTERED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   161
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   162
     case 5:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   163
      /* Undefined Y position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   164
      y = SDL_WINDOWPOS_UNDEFINED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   165
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   166
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   167
     
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   168
    w = SDLTest_RandomIntegerInRange(32, 96);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   169
    h = SDLTest_RandomIntegerInRange(32, 96);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   170
    window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   171
    SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   172
    SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   173
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   174
    /* Clean up */    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   175
    _destroyVideoSuiteTestWindow(window);
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   176
   }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   177
  } 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   178
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   179
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   180
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   181
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   182
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   183
 * @brief Tests the functionality of the SDL_CreateWindow function using different sizes
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   184
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   185
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   186
video_createWindowVariousSizes(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   187
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   188
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   189
  const char* title = "video_createWindowVariousSizes Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   190
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   191
  int wVariation, hVariation;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   192
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   193
  x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   194
  y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   195
  for (wVariation = 0; wVariation < 3; wVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   196
   for (hVariation = 0; hVariation < 3; hVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   197
    switch(wVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   198
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   199
      /* Width of 1 */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   200
      w = 1;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   201
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   202
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   203
      /* Random "normal" width */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   204
      w = SDLTest_RandomIntegerInRange(320, 1920);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   205
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   206
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   207
      /* Random "large" width */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   208
      w = SDLTest_RandomIntegerInRange(2048, 4095);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   209
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   210
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   211
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   212
    switch(hVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   213
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   214
      /* Height of 1 */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   215
      h = 1;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   216
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   217
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   218
      /* Random "normal" height */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   219
      h = SDLTest_RandomIntegerInRange(320, 1080);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   220
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   221
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   222
      /* Random "large" height */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   223
      h = SDLTest_RandomIntegerInRange(2048, 4095);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   224
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   225
     }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   226
     
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   227
    window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   228
    SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   229
    SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   230
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   231
    /* Clean up */    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   232
    _destroyVideoSuiteTestWindow(window);
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   233
   }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   234
  }  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   235
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   236
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   237
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   238
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   239
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   240
 * @brief Tests the functionality of the SDL_CreateWindow function using different flags
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   241
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   242
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   243
video_createWindowVariousFlags(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   244
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   245
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   246
  const char* title = "video_createWindowVariousFlags Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   247
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   248
  int fVariation;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   249
  SDL_WindowFlags flags;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   250
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   251
  /* Standard window */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   252
  x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   253
  y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   254
  w = SDLTest_RandomIntegerInRange(320, 1024);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   255
  h = SDLTest_RandomIntegerInRange(320, 768);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   256
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   257
  for (fVariation = 0; fVariation < 13; fVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   258
    switch(fVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   259
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   260
      flags = SDL_WINDOW_FULLSCREEN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   261
      /* Skip - blanks screen; comment out next line to run test */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   262
      continue;   
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   263
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   264
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   265
      flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   266
      /* Skip - blanks screen; comment out next line to run test */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   267
      continue;  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   268
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   269
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   270
      flags = SDL_WINDOW_OPENGL;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   271
      break;  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   272
     case 3:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   273
      flags = SDL_WINDOW_SHOWN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   274
      break;   
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   275
     case 4:    
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   276
      flags = SDL_WINDOW_HIDDEN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   277
      break;     
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   278
     case 5:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   279
      flags = SDL_WINDOW_BORDERLESS;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   280
      break;       
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   281
     case 6:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   282
      flags = SDL_WINDOW_RESIZABLE;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   283
      break;         
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   284
     case 7:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   285
      flags = SDL_WINDOW_MINIMIZED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   286
      break;           
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   287
     case 8:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   288
      flags = SDL_WINDOW_MAXIMIZED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   289
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   290
     case 9: 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   291
      flags = SDL_WINDOW_INPUT_GRABBED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   292
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   293
     case 10:              
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   294
      flags = SDL_WINDOW_INPUT_FOCUS;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   295
      break;                 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   296
     case 11:                      
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   297
      flags = SDL_WINDOW_MOUSE_FOCUS;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   298
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   299
     case 12: 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   300
      flags = SDL_WINDOW_FOREIGN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   301
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   302
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   303
       
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   304
    window = SDL_CreateWindow(title, x, y, w, h, flags);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   305
    SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   306
    SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   307
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   308
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   309
    /* Clean up */    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   310
    _destroyVideoSuiteTestWindow(window);  
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   311
  }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   312
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   313
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   314
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   315
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   316
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   317
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   318
 * @brief Tests the functionality of the SDL_GetWindowFlags function
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   319
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   320
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   321
video_getWindowFlags(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   322
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   323
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   324
  const char* title = "video_getWindowFlags Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   325
  SDL_WindowFlags flags;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   326
  Uint32 actualFlags;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   327
  
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   328
  /* Reliable flag set always set in test window */
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   329
  flags = SDL_WINDOW_SHOWN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   330
  
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   331
  /* Call against new test window */ 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   332
  window = _createVideoSuiteTestWindow(title);
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   333
  if (window != NULL) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   334
      actualFlags = SDL_GetWindowFlags(window);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   335
      SDLTest_AssertPass("Call to SDL_GetWindowFlags");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   336
      SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags);
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   337
  }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   338
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   339
  /* Clean up */    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   340
  _destroyVideoSuiteTestWindow(window);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   341
  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   342
  return TEST_COMPLETED;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   343
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   344
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   345
/**
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   346
 * @brief Tests the functionality of the SDL_GetNumDisplayModes function
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   347
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   348
int
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   349
video_getNumDisplayModes(void *arg)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   350
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   351
  int result;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   352
  int displayNum;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   353
  int i;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   354
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   355
  /* Get number of displays */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   356
  displayNum = SDL_GetNumVideoDisplays();
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   357
  SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   358
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   359
  /* Make call for each display */  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   360
  for (i=0; i<displayNum; i++) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   361
    result = SDL_GetNumDisplayModes(i);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   362
    SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d)", i);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   363
    SDLTest_AssertCheck(result >= 1, "Validate returned value from function; expected: >=1; got: %d", result);
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   364
  }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   365
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   366
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   367
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   368
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   369
/**
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   370
 * @brief Tests negative call to SDL_GetNumDisplayModes function
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   371
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   372
int
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   373
video_getNumDisplayModesNegative(void *arg)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   374
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   375
  int result;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   376
  int displayNum;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   377
  int displayIndex;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   378
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   379
  /* Get number of displays */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   380
  displayNum = SDL_GetNumVideoDisplays();
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   381
  SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   382
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   383
  /* Invalid boundary values */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   384
  displayIndex =  SDLTest_RandomSint32BoundaryValue(0, displayNum, SDL_FALSE);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   385
  result = SDL_GetNumDisplayModes(displayIndex);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   386
  SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/boundary)", displayIndex);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   387
  SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   388
  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   389
  /* Large (out-of-bounds) display index */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   390
  displayIndex = SDLTest_RandomIntegerInRange(-2000, -1000);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   391
  result = SDL_GetNumDisplayModes(displayIndex);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   392
  SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/large negative)", displayIndex);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   393
  SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   394
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   395
  displayIndex = SDLTest_RandomIntegerInRange(1000, 2000);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   396
  result = SDL_GetNumDisplayModes(displayIndex);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   397
  SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/large positive)", displayIndex);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   398
  SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   399
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   400
  return TEST_COMPLETED;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   401
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   402
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   403
/**
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   404
 * @brief Tests the functionality of the SDL_GetClosestDisplayMode function against current resolution
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   405
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   406
int
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   407
video_getClosestDisplayModeCurrentResolution(void *arg)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   408
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   409
  int result;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   410
  SDL_DisplayMode current; 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   411
  SDL_DisplayMode target; 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   412
  SDL_DisplayMode closest;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   413
  SDL_DisplayMode* dResult;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   414
  int displayNum;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   415
  int i;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   416
  int variation;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   417
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   418
  /* Get number of displays */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   419
  displayNum = SDL_GetNumVideoDisplays();
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   420
  SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   421
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   422
  /* Make calls for each display */  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   423
  for (i=0; i<displayNum; i++) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   424
    SDLTest_Log("Testing against display: %d", i);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   425
  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   426
    /* Get first display mode to get a sane resolution; this should always work */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   427
    result = SDL_GetDisplayMode(i, 0, &current);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   428
    SDLTest_AssertPass("Call to SDL_GetDisplayMode");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   429
    SDLTest_AssertCheck(result == 0, "Verify return value, expected: 0, got: %d", result);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   430
    if (result != 0) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   431
      return TEST_ABORTED;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   432
    }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   433
       
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   434
    /* Set the desired resolution equals to current resolution */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   435
    target.w = current.w;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   436
    target.h = current.h;    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   437
    for (variation = 0; variation < 8; variation ++) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   438
      /* Vary constraints on other query parameters */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   439
      target.format = (variation & 1) ? current.format : 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   440
      target.refresh_rate = (variation & 2) ? current.refresh_rate : 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   441
      target.driverdata = (variation & 4) ? current.driverdata : 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   442
          
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   443
      /* Make call */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   444
      dResult = SDL_GetClosestDisplayMode(i, &target, &closest);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   445
      SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=current/variation%d)", variation);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   446
      SDLTest_AssertCheck(dResult != NULL, "Verify returned value is not NULL");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   447
    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   448
      /* Check that one gets the current resolution back again */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   449
      SDLTest_AssertCheck(closest.w == current.w, "Verify returned width matches current width; expected: %d, got: %d", current.w, closest.w);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   450
      SDLTest_AssertCheck(closest.h == current.h, "Verify returned height matches current height; expected: %d, got: %d", current.h, closest.h);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   451
      SDLTest_AssertCheck(closest.w == dResult->w, "Verify return value matches assigned value; expected: %d, got: %d", closest.w, dResult->w);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   452
      SDLTest_AssertCheck(closest.h == dResult->h, "Verify return value matches assigned value; expected: %d, got: %d", closest.h, dResult->h);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   453
    }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   454
  }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   455
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   456
  return TEST_COMPLETED;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   457
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   458
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   459
/**
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   460
 * @brief Tests the functionality of the SDL_GetClosestDisplayMode function against random resolution
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   461
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   462
int
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   463
video_getClosestDisplayModeRandomResolution(void *arg)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   464
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   465
  SDL_DisplayMode target; 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   466
  SDL_DisplayMode closest;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   467
  SDL_DisplayMode* dResult;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   468
  int displayNum;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   469
  int i;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   470
  int variation;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   471
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   472
  /* Get number of displays */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   473
  displayNum = SDL_GetNumVideoDisplays();
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   474
  SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   475
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   476
  /* Make calls for each display */  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   477
  for (i=0; i<displayNum; i++) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   478
    SDLTest_Log("Testing against display: %d", i);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   479
         
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   480
    for (variation = 0; variation < 16; variation ++) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   481
    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   482
      /* Set random constraints */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   483
      target.w = (variation & 1) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   484
      target.h = (variation & 2) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   485
      target.format = (variation & 4) ? SDLTest_RandomIntegerInRange(1, 10) : 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   486
      target.refresh_rate = (variation & 8) ? SDLTest_RandomIntegerInRange(25, 120) : 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   487
      target.driverdata = 0;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   488
          
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   489
      /* Make call; may or may not find anything, so don't validate any further */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   490
      dResult = SDL_GetClosestDisplayMode(i, &target, &closest);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   491
      SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=random/variation%d)", variation);      
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   492
    }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   493
  }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   494
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   495
  return TEST_COMPLETED;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   496
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   497
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   498
/**
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   499
 * @brief Tests call to SDL_GetWindowBrightness
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   500
 */
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   501
int
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   502
video_getWindowBrightness(void *arg)
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   503
{
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   504
  SDL_Window* window;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   505
  const char* title = "video_getWindowBrightness Test Window";
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   506
  float result;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   507
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   508
  /* Call against new test window */ 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   509
  window = _createVideoSuiteTestWindow(title);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   510
  if (window != NULL) {
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   511
      result = SDL_GetWindowBrightness(window);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   512
      SDLTest_AssertPass("Call to SDL_GetWindowBrightness");
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   513
      SDLTest_AssertCheck(result >= 0.0 && result <= 1.0, "Validate range of result value; expected: [0.0, 1.0], got: %f", result);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   514
  }
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   515
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   516
  /* Clean up */    
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   517
  _destroyVideoSuiteTestWindow(window);
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   518
  
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   519
  return TEST_COMPLETED;
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   520
}
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   521
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   522
/* ================= Test References ================== */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   523
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
/* Video test cases */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   525
static const SDLTest_TestCaseReference videoTest1 =
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   526
		{ (SDLTest_TestCaseFp)video_enableDisableScreensaver, "video_enableDisableScreensaver",  "Enable and disable screenaver while checking state", TEST_ENABLED };
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   528
static const SDLTest_TestCaseReference videoTest2 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   529
		{ (SDLTest_TestCaseFp)video_createWindowVariousPositions, "video_createWindowVariousPositions",  "Create windows at various locations", TEST_ENABLED };
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   530
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   531
static const SDLTest_TestCaseReference videoTest3 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   532
		{ (SDLTest_TestCaseFp)video_createWindowVariousSizes, "video_createWindowVariousSizes",  "Create windows with various sizes", TEST_ENABLED };
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   533
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   534
static const SDLTest_TestCaseReference videoTest4 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   535
		{ (SDLTest_TestCaseFp)video_createWindowVariousFlags, "video_createWindowVariousFlags",  "Create windows using various flags", TEST_ENABLED };
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   536
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   537
static const SDLTest_TestCaseReference videoTest5 =
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   538
		{ (SDLTest_TestCaseFp)video_getWindowFlags, "video_getWindowFlags",  "Get window flags set during SDL_CreateWindow", TEST_ENABLED };
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   539
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   540
static const SDLTest_TestCaseReference videoTest6 =
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   541
		{ (SDLTest_TestCaseFp)video_getNumDisplayModes, "video_getNumDisplayModes",  "Use SDL_GetNumDisplayModes function to get number of display modes", TEST_ENABLED };
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   542
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   543
static const SDLTest_TestCaseReference videoTest7 =
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   544
		{ (SDLTest_TestCaseFp)video_getNumDisplayModesNegative, "video_getNumDisplayModesNegative",  "Negative tests for SDL_GetNumDisplayModes", TEST_ENABLED };
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   545
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   546
static const SDLTest_TestCaseReference videoTest8 =
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   547
		{ (SDLTest_TestCaseFp)video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution",  "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED };
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   548
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   549
static const SDLTest_TestCaseReference videoTest9 =
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   550
		{ (SDLTest_TestCaseFp)video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution",  "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED };
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   551
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   552
static const SDLTest_TestCaseReference videoTest10 =
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   553
		{ (SDLTest_TestCaseFp)video_getWindowBrightness, "video_getWindowBrightness",  "Get window brightness", TEST_ENABLED };
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   554
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   555
/* Sequence of Video test cases */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
static const SDLTest_TestCaseReference *videoTests[] =  {
6921
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   557
	&videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, 
9a29af9de577 Add tests to video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6891
diff changeset
   558
	&videoTest7, &videoTest8, &videoTest9, &videoTest10, NULL
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   559
};
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   560
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   561
/* Video test suite (global) */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   562
SDLTest_TestSuiteReference videoTestSuite = {
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   563
	"Video",
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   564
	NULL,
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   565
	videoTests,
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   566
	NULL
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   567
};