Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 35 #include "core/animation/animatable/AnimatableLength.h" | 35 #include "core/animation/animatable/AnimatableLength.h" |
| 36 #include "core/animation/animatable/AnimatableUnknown.h" | 36 #include "core/animation/animatable/AnimatableUnknown.h" |
| 37 #include "core/css/CSSPrimitiveValue.h" | 37 #include "core/css/CSSPrimitiveValue.h" |
| 38 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 39 #include <gtest/gtest.h> | 39 #include <gtest/gtest.h> |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 const double duration = 1.0; | 43 const double duration = 1.0; |
| 44 | 44 |
| 45 PassRefPtrWillBeRawPtr<AnimatableValue> unknownAnimatableValue(double n) | 45 PassRefPtr<AnimatableValue> unknownAnimatableValue(double n) |
| 46 { | 46 { |
| 47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::UnitType::Unknown).get()); | 47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::UnitType::Unknown).get()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 PassRefPtrWillBeRawPtr<AnimatableValue> pixelAnimatableValue(double n) | 50 PassRefPtr<AnimatableValue> pixelAnimatableValue(double n) |
| 51 { | 51 { |
| 52 return AnimatableLength::create(Length(n, Fixed), 1); | 52 return AnimatableLength::create(Length(n, Fixed), 1); |
| 53 } | 53 } |
| 54 | 54 |
| 55 AnimatableValueKeyframeVector keyframesAtZeroAndOne(PassRefPtrWillBeRawPtr<Anima tableValue> zeroValue, PassRefPtrWillBeRawPtr<AnimatableValue> oneValue) | 55 AnimatableValueKeyframeVector keyframesAtZeroAndOne(PassRefPtr<AnimatableValue> zeroValue, PassRefPtr<AnimatableValue> oneValue) |
| 56 { | 56 { |
| 57 AnimatableValueKeyframeVector keyframes(2); | 57 AnimatableValueKeyframeVector keyframes(2); |
| 58 keyframes[0] = AnimatableValueKeyframe::create(); | 58 keyframes[0] = AnimatableValueKeyframe::create(); |
| 59 keyframes[0]->setOffset(0.0); | 59 keyframes[0]->setOffset(0.0); |
| 60 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue.get()); | 60 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue.get()); |
| 61 keyframes[1] = AnimatableValueKeyframe::create(); | 61 keyframes[1] = AnimatableValueKeyframe::create(); |
| 62 keyframes[1]->setOffset(1.0); | 62 keyframes[1]->setOffset(1.0); |
| 63 keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue.get()); | 63 keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue.get()); |
| 64 return keyframes; | 64 return keyframes; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void expectProperty(CSSPropertyID property, PassRefPtrWillBeRawPtr<Interpolation > interpolationValue) | 67 void expectProperty(CSSPropertyID property, PassRefPtr<Interpolation> interpolat ionValue) |
| 68 { | 68 { |
| 69 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); | 69 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); |
| 70 ASSERT_EQ(property, interpolation->id()); | 70 ASSERT_EQ(property, interpolation->id()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void expectDoubleValue(double expectedValue, PassRefPtrWillBeRawPtr<Interpolatio n> interpolationValue) | 73 void expectDoubleValue(double expectedValue, PassRefPtr<Interpolation> interpola tionValue) |
| 74 { | 74 { |
| 75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); | 75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); |
| 76 RefPtrWillBeRawPtr<AnimatableValue> value = interpolation->currentValue(); | 76 RefPtr<AnimatableValue> value = interpolation->currentValue(); |
| 77 | 77 |
| 78 ASSERT_TRUE(value->isLength() || value->isUnknown()); | 78 ASSERT_TRUE(value->isLength() || value->isUnknown()); |
| 79 | 79 |
| 80 double actualValue; | 80 double actualValue; |
| 81 if (value->isLength()) | 81 if (value->isLength()) |
| 82 actualValue = toAnimatableLength(value.get())->length(1, ValueRangeAll). value(); | 82 actualValue = toAnimatableLength(value.get())->length(1, ValueRangeAll). value(); |
| 83 else | 83 else |
| 84 actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCS SValue().get())->getDoubleValue(); | 84 actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCS SValue().get())->getDoubleValue(); |
| 85 | 85 |
| 86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); | 86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); |
| 87 } | 87 } |
| 88 | 88 |
| 89 Interpolation* findValue(WillBeHeapVector<RefPtrWillBeMember<Interpolation>>& va lues, CSSPropertyID id) | 89 Interpolation* findValue(Vector<RefPtr<Interpolation>>& values, CSSPropertyID id ) |
| 90 { | 90 { |
| 91 for (auto& value : values) { | 91 for (auto& value : values) { |
| 92 if (toLegacyStyleInterpolation(value.get())->id() == id) | 92 if (toLegacyStyleInterpolation(value.get())->id() == id) |
| 93 return value.get(); | 93 return value.get(); |
| 94 } | 94 } |
| 95 return 0; | 95 return 0; |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 TEST(AnimationKeyframeEffectModel, BasicOperation) | 99 TEST(AnimationKeyframeEffectModel, BasicOperation) |
| 100 { | 100 { |
| 101 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima tableValue(3.0), unknownAnimatableValue(5.0)); | 101 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima tableValue(3.0), unknownAnimatableValue(5.0)); |
| 102 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 102 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 103 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 103 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
|
sof
2015/09/02 13:02:12
Not due to your CL, but this type might deserve an
haraken
2015/09/03 00:12:55
Will fix in a follow-up.
| |
| 104 effect->sample(0, 0.6, duration, values); | 104 effect->sample(0, 0.6, duration, values); |
| 105 ASSERT_EQ(1UL, values->size()); | 105 ASSERT_EQ(1UL, values->size()); |
| 106 expectProperty(CSSPropertyLeft, values->at(0)); | 106 expectProperty(CSSPropertyLeft, values->at(0)); |
| 107 expectDoubleValue(5.0, values->at(0)); | 107 expectDoubleValue(5.0, values->at(0)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 TEST(AnimationKeyframeEffectModel, CompositeReplaceNonInterpolable) | 110 TEST(AnimationKeyframeEffectModel, CompositeReplaceNonInterpolable) |
| 111 { | 111 { |
| 112 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima tableValue(3.0), unknownAnimatableValue(5.0)); | 112 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima tableValue(3.0), unknownAnimatableValue(5.0)); |
| 113 keyframes[0]->setComposite(EffectModel::CompositeReplace); | 113 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 114 keyframes[1]->setComposite(EffectModel::CompositeReplace); | 114 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 115 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 115 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 116 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 116 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 117 effect->sample(0, 0.6, duration, values); | 117 effect->sample(0, 0.6, duration, values); |
| 118 expectDoubleValue(5.0, values->at(0)); | 118 expectDoubleValue(5.0, values->at(0)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 TEST(AnimationKeyframeEffectModel, CompositeReplace) | 121 TEST(AnimationKeyframeEffectModel, CompositeReplace) |
| 122 { | 122 { |
| 123 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 123 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 124 keyframes[0]->setComposite(EffectModel::CompositeReplace); | 124 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 125 keyframes[1]->setComposite(EffectModel::CompositeReplace); | 125 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 126 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 126 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 127 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 127 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 128 effect->sample(0, 0.6, duration, values); | 128 effect->sample(0, 0.6, duration, values); |
| 129 expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, values->at(0)); | 129 expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, values->at(0)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 132 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 133 TEST(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) | 133 TEST(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) |
| 134 { | 134 { |
| 135 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 135 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 136 keyframes[0]->setComposite(EffectModel::CompositeAdd); | 136 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 137 keyframes[1]->setComposite(EffectModel::CompositeAdd); | 137 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 138 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 138 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 139 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 139 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 140 effect->sample(0, 0.6, duration, values); | 140 effect->sample(0, 0.6, duration, values); |
| 141 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 141 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 TEST(AnimationKeyframeEffectModel, CompositeEaseIn) | 144 TEST(AnimationKeyframeEffectModel, CompositeEaseIn) |
| 145 { | 145 { |
| 146 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 146 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 147 keyframes[0]->setComposite(EffectModel::CompositeReplace); | 147 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 148 keyframes[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingF unction::EaseIn)); | 148 keyframes[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingF unction::EaseIn)); |
| 149 keyframes[1]->setComposite(EffectModel::CompositeReplace); | 149 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 150 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 150 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 151 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 151 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 152 effect->sample(0, 0.6, duration, values); | 152 effect->sample(0, 0.6, duration, values); |
| 153 expectDoubleValue(3.8579516, values->at(0)); | 153 expectDoubleValue(3.8579516, values->at(0)); |
| 154 effect->sample(0, 0.6, duration * 100, values); | 154 effect->sample(0, 0.6, duration * 100, values); |
| 155 expectDoubleValue(3.8582394, values->at(0)); | 155 expectDoubleValue(3.8582394, values->at(0)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 TEST(AnimationKeyframeEffectModel, CompositeCubicBezier) | 158 TEST(AnimationKeyframeEffectModel, CompositeCubicBezier) |
| 159 { | 159 { |
| 160 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 160 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 161 keyframes[0]->setComposite(EffectModel::CompositeReplace); | 161 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 162 keyframes[0]->setEasing(CubicBezierTimingFunction::create(0.42, 0, 0.58, 1)) ; | 162 keyframes[0]->setEasing(CubicBezierTimingFunction::create(0.42, 0, 0.58, 1)) ; |
| 163 keyframes[1]->setComposite(EffectModel::CompositeReplace); | 163 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 164 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 164 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 165 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 165 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 166 effect->sample(0, 0.6, duration, values); | 166 effect->sample(0, 0.6, duration, values); |
| 167 expectDoubleValue(4.3363357, values->at(0)); | 167 expectDoubleValue(4.3363357, values->at(0)); |
| 168 effect->sample(0, 0.6, duration * 1000, values); | 168 effect->sample(0, 0.6, duration * 1000, values); |
| 169 expectDoubleValue(4.3362322, values->at(0)); | 169 expectDoubleValue(4.3362322, values->at(0)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 TEST(AnimationKeyframeEffectModel, ExtrapolateReplaceNonInterpolable) | 172 TEST(AnimationKeyframeEffectModel, ExtrapolateReplaceNonInterpolable) |
| 173 { | 173 { |
| 174 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima tableValue(3.0), unknownAnimatableValue(5.0)); | 174 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima tableValue(3.0), unknownAnimatableValue(5.0)); |
| 175 keyframes[0]->setComposite(EffectModel::CompositeReplace); | 175 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 176 keyframes[1]->setComposite(EffectModel::CompositeReplace); | 176 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 177 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 177 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 178 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 178 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 179 effect->sample(0, 1.6, duration, values); | 179 effect->sample(0, 1.6, duration, values); |
| 180 expectDoubleValue(5.0, values->at(0)); | 180 expectDoubleValue(5.0, values->at(0)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 TEST(AnimationKeyframeEffectModel, ExtrapolateReplace) | 183 TEST(AnimationKeyframeEffectModel, ExtrapolateReplace) |
| 184 { | 184 { |
| 185 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 185 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 186 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 186 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 187 keyframes[0]->setComposite(EffectModel::CompositeReplace); | 187 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 188 keyframes[1]->setComposite(EffectModel::CompositeReplace); | 188 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 189 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 189 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 190 effect->sample(0, 1.6, duration, values); | 190 effect->sample(0, 1.6, duration, values); |
| 191 expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, values->at(0)); | 191 expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, values->at(0)); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 194 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 195 TEST(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) | 195 TEST(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) |
| 196 { | 196 { |
| 197 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 197 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 198 keyframes[0]->setComposite(EffectModel::CompositeAdd); | 198 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 199 keyframes[1]->setComposite(EffectModel::CompositeAdd); | 199 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 200 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 200 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 201 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 201 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 202 effect->sample(0, 1.6, duration, values); | 202 effect->sample(0, 1.6, duration, values); |
| 203 expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, values->at(0)); | 203 expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, values->at(0)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 TEST(AnimationKeyframeEffectModel, ZeroKeyframes) | 206 TEST(AnimationKeyframeEffectModel, ZeroKeyframes) |
| 207 { | 207 { |
| 208 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(AnimatableValueKeyframeVector()); | 208 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(AnimatableValueKeyframeVector()); |
| 209 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 209 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 210 effect->sample(0, 0.5, duration, values); | 210 effect->sample(0, 0.5, duration, values); |
| 211 EXPECT_TRUE(values->isEmpty()); | 211 EXPECT_TRUE(values->isEmpty()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 214 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 215 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetZero) | 215 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetZero) |
| 216 { | 216 { |
| 217 AnimatableValueKeyframeVector keyframes(1); | 217 AnimatableValueKeyframeVector keyframes(1); |
| 218 keyframes[0] = AnimatableValueKeyframe::create(); | 218 keyframes[0] = AnimatableValueKeyframe::create(); |
| 219 keyframes[0]->setOffset(0.0); | 219 keyframes[0]->setOffset(0.0); |
| 220 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); | 220 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); |
| 221 | 221 |
| 222 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 222 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 223 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 223 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 224 effect->sample(0, 0.6, duration, values); | 224 effect->sample(0, 0.6, duration, values); |
| 225 expectDoubleValue(3.0, values->at(0)); | 225 expectDoubleValue(3.0, values->at(0)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 228 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 229 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetOne) | 229 TEST(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetOne) |
| 230 { | 230 { |
| 231 AnimatableValueKeyframeVector keyframes(1); | 231 AnimatableValueKeyframeVector keyframes(1); |
| 232 keyframes[0] = AnimatableValueKeyframe::create(); | 232 keyframes[0] = AnimatableValueKeyframe::create(); |
| 233 keyframes[0]->setOffset(1.0); | 233 keyframes[0]->setOffset(1.0); |
| 234 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge t()); | 234 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge t()); |
| 235 | 235 |
| 236 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 236 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 237 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 237 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 238 effect->sample(0, 0.6, duration, values); | 238 effect->sample(0, 0.6, duration, values); |
| 239 expectDoubleValue(7.0 * 0.4 + 5.0 * 0.6, values->at(0)); | 239 expectDoubleValue(7.0 * 0.4 + 5.0 * 0.6, values->at(0)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 TEST(AnimationKeyframeEffectModel, MoreThanTwoKeyframes) | 242 TEST(AnimationKeyframeEffectModel, MoreThanTwoKeyframes) |
| 243 { | 243 { |
| 244 AnimatableValueKeyframeVector keyframes(3); | 244 AnimatableValueKeyframeVector keyframes(3); |
| 245 keyframes[0] = AnimatableValueKeyframe::create(); | 245 keyframes[0] = AnimatableValueKeyframe::create(); |
| 246 keyframes[0]->setOffset(0.0); | 246 keyframes[0]->setOffset(0.0); |
| 247 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); | 247 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); |
| 248 keyframes[1] = AnimatableValueKeyframe::create(); | 248 keyframes[1] = AnimatableValueKeyframe::create(); |
| 249 keyframes[1]->setOffset(0.5); | 249 keyframes[1]->setOffset(0.5); |
| 250 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0). get()); | 250 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0). get()); |
| 251 keyframes[2] = AnimatableValueKeyframe::create(); | 251 keyframes[2] = AnimatableValueKeyframe::create(); |
| 252 keyframes[2]->setOffset(1.0); | 252 keyframes[2]->setOffset(1.0); |
| 253 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); | 253 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); |
| 254 | 254 |
| 255 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 255 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 256 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 256 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 257 effect->sample(0, 0.3, duration, values); | 257 effect->sample(0, 0.3, duration, values); |
| 258 expectDoubleValue(4.0, values->at(0)); | 258 expectDoubleValue(4.0, values->at(0)); |
| 259 effect->sample(0, 0.8, duration, values); | 259 effect->sample(0, 0.8, duration, values); |
| 260 expectDoubleValue(5.0, values->at(0)); | 260 expectDoubleValue(5.0, values->at(0)); |
| 261 } | 261 } |
| 262 | 262 |
| 263 TEST(AnimationKeyframeEffectModel, EndKeyframeOffsetsUnspecified) | 263 TEST(AnimationKeyframeEffectModel, EndKeyframeOffsetsUnspecified) |
| 264 { | 264 { |
| 265 AnimatableValueKeyframeVector keyframes(3); | 265 AnimatableValueKeyframeVector keyframes(3); |
| 266 keyframes[0] = AnimatableValueKeyframe::create(); | 266 keyframes[0] = AnimatableValueKeyframe::create(); |
| 267 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); | 267 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); |
| 268 keyframes[1] = AnimatableValueKeyframe::create(); | 268 keyframes[1] = AnimatableValueKeyframe::create(); |
| 269 keyframes[1]->setOffset(0.5); | 269 keyframes[1]->setOffset(0.5); |
| 270 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0). get()); | 270 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0). get()); |
| 271 keyframes[2] = AnimatableValueKeyframe::create(); | 271 keyframes[2] = AnimatableValueKeyframe::create(); |
| 272 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); | 272 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); |
| 273 | 273 |
| 274 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 274 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 275 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 275 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 276 effect->sample(0, 0.1, duration, values); | 276 effect->sample(0, 0.1, duration, values); |
| 277 expectDoubleValue(3.0, values->at(0)); | 277 expectDoubleValue(3.0, values->at(0)); |
| 278 effect->sample(0, 0.6, duration, values); | 278 effect->sample(0, 0.6, duration, values); |
| 279 expectDoubleValue(4.0, values->at(0)); | 279 expectDoubleValue(4.0, values->at(0)); |
| 280 effect->sample(0, 0.9, duration, values); | 280 effect->sample(0, 0.9, duration, values); |
| 281 expectDoubleValue(5.0, values->at(0)); | 281 expectDoubleValue(5.0, values->at(0)); |
| 282 } | 282 } |
| 283 | 283 |
| 284 TEST(AnimationKeyframeEffectModel, SampleOnKeyframe) | 284 TEST(AnimationKeyframeEffectModel, SampleOnKeyframe) |
| 285 { | 285 { |
| 286 AnimatableValueKeyframeVector keyframes(3); | 286 AnimatableValueKeyframeVector keyframes(3); |
| 287 keyframes[0] = AnimatableValueKeyframe::create(); | 287 keyframes[0] = AnimatableValueKeyframe::create(); |
| 288 keyframes[0]->setOffset(0.0); | 288 keyframes[0]->setOffset(0.0); |
| 289 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); | 289 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); |
| 290 keyframes[1] = AnimatableValueKeyframe::create(); | 290 keyframes[1] = AnimatableValueKeyframe::create(); |
| 291 keyframes[1]->setOffset(0.5); | 291 keyframes[1]->setOffset(0.5); |
| 292 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0). get()); | 292 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(4.0). get()); |
| 293 keyframes[2] = AnimatableValueKeyframe::create(); | 293 keyframes[2] = AnimatableValueKeyframe::create(); |
| 294 keyframes[2]->setOffset(1.0); | 294 keyframes[2]->setOffset(1.0); |
| 295 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); | 295 keyframes[2]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); |
| 296 | 296 |
| 297 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 297 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 298 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 298 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 299 effect->sample(0, 0.0, duration, values); | 299 effect->sample(0, 0.0, duration, values); |
| 300 expectDoubleValue(3.0, values->at(0)); | 300 expectDoubleValue(3.0, values->at(0)); |
| 301 effect->sample(0, 0.5, duration, values); | 301 effect->sample(0, 0.5, duration, values); |
| 302 expectDoubleValue(4.0, values->at(0)); | 302 expectDoubleValue(4.0, values->at(0)); |
| 303 effect->sample(0, 1.0, duration, values); | 303 effect->sample(0, 1.0, duration, values); |
| 304 expectDoubleValue(5.0, values->at(0)); | 304 expectDoubleValue(5.0, values->at(0)); |
| 305 } | 305 } |
| 306 | 306 |
| 307 TEST(AnimationKeyframeEffectModel, MultipleKeyframesWithSameOffset) | 307 TEST(AnimationKeyframeEffectModel, MultipleKeyframesWithSameOffset) |
| 308 { | 308 { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 329 keyframes[6]->setOffset(0.9); | 329 keyframes[6]->setOffset(0.9); |
| 330 keyframes[6]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(6.0). get()); | 330 keyframes[6]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(6.0). get()); |
| 331 keyframes[7] = AnimatableValueKeyframe::create(); | 331 keyframes[7] = AnimatableValueKeyframe::create(); |
| 332 keyframes[7]->setOffset(0.9); | 332 keyframes[7]->setOffset(0.9); |
| 333 keyframes[7]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0). get()); | 333 keyframes[7]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0). get()); |
| 334 keyframes[8] = AnimatableValueKeyframe::create(); | 334 keyframes[8] = AnimatableValueKeyframe::create(); |
| 335 keyframes[8]->setOffset(1.0); | 335 keyframes[8]->setOffset(1.0); |
| 336 keyframes[8]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0). get()); | 336 keyframes[8]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(7.0). get()); |
| 337 | 337 |
| 338 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 338 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 339 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 339 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 340 effect->sample(0, 0.0, duration, values); | 340 effect->sample(0, 0.0, duration, values); |
| 341 expectDoubleValue(0.0, values->at(0)); | 341 expectDoubleValue(0.0, values->at(0)); |
| 342 effect->sample(0, 0.2, duration, values); | 342 effect->sample(0, 0.2, duration, values); |
| 343 expectDoubleValue(2.0, values->at(0)); | 343 expectDoubleValue(2.0, values->at(0)); |
| 344 effect->sample(0, 0.4, duration, values); | 344 effect->sample(0, 0.4, duration, values); |
| 345 expectDoubleValue(3.0, values->at(0)); | 345 expectDoubleValue(3.0, values->at(0)); |
| 346 effect->sample(0, 0.5, duration, values); | 346 effect->sample(0, 0.5, duration, values); |
| 347 expectDoubleValue(5.0, values->at(0)); | 347 expectDoubleValue(5.0, values->at(0)); |
| 348 effect->sample(0, 0.6, duration, values); | 348 effect->sample(0, 0.6, duration, values); |
| 349 expectDoubleValue(5.0, values->at(0)); | 349 expectDoubleValue(5.0, values->at(0)); |
| 350 effect->sample(0, 0.8, duration, values); | 350 effect->sample(0, 0.8, duration, values); |
| 351 expectDoubleValue(6.0, values->at(0)); | 351 expectDoubleValue(6.0, values->at(0)); |
| 352 effect->sample(0, 1.0, duration, values); | 352 effect->sample(0, 1.0, duration, values); |
| 353 expectDoubleValue(7.0, values->at(0)); | 353 expectDoubleValue(7.0, values->at(0)); |
| 354 } | 354 } |
| 355 | 355 |
| 356 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 356 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 357 TEST(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) | 357 TEST(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) |
| 358 { | 358 { |
| 359 AnimatableValueKeyframeVector keyframes(2); | 359 AnimatableValueKeyframeVector keyframes(2); |
| 360 keyframes[0] = AnimatableValueKeyframe::create(); | 360 keyframes[0] = AnimatableValueKeyframe::create(); |
| 361 keyframes[0]->setOffset(0.0); | 361 keyframes[0]->setOffset(0.0); |
| 362 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0).ge t()); | 362 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0).ge t()); |
| 363 keyframes[1] = AnimatableValueKeyframe::create(); | 363 keyframes[1] = AnimatableValueKeyframe::create(); |
| 364 keyframes[1]->setOffset(1.0); | 364 keyframes[1]->setOffset(1.0); |
| 365 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge t()); | 365 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge t()); |
| 366 keyframes[1]->setComposite(EffectModel::CompositeAdd); | 366 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 367 | 367 |
| 368 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 368 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 369 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 369 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 370 effect->sample(0, 0.6, duration, values); | 370 effect->sample(0, 0.6, duration, values); |
| 371 expectDoubleValue(3.0 * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 371 expectDoubleValue(3.0 * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 372 } | 372 } |
| 373 | 373 |
| 374 TEST(AnimationKeyframeEffectModel, MultipleProperties) | 374 TEST(AnimationKeyframeEffectModel, MultipleProperties) |
| 375 { | 375 { |
| 376 AnimatableValueKeyframeVector keyframes(2); | 376 AnimatableValueKeyframeVector keyframes(2); |
| 377 keyframes[0] = AnimatableValueKeyframe::create(); | 377 keyframes[0] = AnimatableValueKeyframe::create(); |
| 378 keyframes[0]->setOffset(0.0); | 378 keyframes[0]->setOffset(0.0); |
| 379 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); | 379 keyframes[0]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(3.0). get()); |
| 380 keyframes[0]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(4.0) .get()); | 380 keyframes[0]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(4.0) .get()); |
| 381 keyframes[1] = AnimatableValueKeyframe::create(); | 381 keyframes[1] = AnimatableValueKeyframe::create(); |
| 382 keyframes[1]->setOffset(1.0); | 382 keyframes[1]->setOffset(1.0); |
| 383 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); | 383 keyframes[1]->setPropertyValue(CSSPropertyLeft, unknownAnimatableValue(5.0). get()); |
| 384 keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0) .get()); | 384 keyframes[1]->setPropertyValue(CSSPropertyRight, unknownAnimatableValue(6.0) .get()); |
| 385 | 385 |
| 386 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 386 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 387 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 387 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 388 effect->sample(0, 0.6, duration, values); | 388 effect->sample(0, 0.6, duration, values); |
| 389 EXPECT_EQ(2UL, values->size()); | 389 EXPECT_EQ(2UL, values->size()); |
| 390 Interpolation* leftValue = findValue(*values.get(), CSSPropertyLeft); | 390 Interpolation* leftValue = findValue(*values.get(), CSSPropertyLeft); |
| 391 ASSERT_TRUE(leftValue); | 391 ASSERT_TRUE(leftValue); |
| 392 expectDoubleValue(5.0, leftValue); | 392 expectDoubleValue(5.0, leftValue); |
| 393 Interpolation* rightValue = findValue(*values.get(), CSSPropertyRight); | 393 Interpolation* rightValue = findValue(*values.get(), CSSPropertyRight); |
| 394 ASSERT_TRUE(rightValue); | 394 ASSERT_TRUE(rightValue); |
| 395 expectDoubleValue(6.0, rightValue); | 395 expectDoubleValue(6.0, rightValue); |
| 396 } | 396 } |
| 397 | 397 |
| 398 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 398 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 399 TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) | 399 TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) |
| 400 { | 400 { |
| 401 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); | 401 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(3.0), pixelAnimatableValue(5.0)); |
| 402 keyframes[0]->setComposite(EffectModel::CompositeAdd); | 402 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 403 keyframes[1]->setComposite(EffectModel::CompositeAdd); | 403 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 404 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 404 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 405 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 405 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 406 effect->sample(0, 0.6, duration, values); | 406 effect->sample(0, 0.6, duration, values); |
| 407 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 407 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 408 expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); | 408 expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); |
| 409 } | 409 } |
| 410 | 410 |
| 411 TEST(AnimationKeyframeEffectModel, MultipleIterations) | 411 TEST(AnimationKeyframeEffectModel, MultipleIterations) |
| 412 { | 412 { |
| 413 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(1.0), pixelAnimatableValue(3.0)); | 413 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata bleValue(1.0), pixelAnimatableValue(3.0)); |
| 414 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 414 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 415 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 415 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 416 effect->sample(0, 0.5, duration, values); | 416 effect->sample(0, 0.5, duration, values); |
| 417 expectDoubleValue(2.0, values->at(0)); | 417 expectDoubleValue(2.0, values->at(0)); |
| 418 effect->sample(1, 0.5, duration, values); | 418 effect->sample(1, 0.5, duration, values); |
| 419 expectDoubleValue(2.0, values->at(0)); | 419 expectDoubleValue(2.0, values->at(0)); |
| 420 effect->sample(2, 0.5, duration, values); | 420 effect->sample(2, 0.5, duration, values); |
| 421 expectDoubleValue(2.0, values->at(0)); | 421 expectDoubleValue(2.0, values->at(0)); |
| 422 } | 422 } |
| 423 | 423 |
| 424 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 424 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 425 TEST(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) | 425 TEST(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) |
| 426 { | 426 { |
| 427 AnimatableValueKeyframeVector keyframes(3); | 427 AnimatableValueKeyframeVector keyframes(3); |
| 428 keyframes[0] = AnimatableValueKeyframe::create(); | 428 keyframes[0] = AnimatableValueKeyframe::create(); |
| 429 keyframes[0]->setOffset(0.0); | 429 keyframes[0]->setOffset(0.0); |
| 430 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge t()); | 430 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge t()); |
| 431 keyframes[0]->setComposite(EffectModel::CompositeAdd); | 431 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 432 keyframes[1] = AnimatableValueKeyframe::create(); | 432 keyframes[1] = AnimatableValueKeyframe::create(); |
| 433 keyframes[1]->setOffset(0.5); | 433 keyframes[1]->setOffset(0.5); |
| 434 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge t()); | 434 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge t()); |
| 435 keyframes[2] = AnimatableValueKeyframe::create(); | 435 keyframes[2] = AnimatableValueKeyframe::create(); |
| 436 keyframes[2]->setOffset(1.0); | 436 keyframes[2]->setOffset(1.0); |
| 437 keyframes[2]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge t()); | 437 keyframes[2]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge t()); |
| 438 | 438 |
| 439 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); | 439 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(keyframes); |
| 440 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu es = nullptr; | 440 OwnPtr<Vector<RefPtr<Interpolation>>> values = nullptr; |
| 441 effect->sample(0, 0, duration, values); | 441 effect->sample(0, 0, duration, values); |
| 442 EXPECT_TRUE(values->at(0)); | 442 EXPECT_TRUE(values->at(0)); |
| 443 effect->sample(0, 0.1, duration, values); | 443 effect->sample(0, 0.1, duration, values); |
| 444 EXPECT_TRUE(values->at(0)); | 444 EXPECT_TRUE(values->at(0)); |
| 445 effect->sample(0, 0.25, duration, values); | 445 effect->sample(0, 0.25, duration, values); |
| 446 EXPECT_TRUE(values->at(0)); | 446 EXPECT_TRUE(values->at(0)); |
| 447 effect->sample(0, 0.4, duration, values); | 447 effect->sample(0, 0.4, duration, values); |
| 448 EXPECT_TRUE(values->at(0)); | 448 EXPECT_TRUE(values->at(0)); |
| 449 effect->sample(0, 0.5, duration, values); | 449 effect->sample(0, 0.5, duration, values); |
| 450 EXPECT_FALSE(values->at(0)); | 450 EXPECT_FALSE(values->at(0)); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); | 564 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); |
| 565 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); | 565 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); |
| 566 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); | 566 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); |
| 567 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); | 567 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); |
| 568 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); | 568 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); |
| 569 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); | 569 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); |
| 570 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); | 570 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); |
| 571 } | 571 } |
| 572 | 572 |
| 573 } // namespace blink | 573 } // namespace blink |
| OLD | NEW |