| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/animation/animatable/AnimatableUnknown.h" | 32 #include "core/animation/animatable/AnimatableUnknown.h" |
| 33 | 33 |
| 34 #include "core/animation/animatable/AnimatableNeutral.h" | 34 #include "core/animation/animatable/AnimatableNeutral.h" |
| 35 #include "core/css/CSSValuePool.h" | 35 #include "core/css/CSSValuePool.h" |
| 36 #include <gtest/gtest.h> | 36 #include <gtest/gtest.h> |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class AnimationAnimatableUnknownTest : public ::testing::Test { | 40 TEST(AnimationAnimatableUnknownTest, Create) |
| 41 protected: | |
| 42 virtual void SetUp() | |
| 43 { | |
| 44 cssValue = cssValuePool().createIdentifierValue(CSSValueYellow); | |
| 45 animatableUnknown = AnimatableUnknown::create(cssValue); | |
| 46 | |
| 47 otherCSSValue = cssValuePool().createIdentifierValue(CSSValueOrange); | |
| 48 otherAnimatableUnknown = AnimatableUnknown::create(otherCSSValue); | |
| 49 } | |
| 50 | |
| 51 RefPtrWillBePersistent<CSSValue> cssValue; | |
| 52 RefPtrWillBePersistent<AnimatableValue> animatableUnknown; | |
| 53 RefPtrWillBePersistent<CSSValue> otherCSSValue; | |
| 54 RefPtrWillBePersistent<AnimatableValue> otherAnimatableUnknown; | |
| 55 }; | |
| 56 | |
| 57 TEST_F(AnimationAnimatableUnknownTest, Create) | |
| 58 { | 41 { |
| 59 EXPECT_TRUE(animatableUnknown); | 42 CSSValue cssValue = cssValuePool().createIdentifierValue(CSSValueYellow); |
| 43 EXPECT_TRUE(AnimatableUnknown::create(cssValue)); |
| 60 } | 44 } |
| 61 | 45 |
| 62 TEST_F(AnimationAnimatableUnknownTest, ToCSSValue) | 46 TEST(AnimationAnimatableUnknownTest, ToCSSValue) |
| 63 { | 47 { |
| 64 EXPECT_EQ(cssValue, toAnimatableUnknown(animatableUnknown.get())->toCSSValue
()); | 48 CSSValue cssValue = cssValuePool().createIdentifierValue(CSSValueYellow); |
| 49 EXPECT_EQ(cssValue, AnimatableUnknown::create(cssValue)->toCSSValue()); |
| 65 } | 50 } |
| 66 | 51 |
| 67 TEST_F(AnimationAnimatableUnknownTest, Interpolate) | 52 TEST(AnimationAnimatableUnknownTest, Interpolate) |
| 68 { | 53 { |
| 54 CSSValue cssValue = cssValuePool().createIdentifierValue(CSSValueYellow); |
| 55 CSSValue otherCSSValue = cssValuePool().createIdentifierValue(CSSValueOrange
); |
| 56 RefPtrWillBePersistent<AnimatableValue> animatableUnknown = AnimatableUnknow
n::create(cssValue); |
| 57 RefPtrWillBePersistent<AnimatableValue> otherAnimatableUnknown = AnimatableU
nknown::create(otherCSSValue); |
| 58 |
| 69 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(animata
bleUnknown.get(), otherAnimatableUnknown.get(), 0).get())->toCSSValue()); | 59 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(animata
bleUnknown.get(), otherAnimatableUnknown.get(), 0).get())->toCSSValue()); |
| 70 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(animata
bleUnknown.get(), otherAnimatableUnknown.get(), 0.4).get())->toCSSValue()); | 60 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(animata
bleUnknown.get(), otherAnimatableUnknown.get(), 0.4).get())->toCSSValue()); |
| 71 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(an
imatableUnknown.get(), otherAnimatableUnknown.get(), 0.5).get())->toCSSValue()); | 61 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(an
imatableUnknown.get(), otherAnimatableUnknown.get(), 0.5).get())->toCSSValue()); |
| 72 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(an
imatableUnknown.get(), otherAnimatableUnknown.get(), 0.6).get())->toCSSValue()); | 62 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(an
imatableUnknown.get(), otherAnimatableUnknown.get(), 0.6).get())->toCSSValue()); |
| 73 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(an
imatableUnknown.get(), otherAnimatableUnknown.get(), 1).get())->toCSSValue()); | 63 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(an
imatableUnknown.get(), otherAnimatableUnknown.get(), 1).get())->toCSSValue()); |
| 74 | 64 |
| 75 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(ot
herAnimatableUnknown.get(), animatableUnknown.get(), 0).get())->toCSSValue()); | 65 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(ot
herAnimatableUnknown.get(), animatableUnknown.get(), 0).get())->toCSSValue()); |
| 76 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(ot
herAnimatableUnknown.get(), animatableUnknown.get(), 0.4).get())->toCSSValue()); | 66 EXPECT_EQ(otherCSSValue, toAnimatableUnknown(AnimatableValue::interpolate(ot
herAnimatableUnknown.get(), animatableUnknown.get(), 0.4).get())->toCSSValue()); |
| 77 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(otherAn
imatableUnknown.get(), animatableUnknown.get(), 0.5).get())->toCSSValue()); | 67 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(otherAn
imatableUnknown.get(), animatableUnknown.get(), 0.5).get())->toCSSValue()); |
| 78 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(otherAn
imatableUnknown.get(), animatableUnknown.get(), 0.6).get())->toCSSValue()); | 68 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(otherAn
imatableUnknown.get(), animatableUnknown.get(), 0.6).get())->toCSSValue()); |
| 79 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(otherAn
imatableUnknown.get(), animatableUnknown.get(), 1).get())->toCSSValue()); | 69 EXPECT_EQ(cssValue, toAnimatableUnknown(AnimatableValue::interpolate(otherAn
imatableUnknown.get(), animatableUnknown.get(), 1).get())->toCSSValue()); |
| 80 } | 70 } |
| 81 | 71 |
| 82 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |