Changeset 140205 in webkit


Ignore:
Timestamp:
Jan 18, 2013 1:56:24 PM (11 years ago)
Author:
eae@chromium.org
Message:

Update LayoutUnit rounding unit test
https://bugs.webkit.org/show_bug.cgi?id=107322

Reviewed by Levi Weintraub.

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).

  • TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp:

(TestWebKitAPI::TEST):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r140204 r140205  
     12013-01-18  Emil A Eklund  <eae@chromium.org>
     2
     3        Update LayoutUnit rounding unit test
     4        https://bugs.webkit.org/show_bug.cgi?id=107322
     5
     6        Reviewed by Levi Weintraub.
     7       
     8        Update the LayoutUnitRounding test to use fromFloatRound for
     9        values that cannot accurately be represented as a LayoutUnit
     10        (the default behavior is to floor the value to the nearest
     11        LayoutUnit).
     12
     13        * TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp:
     14        (TestWebKitAPI::TEST):
     15
    1162013-01-18  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    217
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/LayoutUnit.cpp

    r140192 r140205  
    8484    ASSERT_EQ(LayoutUnit(-1.9f).round(), -2);
    8585    ASSERT_EQ(LayoutUnit(-1.6f).round(), -2);
    86     ASSERT_EQ(LayoutUnit(-1.52f).round(), -2);
    87     ASSERT_EQ(LayoutUnit(-1.5f).round(), -1);
    88     ASSERT_EQ(LayoutUnit(-1.49f).round(), -1);
     86    ASSERT_EQ(LayoutUnit::fromFloatRound(-1.51f).round(), -2);
     87    ASSERT_EQ(LayoutUnit::fromFloatRound(-1.5f).round(), -1);
     88    ASSERT_EQ(LayoutUnit::fromFloatRound(-1.49f).round(), -1);
    8989    ASSERT_EQ(LayoutUnit(-1.0f).round(), -1);
    90     ASSERT_EQ(LayoutUnit(-0.99f).round(), -1);
    91     ASSERT_EQ(LayoutUnit(-0.51f).round(), 0);
    92     ASSERT_EQ(LayoutUnit(-0.50f).round(), 0);
    93     ASSERT_EQ(LayoutUnit(-0.49f).round(), 0);
     90    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.99f).round(), -1);
     91    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.51f).round(), -1);
     92    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.50f).round(), 0);
     93    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.49f).round(), 0);
    9494    ASSERT_EQ(LayoutUnit(-0.1f).round(), 0);
    9595    ASSERT_EQ(LayoutUnit(0.0f).round(), 0);
    9696    ASSERT_EQ(LayoutUnit(0.1f).round(), 0);
    97     ASSERT_EQ(LayoutUnit(0.49f).round(), 0);
    98     ASSERT_EQ(LayoutUnit(0.50f).round(), 1);
     97    ASSERT_EQ(LayoutUnit::fromFloatRound(0.49f).round(), 0);
     98    ASSERT_EQ(LayoutUnit::fromFloatRound(0.50f).round(), 1);
     99    ASSERT_EQ(LayoutUnit::fromFloatRound(0.51f).round(), 1);
    99100    ASSERT_EQ(LayoutUnit(0.99f).round(), 1);
    100101    ASSERT_EQ(LayoutUnit(1.0f).round(), 1);
    101     ASSERT_EQ(LayoutUnit(1.49f).round(), 1);
    102     ASSERT_EQ(LayoutUnit(1.5f).round(), 2);
     102    ASSERT_EQ(LayoutUnit::fromFloatRound(1.49f).round(), 1);
     103    ASSERT_EQ(LayoutUnit::fromFloatRound(1.5f).round(), 2);
     104    ASSERT_EQ(LayoutUnit::fromFloatRound(1.51f).round(), 2);
    103105}
    104106
Note: See TracChangeset for help on using the changeset viewer.