From 18e943a65b643e90a657c803e2152180cafc7daa Mon Sep 17 00:00:00 2001 From: Mike Fellows Date: Fri, 3 Dec 2010 01:59:41 -0800 Subject: [PATCH] Expand the KeyEquivalent manual test to include tests for the keys allowed without Cmd/Ctrl modifier. Also include an additional check that each button's callback is being called. --- Tests/Manual/KeyEquivalents/AppController.j | 85 ++++++++++++++++----- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/Tests/Manual/KeyEquivalents/AppController.j b/Tests/Manual/KeyEquivalents/AppController.j index 8dcc6c177..f7836955f 100644 --- a/Tests/Manual/KeyEquivalents/AppController.j +++ b/Tests/Manual/KeyEquivalents/AppController.j @@ -8,7 +8,6 @@ @import - @implementation AppController : CPObject { } @@ -18,14 +17,16 @@ var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], contentView = [theWindow contentView]; + function plainFormatter(aString, aLevel, aTitle){ + return aString; + } + CPLogRegisterRange(CPLogDefault, "debug", "debug", plainFormatter); + CPLogRegisterRange(CPLogDefault, "warn", "warn", plainFormatter); + var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; - - [label setStringValue:@"Press Cmd-X on the keyboard for each button and verify that it reacts."]; - [label setFont:[CPFont boldSystemFontOfSize:24.0]]; - + [label setStringValue:@"Press Cmd-X on Mac, or Ctrl-X on Windows, on the keyboard for each button and verify that it reacts."]; + [label setFont:[CPFont boldSystemFontOfSize:14.0]]; [label sizeToFit]; - - [label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin]; [label setFrameOrigin:CGPointMake(10, 10)]; [contentView addSubview:label]; @@ -43,36 +44,82 @@ "[", "\\", "]" - ]; + ]; - for (var i=0; i 32 && eventKey.charCodeAt(0) < 127 ? "Key: " + eventKey + ", " : ""); + + CPLog.debug("TestButton \"" + [self title] + "\", " + keyMessage + "anEvent: " + anEvent); + + return [super performKeyEquivalent:anEvent]; } -@end \ No newline at end of file +@end