From 05f8a10b3d3080c6c6bfa9cb776dabc168c8bca4 Mon Sep 17 00:00:00 2001 From: aburkhalter Date: Thu, 18 Mar 2010 13:39:27 -0700 Subject: [PATCH 01/10] Trivial syntax fixes. --- Jakefile | 2 +- Tools/capp/Resources/Templates/Application/Jakefile | 4 ++-- Tools/capp/Resources/Templates/NibApplication/Jakefile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Jakefile b/Jakefile index 94112040d..77a4ccc0a 100644 --- a/Jakefile +++ b/Jakefile @@ -281,7 +281,7 @@ function pushPackage(path, remote, branch) { branch = branch || "master"; - var pushPackagesPath = FILE.path(".push-package") + var pushPackagesPath = FILE.path(".push-package"); pushPackagesPath.mkdirs(); diff --git a/Tools/capp/Resources/Templates/Application/Jakefile b/Tools/capp/Resources/Templates/Application/Jakefile index 752b63495..2fa0c14f9 100644 --- a/Tools/capp/Resources/Templates/Application/Jakefile +++ b/Tools/capp/Resources/Templates/Application/Jakefile @@ -39,9 +39,9 @@ app ("__project.nameasidentifier__", function(task) function printResults(configuration) { - print("----------------------------") + print("----------------------------"); print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__")); - print("----------------------------") + print("----------------------------"); } task ("default", ["__project.nameasidentifier__"], function() diff --git a/Tools/capp/Resources/Templates/NibApplication/Jakefile b/Tools/capp/Resources/Templates/NibApplication/Jakefile index bbda96c09..41505c40a 100644 --- a/Tools/capp/Resources/Templates/NibApplication/Jakefile +++ b/Tools/capp/Resources/Templates/NibApplication/Jakefile @@ -40,9 +40,9 @@ app ("__project.nameasidentifier__", function(task) function printResults(configuration) { - print("----------------------------") + print("----------------------------"); print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__")); - print("----------------------------") + print("----------------------------"); } task ("default", ["__project.nameasidentifier__"], function() From 5d3eae9022fde66a1874e676e45f5f066465d92c Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Wed, 17 Mar 2010 16:50:43 -0700 Subject: [PATCH 02/10] deleteBackwards: => deleteBackward: --- AppKit/CPCollectionView.j | 2 +- AppKit/CPTextField.j | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index e6976c3ba..cf91c32cd 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -758,7 +758,7 @@ [self _scrollToSelection]; } -- (void)deleteBackwards:(id)sender +- (void)deleteBackward:(id)sender { if ([[self delegate] respondsToSelector:@selector(collectionView:shouldDeleteItemsAtIndexes:)]) { diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index e70984296..7459fa772 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -813,7 +813,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); if (![CPPlatform isBrowser]) { [self copy:sender]; - [self deleteBackwards:sender]; + [self deleteBackward:sender]; } } @@ -826,7 +826,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); if (![[pasteboard types] containsObject:CPStringPboardType]) return; - [self deleteBackwards:sender]; + [self deleteBackward:sender]; var selectedRange = [self selectedRange], stringValue = [self stringValue], @@ -912,7 +912,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); [self selectText:sender]; } -- (void)deleteBackwards:(id)sender +- (void)deleteBackward:(id)sender { var selectedRange = [self selectedRange], stringValue = [self stringValue], From 58179939bb812b51d842e0ccb1b725a628e2e234 Mon Sep 17 00:00:00 2001 From: Emmanuel Maillard Date: Tue, 9 Mar 2010 03:34:57 +0100 Subject: [PATCH 03/10] - fix a typo in documentation --- AppKit/CPApplication.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 2f67b076d..fd7bcfc47 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -873,7 +873,7 @@ CPRunContinuesResponse = -1002; Checks for a target in the following order:
  1. a responder from the key window
  2. -
  3. a responder frmo the main window
  4. +
  5. a responder from the main window
  6. the CPApplication instance
  7. the application delegate
  8. the document controller
  9. From 7aa1ae6bd45d3142aba2c5cb2bdf55615575b379 Mon Sep 17 00:00:00 2001 From: Emmanuel Maillard Date: Mon, 8 Mar 2010 01:20:28 +0100 Subject: [PATCH 04/10] - fix typo --- AppKit/CPFontManager.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPFontManager.j b/AppKit/CPFontManager.j index e95057b99..e4f9c8c68 100644 --- a/AppKit/CPFontManager.j +++ b/AppKit/CPFontManager.j @@ -51,7 +51,7 @@ var CPSharedFontManager = nil, // Changing the Default Font Conversion Classes /*! - Sets the class that will be used to create the applcation's + Sets the class that will be used to create the application's font manager. */ + (void)setFontManagerFactory:(Class)aClass From c8f3445fa6ecf7641e9d7a18a3a006477607005f Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Wed, 10 Mar 2010 14:09:54 +1100 Subject: [PATCH 05/10] Adding a unit test to verify fix to +[CPDictionary dictionaryWithJSObject:(JSObject)object recursively:(BOOL)recursively] --- Tests/Foundation/CPDictionaryTest.j | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tests/Foundation/CPDictionaryTest.j b/Tests/Foundation/CPDictionaryTest.j index f3936b26b..8a29cd853 100644 --- a/Tests/Foundation/CPDictionaryTest.j +++ b/Tests/Foundation/CPDictionaryTest.j @@ -16,6 +16,12 @@ string_dict = [[CPDictionary alloc] initWithObjects:[@"1", @"2"] forKeys:[@"key1", @"key2"]]; json_dict = [CPDictionary dictionaryWithJSObject:json recursively:YES]; + + json_with_nulls = { + "key1": ['1', '2', '3'], + "key2": "This is a string", + "key3": null + } } - (void)testInitWithDictionary @@ -58,6 +64,14 @@ [self assert:[[dict objectForKey:@"key3"] count] equals:1]; } +- (void)testDictionaryWithJSObjectRecursiveWithNull +{ + var dict = [CPDictionary dictionaryWithJSObject:json_with_nulls recursively:YES]; + [self assert:2 equals:[dict count]]; + [self assert:[@"key1", @"key2"] equals:[dict allKeys]]; + [self assert:[dict objectForKey:@"key3"] equals:nil]; +} + - (void)testDictionaryWithJSObjectNonRecursive { var non_recursive_dict = [CPDictionary dictionaryWithJSObject:json recursively:NO]; From 4e1e6f3c0bada5934a980d2655f4f4f308ef2e4d Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Wed, 24 Feb 2010 15:15:27 +1100 Subject: [PATCH 06/10] Little fix for CPDictionary, we should not try and recursively convert null JSON objects. --- Foundation/CPDictionary.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Foundation/CPDictionary.j b/Foundation/CPDictionary.j index e6f83f56a..8b5af8392 100755 --- a/Foundation/CPDictionary.j +++ b/Foundation/CPDictionary.j @@ -154,7 +154,7 @@ var value = object[key]; - if (recursively) + if (recursively && value != null) { if (value.constructor === Object) value = [CPDictionary dictionaryWithJSObject:value recursively:YES]; From 35b62ca53f909c20df918fd561e238f124ee5550 Mon Sep 17 00:00:00 2001 From: Alan Rogers Date: Wed, 10 Mar 2010 17:31:42 +1100 Subject: [PATCH 07/10] Updated test and fix for gh issue #539 --- Foundation/CPDictionary.j | 8 +++++++- Tests/Foundation/CPDictionaryTest.j | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Foundation/CPDictionary.j b/Foundation/CPDictionary.j index 8b5af8392..f0db3cfa1 100755 --- a/Foundation/CPDictionary.j +++ b/Foundation/CPDictionary.j @@ -153,8 +153,14 @@ continue; var value = object[key]; + + if (value == null) + { + [dictionary setObject:[CPNull null] forKey:key]; + continue; + } - if (recursively && value != null) + if (recursively) { if (value.constructor === Object) value = [CPDictionary dictionaryWithJSObject:value recursively:YES]; diff --git a/Tests/Foundation/CPDictionaryTest.j b/Tests/Foundation/CPDictionaryTest.j index 8a29cd853..3cdfd51df 100644 --- a/Tests/Foundation/CPDictionaryTest.j +++ b/Tests/Foundation/CPDictionaryTest.j @@ -67,9 +67,9 @@ - (void)testDictionaryWithJSObjectRecursiveWithNull { var dict = [CPDictionary dictionaryWithJSObject:json_with_nulls recursively:YES]; - [self assert:2 equals:[dict count]]; - [self assert:[@"key1", @"key2"] equals:[dict allKeys]]; - [self assert:[dict objectForKey:@"key3"] equals:nil]; + [self assert:3 equals:[dict count]]; + [self assert:[@"key1", @"key2", @"key3"] equals:[dict allKeys]]; + [self assert:[CPNull null] equals:[dict objectForKey:@"key3"]]; } - (void)testDictionaryWithJSObjectNonRecursive From 319b9ed00f0116ff6fbabf83415c893372d9b601 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Mon, 22 Mar 2010 14:53:49 -0700 Subject: [PATCH 08/10] Use === not ==. --- Foundation/CPDictionary.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Foundation/CPDictionary.j b/Foundation/CPDictionary.j index f0db3cfa1..28e7a1310 100755 --- a/Foundation/CPDictionary.j +++ b/Foundation/CPDictionary.j @@ -154,7 +154,7 @@ var value = object[key]; - if (value == null) + if (value === null) { [dictionary setObject:[CPNull null] forKey:key]; continue; From ef4c108b9e77a1807899e06955be71edd8056eaf Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Mon, 22 Mar 2010 15:08:29 -0700 Subject: [PATCH 09/10] Date test wasn't accurately accounting for daylight savings time. --- Tests/Foundation/CPDateTest.j | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Tests/Foundation/CPDateTest.j b/Tests/Foundation/CPDateTest.j index ccaf42666..4668d37af 100644 --- a/Tests/Foundation/CPDateTest.j +++ b/Tests/Foundation/CPDateTest.j @@ -63,12 +63,14 @@ - (void)testDescription { // Unfortunately the result will be different depending on the testing machine's timezone. - var expectedHour = 23 - var expectedMinute = 31; - var offsetHours = Math.floor(new Date().getTimezoneOffset() / 60); - var offsetMinutes = new Date().getTimezoneOffset() - offsetHours * 60; - var expectedString = [CPString stringWithFormat:"2009-02-13 %02d:%02d:30 +%02d%02d", expectedHour-offsetHours, expectedMinute-offsetMinutes, offsetHours, offsetMinutes]; - [self assert:expectedString equals: [[CPDate dateWithTimeIntervalSince1970: 1234567890] description]]; + var date = [CPDate dateWithTimeIntervalSince1970: 1234567890], + expectedHour = 23, + expectedMinute = 31, + offsetHours = Math.floor(date.getTimezoneOffset() / 60), + offsetMinutes = date.getTimezoneOffset() - offsetHours * 60, + expectedString = [CPString stringWithFormat:"2009-02-13 %02d:%02d:30 +%02d%02d", expectedHour-offsetHours, expectedMinute-offsetMinutes, offsetHours, offsetMinutes]; + + [self assert:expectedString equals:[date description]]; } - (void)testCopy From bb0835e2f3e2d8e1f9581e0aa08879f75b9580dd Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Mon, 8 Mar 2010 18:52:00 -0800 Subject: [PATCH 10/10] CPImageView should send action on drop, as in Cocoa --- AppKit/CPImageView.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j index 817ffbd0b..234f74ceb 100644 --- a/AppKit/CPImageView.j +++ b/AppKit/CPImageView.j @@ -370,7 +370,10 @@ var LEFT_SHADOW_INSET = 3.0, var images = [CPKeyedUnarchiver unarchiveObjectWithData:[[aSender draggingPasteboard] dataForType:CPImagesPboardType]]; if ([images count]) + { [self setImage:images[0]]; + [self sendAction:[self action] to:[self target]]; + } } @end