Fixed bug #2426 - SDL_RenderReadPixels result is unspecified and fails testautomation Call SDL_RenderPresent after calling SDL_RenderReadPixels. From "include/SDL_render.h": "If you're using this on the main rendering target, it should be called after rendering and before SDL_RenderPresent()."
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
diff --git a/test/testautomation_render.c b/test/testautomation_render.c
index 42fc54d..0117334 100644
--- a/test/testautomation_render.c
+++ b/test/testautomation_render.c
@@ -187,14 +187,14 @@ int render_testPrimitives (void *arg)
ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
-
- /* Make current */
- SDL_RenderPresent(renderer);
-
+
/* See if it's the same. */
referenceSurface = SDLTest_ImagePrimitives();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
+ /* Make current */
+ SDL_RenderPresent(renderer);
+
/* Clean up. */
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@@ -335,13 +335,13 @@ int render_testPrimitivesBlend (void *arg)
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
- /* Make current */
- SDL_RenderPresent(renderer);
-
/* See if it's the same. */
referenceSurface = SDLTest_ImagePrimitivesBlend();
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
+ /* Make current */
+ SDL_RenderPresent(renderer);
+
/* Clean up. */
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@@ -404,13 +404,13 @@ render_testBlit(void *arg)
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
- /* Make current */
- SDL_RenderPresent(renderer);
-
/* See if it's the same */
referenceSurface = SDLTest_ImageBlit();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
+ /* Make current */
+ SDL_RenderPresent(renderer);
+
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
@@ -478,13 +478,13 @@ render_testBlitColor (void *arg)
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
- /* Make current */
- SDL_RenderPresent(renderer);
-
/* See if it's the same. */
referenceSurface = SDLTest_ImageBlitColor();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
+ /* Make current */
+ SDL_RenderPresent(renderer);
+
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
@@ -555,13 +555,13 @@ render_testBlitAlpha (void *arg)
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
- /* Make current */
- SDL_RenderPresent(renderer);
-
/* See if it's the same. */
referenceSurface = SDLTest_ImageBlitAlpha();
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
+ /* Make current */
+ SDL_RenderPresent(renderer);
+
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
@@ -674,9 +674,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
referenceSurface = SDLTest_ImageBlitBlendNone();
- /* Make current and compare */
- SDL_RenderPresent(renderer);
+ /* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
+ SDL_RenderPresent(renderer);
+
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@@ -684,9 +685,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
referenceSurface = SDLTest_ImageBlitBlend();
- /* Make current and compare */
- SDL_RenderPresent(renderer);
+ /* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
+ SDL_RenderPresent(renderer);
+
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@@ -694,9 +696,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
referenceSurface = SDLTest_ImageBlitBlendAdd();
- /* Make current and compare */
- SDL_RenderPresent(renderer);
+ /* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
+ SDL_RenderPresent(renderer);
+
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@@ -704,9 +707,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
referenceSurface = SDLTest_ImageBlitBlendMod();
- /* Make current and compare */
- SDL_RenderPresent(renderer);
+ /* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
+ SDL_RenderPresent(renderer);
+
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@@ -753,12 +757,13 @@ render_testBlitBlend (void *arg)
/* Clean up. */
SDL_DestroyTexture( tface );
- /* Make current */
- SDL_RenderPresent(renderer);
-
/* Check to see if final image matches. */
referenceSurface = SDLTest_ImageBlitBlendAll();
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
+
+ /* Make current */
+ SDL_RenderPresent(renderer);
+
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;