| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 TEST(AnimationAnimatableDoubleTest, ToDouble) { | 49 TEST(AnimationAnimatableDoubleTest, ToDouble) { |
| 50 EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble()); | 50 EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble()); |
| 51 EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble()); | 51 EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 TEST(AnimationAnimatableDoubleTest, Interpolate) { | 54 TEST(AnimationAnimatableDoubleTest, Interpolate) { |
| 55 RefPtr<AnimatableDouble> from10 = AnimatableDouble::create(10); | 55 RefPtr<AnimatableDouble> from10 = AnimatableDouble::create(10); |
| 56 RefPtr<AnimatableDouble> to20 = AnimatableDouble::create(20); | 56 RefPtr<AnimatableDouble> to20 = AnimatableDouble::create(20); |
| 57 EXPECT_EQ( | 57 EXPECT_EQ( |
| 58 5, toAnimatableDouble( | 58 5, |
| 59 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) | 59 toAnimatableDouble( |
| 60 ->toDouble()); | 60 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) |
| 61 ->toDouble()); |
| 61 EXPECT_EQ(10, | 62 EXPECT_EQ(10, |
| 62 toAnimatableDouble( | 63 toAnimatableDouble( |
| 63 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get()) | 64 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get()) |
| 64 ->toDouble()); | 65 ->toDouble()); |
| 65 EXPECT_EQ( | 66 EXPECT_EQ( |
| 66 14, toAnimatableDouble( | 67 14, |
| 67 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get()) | 68 toAnimatableDouble( |
| 68 ->toDouble()); | 69 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get()) |
| 70 ->toDouble()); |
| 69 EXPECT_EQ( | 71 EXPECT_EQ( |
| 70 15, toAnimatableDouble( | 72 15, |
| 71 AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get()) | 73 toAnimatableDouble( |
| 72 ->toDouble()); | 74 AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get()) |
| 75 ->toDouble()); |
| 73 EXPECT_EQ( | 76 EXPECT_EQ( |
| 74 16, toAnimatableDouble( | 77 16, |
| 75 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get()) | 78 toAnimatableDouble( |
| 76 ->toDouble()); | 79 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get()) |
| 80 ->toDouble()); |
| 77 EXPECT_EQ(20, | 81 EXPECT_EQ(20, |
| 78 toAnimatableDouble( | 82 toAnimatableDouble( |
| 79 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get()) | 83 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get()) |
| 80 ->toDouble()); | 84 ->toDouble()); |
| 81 EXPECT_EQ( | 85 EXPECT_EQ( |
| 82 25, toAnimatableDouble( | 86 25, |
| 83 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) | 87 toAnimatableDouble( |
| 84 ->toDouble()); | 88 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) |
| 89 ->toDouble()); |
| 85 } | 90 } |
| 86 | 91 |
| 87 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |