Skip to content
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

Update syntax for ObjC constraint API usage to avoid long lines. #2682

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

freakboy3742
Copy link
Member

@freakboy3742 freakboy3742 commented Jun 29, 2024

With the fix for beeware/rubicon-objc#148 being introduced in Rubicon 0.4.9, we can now remove the unwieldy long lines when creating NSLayoutConstraint objects.

This was fixed in the process of trying to narrow down an intermittent segfault I was seeing in the testing for #2666. The underlying fix for that issue is included here (a window cleanup autouse fixture, with explicit GC passes in the app and window cleanup fixtures). That segfault was caused by garbage collection of NSWindow (and related) objects in the pytest thread; we previously added a GC pass in the Window tests to allow for this class of issue, but we've recently added app tests that also create windows; and the main window is also (sometimes) prone to this issue.

Updating the constraint syntax is mostly incidental to the test stability fix - but I spent a lot of time poking around constraints, so I did some housekeeping while I was in the area.

This also corrects an edge case around testbed startup that I've now seen a couple of times on iOS. If the pytest thread starts quickly, the main window may not have been assigned yet, resulting in an exception being raised in testbed startup.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

testbed/tests/testbed.py Outdated Show resolved Hide resolved
@freakboy3742 freakboy3742 requested a review from mhsmith July 2, 2024 05:41
@mhsmith mhsmith merged commit e343028 into beeware:main Jul 2, 2024
32 of 35 checks passed
@freakboy3742 freakboy3742 deleted the constraint-cleanup branch July 2, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants