! * \brief Tests SDL_HasIntersection() with empty rectangles * * \sa * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection */
| 876 | * http://wiki.libsdl.org/moin.cgi/SDL_HasIntersection |
| 877 | */ |
| 878 | int rect_testHasIntersectionEmpty (void *arg) |
| 879 | { |
| 880 | SDL_Rect refRectA; |
| 881 | SDL_Rect refRectB; |
| 882 | SDL_Rect rectA; |
| 883 | SDL_Rect rectB; |
| 884 | SDL_bool intersection; |
| 885 | |
| 886 | /* Rect A empty */ |
| 887 | refRectA.x = SDLTest_RandomIntegerInRange(1, 100); |
| 888 | refRectA.y = SDLTest_RandomIntegerInRange(1, 100); |
| 889 | refRectA.w = SDLTest_RandomIntegerInRange(1, 100); |
| 890 | refRectA.h = SDLTest_RandomIntegerInRange(1, 100); |
| 891 | refRectB = refRectA; |
| 892 | refRectA.w = 0; |
| 893 | refRectA.h = 0; |
| 894 | rectA = refRectA; |
| 895 | rectB = refRectB; |
| 896 | intersection = SDL_HasIntersection(&rectA, &rectB); |
| 897 | _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); |
| 898 | |
| 899 | /* Rect B empty */ |
| 900 | refRectA.x = SDLTest_RandomIntegerInRange(1, 100); |
| 901 | refRectA.y = SDLTest_RandomIntegerInRange(1, 100); |
| 902 | refRectA.w = SDLTest_RandomIntegerInRange(1, 100); |
| 903 | refRectA.h = SDLTest_RandomIntegerInRange(1, 100); |
| 904 | refRectB = refRectA; |
| 905 | refRectB.w = 0; |
| 906 | refRectB.h = 0; |
| 907 | rectA = refRectA; |
| 908 | rectB = refRectB; |
| 909 | intersection = SDL_HasIntersection(&rectA, &rectB); |
| 910 | _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); |
| 911 | |
| 912 | /* Rect A and B empty */ |
| 913 | refRectA.x = SDLTest_RandomIntegerInRange(1, 100); |
| 914 | refRectA.y = SDLTest_RandomIntegerInRange(1, 100); |
| 915 | refRectA.w = SDLTest_RandomIntegerInRange(1, 100); |
| 916 | refRectA.h = SDLTest_RandomIntegerInRange(1, 100); |
| 917 | refRectB = refRectA; |
| 918 | refRectA.w = 0; |
| 919 | refRectA.h = 0; |
| 920 | refRectB.w = 0; |
| 921 | refRectB.h = 0; |
| 922 | rectA = refRectA; |
| 923 | rectB = refRectB; |
| 924 | intersection = SDL_HasIntersection(&rectA, &rectB); |
| 925 | _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); |
| 926 | |
| 927 | return TEST_COMPLETED; |
| 928 | } |
| 929 | |
| 930 | /* ! |
| 931 | * \brief Negative tests against SDL_HasIntersection() with invalid parameters |
nothing calls this directly
no test coverage detected