DescriptionFixing reflectivity of operator== for timing functions.
(Also added a bunch of equality tests to make sure no other bugs exist.)
Previously, ((A == B) == (B == A)) was not true in all cases.
If A was a preset and B was a Custom with identical internal values to the
preset, then the reflectivity would not hold.
Before this patch, the test output looked like the following:
----
TEST_F(TimingFunctionTest, CubicOperatorEqReflectivityBug)
{
RefPtr<TimingFunction> cubicA = CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn);
RefPtr<TimingFunction> cubicB = CubicBezierTimingFunction::create(0.42, 0.0, 1.0, 1.0);
EXPECT_REFV_NE(cubicA, cubicB);
EXPECT_REFV_NE(cubicB, cubicA);
}
[ RUN ] TimingFunctionTest.CubicOperatorEqReflectivityBug
../../third_party/WebKit/Source/core/platform/animation/TimingFunctionTest.cpp:111: Failure
Expected: (*(cubicB.get())) != (*(cubicA.get())), actual: CubicBezierTimingFunction@0x16d1b01f2ec0(Custom, 0.42, 0, 1, 1) vs CubicBezierTimingFunction@0x16d1b01f2020(EaseIn, 0.42, 0, 1, 1)
[ FAILED ] TimingFunctionTest.CubicOperatorEqReflectivityBug (0 ms)
----
TEST_F(TimingFunctionTest, StepsOperatorEqReflectivityBug)
{
RefPtr<TimingFunction> stepsA = StepsTimingFunction::preset(StepsTimingFunction::Start);
RefPtr<TimingFunction> stepsB = StepsTimingFunction::create(1, true);
EXPECT_REFV_NE(stepsA, stepsB);
EXPECT_REFV_NE(stepsB, stepsA);
}
[ RUN ] TimingFunctionTest.StepsOperatorEqReflectivityBug
../../third_party/WebKit/Source/core/platform/animation/TimingFunctionTest.cpp:180: Failure
Expected: (*(stepsB.get())) != (*(stepsA.get())), actual: StepsTimingFunction@0x16d1b01ea800(Custom, 1, true) vs StepsTimingFunction@0x16d1b01e9f20(Start, 1, true)
[ FAILED ] TimingFunctionTest.StepsOperatorEqReflectivityBug (0 ms)
----
DEPENDS=https://codereview.chromium.org/39223002/
BUG=
Patch Set 1 : #
Messages
Total messages: 6 (0 generated)
|