-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test function for pygame.draw.arc (resolves #2636) #2638
base: main
Are you sure you want to change the base?
Conversation
The circleci fail on this PR is not this PRs fault, don't worry. It's being resolved in another PR |
test/draw_test.py
Outdated
self.assertEqual( | ||
number_of_valid_arc_points, | ||
number_of_invalid_arc_points + number_of_valid_arc_points, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check can more simply be written as self.assertEqual(number_of_invalid_arc_points, 0)
.
Additionally, we should probably test for number_of_valid_arc_points
being correct somehow?
start = 0 | ||
stop = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should probably test a broader range of arcs than just 0 to 2 radians, probably stuff like: pi, pi/2, pi/4, 2 * pi.
"rect": rect, | ||
"start_angle": start, | ||
"stop_angle": stop, | ||
"width": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should also test on wider range of widths than just 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is here is nice, but I think this test should test more angles and more widths to fully test out draw arc.
Hi @Houda222, do you think you will make any of the changes asked for? Or should we pass this PR over to someone else to finish off? |
This pull request resolves issue #2636
I added a test function
test_arc__correct_drawing
that replaced thetodo_test_arc
function in theDrawArcMixin
class. It ensures thatpygame.draw.arc
works correctly, by checking whether the drawn arc matches the ellipse defined by the bounding rectangle. The comparison is done by measuring the difference between the ellipse's points and the arc's point and making sure it's less than a certain threshold.The test is done on different bounding rectangles.