mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-23 16:48:53 +00:00
Merge branch 'main' into refactor-remove-nativehost-target
This commit is contained in:
commit
be8d536565
5 files changed
+54
-4
No files matched your search
+2
-1
@@ -137,7 +137,8 @@ var bottomHeight = 71;
|
||||
@delegate -(void)alertDidEnd:(CPAlert)theAlert returnCode:(int)returnCode;
|
||||
Called when the user dismisses the alert by clicking one of the buttons.
|
||||
@param theAlert the alert panel that the user dismissed
|
||||
@param returnCode the index of the button that the user clicked (starting from 0,
|
||||
@param returnCode the tag of the button that the user clicked. Unless a button's
|
||||
tag has been changed, it is the button's index (starting from 0,
|
||||
representing the first button added to the alert which appears on the
|
||||
right, 1 representing the next button to the left and so on)
|
||||
*/
|
||||
|
||||
@@ -205,7 +205,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
|
||||
bounds.size.height -= [horizontalScrollerClass scrollerWidthInStyle:scrollerStyle];
|
||||
|
||||
if (verticalScrollerClass)
|
||||
bounds.size.width -= [verticalScrollerClass scrollerWidthForControlSize:scrollerStyle];
|
||||
bounds.size.width -= [verticalScrollerClass scrollerWidthInStyle:scrollerStyle];
|
||||
|
||||
return bounds.size;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
|
||||
frameSize.height += [horizontalScrollerClass scrollerWidthInStyle:scrollerStyle];
|
||||
|
||||
if (verticalScrollerClass)
|
||||
frameSize.width += [verticalScrollerClass scrollerWidthForControlSize:scrollerStyle];
|
||||
frameSize.width += [verticalScrollerClass scrollerWidthInStyle:scrollerStyle];
|
||||
|
||||
return frameSize;
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ function CPDecimalAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
// swap sign over over/underflow exception
|
||||
if (CPCalculationUnderflow == adderror)
|
||||
adderror = CPCalculationOverflow;
|
||||
else if (CPCalculationUnderflow == adderror)
|
||||
else if (CPCalculationOverflow == adderror)
|
||||
adderror = CPCalculationUnderflow;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -379,5 +379,48 @@
|
||||
[self assertSize:expected.size equals:actual.size message:message]
|
||||
}
|
||||
|
||||
- (void)testFrameSizeForContentSizeUsesScrollerStyleForBothScrollers
|
||||
{
|
||||
var frameSize = [CPScrollView frameSizeForContentSize:CGSizeMake(100.0, 100.0)
|
||||
horizontalScrollerClass:[_CPScrollViewTestScroller class]
|
||||
verticalScrollerClass:[_CPScrollViewTestScroller class]
|
||||
borderType:CPNoBorder
|
||||
controlSize:CPRegularControlSize
|
||||
scrollerStyle:CPScrollerStyleOverlay];
|
||||
|
||||
[self assertSize:CGSizeMake(105.0, 105.0) equals:frameSize message:@"both scroller widths come from scrollerWidthInStyle:"];
|
||||
}
|
||||
|
||||
- (void)testContentSizeForFrameSizeUsesScrollerStyleForBothScrollers
|
||||
{
|
||||
var contentSize = [CPScrollView contentSizeForFrameSize:CGSizeMake(100.0, 100.0)
|
||||
horizontalScrollerClass:[_CPScrollViewTestScroller class]
|
||||
verticalScrollerClass:[_CPScrollViewTestScroller class]
|
||||
borderType:CPNoBorder
|
||||
controlSize:CPRegularControlSize
|
||||
scrollerStyle:CPScrollerStyleOverlay];
|
||||
|
||||
[self assertSize:CGSizeMake(95.0, 95.0) equals:contentSize message:@"both scroller widths come from scrollerWidthInStyle:"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/*!
|
||||
A scroller whose widths differ by style, and whose control-size width differs
|
||||
from both, so a size calculation that uses the wrong method is detectable
|
||||
regardless of the theme.
|
||||
*/
|
||||
@implementation _CPScrollViewTestScroller : CPScroller
|
||||
|
||||
+ (float)scrollerWidthInStyle:(CPScrollerStyle)aStyle
|
||||
{
|
||||
return aStyle === CPScrollerStyleOverlay ? 5.0 : 20.0;
|
||||
}
|
||||
|
||||
+ (float)scrollerWidthForControlSize:(CPControlSize)aControlSize
|
||||
{
|
||||
return 99.0;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -468,6 +468,12 @@
|
||||
d1 = CPDecimalMakeWithString(@"1e127");
|
||||
d2 = CPDecimalMakeWithString(@"99999999999999999999999999999999999999e127");
|
||||
[self assert:CPDecimalAdd(d1, d1, d2, CPRoundPlain) equals:CPCalculationOverflow message:"CPDecimalAdd() Tao1: addition loss of precision"];
|
||||
|
||||
// Overflow of two negative operands is reported as underflow
|
||||
d1 = CPDecimalMakeWithString(@"-1e127");
|
||||
d2 = CPDecimalMakeWithString(@"-99999999999999999999999999999999999999e127");
|
||||
[self assert:CPCalculationUnderflow equals:CPDecimalAdd(d1, d1, d2, CPRoundPlain) message:"CPDecimalAdd() Tao2: negative overflow is reported as underflow"];
|
||||
[self assert:YES equals:d1._isNegative message:"CPDecimalAdd() Tao2: sign"];
|
||||
}
|
||||
|
||||
- (void)testSubtract
|
||||
|
||||
Reference in new issue
Block a user