! * \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles * * \sa * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection */
| 830 | * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection |
| 831 | */ |
| 832 | int rect_testHasIntersectionPoint (void *arg) |
| 833 | { |
| 834 | SDL_Rect refRectA = { 0, 0, 1, 1 }; |
| 835 | SDL_Rect refRectB = { 0, 0, 1, 1 }; |
| 836 | SDL_Rect rectA; |
| 837 | SDL_Rect rectB; |
| 838 | SDL_bool intersection; |
| 839 | int offsetX, offsetY; |
| 840 | |
| 841 | /* intersecting pixels */ |
| 842 | refRectA.x = SDLTest_RandomIntegerInRange(1, 100); |
| 843 | refRectA.y = SDLTest_RandomIntegerInRange(1, 100); |
| 844 | refRectB.x = refRectA.x; |
| 845 | refRectB.y = refRectA.y; |
| 846 | rectA = refRectA; |
| 847 | rectB = refRectB; |
| 848 | intersection = SDL_HasIntersection(&rectA, &rectB); |
| 849 | _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); |
| 850 | |
| 851 | /* non-intersecting pixels cases */ |
| 852 | for (offsetX = -1; offsetX <= 1; offsetX++) { |
| 853 | for (offsetY = -1; offsetY <= 1; offsetY++) { |
| 854 | if (offsetX != 0 || offsetY != 0) { |
| 855 | refRectA.x = SDLTest_RandomIntegerInRange(1, 100); |
| 856 | refRectA.y = SDLTest_RandomIntegerInRange(1, 100); |
| 857 | refRectB.x = refRectA.x; |
| 858 | refRectB.y = refRectA.y; |
| 859 | refRectB.x += offsetX; |
| 860 | refRectB.y += offsetY; |
| 861 | rectA = refRectA; |
| 862 | rectB = refRectB; |
| 863 | intersection = SDL_HasIntersection(&rectA, &rectB); |
| 864 | _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); |
| 865 | } |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | return TEST_COMPLETED; |
| 870 | } |
| 871 | |
| 872 | /* ! |
| 873 | * \brief Tests SDL_HasIntersection() with empty rectangles |
nothing calls this directly
no test coverage detected