From 72455f43d4ee25b1257c1ef27889d879e985ca02 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Tue, 30 Apr 2013 00:57:42 +0100 Subject: [PATCH] Test: expose child window level crash bug if present. This manual test exposes the bug addressed by issue #1911. --- .../AttachedSheet2/SheetWindowController.j | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tests/Manual/AttachedSheet2/SheetWindowController.j b/Tests/Manual/AttachedSheet2/SheetWindowController.j index ea4631af0..096beec68 100644 --- a/Tests/Manual/AttachedSheet2/SheetWindowController.j +++ b/Tests/Manual/AttachedSheet2/SheetWindowController.j @@ -259,6 +259,23 @@ [self disableUnlinkedButtons]; [self showWindow:self]; + + // This code exposes the bug described in issue #1911 by adding a CPPanel child window at a different window + // level than the parent window and then immediately closing it. To test, click the Window button. If a + // crash ensues the #1911 fix is not operating. On the other hand if the panel widnow is never seen and + // the window opens like normal everything is correct. + var windows = [CPApp windows]; + + if ([windows count] >= 2) + { + var w = [[CPPanel alloc] initWithContentRect:CGRectMake(100, 100, 100, 100) + styleMask:CPTitledWindowMask | CPClosableWindowMask | CPResizableWindowMask | CPHUDBackgroundWindowMask]; + [w setLevel:CPFloatingWindowLevel]; + [[windows objectAtIndex:0] addChildWindow:w ordered:CPWindowAbove]; + [[windows objectAtIndex:0] makeKeyAndOrderFront:nil]; + [w orderOut:nil]; + [[self window] makeKeyAndOrderFront:nil]; + } } //