mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-26 19:47:42 +00:00
Restack and makeKey no longer map a window AppKit considers hidden, and setIsVisible: NO always unmaps, so the client's splash stays hidden. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
37 lines
1.7 KiB
Python
37 lines
1.7 KiB
Python
"""Check that the patched X11 backend cannot re-map a window AppKit has hidden."""
|
|
import unittest
|
|
import test_runtime_compatibility as sources
|
|
|
|
|
|
def body(source, signature):
|
|
return source.split(signature + ' {', 1)[1].split('\n}', 1)[0]
|
|
|
|
|
|
class HiddenWindowChecks(unittest.TestCase):
|
|
patched = sources.CompatibilityChecks.patched
|
|
|
|
def test_restack_and_make_key_map_only_visible_windows(self):
|
|
source = self.patched('cocotron', 'AppKit/X11.backend/X11Window.m')
|
|
self.assertIn('[_delegate isVisible]', body(source, '- (void) ensureMappedIfVisible'))
|
|
for signature in ('- (void) placeAboveWindow: (NSInteger) otherNumber',
|
|
'- (void) placeBelowWindow: (NSInteger) otherNumber', '- (void) makeKey'):
|
|
method = body(source, signature)
|
|
self.assertIn('[self ensureMappedIfVisible]', method, signature)
|
|
self.assertNotIn('[self ensureMapped]', method, signature)
|
|
|
|
def test_ordering_marks_window_visible_before_placing_it(self):
|
|
source = self.patched('cocotron', 'AppKit/NSWindow.m')
|
|
ordering = source.split('relativeTo: (NSInteger) relativeTo\n{', 1)[1].split('\n}', 1)[0]
|
|
for call in ('placeAboveWindow', 'placeBelowWindow'):
|
|
self.assertLess(ordering.index('_isVisible = YES'), ordering.index(call))
|
|
|
|
def test_hiding_reaches_the_platform_window_when_already_not_visible(self):
|
|
source = self.patched('cocotron', 'AppKit/NSWindow.m')
|
|
method = body(source, '- (void) setIsVisible: (BOOL) visible')
|
|
self.assertIn('_isVisible == visible && visible', method)
|
|
self.assertIn('hideWindow', method)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|