Bug 107322

Summary: Update LayoutUnit rounding unit test
Product: WebKit Reporter: Emil A Eklund <eae>
Component: Tools / TestsAssignee: Emil A Eklund <eae>
Status: RESOLVED FIXED    
Severity: Normal CC: leviw
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Emil A Eklund 2013-01-18 13:51:16 PST
Update the LayoutUnitRounding test to use fromFloatRound for values that cannot accurately be represented as a LayoutUnit (the default behavior is to floor the value to the nearest LayoutUnit).
Comment 1 Emil A Eklund 2013-01-18 13:52:38 PST
Created attachment 183539 [details]
Patch
Comment 2 Levi Weintraub 2013-01-18 13:53:50 PST
Comment on attachment 183539 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=183539&action=review

> Tools/TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp:99
> +    ASSERT_EQ(LayoutUnit::fromFloatRound(0.49f).round(), 0);
> +    ASSERT_EQ(LayoutUnit::fromFloatRound(0.50f).round(), 1);
>      ASSERT_EQ(LayoutUnit(0.99f).round(), 1);

For consistency with above, should you check 0.51f here as well?

> Tools/TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp:102
> +    ASSERT_EQ(LayoutUnit::fromFloatRound(1.49f).round(), 1);
> +    ASSERT_EQ(LayoutUnit::fromFloatRound(1.5f).round(), 2);

Ditto
Comment 3 Emil A Eklund 2013-01-18 13:55:07 PST
Created attachment 183541 [details]
Patch
Comment 4 Levi Weintraub 2013-01-18 13:55:50 PST
Comment on attachment 183541 [details]
Patch

Who has two thumbs and is equal to r?
Me.
Comment 5 Emil A Eklund 2013-01-18 13:57:15 PST
(In reply to comment #4)
> (From update of attachment 183541 [details])
> Who has two thumbs and is equal to r?
> Me.

Thanks
Isn't it closer to 1.98 thumbs at the moment though?
Comment 6 Levi Weintraub 2013-01-18 13:58:44 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 183541 [details] [details])
> > Who has two thumbs and is equal to r?
> > Me.
> 
> Thanks
> Isn't it closer to 1.98 thumbs at the moment though?

1.98 rounds to 2. Be careful I don't r- and demand that be included!
Comment 7 Emil A Eklund 2013-01-18 14:02:31 PST
Committed r140205: <http://trac.webkit.org/changeset/140205>