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.
This commit is contained in:
Alexandre Wilhelm committed 2015-07-06 14:14:39 -07:00
1 parent 058a73f8a0
commit 4c1e22b0f6
3 files changed
+14 -5

No files matched your search

+4 -4
View File
@@ -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];
+3
View File
@@ -34,6 +34,9 @@
@end
// Remove compiling warnings
@class Notification
@global CPApp
var CPUserNotificationCenterDelegate_userNotificationCenter_shouldPresentNotification_ = 1 << 0,
+7 -1
View File
@@ -1,7 +1,8 @@
@import <OJUnit/OJTestCase.j>
@import <AppKit/CPDatePicker.j>
@import <AppKit/CPApplication.j>
@import <AppKit/CPText.j>
@import <Foundation/Foundation.j>
[CPApplication sharedApplication];
@@ -20,4 +21,9 @@
[self assertTrue:!!datePicker];
}
- (void)testLayoutSubviews
{
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
@end