| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 105 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 106 effect->sample(0, 0.6, duration, values); | 106 effect->sample(0, 0.6, duration, values); |
| 107 ASSERT_EQ(1UL, values->size()); | 107 ASSERT_EQ(1UL, values->size()); |
| 108 expectProperty(CSSPropertyLeft, values->at(0)); | 108 expectProperty(CSSPropertyLeft, values->at(0)); |
| 109 expectDoubleValue(5.0, values->at(0)); | 109 expectDoubleValue(5.0, values->at(0)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 TEST(AnimationKeyframeEffectModel, CompositeReplaceNonInterpolable) | 112 TEST(AnimationKeyframeEffectModel, CompositeReplaceNonInterpolable) |
| 113 { | 113 { |
| 114 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima
tableValue(3.0), unknownAnimatableValue(5.0)); | 114 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima
tableValue(3.0), unknownAnimatableValue(5.0)); |
| 115 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 115 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 116 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 116 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 117 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 117 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 118 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 118 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 119 effect->sample(0, 0.6, duration, values); | 119 effect->sample(0, 0.6, duration, values); |
| 120 expectDoubleValue(5.0, values->at(0)); | 120 expectDoubleValue(5.0, values->at(0)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 TEST(AnimationKeyframeEffectModel, CompositeReplace) | 123 TEST(AnimationKeyframeEffectModel, CompositeReplace) |
| 124 { | 124 { |
| 125 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 125 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 126 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 126 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 127 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 127 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 128 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 128 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 129 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 129 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 130 effect->sample(0, 0.6, duration, values); | 130 effect->sample(0, 0.6, duration, values); |
| 131 expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, values->at(0)); | 131 expectDoubleValue(3.0 * 0.4 + 5.0 * 0.6, values->at(0)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 134 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 135 TEST(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) | 135 TEST(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) |
| 136 { | 136 { |
| 137 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 137 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 138 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 138 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 139 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 139 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 140 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 140 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 141 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 141 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 142 effect->sample(0, 0.6, duration, values); | 142 effect->sample(0, 0.6, duration, values); |
| 143 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 143 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 TEST(AnimationKeyframeEffectModel, CompositeEaseIn) | 146 TEST(AnimationKeyframeEffectModel, CompositeEaseIn) |
| 147 { | 147 { |
| 148 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 148 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 149 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 149 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 150 keyframes[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingF
unction::EaseIn)); | 150 keyframes[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingF
unction::EaseIn)); |
| 151 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 151 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 152 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 152 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 153 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 153 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 154 effect->sample(0, 0.6, duration, values); | 154 effect->sample(0, 0.6, duration, values); |
| 155 expectDoubleValue(3.8579516, values->at(0)); | 155 expectDoubleValue(3.8579516, values->at(0)); |
| 156 effect->sample(0, 0.6, duration * 100, values); | 156 effect->sample(0, 0.6, duration * 100, values); |
| 157 expectDoubleValue(3.8582394, values->at(0)); | 157 expectDoubleValue(3.8582394, values->at(0)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TEST(AnimationKeyframeEffectModel, CompositeCubicBezier) | 160 TEST(AnimationKeyframeEffectModel, CompositeCubicBezier) |
| 161 { | 161 { |
| 162 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 162 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 163 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 163 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 164 keyframes[0]->setEasing(CubicBezierTimingFunction::create(0.42, 0, 0.58, 1))
; | 164 keyframes[0]->setEasing(CubicBezierTimingFunction::create(0.42, 0, 0.58, 1))
; |
| 165 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 165 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 166 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 166 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 167 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 167 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 168 effect->sample(0, 0.6, duration, values); | 168 effect->sample(0, 0.6, duration, values); |
| 169 expectDoubleValue(4.3363357, values->at(0)); | 169 expectDoubleValue(4.3363357, values->at(0)); |
| 170 effect->sample(0, 0.6, duration * 1000, values); | 170 effect->sample(0, 0.6, duration * 1000, values); |
| 171 expectDoubleValue(4.3362322, values->at(0)); | 171 expectDoubleValue(4.3362322, values->at(0)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 TEST(AnimationKeyframeEffectModel, ExtrapolateReplaceNonInterpolable) | 174 TEST(AnimationKeyframeEffectModel, ExtrapolateReplaceNonInterpolable) |
| 175 { | 175 { |
| 176 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima
tableValue(3.0), unknownAnimatableValue(5.0)); | 176 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(unknownAnima
tableValue(3.0), unknownAnimatableValue(5.0)); |
| 177 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 177 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 178 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 178 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 179 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 179 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 180 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 180 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 181 effect->sample(0, 1.6, duration, values); | 181 effect->sample(0, 1.6, duration, values); |
| 182 expectDoubleValue(5.0, values->at(0)); | 182 expectDoubleValue(5.0, values->at(0)); |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST(AnimationKeyframeEffectModel, ExtrapolateReplace) | 185 TEST(AnimationKeyframeEffectModel, ExtrapolateReplace) |
| 186 { | 186 { |
| 187 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 187 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 188 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 188 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 189 keyframes[0]->setComposite(AnimationEffect::CompositeReplace); | 189 keyframes[0]->setComposite(EffectModel::CompositeReplace); |
| 190 keyframes[1]->setComposite(AnimationEffect::CompositeReplace); | 190 keyframes[1]->setComposite(EffectModel::CompositeReplace); |
| 191 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 191 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 192 effect->sample(0, 1.6, duration, values); | 192 effect->sample(0, 1.6, duration, values); |
| 193 expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, values->at(0)); | 193 expectDoubleValue(3.0 * -0.6 + 5.0 * 1.6, values->at(0)); |
| 194 } | 194 } |
| 195 | 195 |
| 196 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 196 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 197 TEST(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) | 197 TEST(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) |
| 198 { | 198 { |
| 199 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 199 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 200 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 200 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 201 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 201 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 202 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 202 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 203 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 203 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 204 effect->sample(0, 1.6, duration, values); | 204 effect->sample(0, 1.6, duration, values); |
| 205 expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, values->at(0)); | 205 expectDoubleValue((7.0 + 3.0) * -0.6 + (7.0 + 5.0) * 1.6, values->at(0)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 TEST(AnimationKeyframeEffectModel, ZeroKeyframes) | 208 TEST(AnimationKeyframeEffectModel, ZeroKeyframes) |
| 209 { | 209 { |
| 210 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); | 210 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(AnimatableValueKeyframeVector()); |
| 211 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 211 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 358 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 359 TEST(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) | 359 TEST(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) |
| 360 { | 360 { |
| 361 AnimatableValueKeyframeVector keyframes(2); | 361 AnimatableValueKeyframeVector keyframes(2); |
| 362 keyframes[0] = AnimatableValueKeyframe::create(); | 362 keyframes[0] = AnimatableValueKeyframe::create(); |
| 363 keyframes[0]->setOffset(0.0); | 363 keyframes[0]->setOffset(0.0); |
| 364 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0).ge
t()); | 364 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(3.0).ge
t()); |
| 365 keyframes[1] = AnimatableValueKeyframe::create(); | 365 keyframes[1] = AnimatableValueKeyframe::create(); |
| 366 keyframes[1]->setOffset(1.0); | 366 keyframes[1]->setOffset(1.0); |
| 367 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge
t()); | 367 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(5.0).ge
t()); |
| 368 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 368 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 369 | 369 |
| 370 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 370 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 371 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 371 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 372 effect->sample(0, 0.6, duration, values); | 372 effect->sample(0, 0.6, duration, values); |
| 373 expectDoubleValue(3.0 * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 373 expectDoubleValue(3.0 * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 374 } | 374 } |
| 375 | 375 |
| 376 TEST(AnimationKeyframeEffectModel, MultipleProperties) | 376 TEST(AnimationKeyframeEffectModel, MultipleProperties) |
| 377 { | 377 { |
| 378 AnimatableValueKeyframeVector keyframes(2); | 378 AnimatableValueKeyframeVector keyframes(2); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 394 expectDoubleValue(5.0, leftValue); | 394 expectDoubleValue(5.0, leftValue); |
| 395 Interpolation* rightValue = findValue(*values.get(), CSSPropertyRight); | 395 Interpolation* rightValue = findValue(*values.get(), CSSPropertyRight); |
| 396 ASSERT_TRUE(rightValue); | 396 ASSERT_TRUE(rightValue); |
| 397 expectDoubleValue(6.0, rightValue); | 397 expectDoubleValue(6.0, rightValue); |
| 398 } | 398 } |
| 399 | 399 |
| 400 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 400 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 401 TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) | 401 TEST(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) |
| 402 { | 402 { |
| 403 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); | 403 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(3.0), pixelAnimatableValue(5.0)); |
| 404 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 404 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 405 keyframes[1]->setComposite(AnimationEffect::CompositeAdd); | 405 keyframes[1]->setComposite(EffectModel::CompositeAdd); |
| 406 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 406 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 407 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 407 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 408 effect->sample(0, 0.6, duration, values); | 408 effect->sample(0, 0.6, duration, values); |
| 409 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); | 409 expectDoubleValue((7.0 + 3.0) * 0.4 + (7.0 + 5.0) * 0.6, values->at(0)); |
| 410 expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); | 410 expectDoubleValue((9.0 + 3.0) * 0.4 + (9.0 + 5.0) * 0.6, values->at(0)); |
| 411 } | 411 } |
| 412 | 412 |
| 413 TEST(AnimationKeyframeEffectModel, MultipleIterations) | 413 TEST(AnimationKeyframeEffectModel, MultipleIterations) |
| 414 { | 414 { |
| 415 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(1.0), pixelAnimatableValue(3.0)); | 415 AnimatableValueKeyframeVector keyframes = keyframesAtZeroAndOne(pixelAnimata
bleValue(1.0), pixelAnimatableValue(3.0)); |
| 416 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 416 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 417 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 417 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 418 effect->sample(0, 0.5, duration, values); | 418 effect->sample(0, 0.5, duration, values); |
| 419 expectDoubleValue(2.0, values->at(0)); | 419 expectDoubleValue(2.0, values->at(0)); |
| 420 effect->sample(1, 0.5, duration, values); | 420 effect->sample(1, 0.5, duration, values); |
| 421 expectDoubleValue(2.0, values->at(0)); | 421 expectDoubleValue(2.0, values->at(0)); |
| 422 effect->sample(2, 0.5, duration, values); | 422 effect->sample(2, 0.5, duration, values); |
| 423 expectDoubleValue(2.0, values->at(0)); | 423 expectDoubleValue(2.0, values->at(0)); |
| 424 } | 424 } |
| 425 | 425 |
| 426 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. | 426 // FIXME: Re-enable this test once compositing of CompositeAdd is supported. |
| 427 TEST(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) | 427 TEST(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) |
| 428 { | 428 { |
| 429 AnimatableValueKeyframeVector keyframes(3); | 429 AnimatableValueKeyframeVector keyframes(3); |
| 430 keyframes[0] = AnimatableValueKeyframe::create(); | 430 keyframes[0] = AnimatableValueKeyframe::create(); |
| 431 keyframes[0]->setOffset(0.0); | 431 keyframes[0]->setOffset(0.0); |
| 432 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); | 432 keyframes[0]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); |
| 433 keyframes[0]->setComposite(AnimationEffect::CompositeAdd); | 433 keyframes[0]->setComposite(EffectModel::CompositeAdd); |
| 434 keyframes[1] = AnimatableValueKeyframe::create(); | 434 keyframes[1] = AnimatableValueKeyframe::create(); |
| 435 keyframes[1]->setOffset(0.5); | 435 keyframes[1]->setOffset(0.5); |
| 436 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); | 436 keyframes[1]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); |
| 437 keyframes[2] = AnimatableValueKeyframe::create(); | 437 keyframes[2] = AnimatableValueKeyframe::create(); |
| 438 keyframes[2]->setOffset(1.0); | 438 keyframes[2]->setOffset(1.0); |
| 439 keyframes[2]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); | 439 keyframes[2]->setPropertyValue(CSSPropertyLeft, pixelAnimatableValue(1.0).ge
t()); |
| 440 | 440 |
| 441 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 441 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 442 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; | 442 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> valu
es = nullptr; |
| 443 effect->sample(0, 0, duration, values); | 443 effect->sample(0, 0, duration, values); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 473 EXPECT_DOUBLE_EQ(0.0, propertySpecificKeyframes[0]->offset()); | 473 EXPECT_DOUBLE_EQ(0.0, propertySpecificKeyframes[0]->offset()); |
| 474 EXPECT_DOUBLE_EQ(0.5, propertySpecificKeyframes[1]->offset()); | 474 EXPECT_DOUBLE_EQ(0.5, propertySpecificKeyframes[1]->offset()); |
| 475 EXPECT_DOUBLE_EQ(1.0, propertySpecificKeyframes[2]->offset()); | 475 EXPECT_DOUBLE_EQ(1.0, propertySpecificKeyframes[2]->offset()); |
| 476 } | 476 } |
| 477 | 477 |
| 478 TEST(AnimationKeyframeEffectModel, ToKeyframeEffectModel) | 478 TEST(AnimationKeyframeEffectModel, ToKeyframeEffectModel) |
| 479 { | 479 { |
| 480 AnimatableValueKeyframeVector keyframes(0); | 480 AnimatableValueKeyframeVector keyframes(0); |
| 481 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); | 481 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 482 | 482 |
| 483 AnimationEffect* baseEffect = effect.get(); | 483 EffectModel* baseEffect = effect.get(); |
| 484 EXPECT_TRUE(toAnimatableValueKeyframeEffectModel(baseEffect)); | 484 EXPECT_TRUE(toAnimatableValueKeyframeEffectModel(baseEffect)); |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace | 487 } // namespace |
| 488 | 488 |
| 489 namespace blink { | 489 namespace blink { |
| 490 | 490 |
| 491 class KeyframeEffectModelTest : public ::testing::Test { | 491 class KeyframeEffectModelTest : public ::testing::Test { |
| 492 public: | 492 public: |
| 493 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes) | 493 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); | 566 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); |
| 567 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); | 567 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); |
| 568 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); | 568 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); |
| 569 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); | 569 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); |
| 570 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); | 570 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); |
| 571 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); | 571 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); |
| 572 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); | 572 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace blink | 575 } // namespace blink |
| OLD | NEW |