Browse Source

Fixed floating point rectangles to be mathematically correct.

* A floating point rectangle contains all points >= x and <= x + w
* A floating point rectangle is only empty if it has negative width. The zero rectangle contains the zero point.
* Adjacent floating point rectangles intersect along their shared side

Fixes https://github.com/libsdl-org/SDL/issues/6791
Sam Lantinga 9 months ago
parent
commit
e0fd59de64
4 changed files with 295 additions and 17 deletions
  1. 7 7
      include/SDL3/SDL_rect.h
  2. 2 0
      src/video/SDL_rect.c
  3. 9 8
      src/video/SDL_rect_impl.h
  4. 277 2
      test/testautomation_rect.c

+ 7 - 7
include/SDL3/SDL_rect.h

@@ -293,8 +293,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Re
  *
  * A point is considered part of a rectangle if both `p` and `r` are not NULL,
  * and `p`'s x and y coordinates are >= to the rectangle's top left corner,
- * and < the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0)
- * as "inside" and (0,1) as not.
+ * and <= the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0)
+ * and (0,1) as "inside" and (0,2) as not.
  *
  * Note that this is a forced-inline function in a header, and not a public
  * API function available in the SDL library (which is to say, the code is
@@ -311,15 +311,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Re
  */
 SDL_FORCE_INLINE SDL_bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FRect *r)
 {
-    return ( p && r && (p->x >= r->x) && (p->x < (r->x + r->w)) &&
-             (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
+    return ( p && r && (p->x >= r->x) && (p->x <= (r->x + r->w)) &&
+             (p->y >= r->y) && (p->y <= (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
 }
 
 /**
- * Determine whether a floating point rectangle has no area.
+ * Determine whether a floating point rectangle can contain any point.
  *
  * A rectangle is considered "empty" for this function if `r` is NULL, or if
- * `r`'s width and/or height are <= 0.0f.
+ * `r`'s width and/or height are < 0.0f.
  *
  * Note that this is a forced-inline function in a header, and not a public
  * API function available in the SDL library (which is to say, the code is
@@ -335,7 +335,7 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FR
  */
 SDL_FORCE_INLINE SDL_bool SDL_RectEmptyFloat(const SDL_FRect *r)
 {
-    return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE;
+    return ((!r) || (r->w < 0.0f) || (r->h < 0.0f)) ? SDL_TRUE : SDL_FALSE;
 }
 
 /**

+ 2 - 0
src/video/SDL_rect.c

@@ -90,6 +90,7 @@ SDL_bool SDL_GetSpanEnclosingRect(int width, int height,
 #define SCALARTYPE               int
 #define BIGSCALARTYPE            Sint64
 #define COMPUTEOUTCODE           ComputeOutCode
+#define ENCLOSEPOINTS_EPSILON    1
 #define SDL_HASINTERSECTION      SDL_HasRectIntersection
 #define SDL_INTERSECTRECT        SDL_GetRectIntersection
 #define SDL_RECTEMPTY            SDL_RectEmpty
@@ -103,6 +104,7 @@ SDL_bool SDL_GetSpanEnclosingRect(int width, int height,
 #define SCALARTYPE               float
 #define BIGSCALARTYPE            double
 #define COMPUTEOUTCODE           ComputeOutCodeFloat
+#define ENCLOSEPOINTS_EPSILON    0.0f
 #define SDL_HASINTERSECTION      SDL_HasRectIntersectionFloat
 #define SDL_INTERSECTRECT        SDL_GetRectIntersectionFloat
 #define SDL_RECTEMPTY            SDL_RectEmptyFloat

+ 9 - 8
src/video/SDL_rect_impl.h

@@ -46,7 +46,7 @@ SDL_bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B)
     if (Bmax < Amax) {
         Amax = Bmax;
     }
-    if (Amax <= Amin) {
+    if ((Amax - ENCLOSEPOINTS_EPSILON) < Amin) {
         return SDL_FALSE;
     }
     /* Vertical intersection */
@@ -60,7 +60,7 @@ SDL_bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B)
     if (Bmax < Amax) {
         Amax = Bmax;
     }
-    if (Amax <= Amin) {
+    if ((Amax - ENCLOSEPOINTS_EPSILON) < Amin) {
         return SDL_FALSE;
     }
     return SDL_TRUE;
@@ -190,8 +190,8 @@ SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *c
         SDL_bool added = SDL_FALSE;
         const SCALARTYPE clip_minx = clip->x;
         const SCALARTYPE clip_miny = clip->y;
-        const SCALARTYPE clip_maxx = clip->x + clip->w - 1;
-        const SCALARTYPE clip_maxy = clip->y + clip->h - 1;
+        const SCALARTYPE clip_maxx = clip->x + clip->w - ENCLOSEPOINTS_EPSILON;
+        const SCALARTYPE clip_maxy = clip->y + clip->h - ENCLOSEPOINTS_EPSILON;
 
         /* Special case for empty rectangle */
         if (SDL_RECTEMPTY(clip)) {
@@ -262,8 +262,8 @@ SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *c
     if (result) {
         result->x = minx;
         result->y = miny;
-        result->w = (maxx - minx) + 1;
-        result->h = (maxy - miny) + 1;
+        result->w = (maxx - minx) + ENCLOSEPOINTS_EPSILON;
+        result->h = (maxy - miny) + ENCLOSEPOINTS_EPSILON;
     }
     return SDL_TRUE;
 }
@@ -322,8 +322,8 @@ SDL_bool SDL_INTERSECTRECTANDLINE(const RECTTYPE *rect, SCALARTYPE *X1, SCALARTY
     y2 = *Y2;
     rectx1 = rect->x;
     recty1 = rect->y;
-    rectx2 = rect->x + rect->w - 1;
-    recty2 = rect->y + rect->h - 1;
+    rectx2 = rect->x + rect->w - ENCLOSEPOINTS_EPSILON;
+    recty2 = rect->y + rect->h - ENCLOSEPOINTS_EPSILON;
 
     /* Check to see if entire line is inside rect */
     if (x1 >= rectx1 && x1 <= rectx2 && x2 >= rectx1 && x2 <= rectx2 &&
@@ -429,6 +429,7 @@ SDL_bool SDL_INTERSECTRECTANDLINE(const RECTTYPE *rect, SCALARTYPE *X1, SCALARTY
 #undef SCALARTYPE
 #undef BIGSCALARTYPE
 #undef COMPUTEOUTCODE
+#undef ENCLOSEPOINTS_EPSILON
 #undef SDL_HASINTERSECTION
 #undef SDL_INTERSECTRECT
 #undef SDL_RECTEMPTY

+ 277 - 2
test/testautomation_rect.c

@@ -10,6 +10,27 @@
 
 /* Helper functions */
 
+/**
+ * Private helper to check SDL_GetRectAndLineIntersectionFloat results
+ */
+static void validateIntersectRectAndLineFloatResults(
+    SDL_bool intersection, SDL_bool expectedIntersection,
+    SDL_FRect *rect,
+    float x1, float y1, float x2, float y2,
+    float x1Ref, float y1Ref, float x2Ref, float y2Ref)
+{
+    SDLTest_AssertCheck(intersection == expectedIntersection,
+                        "Check for correct intersection result: expected %s, got %s intersecting rect (%.2f,%.2f,%.2f,%.2f) with line (%.2f,%.2f - %.2f,%.2f)",
+                        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+                        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+                        rect->x, rect->y, rect->w, rect->h,
+                        x1Ref, y1Ref, x2Ref, y2Ref);
+    SDLTest_AssertCheck(x1 == x1Ref && y1 == y1Ref && x2 == x2Ref && y2 == y2Ref,
+                        "Check if line was incorrectly clipped or modified: got (%.2f,%.2f - %.2f,%.2f) expected (%.2f,%.2f - %.2f,%.2f)",
+                        x1, y1, x2, y2,
+                        x1Ref, y1Ref, x2Ref, y2Ref);
+}
+
 /**
  * Private helper to check SDL_GetRectAndLineIntersection results
  */
@@ -37,6 +58,43 @@ static void validateIntersectRectAndLineResults(
 
 /* Test case functions */
 
+/**
+ * Tests SDL_GetRectAndLineIntersectionFloat() clipping cases
+ *
+ * \sa SDL_GetRectAndLineIntersectionFloat
+ */
+static int rect_testIntersectRectAndLineFloat(void *arg)
+{
+    SDL_FRect rect;
+    float x1, y1;
+    float x2, y2;
+    SDL_bool intersected;
+
+    x1 = 5.0f;
+    y1 = 6.0f;
+    x2 = 23.0f;
+    y2 = 6.0f;
+    rect.x = 2.5f;
+    rect.y = 1.5f;
+    rect.w = 15.25f;
+    rect.h = 12.0f;
+    intersected = SDL_GetRectAndLineIntersectionFloat(&rect, &x1, &y1, &x2, &y2);
+    validateIntersectRectAndLineFloatResults(intersected, SDL_TRUE, &rect, x1, y1, x2, y2, 5.0f, 6.0f, 17.75f, 6.0f);
+
+    x1 = 0.0f;
+    y1 = 6.0f;
+    x2 = 23.0f;
+    y2 = 6.0f;
+    rect.x = 2.5f;
+    rect.y = 1.5f;
+    rect.w = 0.25f;
+    rect.h = 12.0f;
+    intersected = SDL_GetRectAndLineIntersectionFloat(&rect, &x1, &y1, &x2, &y2);
+    validateIntersectRectAndLineFloatResults(intersected, SDL_TRUE, &rect, x1, y1, x2, y2, 2.5f, 6.0f, 2.75f, 6.0f);
+
+    return TEST_COMPLETED;
+}
+
 /**
  * Tests SDL_GetRectAndLineIntersection() clipping cases
  *
@@ -290,6 +348,21 @@ static int rect_testIntersectRectAndLineParam(void *arg)
     return TEST_COMPLETED;
 }
 
+/**
+ * Private helper to check SDL_HasRectIntersectionFloat results
+ */
+static void validateHasIntersectionFloatResults(
+    SDL_bool intersection, SDL_bool expectedIntersection,
+    SDL_FRect *rectA, SDL_FRect *rectB)
+{
+    SDLTest_AssertCheck(intersection == expectedIntersection,
+                        "Check intersection result: expected %s, got %s intersecting A (%.2f,%.2f,%.2f,%.2f) with B (%.2f,%.2f,%.2f,%.2f)",
+                        (expectedIntersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+                        (intersection == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+                        rectA->x, rectA->y, rectA->w, rectA->h,
+                        rectB->x, rectB->y, rectB->w, rectB->h);
+}
+
 /**
  * Private helper to check SDL_HasRectIntersection results
  */
@@ -313,6 +386,29 @@ static void validateHasIntersectionResults(
                         refRectB->x, refRectB->y, refRectB->w, refRectB->h);
 }
 
+/**
+ * Private helper to check SDL_GetRectIntersection results
+ */
+static void validateIntersectRectFloatResults(
+    SDL_bool intersection, SDL_bool expectedIntersection,
+    SDL_FRect *rectA, SDL_FRect *rectB,
+    SDL_FRect *result, SDL_FRect *expectedResult)
+{
+    validateHasIntersectionFloatResults(intersection, expectedIntersection, rectA, rectB);
+    if (result && expectedResult) {
+        SDLTest_AssertCheck(result->x == expectedResult->x && result->y == expectedResult->y && result->w == expectedResult->w && result->h == expectedResult->h,
+                            "Check that intersection of rectangles A (%.2f,%.2f, %.2fx%.2f) and B (%.2f,%.2f %.2fx%.2f) was correctly calculated, got (%.2f,%.2f %.2fx%.2f) expected (%.2f,%.2f,%.2f,%.2f)",
+                            rectA->x, rectA->y, rectA->w, rectA->h,
+                            rectB->x, rectB->y, rectB->w, rectB->h,
+                            result->x, result->y, result->w, result->h,
+                            expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
+    }
+    SDLTest_AssertCheck(intersection == SDL_HasRectIntersectionFloat(rectA, rectB),
+                        "Check that intersection (%s) matches SDL_HasRectIntersectionFloat() result (%s)",
+                        intersection ? "SDL_TRUE" : "SDL_FALSE",
+                        SDL_HasRectIntersectionFloat(rectA, rectB) ? "SDL_TRUE" : "SDL_FALSE");
+}
+
 /**
  * Private helper to check SDL_GetRectIntersection results
  */
@@ -355,6 +451,20 @@ static void validateUnionRectResults(
                         expectedResult->x, expectedResult->y, expectedResult->w, expectedResult->h);
 }
 
+/**
+ * Private helper to check SDL_RectEmptyFloat results
+ */
+static void validateRectEmptyFloatResults(
+    SDL_bool empty, SDL_bool expectedEmpty,
+    SDL_FRect *rect)
+{
+    SDLTest_AssertCheck(empty == expectedEmpty,
+                        "Check for correct empty result: expected %s, got %s testing (%.2f,%.2f,%.2f,%.2f)",
+                        (expectedEmpty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+                        (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE",
+                        rect->x, rect->y, rect->w, rect->h);
+}
+
 /**
  * Private helper to check SDL_RectEmpty results
  */
@@ -422,6 +532,74 @@ static void validateFRectEqualsResults(
                         refRectB->x, refRectB->y, refRectB->w, refRectB->h);
 }
 
+/**
+ * Tests SDL_GetRectIntersectionFloat()
+ *
+ * \sa SDL_GetRectIntersectionFloat
+ */
+static int rect_testIntersectRectFloat(void *arg)
+{
+    SDL_FRect rectA;
+    SDL_FRect rectB;
+    SDL_FRect result;
+    SDL_FRect expectedResult;
+    SDL_bool intersection;
+
+    rectA.x = 0.0f;
+    rectA.y = 0.0f;
+    rectA.w = 1.0f;
+    rectA.h = 1.0f;
+    rectB.x = 0.0f;
+    rectB.y = 0.0f;
+    rectB.w = 1.0f;
+    rectB.h = 1.0f;
+    expectedResult = rectA;
+    intersection = SDL_GetRectIntersectionFloat(&rectA, &rectB, &result);
+    validateIntersectRectFloatResults(intersection, SDL_TRUE, &rectA, &rectB, &result, &expectedResult);
+
+    rectA.x = 0.0f;
+    rectA.y = 0.0f;
+    rectA.w = 1.0f;
+    rectA.h = 1.0f;
+    rectB.x = 1.0f;
+    rectB.y = 0.0f;
+    rectB.w = 1.0f;
+    rectB.h = 1.0f;
+    expectedResult = rectB;
+    expectedResult.w = 0.0f;
+    intersection = SDL_GetRectIntersectionFloat(&rectA, &rectB, &result);
+    validateIntersectRectFloatResults(intersection, SDL_TRUE, &rectA, &rectB, &result, &expectedResult);
+
+    rectA.x = 0.0f;
+    rectA.y = 0.0f;
+    rectA.w = 1.0f;
+    rectA.h = 1.0f;
+    rectB.x = 1.0f;
+    rectB.y = 1.0f;
+    rectB.w = 1.0f;
+    rectB.h = 1.0f;
+    expectedResult = rectB;
+    expectedResult.w = 0.0f;
+    expectedResult.h = 0.0f;
+    intersection = SDL_GetRectIntersectionFloat(&rectA, &rectB, &result);
+    validateIntersectRectFloatResults(intersection, SDL_TRUE, &rectA, &rectB, &result, &expectedResult);
+
+    rectA.x = 0.0f;
+    rectA.y = 0.0f;
+    rectA.w = 1.0f;
+    rectA.h = 1.0f;
+    rectB.x = 2.0f;
+    rectB.y = 0.0f;
+    rectB.w = 1.0f;
+    rectB.h = 1.0f;
+    expectedResult = rectB;
+    expectedResult.w = -1.0f;
+    intersection = SDL_GetRectIntersectionFloat(&rectA, &rectB, &result);
+    validateIntersectRectFloatResults(intersection, SDL_FALSE, &rectA, &rectB, &result, &expectedResult);
+
+    return TEST_COMPLETED;
+}
+
 /**
  * Tests SDL_GetRectIntersection() with B fully inside A
  *
@@ -952,6 +1130,39 @@ static int rect_testHasIntersectionParam(void *arg)
     return TEST_COMPLETED;
 }
 
+/**
+ * Test SDL_GetRectEnclosingPointsFloat()
+ *
+ * \sa SDL_GetRectEnclosingPointsFloat
+ */
+static int rect_testEnclosePointsFloat(void *arg)
+{
+    SDL_FPoint fpts[3] = { { 1.25f, 2.5f }, { 1.75f, 3.75f }, { 3.5f, 3.0f } };
+    int i, count = 3;
+    SDL_FRect clip = { 0.0f, 1.0f, 4.0f, 4.0f };
+    SDL_FRect result;
+
+    SDL_GetRectEnclosingPointsFloat(fpts, count, &clip, &result);
+    SDLTest_AssertCheck(result.x == 1.25f && result.y == 2.5f && result.w == 2.25f && result.h == 1.25f,
+                        "Resulting enclosing rectangle incorrect: expected (%.2f,%.2f - %.2fx%.2f), actual (%.2f,%.2f - %.2fx%.2f)",
+                        1.25f, 2.5f, 2.25f, 1.25f, result.x, result.y, result.w, result.h);
+    for (i = 0; i != count; i++) {
+        SDL_bool inside;
+
+        inside = SDL_PointInRectFloat(&fpts[i], &clip);
+        SDLTest_AssertCheck(inside,
+                            "Expected point (%.2f,%.2f) to be inside clip rect (%.2f,%.2f - %.2fx%.2f)",
+                            fpts[i].x, fpts[i].y, clip.x, clip.y, clip.w, clip.h);
+
+        inside = SDL_PointInRectFloat(&fpts[i], &result);
+        SDLTest_AssertCheck(inside,
+                            "Expected point (%.2f,%.2f) to be inside result rect (%.2f,%.2f - %.2fx%.2f)",
+                            fpts[i].x, fpts[i].y, result.x, result.y, result.w, result.h);
+    }
+
+    return TEST_COMPLETED;
+}
+
 /**
  * Test SDL_GetRectEnclosingPoints() without clipping
  *
@@ -1485,6 +1696,48 @@ static int rect_testUnionRectParam(void *arg)
     return TEST_COMPLETED;
 }
 
+/**
+ * Tests SDL_RectEmptyFloat() with various inputs
+ *
+ * \sa SDL_RectEmptyFloat
+ */
+static int rect_testRectEmptyFloat(void *arg)
+{
+    SDL_FRect rect;
+    SDL_bool result;
+
+    rect.x = 0.0f;
+    rect.y = 0.0f;
+    rect.w = 1.0f;
+    rect.h = 1.0f;
+    result = SDL_RectEmptyFloat(&rect);
+    validateRectEmptyFloatResults(result, SDL_FALSE, &rect);
+
+    rect.x = 0.0f;
+    rect.y = 0.0f;
+    rect.w = 0.0f;
+    rect.h = 0.0f;
+    result = SDL_RectEmptyFloat(&rect);
+    validateRectEmptyFloatResults(result, SDL_FALSE, &rect);
+
+    rect.x = 0.0f;
+    rect.y = 0.0f;
+    rect.w = -1.0f;
+    rect.h = 1.0f;
+    result = SDL_RectEmptyFloat(&rect);
+    validateRectEmptyFloatResults(result, SDL_TRUE, &rect);
+
+    rect.x = 0.0f;
+    rect.y = 0.0f;
+    rect.w = 1.0f;
+    rect.h = -1.0f;
+    result = SDL_RectEmptyFloat(&rect);
+    validateRectEmptyFloatResults(result, SDL_TRUE, &rect);
+
+
+    return TEST_COMPLETED;
+}
+
 /**
  * Tests SDL_RectEmpty() with various inputs
  *
@@ -1669,6 +1922,11 @@ static int rect_testFRectEqualsParam(void *arg)
 
 /* Rect test cases */
 
+/* SDL_GetRectAndLineIntersectionFloat */
+static const SDLTest_TestCaseReference rectTestIntersectRectAndLineFloat = {
+    (SDLTest_TestCaseFp)rect_testIntersectRectAndLineFloat, "rect_testIntersectRectAndLineFloat", "Tests SDL_GetRectAndLineIntersectionFloat", TEST_ENABLED
+};
+
 /* SDL_GetRectAndLineIntersection */
 static const SDLTest_TestCaseReference rectTestIntersectRectAndLine = {
     (SDLTest_TestCaseFp)rect_testIntersectRectAndLine, "rect_testIntersectRectAndLine", "Tests SDL_GetRectAndLineIntersection clipping cases", TEST_ENABLED
@@ -1690,6 +1948,11 @@ static const SDLTest_TestCaseReference rectTestIntersectRectAndLineParam = {
     (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_GetRectAndLineIntersection with invalid parameters", TEST_ENABLED
 };
 
+/* SDL_GetRectIntersectionFloat */
+static const SDLTest_TestCaseReference rectTestIntersectRectFloat = {
+    (SDLTest_TestCaseFp)rect_testIntersectRectFloat, "rect_testIntersectRectFloat", "Tests SDL_GetRectIntersectionFloat", TEST_ENABLED
+};
+
 /* SDL_GetRectIntersection */
 static const SDLTest_TestCaseReference rectTestIntersectRectInside = {
     (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_GetRectIntersection with B fully contained in A", TEST_ENABLED
@@ -1740,6 +2003,11 @@ static const SDLTest_TestCaseReference rectTestHasIntersectionParam = {
     (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasRectIntersection with invalid parameters", TEST_ENABLED
 };
 
+/* SDL_GetRectEnclosingPointsFloat */
+static const SDLTest_TestCaseReference rectTestEnclosePointsFloat = {
+    (SDLTest_TestCaseFp)rect_testEnclosePointsFloat, "rect_testEnclosePointsFloat", "Tests SDL_GetRectEnclosingPointsFloat", TEST_ENABLED
+};
+
 /* SDL_GetRectEnclosingPoints */
 static const SDLTest_TestCaseReference rectTestEnclosePoints = {
     (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_GetRectEnclosingPoints without clipping", TEST_ENABLED
@@ -1774,6 +2042,11 @@ static const SDLTest_TestCaseReference rectTestUnionRectParam = {
     (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_GetRectUnion with invalid parameters", TEST_ENABLED
 };
 
+/* SDL_RectEmptyFloat */
+static const SDLTest_TestCaseReference rectTestRectEmptyFloat = {
+    (SDLTest_TestCaseFp)rect_testRectEmptyFloat, "rect_testRectEmptyFloat", "Tests SDL_RectEmptyFloat with various inputs", TEST_ENABLED
+};
+
 /* SDL_RectEmpty */
 static const SDLTest_TestCaseReference rectTestRectEmpty = {
     (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_RectEmpty with various inputs", TEST_ENABLED
@@ -1784,7 +2057,6 @@ static const SDLTest_TestCaseReference rectTestRectEmptyParam = {
 };
 
 /* SDL_RectsEqual */
-
 static const SDLTest_TestCaseReference rectTestRectEquals = {
     (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_RectsEqual with various inputs", TEST_ENABLED
 };
@@ -1794,7 +2066,6 @@ static const SDLTest_TestCaseReference rectTestRectEqualsParam = {
 };
 
 /* SDL_RectsEqualFloat */
-
 static const SDLTest_TestCaseReference rectTestFRectEquals = {
     (SDLTest_TestCaseFp)rect_testFRectEquals, "rect_testFRectEquals", "Tests SDL_RectsEqualFloat with various inputs", TEST_ENABLED
 };
@@ -1807,11 +2078,13 @@ static const SDLTest_TestCaseReference rectTestFRectEqualsParam = {
  * Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges.
  */
 static const SDLTest_TestCaseReference *rectTests[] = {
+    &rectTestIntersectRectAndLineFloat,
     &rectTestIntersectRectAndLine,
     &rectTestIntersectRectAndLineInside,
     &rectTestIntersectRectAndLineOutside,
     &rectTestIntersectRectAndLineEmpty,
     &rectTestIntersectRectAndLineParam,
+    &rectTestIntersectRectFloat,
     &rectTestIntersectRectInside,
     &rectTestIntersectRectOutside,
     &rectTestIntersectRectPartial,
@@ -1824,6 +2097,7 @@ static const SDLTest_TestCaseReference *rectTests[] = {
     &rectTestHasIntersectionPoint,
     &rectTestHasIntersectionEmpty,
     &rectTestHasIntersectionParam,
+    &rectTestEnclosePointsFloat,
     &rectTestEnclosePoints,
     &rectTestEnclosePointsWithClipping,
     &rectTestEnclosePointsRepeatedInput,
@@ -1832,6 +2106,7 @@ static const SDLTest_TestCaseReference *rectTests[] = {
     &rectTestUnionRectOutside,
     &rectTestUnionRectEmpty,
     &rectTestUnionRectParam,
+    &rectTestRectEmptyFloat,
     &rectTestRectEmpty,
     &rectTestRectEmptyParam,
     &rectTestRectEquals,