annotate test/automated/render/render.c @ 3738:c875baafce36 gsoc2009_unit_tests

Changed placeholder for SDL_ReadPixels.
author Edgar Simo <bobbens@gmail.com>
date Sun, 02 Aug 2009 15:41:49 +0000
parents 27b4b4d71011
children 651b261e591d
rev   line source
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
1 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
2 * Automated SDL_Surface test.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
3 *
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
4 * Written by Edgar Simo "bobbens"
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
5 *
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
6 * Released under Public Domain.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
7 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
8
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
9
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
10 #include "SDL.h"
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
11 #include "SDL_at.h"
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
12
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
13 #include "common/common.h"
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
14
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
15
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
16 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
17 * Pull in images for testcases.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
18 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
19 #include "common/images.h"
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
20
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
21
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
22 #define SCREEN_W 80
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
23 #define SCREEN_H 60
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
24
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
25 #define FACE_W img_face.width
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
26 #define FACE_H img_face.height
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
27
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
28
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
29 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
30 * Prototypes.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
31 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
32 static int render_compare( const char *msg, const SurfaceImage_t *s );
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
33 static int render_hasDrawColor (void);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
34 static int render_hasBlendModes (void);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
35 static int render_hasTexColor (void);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
36 static int render_hasTexAlpha (void);
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
37 static int render_clearScreen (void);
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
38 /* Testcases. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
39 static int render_testPrimitives (void);
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
40 static int render_testPrimitivesBlend (void);
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
41 static int render_testBlit (void);
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
42 static int render_testBlitColour (void);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
43 static int render_testBlitAlpha (void);
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
44 static int render_testBlitBlendMode( SDL_TextureID tface, int mode );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
45 static int render_testBlitBlend (void);
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
46
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
47
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
48 /**
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
49 * @brief Compares screen pixels with image pixels.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
50 *
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
51 * @param msg Message on failure.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
52 * @param s Image to compare against.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
53 * @return 0 on success.
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
54 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
55 static int render_compare( const char *msg, const SurfaceImage_t *s )
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
56 {
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
57 (void) msg;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
58 (void) s;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
59 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
60 void *pix;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
61 SDL_Surface *testsur;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
62
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
63 /* Allocate pixel space. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
64 pix = malloc( 4*80*60 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
65 if (SDL_ATassert( "malloc", pix!=NULL ))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
66 return 1;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
67
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
68 /* Read pixels. */
3738
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
69 #if 0
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
70 ret = SDL_RenderReadPixels( NULL, pix, 80*4 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
71 if (SDL_ATassert( "SDL_RenderReadPixels", ret==0) )
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
72 return 1;
3738
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
73 #else
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
74 int i, j;
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
75 Uint8 *buf = pix;
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
76 const Uint8 *read_pix;
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
77 Uint8 *write_pix;
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
78 for (j=0; j<s->height; j++) {
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
79 for (i=0; i<s->width; i++) {
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
80 read_pix = &s->pixel_data[ (j*80 + i) * s->bytes_per_pixel ];
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
81 write_pix = &buf[ (j*80 + i) * 4 ];
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
82 write_pix[0] = read_pix[0];
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
83 write_pix[1] = read_pix[1];
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
84 write_pix[2] = read_pix[2];
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
85 write_pix[3] = SDL_ALPHA_OPAQUE;
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
86 }
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
87 }
c875baafce36 Changed placeholder for SDL_ReadPixels.
Edgar Simo <bobbens@gmail.com>
parents: 3735
diff changeset
88 #endif
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
89
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
90 /* Create surface. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
91 testsur = SDL_CreateRGBSurfaceFrom( pix, 80, 60, 32, 80*4,
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
92 RMASK, GMASK, BMASK, AMASK );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
93 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", testsur!=NULL ))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
94 return 1;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
95
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
96 /* Compare surface. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
97 ret = surface_compare( testsur, s );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
98 if (SDL_ATassert( msg, ret==0 ))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
99 return 1;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
100
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
101 /* Clean up. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
102 SDL_FreeSurface( testsur );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
103 free(pix);
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
104
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
105 return 0;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
106 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
107
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
108
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
109 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
110 * @brief Test to see if we can vary the draw colour.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
111 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
112 static int render_hasDrawColor (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
113 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
114 int ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
115 Uint8 r, g, b, a;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
116
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
117 /* Set colour. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
118 ret = SDL_SetRenderDrawColor( 100, 100, 100, 100 );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
119 ret |= SDL_GetRenderDrawColor( &r, &g, &b, &a );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
120 /* Restore natural. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
121 ret |= SDL_SetRenderDrawColor( 0, 0, 0, SDL_ALPHA_OPAQUE );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
122
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
123 /* Something failed, consider not available. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
124 if (ret != 0)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
125 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
126 /* Not set properly, consider failed. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
127 else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
128 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
129 return 1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
130 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
131
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
132
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
133 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
134 * @brief Test to see if we can vary the blend mode.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
135 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
136 static int render_hasBlendModes (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
137 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
138 int ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
139 int mode;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
140
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
141 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
142 ret |= SDL_GetRenderDrawBlendMode( &mode );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
143 ret |= (mode != SDL_BLENDMODE_BLEND);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
144 ret |= SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
145 ret |= SDL_GetRenderDrawBlendMode( &mode );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
146 ret |= (mode != SDL_BLENDMODE_ADD);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
147 ret |= SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MOD );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
148 ret |= SDL_GetRenderDrawBlendMode( &mode );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
149 ret |= (mode != SDL_BLENDMODE_MOD);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
150 ret |= SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MASK );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
151 ret |= SDL_GetRenderDrawBlendMode( &mode );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
152 ret |= (mode != SDL_BLENDMODE_MASK);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
153 ret |= SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
154 ret |= SDL_GetRenderDrawBlendMode( &mode );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
155 ret |= (mode != SDL_BLENDMODE_NONE);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
156
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
157 return !ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
158 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
159
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
160
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
161 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
162 * @brief Loads the test face.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
163 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
164 static SDL_TextureID render_loadTestFace (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
165 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
166 SDL_Surface *face;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
167 SDL_TextureID tface;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
168
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
169 /* Create face surface. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
170 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
171 img_face.width, img_face.height, 32, img_face.width*4,
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
172 RMASK, GMASK, BMASK, AMASK );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
173 if (face == NULL)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
174 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
175 tface = SDL_CreateTextureFromSurface( 0, face );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
176 SDL_FreeSurface(face);
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
177
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
178 return tface;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
179 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
180
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
181
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
182 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
183 * @brief Test to see if can set texture colour mode.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
184 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
185 static int render_hasTexColor (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
186 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
187 int ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
188 SDL_TextureID tface;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
189 Uint8 r, g, b;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
190
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
191 /* Get test face. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
192 tface = render_loadTestFace();
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
193 if (tface == 0)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
194 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
195
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
196 /* See if supported. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
197 ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
198 ret |= SDL_GetTextureColorMod( tface, &r, &g, &b );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
199
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
200 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
201 SDL_DestroyTexture( tface );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
202
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
203 if (ret)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
204 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
205 else if ((r != 100) || (g != 100) || (b != 100))
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
206 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
207 return 1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
208 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
209
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
210
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
211 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
212 * @brief Test to see if we can vary the alpha of the texture.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
213 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
214 static int render_hasTexAlpha (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
215 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
216 int ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
217 SDL_TextureID tface;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
218 Uint8 a;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
219
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
220 /* Get test face. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
221 tface = render_loadTestFace();
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
222 if (tface == 0)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
223 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
224
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
225 /* See if supported. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
226 ret = SDL_SetTextureAlphaMod( tface, 100 );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
227 ret |= SDL_GetTextureAlphaMod( tface, &a );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
228
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
229 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
230 SDL_DestroyTexture( tface );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
231
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
232 if (ret)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
233 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
234 else if (a != 100)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
235 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
236 return 1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
237 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
238
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
239
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
240 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
241 * @brief Clears the screen.
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
242 *
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
243 * @note We don't test for errors, but they shouldn't happen.
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
244 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
245 static int render_clearScreen (void)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
246 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
247 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
248
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
249 /* Set colour. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
250 ret = SDL_SetRenderDrawColor( 0, 0, 0, SDL_ALPHA_OPAQUE );
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
251 /*
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
252 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
253 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
254 */
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
255
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
256 /* Clear screen. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
257 ret = SDL_RenderFill( NULL );
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
258 /*
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
259 if (SDL_ATassert( "SDL_RenderFill", ret == 0))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
260 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
261 */
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
262
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
263 /* Set defaults. */
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
264 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
265 /*
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
266 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
267 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
268 */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
269 ret = SDL_SetRenderDrawColor( 255, 255, 255, SDL_ALPHA_OPAQUE );
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
270 /*
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
271 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
272 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
273 */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
274
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
275 return 0;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
276 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
277
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
278
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
279 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
280 * @brief Tests the SDL primitives for rendering.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
281 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
282 static int render_testPrimitives (void)
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
283 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
284 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
285 int x, y;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
286 SDL_Rect rect;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
287
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
288 /* Clear surface. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
289 if (render_clearScreen())
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
290 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
291
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
292 /* Need drawcolour or just skip test. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
293 if (!render_hasDrawColor())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
294 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
295
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
296 /* Draw a rectangle. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
297 rect.x = 40;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
298 rect.y = 0;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
299 rect.w = 40;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
300 rect.h = 80;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
301 ret = SDL_SetRenderDrawColor( 13, 73, 200, SDL_ALPHA_OPAQUE );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
302 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
303 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
304 ret = SDL_RenderFill( &rect );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
305 if (SDL_ATassert( "SDL_RenderRect", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
306 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
307
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
308 /* Draw a rectangle. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
309 rect.x = 10;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
310 rect.y = 10;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
311 rect.w = 60;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
312 rect.h = 40;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
313 ret = SDL_SetRenderDrawColor( 200, 0, 100, SDL_ALPHA_OPAQUE );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
314 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
315 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
316 ret = SDL_RenderFill( &rect );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
317 if (SDL_ATassert( "SDL_RenderRect", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
318 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
319
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
320 /* Draw some points like so:
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
321 * X.X.X.X..
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
322 * .X.X.X.X.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
323 * X.X.X.X.. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
324 for (y=0; y<3; y++) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
325 x = y % 2;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
326 for (; x<80; x+=2) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
327 ret = SDL_SetRenderDrawColor( x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
328 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
329 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
330 ret = SDL_RenderPoint( x, y );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
331 if (SDL_ATassert( "SDL_RenderPoint", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
332 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
333 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
334 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
335
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
336 /* Draw some lines. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
337 ret = SDL_SetRenderDrawColor( 0, 255, 0, SDL_ALPHA_OPAQUE );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
338 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
339 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
340 ret = SDL_RenderLine( 0, 30, 80, 30 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
341 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
342 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
343 ret = SDL_SetRenderDrawColor( 55, 55, 5, SDL_ALPHA_OPAQUE );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
344 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
345 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
346 ret = SDL_RenderLine( 40, 30, 40, 60 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
347 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
348 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
349 ret = SDL_SetRenderDrawColor( 5, 105, 105, SDL_ALPHA_OPAQUE );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
350 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
351 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
352 ret = SDL_RenderLine( 0, 60, 80, 0 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
353 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
354 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
355
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
356 /* See if it's the same. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
357 if (render_compare( "Primitives output not the same.", &img_primitives ))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
358 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
359
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
360 return 0;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
361 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
362
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
363
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
364 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
365 * @brief Tests the SDL primitives with alpha for rendering.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
366 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
367 static int render_testPrimitivesBlend (void)
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
368 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
369 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
370 int i, j;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
371 SDL_Rect rect;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
372
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
373 /* Clear surface. */
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
374 if (render_clearScreen())
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
375 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
376
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
377 /* Need drawcolour and blendmode or just skip test. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
378 if (!render_hasDrawColor() || !render_hasBlendModes())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
379 return 0;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
380
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
381 /* Create some rectangles for each blend mode. */
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
382 ret = SDL_SetRenderDrawColor( 255, 255, 255, 0 );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
383 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
384 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
385 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
386 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
387 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
388 ret = SDL_RenderFill( NULL );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
389 if (SDL_ATassert( "SDL_RenderFill", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
390 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
391 rect.x = 10;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
392 rect.y = 25;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
393 rect.w = 40;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
394 rect.h = 25;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
395 ret = SDL_SetRenderDrawColor( 240, 10, 10, 75 );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
396 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
397 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
398 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_ADD );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
399 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
400 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
401 ret = SDL_RenderFill( &rect );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
402 if (SDL_ATassert( "SDL_RenderFill", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
403 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
404 rect.x = 30;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
405 rect.y = 40;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
406 rect.w = 45;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
407 rect.h = 15;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
408 ret = SDL_SetRenderDrawColor( 10, 240, 10, 100 );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
409 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
410 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
411 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_BLEND );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
412 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
413 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
414 ret = SDL_RenderFill( &rect );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
415 if (SDL_ATassert( "SDL_RenderFill", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
416 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
417 rect.x = 25;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
418 rect.y = 25;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
419 rect.w = 25;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
420 rect.h = 25;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
421 ret = SDL_SetRenderDrawColor( 10, 10, 240, 125 );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
422 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
423 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
424 ret = SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_MOD );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
425 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
426 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
427 ret = SDL_RenderFill( &rect );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
428 if (SDL_ATassert( "SDL_RenderFill", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
429 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
430
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
431 /* Draw blended lines, lines for everyone. */
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
432 for (i=0; i<SCREEN_W; i+=2) {
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
433 ret = SDL_SetRenderDrawColor( 60+2*i, 240-2*i, 50, 3*i );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
434 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
435 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
436 ret = SDL_SetRenderDrawBlendMode((((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
437 (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
438 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
439 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
440 ret = SDL_RenderLine( 0, 0, i, 59 );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
441 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
442 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
443 }
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
444 for (i=0; i<SCREEN_H; i+=2) {
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
445 ret = SDL_SetRenderDrawColor( 60+2*i, 240-2*i, 50, 3*i );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
446 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
447 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
448 ret = SDL_SetRenderDrawBlendMode((((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
449 (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
450 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
451 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
452 ret = SDL_RenderLine( 0, 0, 79, i );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
453 if (SDL_ATassert( "SDL_RenderLine", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
454 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
455 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
456
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
457 /* Draw points. */
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
458 for (j=0; j<SCREEN_H; j+=3) {
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
459 for (i=0; i<SCREEN_W; i+=3) {
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
460 ret = SDL_SetRenderDrawColor( j*4, i*3, j*4, i*3 );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
461 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
462 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
463 ret = SDL_SetRenderDrawBlendMode( ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
464 ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_MOD );
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
465 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
466 return -1;
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
467 ret = SDL_RenderPoint( i, j );
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
468 if (SDL_ATassert( "SDL_RenderPoint", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
469 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
470 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
471 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
472
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
473 /* See if it's the same. */
3731
f5ddf1b670f0 Converted another testcase to the render system.
Edgar Simo <bobbens@gmail.com>
parents: 3730
diff changeset
474 if (render_compare( "Blended primitives output not the same.", &img_primitives ))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
475 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
476
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
477 return 0;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
478 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
479
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
480
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
481 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
482 * @brief Tests some blitting routines.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
483 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
484 static int render_testBlit (void)
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
485 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
486 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
487 SDL_Rect rect;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
488 SDL_Surface *face;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
489 SDL_TextureID tface;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
490 int i, j, ni, nj;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
491
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
492 /* Clear surface. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
493 if (render_clearScreen())
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
494 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
495
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
496 /* Need drawcolour or just skip test. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
497 if (!render_hasDrawColor())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
498 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
499
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
500 /* Create face surface. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
501 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
502 img_face.width, img_face.height, 32, img_face.width*4,
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
503 RMASK, GMASK, BMASK, AMASK );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
504 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
505 return -1;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
506 tface = SDL_CreateTextureFromSurface( 0, face );
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
507 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
508 return -1;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
509
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
510 /* Clean up. */
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
511 SDL_FreeSurface( face );
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
512
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
513 /* Constant values. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
514 rect.w = face->w;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
515 rect.h = face->h;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
516 ni = SCREEN_W - face->w;
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
517 nj = SCREEN_H - face->h;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
518
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
519 /* Loop blit. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
520 for (j=0; j <= nj; j+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
521 for (i=0; i <= ni; i+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
522 /* Blitting. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
523 rect.x = i;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
524 rect.y = j;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
525 ret = SDL_RenderCopy( tface, NULL, &rect );
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
526 if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
527 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
528 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
529 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
530
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
531 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
532 SDL_DestroyTexture( tface );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
533
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
534 /* See if it's the same. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
535 if (render_compare( "Blit output not the same.", &img_blit ))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
536 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
537
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
538 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
539 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
540
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
541
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
542 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
543 * @brief Blits doing colour tests.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
544 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
545 static int render_testBlitColour (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
546 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
547 int ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
548 SDL_Rect rect;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
549 SDL_Surface *face;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
550 SDL_TextureID tface;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
551 int i, j, ni, nj;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
552
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
553 /* Clear surface. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
554 if (render_clearScreen())
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
555 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
556
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
557 /* Need drawcolour or just skip test. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
558 if (!render_hasTexColor())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
559 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
560
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
561 /* Create face surface. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
562 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
563 img_face.width, img_face.height, 32, img_face.width*4,
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
564 RMASK, GMASK, BMASK, AMASK );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
565 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
566 return -1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
567 tface = SDL_CreateTextureFromSurface( 0, face );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
568 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
569 return -1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
570
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
571 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
572 SDL_FreeSurface( face );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
573
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
574 /* Constant values. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
575 rect.w = face->w;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
576 rect.h = face->h;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
577 ni = SCREEN_W - face->w;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
578 nj = SCREEN_H - face->h;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
579
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
580 /* Test blitting with colour mod. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
581 for (j=0; j <= nj; j+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
582 for (i=0; i <= ni; i+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
583 /* Set colour mod. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
584 ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
585 if (SDL_ATassert( "SDL_SetTextureColorMod", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
586 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
587
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
588 /* Blitting. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
589 rect.x = i;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
590 rect.y = j;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
591 ret = SDL_RenderCopy( tface, NULL, &rect );
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
592 if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
593 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
594 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
595 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
596
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
597 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
598 SDL_DestroyTexture( tface );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
599
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
600 /* See if it's the same. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
601 if (render_compare( "Blit output not the same (using SDL_SetTextureColorMod).",
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
602 &img_blitColour ))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
603 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
604
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
605 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
606 }
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
607
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
608
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
609 /**
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
610 * @brief Tests blitting with alpha.
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
611 */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
612 static int render_testBlitAlpha (void)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
613 {
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
614 int ret;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
615 SDL_Rect rect;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
616 SDL_Surface *face;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
617 SDL_TextureID tface;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
618 int i, j, ni, nj;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
619
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
620 /* Clear surface. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
621 if (render_clearScreen())
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
622 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
623
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
624 /* Need alpha or just skip test. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
625 if (!render_hasTexAlpha())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
626 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
627
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
628 /* Create face surface. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
629 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
630 img_face.width, img_face.height, 32, img_face.width*4,
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
631 RMASK, GMASK, BMASK, AMASK );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
632 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
633 return -1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
634 tface = SDL_CreateTextureFromSurface( 0, face );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
635 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
636 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
637
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
638 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
639 SDL_FreeSurface( face );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
640
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
641 /* Constant values. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
642 rect.w = face->w;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
643 rect.h = face->h;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
644 ni = SCREEN_W - face->w;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
645 nj = SCREEN_H - face->h;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
646
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
647 /* Clear surface. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
648 if (render_clearScreen())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
649 return -1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
650
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
651 /* Test blitting with alpha mod. */
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
652 for (j=0; j <= nj; j+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
653 for (i=0; i <= ni; i+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
654 /* Set alpha mod. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
655 ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
656 if (SDL_ATassert( "SDL_SetTextureAlphaMod", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
657 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
658
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
659 /* Blitting. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
660 rect.x = i;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
661 rect.y = j;
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
662 ret = SDL_RenderCopy( tface, NULL, &rect );
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
663 if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
664 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
665 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
666 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
667
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
668 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
669 SDL_DestroyTexture( tface );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
670
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
671 /* See if it's the same. */
3733
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
672 if (render_compare( "Blit output not the same (using SDL_SetSurfaceAlphaMod).",
ca544951b504 Finished converting the blit testcase.
Edgar Simo <bobbens@gmail.com>
parents: 3731
diff changeset
673 &img_blitAlpha ))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
674 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
675
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
676 return 0;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
677 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
678
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
679
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
680 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
681 * @brief Tests a blend mode.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
682 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
683 static int render_testBlitBlendMode( SDL_TextureID tface, int mode )
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
684 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
685 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
686 int i, j, ni, nj;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
687 SDL_Rect rect;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
688
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
689 /* Clear surface. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
690 if (render_clearScreen())
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
691 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
692
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
693 /* Steps to take. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
694 ni = SCREEN_W - FACE_W;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
695 nj = SCREEN_H - FACE_H;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
696
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
697 /* Constant values. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
698 rect.w = FACE_W;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
699 rect.h = FACE_H;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
700
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
701 /* Test blend mode. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
702 for (j=0; j <= nj; j+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
703 for (i=0; i <= ni; i+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
704 /* Set blend mode. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
705 ret = SDL_SetRenderDrawBlendMode( mode );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
706 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
707 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
708
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
709 /* Blitting. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
710 rect.x = i;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
711 rect.y = j;
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
712 ret = SDL_RenderCopy( tface, NULL, &rect );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
713 if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
714 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
715 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
716 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
717
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
718 return 0;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
719 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
720
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
721
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
722 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
723 * @brief Tests some more blitting routines.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
724 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
725 static int render_testBlitBlend (void)
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
726 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
727 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
728 SDL_Rect rect;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
729 SDL_Surface *face;
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
730 SDL_TextureID tface;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
731 int i, j, ni, nj;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
732 int mode;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
733
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
734 /* Clear surface. */
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
735 if (render_clearScreen())
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
736 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
737
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
738 /* Need drawcolour and blendmode or just skip test. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
739 if (!render_hasBlendModes() || !render_hasTexColor() || !render_hasTexAlpha())
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
740 return 0;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
741
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
742 /* Create face surface. */
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
743 face = SDL_CreateRGBSurfaceFrom( (void*)img_face.pixel_data,
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
744 img_face.width, img_face.height, 32, img_face.width*4,
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
745 RMASK, GMASK, BMASK, AMASK );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
746 if (SDL_ATassert( "SDL_CreateRGBSurfaceFrom", face != NULL))
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
747 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
748 tface = SDL_CreateTextureFromSurface( 0, face );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
749 if (SDL_ATassert( "SDL_CreateTextureFromSurface", tface != 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
750 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
751
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
752 /* Clean up. */
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
753 SDL_FreeSurface( face );
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
754
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
755 /* Set alpha mod. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
756 ret = SDL_SetRenderDrawColor( 255, 255, 255, 100 );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
757 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
758 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
759
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
760 /* Steps to take. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
761 ni = SCREEN_W - FACE_W;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
762 nj = SCREEN_H - FACE_H;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
763
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
764 /* Constant values. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
765 rect.w = face->w;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
766 rect.h = face->h;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
767
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
768 /* Test None. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
769 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_NONE ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
770 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
771 /* See if it's the same. */
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
772 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_NONE).",
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
773 &img_blitAlpha ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
774 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
775
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
776 /* Test Mask. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
777 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_MASK ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
778 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
779 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_MASK).",
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
780 &img_blendMask ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
781 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
782
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
783 /* Test Blend. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
784 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_BLEND ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
785 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
786 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_BLEND).",
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
787 &img_blendBlend ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
788 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
789
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
790 /* Test Add. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
791 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_ADD ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
792 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
793 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_ADD).",
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
794 &img_blendAdd ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
795 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
796
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
797 /* Test Mod. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
798 if (render_testBlitBlendMode( tface, SDL_BLENDMODE_MOD ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
799 return -1;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
800 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_MOD).",
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
801 &img_blendMod ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
802 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
803
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
804 /* Clear surface. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
805 if (render_clearScreen())
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
806 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
807
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
808 /* Loop blit. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
809 for (j=0; j <= nj; j+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
810 for (i=0; i <= ni; i+=4) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
811
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
812 /* Set colour mod. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
813 ret = SDL_SetRenderDrawColor( (255/nj)*j, (255/ni)*i, (255/nj)*j, (100/ni)*i );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
814 if (SDL_ATassert( "SDL_SetRenderDrawColor", ret == 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
815 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
816
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
817 /* Crazy blending mode magic. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
818 mode = (i/4*j/4) % 4;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
819 if (mode==0) mode = SDL_BLENDMODE_MASK;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
820 else if (mode==1) mode = SDL_BLENDMODE_BLEND;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
821 else if (mode==2) mode = SDL_BLENDMODE_ADD;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
822 else if (mode==3) mode = SDL_BLENDMODE_MOD;
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
823 ret = SDL_SetRenderDrawBlendMode( mode );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
824 if (SDL_ATassert( "SDL_SetRenderDrawBlendMode", ret == 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
825 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
826
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
827 /* Blitting. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
828 rect.x = i;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
829 rect.y = j;
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
830 ret = SDL_RenderCopy( tface, NULL, &rect );
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
831 if (SDL_ATassert( "SDL_RenderCopy", ret == 0))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
832 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
833 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
834 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
835
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
836 /* Clean up. */
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
837 SDL_DestroyTexture( tface );
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
838
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
839 /* Check to see if matches. */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
840 if (render_compare( "Blit blending output not the same (using SDL_BLENDMODE_*).",
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
841 &img_blendAll ))
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
842 return -1;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
843
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
844 return 0;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
845 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
846
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
847
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
848 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
849 * @brief Runs all the tests on the surface.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
850 *
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
851 * @return 0 on success.
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
852 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
853 int render_runTests (void)
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
854 {
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
855 int ret;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
856
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
857 /* No error. */
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
858 ret = 0;
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
859
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
860 /* Software surface blitting. */
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
861 ret = render_testPrimitives();
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
862 if (ret)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
863 return -1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
864 ret = render_testPrimitivesBlend();
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
865 if (ret)
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
866 return -1;
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
867 ret = render_testBlit();
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
868 if (ret)
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
869 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
870 ret = render_testBlitColour();
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
871 if (ret)
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
872 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
873 ret = render_testBlitAlpha();
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
874 if (ret)
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
875 return -1;
3735
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
876 ret = render_testBlitBlend();
27b4b4d71011 Test for capabilities for each test.
Edgar Simo <bobbens@gmail.com>
parents: 3734
diff changeset
877
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
878
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
879 return ret;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
880 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
881
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
882
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
883 /**
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
884 * @brief Entry point.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
885 *
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
886 * This testsuite is tricky, we're creating a testsuite per driver, the thing
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
887 * is we do quite a of stuff outside of the actual testcase which *could*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
888 * give issues. Don't like that very much, but no way around without creating
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
889 * superfluous testsuites.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
890 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
891 int main( int argc, const char *argv[] )
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
892 {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
893 (void) argc;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
894 (void) argv;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
895 int i, j, nd, nr;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
896 int ret;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
897 const char *driver, *str;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
898 char msg[256];
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
899 SDL_WindowID wid;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
900 SDL_RendererInfo renderer;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
901
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
902 /* Initializes the SDL subsystems. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
903 ret = SDL_Init(0);
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
904 if (ret != 0)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
905 return -1;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
906
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
907 /* Get number of drivers. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
908 nd = SDL_GetNumVideoDrivers();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
909 if (ret < 0)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
910 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
911
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
912 /* Now run on the video mode. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
913 ret = SDL_InitSubSystem( SDL_INIT_VIDEO );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
914 if (ret != 0)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
915 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
916
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
917 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
918 * Surface on video mode tests.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
919 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
920 /* Run for all video modes. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
921 for (i=0; i<nd; i++) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
922 /* Get video mode. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
923 driver = SDL_GetVideoDriver(i);
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
924 if (driver == NULL)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
925 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
926 /* Hack to avoid dummy driver. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
927 if (strcmp(driver,"dummy")==0)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
928 continue;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
929
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
930 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
931 * Initialize testsuite.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
932 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
933 snprintf( msg, sizeof(msg) , "Rendering with %s driver", driver );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
934 SDL_ATinit( msg );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
935
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
936 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
937 * Initialize.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
938 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
939 SDL_ATbegin( "Initializing video mode" );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
940 /* Initialize video mode. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
941 ret = SDL_VideoInit( driver, 0 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
942 if (SDL_ATvassert( ret==0, "SDL_VideoInit( %s, 0 )", driver ))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
943 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
944 /* Check to see if it's the one we want. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
945 str = SDL_GetCurrentVideoDriver();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
946 if (SDL_ATassert( "SDL_GetCurrentVideoDriver", strcmp(driver,str)==0))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
947 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
948 /* Create window. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
949 wid = SDL_CreateWindow( msg, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
950 80, 60, 0 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
951 if (SDL_ATassert( "SDL_CreateWindow", wid!=0 ))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
952 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
953 /* Check title. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
954 str = SDL_GetWindowTitle( wid );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
955 if (SDL_ATassert( "SDL_GetWindowTitle", strcmp(msg,str)==0))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
956 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
957 /* Get renderers. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
958 nr = SDL_GetNumRenderDrivers();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
959 if (SDL_ATassert("SDL_GetNumRenderDrivers", nr>=0))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
960 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
961 SDL_ATend();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
962 for (j=0; j<nr; j++) {
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
963
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
964 /* Get renderer info. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
965 ret = SDL_GetRenderDriverInfo( j, &renderer );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
966 if (ret != 0)
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
967 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
968 /* Set testcase name. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
969 snprintf( msg, sizeof(msg), "Renderer %s", renderer.name );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
970 SDL_ATbegin( msg );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
971 /* Set renderer. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
972 ret = SDL_CreateRenderer( wid, j, 0 );
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
973 if (SDL_ATassert( "SDL_CreateRenderer", ret==0 ))
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
974 goto err;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
975
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
976 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
977 * Run tests.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
978 */
3734
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
979 if (render_runTests())
42356acbc993 Finished last of the render testcases.
Edgar Simo <bobbens@gmail.com>
parents: 3733
diff changeset
980 continue;
3730
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
981
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
982 SDL_ATend();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
983 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
984
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
985 /* Exit the current renderer. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
986 SDL_VideoQuit();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
987
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
988 /*
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
989 * Finish testsuite.
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
990 */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
991 SDL_ATfinish(1);
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
992 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
993
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
994
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
995 /* Exit SDL. */
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
996 SDL_Quit();
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
997
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
998 return 0;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
999
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
1000 err:
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
1001 return -1;
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
1002 }
dafd796f0c95 * Added preliminary render tests, missing some SDL functions to work properly.
Edgar Simo <bobbens@gmail.com>
parents:
diff changeset
1003