test/testautomation_video.c
author Andreas Schiffler <aschiffler@ferzkopp.net>
Sat, 16 Feb 2013 23:09:10 -0800
changeset 6891 177f29ae5279
parent 6800 26c6795ec1a4
child 6921 9a29af9de577
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
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    10
/* 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
    11
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    12
/**
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    13
 * @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
    14
 */
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    15
int
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    16
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
    17
{
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    18
	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
    19
	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
    20
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    21
	/* 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
    22
	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
    23
	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
    24
	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
    25
	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    26
	  /* 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
    27
	  
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    28
	  /* 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
    29
	  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
    30
	  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
    31
	  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
    32
	  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
    33
	  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
    34
	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    35
	  /* 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
    36
	  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
    37
	  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
    38
	  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
    39
	  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
    40
	  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
    41
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    42
	} else {
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    43
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    44
	  /* 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
    45
	  
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    46
	  /* 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
    47
	  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
    48
	  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
    49
	  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
    50
	  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
    51
	  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
    52
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    53
	  /* 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
    54
	  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
    55
	  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
    56
	  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
    57
	  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
    58
	  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
    59
	}	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    60
	
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    61
	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
    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
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    64
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    65
 * @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
    66
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    67
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    68
video_createWindowVariousPositions(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    69
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    70
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    71
  const char* title = "video_createWindowVariousPositions Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    72
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    73
  int xVariation, yVariation;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    74
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    75
  for (xVariation = 0; xVariation < 6; xVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    76
   for (yVariation = 0; yVariation < 6; yVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    77
    switch(xVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    78
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    79
      /* Zero X Position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    80
      x = 0;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    81
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    82
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    83
      /* Random X position inside screen */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    84
      x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    85
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    86
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    87
      /* Random X position outside screen (positive) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    88
      x = SDLTest_RandomIntegerInRange(10000, 11000);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    89
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    90
     case 3:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    91
      /* Random X position outside screen (negative) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    92
      x = SDLTest_RandomIntegerInRange(-1000, -100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    93
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    94
     case 4:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    95
      /* Centered X position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    96
      x = SDL_WINDOWPOS_CENTERED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    97
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    98
     case 5:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
    99
      /* Undefined X position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   100
      x = SDL_WINDOWPOS_UNDEFINED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   101
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   102
    }
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
    switch(yVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   105
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   106
      /* Zero X Position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   107
      y = 0;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   108
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   109
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   110
      /* Random X position inside screen */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   111
      y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   112
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   113
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   114
      /* Random X position outside screen (positive) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   115
      y = SDLTest_RandomIntegerInRange(10000, 11000);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   116
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   117
     case 3:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   118
      /* Random Y position outside screen (negative) */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   119
      y = SDLTest_RandomIntegerInRange(-1000, -100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   120
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   121
     case 4:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   122
      /* Centered Y position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   123
      y = SDL_WINDOWPOS_CENTERED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   124
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   125
     case 5:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   126
      /* Undefined Y position */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   127
      y = SDL_WINDOWPOS_UNDEFINED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   128
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   129
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   130
     
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   131
    w = SDLTest_RandomIntegerInRange(32, 96);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   132
    h = SDLTest_RandomIntegerInRange(32, 96);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   133
    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
   134
    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
   135
    SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   136
    if (window != NULL) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   137
      SDL_DestroyWindow(window);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   138
      SDLTest_AssertPass("Call to SDL_DestroyWindow");
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
  } 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   142
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   143
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   144
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   145
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   146
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   147
 * @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
   148
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   149
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   150
video_createWindowVariousSizes(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   151
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   152
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   153
  const char* title = "video_createWindowVariousSizes Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   154
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   155
  int wVariation, hVariation;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   156
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   157
  x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   158
  y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   159
  for (wVariation = 0; wVariation < 3; wVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   160
   for (hVariation = 0; hVariation < 3; hVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   161
    switch(wVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   162
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   163
      /* Width of 1 */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   164
      w = 1;
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
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   167
      /* Random "normal" width */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   168
      w = SDLTest_RandomIntegerInRange(320, 1920);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   169
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   170
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   171
      /* Random "large" width */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   172
      w = SDLTest_RandomIntegerInRange(2048, 4095);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   173
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   174
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   175
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   176
    switch(hVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   177
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   178
      /* Height of 1 */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   179
      h = 1;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   180
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   181
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   182
      /* Random "normal" height */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   183
      h = SDLTest_RandomIntegerInRange(320, 1080);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   184
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   185
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   186
      /* Random "large" height */  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   187
      h = SDLTest_RandomIntegerInRange(2048, 4095);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   188
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   189
     }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   190
     
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   191
    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
   192
    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
   193
    SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   194
    if (window != NULL) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   195
      SDL_DestroyWindow(window);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   196
      SDLTest_AssertPass("Call to SDL_DestroyWindow");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   197
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   198
   }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   199
  }  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   200
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   201
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   202
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   203
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   204
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   205
 * @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
   206
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   207
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   208
video_createWindowVariousFlags(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   209
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   210
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   211
  const char* title = "video_createWindowVariousFlags Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   212
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   213
  int fVariation;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   214
  SDL_WindowFlags flags;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   215
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   216
  /* Standard window */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   217
  x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   218
  y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   219
  w = SDLTest_RandomIntegerInRange(320, 1024);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   220
  h = SDLTest_RandomIntegerInRange(320, 768);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   221
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   222
  for (fVariation = 0; fVariation < 13; fVariation++) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   223
    switch(fVariation) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   224
     case 0:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   225
      flags = SDL_WINDOW_FULLSCREEN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   226
      /* 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
   227
      continue;   
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   228
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   229
     case 1:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   230
      flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   231
      /* 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
   232
      continue;  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   233
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   234
     case 2:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   235
      flags = SDL_WINDOW_OPENGL;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   236
      break;  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   237
     case 3:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   238
      flags = SDL_WINDOW_SHOWN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   239
      break;   
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   240
     case 4:    
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   241
      flags = SDL_WINDOW_HIDDEN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   242
      break;     
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   243
     case 5:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   244
      flags = SDL_WINDOW_BORDERLESS;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   245
      break;       
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   246
     case 6:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   247
      flags = SDL_WINDOW_RESIZABLE;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   248
      break;         
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   249
     case 7:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   250
      flags = SDL_WINDOW_MINIMIZED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   251
      break;           
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   252
     case 8:
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   253
      flags = SDL_WINDOW_MAXIMIZED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   254
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   255
     case 9: 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   256
      flags = SDL_WINDOW_INPUT_GRABBED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   257
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   258
     case 10:              
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   259
      flags = SDL_WINDOW_INPUT_FOCUS;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   260
      break;                 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   261
     case 11:                      
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   262
      flags = SDL_WINDOW_MOUSE_FOCUS;
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 12: 
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   265
      flags = SDL_WINDOW_FOREIGN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   266
      break;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   267
    }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   268
       
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   269
    window = SDL_CreateWindow(title, x, y, w, h, flags);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   270
    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
   271
    SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   272
    if (window != NULL) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   273
      SDL_DestroyWindow(window);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   274
      SDLTest_AssertPass("Call to SDL_DestroyWindow");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   275
    }   
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   276
  }
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   277
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   278
  return TEST_COMPLETED;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   279
}
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   280
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   281
/**
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   282
 * @brief Tests the functionality of the SDL_GetWindowFlags function
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   283
 */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   284
int
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   285
video_getWindowFlags(void *arg)
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   286
{
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   287
  SDL_Window* window;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   288
  const char* title = "video_getWindowFlags Test Window";
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   289
  int x, y, w, h;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   290
  SDL_WindowFlags flags;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   291
  Uint32 actualFlags;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   292
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   293
  /* Standard window */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   294
  x = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   295
  y = SDLTest_RandomIntegerInRange(1, 100);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   296
  w = SDLTest_RandomIntegerInRange(320, 1024);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   297
  h = SDLTest_RandomIntegerInRange(320, 768);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   298
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   299
  /* Reliable flag */
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   300
  flags = SDL_WINDOW_SHOWN;
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   301
  
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   302
  window = SDL_CreateWindow(title, x, y, w, h, flags);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   303
  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
   304
  SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   305
  if (window != NULL) {
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   306
      actualFlags = SDL_GetWindowFlags(window);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   307
      SDLTest_AssertPass("Call to SDL_GetWindowFlags");
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   308
      SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   309
      SDL_DestroyWindow(window);
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   310
      SDLTest_AssertPass("Call to SDL_DestroyWindow");  
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
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   316
/* ================= 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
   317
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   318
/* 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
   319
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
   320
		{ (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
   321
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   322
static const SDLTest_TestCaseReference videoTest2 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   323
		{ (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
   324
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   325
static const SDLTest_TestCaseReference videoTest3 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   326
		{ (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
   327
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   328
static const SDLTest_TestCaseReference videoTest4 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   329
		{ (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
   330
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   331
static const SDLTest_TestCaseReference videoTest5 =
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   332
		{ (SDLTest_TestCaseFp)video_getWindowFlags, "video_getWindowFlags",  "Set and get window flags", TEST_ENABLED };
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   333
6800
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   334
/* 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
   335
static const SDLTest_TestCaseReference *videoTests[] =  {
6891
177f29ae5279 Add tests to Video suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6800
diff changeset
   336
	&videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, 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
   337
};
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   338
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   339
/* 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
   340
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
   341
	"Video",
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   342
	NULL,
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   343
	videoTests,
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
	NULL
26c6795ec1a4 Add new test suites (events, keyboard, syswm, video) with a few new tests each
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   345
};