From 4c1e22b0f6c4bd6b77692e9b0e3695a3c7627e3f Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 6 Jul 2015 14:14:39 -0700 Subject: [PATCH] Fixed: travis failed because the unittests tried to display a layer Previously, the unittests for the CPDatePicker broke the tests suite of cappuccino. A CPDatePicker uses a CALayer, and the CALayer display methods wasn't wrap in a #if PLATFOrM(DOM). Now it does, so during the tests we do not try to access do the element document anymore. This PR fixes also some warnings when compiling. --- AppKit/CoreAnimation/CALayer.j | 8 ++++---- Foundation/CPUserNotificationCenter.j | 3 +++ Tests/AppKit/CPDatePickerTest.j | 8 +++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/AppKit/CoreAnimation/CALayer.j b/AppKit/CoreAnimation/CALayer.j index 433a36253..2230b7197 100644 --- a/AppKit/CoreAnimation/CALayer.j +++ b/AppKit/CoreAnimation/CALayer.j @@ -27,7 +27,8 @@ @import "CGContext.j" @import "CGGeometry.j" - +@import "CPColor.j" +@import "CPView.j" #define DOM(aLayer) aLayer._DOMElement @@ -494,11 +495,11 @@ var CALayerRegisteredRunLoopUpdates = nil; */ - (void)display { +#if PLATFORM(DOM) if (!_context) { _context = CGBitmapGraphicsContextCreate(); -#if PLATFORM(DOM) _DOMContentsElement = _context.DOMElement; _DOMContentsElement.style.zIndex = -100; @@ -516,7 +517,6 @@ var CALayerRegisteredRunLoopUpdates = nil; _DOMContentsElement.style.height = ROUND(CGRectGetHeight(_backingStoreFrame)) + "px"; _DOMElement.appendChild(_DOMContentsElement); -#endif } if (USE_BUFFER) @@ -534,6 +534,7 @@ var CALayerRegisteredRunLoopUpdates = nil; [self drawInContext:CABackingStoreGetContext(_contents)]; } +#endif [self composite]; } @@ -796,7 +797,6 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) if (mask & CALayerDisplayUpdateMask) [layer display]; - else if (mask & CALayerFrameSizeUpdateMask || mask & CALayerCompositeUpdateMask) [layer composite]; diff --git a/Foundation/CPUserNotificationCenter.j b/Foundation/CPUserNotificationCenter.j index f7679be1c..34800d940 100644 --- a/Foundation/CPUserNotificationCenter.j +++ b/Foundation/CPUserNotificationCenter.j @@ -34,6 +34,9 @@ @end +// Remove compiling warnings +@class Notification + @global CPApp var CPUserNotificationCenterDelegate_userNotificationCenter_shouldPresentNotification_ = 1 << 0, diff --git a/Tests/AppKit/CPDatePickerTest.j b/Tests/AppKit/CPDatePickerTest.j index 78fb204aa..6b0779d92 100644 --- a/Tests/AppKit/CPDatePickerTest.j +++ b/Tests/AppKit/CPDatePickerTest.j @@ -1,7 +1,8 @@ +@import @import @import -@import +@import [CPApplication sharedApplication]; @@ -20,4 +21,9 @@ [self assertTrue:!!datePicker]; } +- (void)testLayoutSubviews +{ + [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode]; +} + @end