[Webkit-unassigned] [Bug 266855] Add infinity check to FloatQuad::boundingBox
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Dec 26 12:01:22 PST 2023
https://bugs.webkit.org/show_bug.cgi?id=266855
--- Comment #5 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
(In reply to Ahmad Saleem from comment #4)
> TEST(FloatQuad, BoundingBox)
> {
> FloatQuad quad(FloatPoint(2, 3), FloatPoint(5, 7), FloatPoint(11, 13),
> FloatPoint(17, 19));
> FloatRect rect = quad.boundingBox();
> ASSERT_EQ(rect.x(), 2);
> ASSERT_EQ(rect.y(), 3);
> ASSERT_EQ(rect.width(), 17 - 2);
> ASSERT_EQ(rect.height(), 19 - 3);
> }
>
> TEST(FloatQuad, BoundingBoxSaturateInf)
> {
> constexpr double inf = std::numeric_limits<double>::infinity();
> FloatQuad quad(FloatPoint(-inf, 3), FloatPoint(5, inf), FloatPoint(11,
> 13), FloatPoint(17, 19));
> FloatRect rect = quad.boundingBox();
> ASSERT_EQ(rect.x(), std::numeric_limits<int>::min());
> ASSERT_EQ(rect.y(), 3.0f);
> ASSERT_EQ(rect.width(), 17.0f - std::numeric_limits<int>::min());
> ASSERT_EQ(rect.height(),
> static_cast<float>(std::numeric_limits<int>::max()) - 3.0f);
> }
>
> TEST(FloatQuad, BoundingBoxSaturateLarge)
> {
> constexpr double large = std::numeric_limits<float>::max() * 4;
> FloatQuad quad(FloatPoint(-large, 3), FloatPoint(5, large),
> FloatPoint(11, 13), FloatPoint(17, 19));
> FloatRect rect = quad.boundingBox();
> ASSERT_EQ(rect.x(), std::numeric_limits<int>::min());
> ASSERT_EQ(rect.y(), 3.0f);
> ASSERT_EQ(rect.width(), 17.0f - std::numeric_limits<int>::min());
> ASSERT_EQ(rect.height(),
> static_cast<float>(std::numeric_limits<int>::max()) - 3.0f);
> }
With change -
Ran 3 tests of 3 with 3 successful
------------------------------
All tests successfully passed!
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231226/7145a35d/attachment.htm>
More information about the webkit-unassigned
mailing list