Bug 107322 - Update LayoutUnit rounding unit test
Summary: Update LayoutUnit rounding unit test
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Emil A Eklund
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-18 13:51 PST by Emil A Eklund
Modified: 2013-01-18 14:02 PST (History)
1 user (show)

See Also:


Attachments
Patch (2.72 KB, patch)
2013-01-18 13:52 PST, Emil A Eklund
no flags Details | Formatted Diff | Diff
Patch (2.84 KB, patch)
2013-01-18 13:55 PST, Emil A Eklund
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>