| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include <gtest/gtest.h> | 54 #include <gtest/gtest.h> |
| 55 | 55 |
| 56 namespace WebCore { | 56 namespace WebCore { |
| 57 | 57 |
| 58 using ::testing::CloneToPassOwnPtr; | 58 using ::testing::CloneToPassOwnPtr; |
| 59 using ::testing::ExpectationSet; | 59 using ::testing::ExpectationSet; |
| 60 using ::testing::Ref; | 60 using ::testing::Ref; |
| 61 using ::testing::Return; | 61 using ::testing::Return; |
| 62 using ::testing::_; | 62 using ::testing::_; |
| 63 | 63 |
| 64 class CoreAnimationCompositorAnimationsTest : public CoreAnimationCompositorAnim
ationsTestBase { | 64 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe
stBase { |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 RefPtr<TimingFunction> m_linearTimingFunction; | 67 RefPtr<TimingFunction> m_linearTimingFunction; |
| 68 RefPtr<TimingFunction> m_cubicEaseTimingFunction; | 68 RefPtr<TimingFunction> m_cubicEaseTimingFunction; |
| 69 RefPtr<TimingFunction> m_cubicCustomTimingFunction; | 69 RefPtr<TimingFunction> m_cubicCustomTimingFunction; |
| 70 RefPtr<TimingFunction> m_stepTimingFunction; | 70 RefPtr<TimingFunction> m_stepTimingFunction; |
| 71 | 71 |
| 72 Timing m_timing; | 72 Timing m_timing; |
| 73 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; | 73 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; |
| 74 KeyframeAnimationEffect::KeyframeVector m_keyframeVector2; | 74 KeyframeAnimationEffect::KeyframeVector m_keyframeVector2; |
| 75 KeyframeAnimationEffect::KeyframeVector m_keyframeVector5; | 75 KeyframeAnimationEffect::KeyframeVector m_keyframeVector5; |
| 76 | 76 |
| 77 virtual void SetUp() | 77 virtual void SetUp() |
| 78 { | 78 { |
| 79 CoreAnimationCompositorAnimationsTestBase::SetUp(); | 79 AnimationCompositorAnimationsTestBase::SetUp(); |
| 80 | 80 |
| 81 m_linearTimingFunction = LinearTimingFunction::create(); | 81 m_linearTimingFunction = LinearTimingFunction::create(); |
| 82 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); | 82 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie
rTimingFunction::Ease); |
| 83 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); | 83 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3,
4); |
| 84 m_stepTimingFunction = StepsTimingFunction::create(1, false); | 84 m_stepTimingFunction = StepsTimingFunction::create(1, false); |
| 85 | 85 |
| 86 m_timing = createCompositableTiming(); | 86 m_timing = createCompositableTiming(); |
| 87 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); | 87 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); |
| 88 // Make sure the CompositableTiming is really compositable, otherwise | 88 // Make sure the CompositableTiming is really compositable, otherwise |
| 89 // most other tests will fail. | 89 // most other tests will fail. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 EXPECT_EQ(to->offset(), 1.0); | 202 EXPECT_EQ(to->offset(), 1.0); |
| 203 } | 203 } |
| 204 if (!HasFatalFailure()) { | 204 if (!HasFatalFailure()) { |
| 205 return KeyframeAnimationEffect::create(frames); | 205 return KeyframeAnimationEffect::create(frames); |
| 206 } | 206 } |
| 207 return PassRefPtr<KeyframeAnimationEffect>(); | 207 return PassRefPtr<KeyframeAnimationEffect>(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 IntSize CoreAnimationCompositorAnimationsTest::empty; | 212 IntSize AnimationCompositorAnimationsTest::empty; |
| 213 | 213 |
| 214 class CustomFilterOperationMock : public FilterOperation { | 214 class CustomFilterOperationMock : public FilterOperation { |
| 215 public: | 215 public: |
| 216 virtual bool operator==(const FilterOperation&) const OVERRIDE FINAL { | 216 virtual bool operator==(const FilterOperation&) const OVERRIDE FINAL { |
| 217 ASSERT_NOT_REACHED(); | 217 ASSERT_NOT_REACHED(); |
| 218 return false; | 218 return false; |
| 219 } | 219 } |
| 220 | 220 |
| 221 MOCK_CONST_METHOD2(blend, PassRefPtr<FilterOperation>(const FilterOperation*
, double)); | 221 MOCK_CONST_METHOD2(blend, PassRefPtr<FilterOperation>(const FilterOperation*
, double)); |
| 222 | 222 |
| 223 static PassRefPtr<CustomFilterOperationMock> create() | 223 static PassRefPtr<CustomFilterOperationMock> create() |
| 224 { | 224 { |
| 225 return adoptRef(new CustomFilterOperationMock()); | 225 return adoptRef(new CustomFilterOperationMock()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 CustomFilterOperationMock() | 228 CustomFilterOperationMock() |
| 229 : FilterOperation(FilterOperation::CUSTOM) | 229 : FilterOperation(FilterOperation::CUSTOM) |
| 230 { | 230 { |
| 231 } | 231 } |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 // ----------------------------------------------------------------------- | 234 // ----------------------------------------------------------------------- |
| 235 // ----------------------------------------------------------------------- | 235 // ----------------------------------------------------------------------- |
| 236 | 236 |
| 237 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeCS
SPropertySupported) | 237 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeCSSPro
pertySupported) |
| 238 { | 238 { |
| 239 EXPECT_TRUE( | 239 EXPECT_TRUE( |
| 240 isCandidateForCompositor( | 240 isCandidateForCompositor( |
| 241 *createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::Composit
eReplace).get())); | 241 *createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::Composit
eReplace).get())); |
| 242 | 242 |
| 243 EXPECT_TRUE( | 243 EXPECT_TRUE( |
| 244 isCandidateForCompositor( | 244 isCandidateForCompositor( |
| 245 *createDefaultKeyframe(CSSPropertyWebkitTransform, AnimationEffect::
CompositeReplace).get())); | 245 *createDefaultKeyframe(CSSPropertyWebkitTransform, AnimationEffect::
CompositeReplace).get())); |
| 246 | 246 |
| 247 EXPECT_FALSE( | 247 EXPECT_FALSE( |
| 248 isCandidateForCompositor( | 248 isCandidateForCompositor( |
| 249 *createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::Composit
eAdd).get())); | 249 *createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::Composit
eAdd).get())); |
| 250 } | 250 } |
| 251 | 251 |
| 252 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeCS
SPropertyNotSupported) | 252 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeCSSPro
pertyNotSupported) |
| 253 { | 253 { |
| 254 EXPECT_FALSE( | 254 EXPECT_FALSE( |
| 255 isCandidateForCompositor( | 255 isCandidateForCompositor( |
| 256 *createDefaultKeyframe(CSSPropertyColor, AnimationEffect::CompositeR
eplace).get())); | 256 *createDefaultKeyframe(CSSPropertyColor, AnimationEffect::CompositeR
eplace).get())); |
| 257 | 257 |
| 258 EXPECT_FALSE( | 258 EXPECT_FALSE( |
| 259 isCandidateForCompositor( | 259 isCandidateForCompositor( |
| 260 *createDefaultKeyframe(CSSPropertyColor, AnimationEffect::CompositeA
dd).get())); | 260 *createDefaultKeyframe(CSSPropertyColor, AnimationEffect::CompositeA
dd).get())); |
| 261 } | 261 } |
| 262 | 262 |
| 263 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeMu
ltipleCSSProperties) | 263 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeMultip
leCSSProperties) |
| 264 { | 264 { |
| 265 // In this test, we cheat by using an AnimatableDouble even with Transform | 265 // In this test, we cheat by using an AnimatableDouble even with Transform |
| 266 // as the actual value isn't considered. | 266 // as the actual value isn't considered. |
| 267 RefPtr<Keyframe> keyframeGoodMultiple = createDefaultKeyframe(CSSPropertyOpa
city, AnimationEffect::CompositeReplace); | 267 RefPtr<Keyframe> keyframeGoodMultiple = createDefaultKeyframe(CSSPropertyOpa
city, AnimationEffect::CompositeReplace); |
| 268 keyframeGoodMultiple->setPropertyValue(CSSPropertyWebkitTransform, Animatabl
eDouble::create(10.0).get()); | 268 keyframeGoodMultiple->setPropertyValue(CSSPropertyWebkitTransform, Animatabl
eDouble::create(10.0).get()); |
| 269 EXPECT_TRUE(isCandidateForCompositor(*keyframeGoodMultiple.get())); | 269 EXPECT_TRUE(isCandidateForCompositor(*keyframeGoodMultiple.get())); |
| 270 | 270 |
| 271 RefPtr<Keyframe> keyframeBadMultipleOp = createDefaultKeyframe(CSSPropertyOp
acity, AnimationEffect::CompositeAdd); | 271 RefPtr<Keyframe> keyframeBadMultipleOp = createDefaultKeyframe(CSSPropertyOp
acity, AnimationEffect::CompositeAdd); |
| 272 keyframeBadMultipleOp->setPropertyValue(CSSPropertyWebkitTransform, Animatab
leDouble::create(10.0).get()); | 272 keyframeBadMultipleOp->setPropertyValue(CSSPropertyWebkitTransform, Animatab
leDouble::create(10.0).get()); |
| 273 EXPECT_FALSE(isCandidateForCompositor(*keyframeBadMultipleOp.get())); | 273 EXPECT_FALSE(isCandidateForCompositor(*keyframeBadMultipleOp.get())); |
| 274 | 274 |
| 275 // Check both an unsupported property which hashes before and after the | 275 // Check both an unsupported property which hashes before and after the |
| 276 // supported property. | 276 // supported property. |
| 277 typedef DefaultHash<CSSPropertyID>::Hash HashFunctions; | 277 typedef DefaultHash<CSSPropertyID>::Hash HashFunctions; |
| 278 | 278 |
| 279 RefPtr<Keyframe> keyframeBadMultiple1ID = createDefaultKeyframe(CSSPropertyC
olor, AnimationEffect::CompositeReplace); | 279 RefPtr<Keyframe> keyframeBadMultiple1ID = createDefaultKeyframe(CSSPropertyC
olor, AnimationEffect::CompositeReplace); |
| 280 keyframeBadMultiple1ID->setPropertyValue(CSSPropertyOpacity, AnimatableDoubl
e::create(10.0).get()); | 280 keyframeBadMultiple1ID->setPropertyValue(CSSPropertyOpacity, AnimatableDoubl
e::create(10.0).get()); |
| 281 EXPECT_FALSE(isCandidateForCompositor(*keyframeBadMultiple1ID.get())); | 281 EXPECT_FALSE(isCandidateForCompositor(*keyframeBadMultiple1ID.get())); |
| 282 EXPECT_LT(HashFunctions::hash(CSSPropertyColor), HashFunctions::hash(CSSProp
ertyOpacity)); | 282 EXPECT_LT(HashFunctions::hash(CSSPropertyColor), HashFunctions::hash(CSSProp
ertyOpacity)); |
| 283 | 283 |
| 284 RefPtr<Keyframe> keyframeBadMultiple2ID = createDefaultKeyframe(CSSPropertyW
ebkitTransform, AnimationEffect::CompositeReplace); | 284 RefPtr<Keyframe> keyframeBadMultiple2ID = createDefaultKeyframe(CSSPropertyW
ebkitTransform, AnimationEffect::CompositeReplace); |
| 285 keyframeBadMultiple2ID->setPropertyValue(CSSPropertyWidth, AnimatableDouble:
:create(10.0).get()); | 285 keyframeBadMultiple2ID->setPropertyValue(CSSPropertyWidth, AnimatableDouble:
:create(10.0).get()); |
| 286 EXPECT_FALSE(isCandidateForCompositor(*keyframeBadMultiple2ID.get())); | 286 EXPECT_FALSE(isCandidateForCompositor(*keyframeBadMultiple2ID.get())); |
| 287 EXPECT_GT(HashFunctions::hash(CSSPropertyWebkitTransform), HashFunctions::ha
sh(CSSPropertyWidth)); | 287 EXPECT_GT(HashFunctions::hash(CSSPropertyWebkitTransform), HashFunctions::ha
sh(CSSPropertyWidth)); |
| 288 } | 288 } |
| 289 | 289 |
| 290 TEST_F(CoreAnimationCompositorAnimationsTest, isNotCandidateForCompositorCustomF
ilter) | 290 TEST_F(AnimationCompositorAnimationsTest, isNotCandidateForCompositorCustomFilte
r) |
| 291 { | 291 { |
| 292 FilterOperations ops; | 292 FilterOperations ops; |
| 293 ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterO
peration::SATURATE)); | 293 ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterO
peration::SATURATE)); |
| 294 RefPtr<Keyframe> goodKeyframe = createReplaceOpKeyframe(CSSPropertyWebkitFil
ter, AnimatableFilterOperations::create(ops).get()); | 294 RefPtr<Keyframe> goodKeyframe = createReplaceOpKeyframe(CSSPropertyWebkitFil
ter, AnimatableFilterOperations::create(ops).get()); |
| 295 EXPECT_TRUE(isCandidateForCompositor(*goodKeyframe.get())); | 295 EXPECT_TRUE(isCandidateForCompositor(*goodKeyframe.get())); |
| 296 | 296 |
| 297 ops.operations().append(CustomFilterOperationMock::create()); | 297 ops.operations().append(CustomFilterOperationMock::create()); |
| 298 RefPtr<Keyframe> badKeyframe = createReplaceOpKeyframe(CSSPropertyFilter, An
imatableFilterOperations::create(ops).get()); | 298 RefPtr<Keyframe> badKeyframe = createReplaceOpKeyframe(CSSPropertyFilter, An
imatableFilterOperations::create(ops).get()); |
| 299 EXPECT_FALSE(isCandidateForCompositor(*badKeyframe.get())); | 299 EXPECT_FALSE(isCandidateForCompositor(*badKeyframe.get())); |
| 300 } | 300 } |
| 301 | 301 |
| 302 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEf
fectGoodSingleFrame) | 302 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEffect
GoodSingleFrame) |
| 303 { | 303 { |
| 304 KeyframeAnimationEffect::KeyframeVector frames; | 304 KeyframeAnimationEffect::KeyframeVector frames; |
| 305 frames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::Com
positeReplace).get()); | 305 frames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::Com
positeReplace).get()); |
| 306 EXPECT_TRUE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frames
).get())); | 306 EXPECT_TRUE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frames
).get())); |
| 307 } | 307 } |
| 308 | 308 |
| 309 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEf
fectBadSingleFrame) | 309 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEffect
BadSingleFrame) |
| 310 { | 310 { |
| 311 KeyframeAnimationEffect::KeyframeVector framesBadSingle; | 311 KeyframeAnimationEffect::KeyframeVector framesBadSingle; |
| 312 framesBadSingle.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffe
ct::CompositeReplace).get()); | 312 framesBadSingle.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffe
ct::CompositeReplace).get()); |
| 313 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sBadSingle).get())); | 313 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sBadSingle).get())); |
| 314 } | 314 } |
| 315 | 315 |
| 316 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEf
fectMultipleFramesOkay) | 316 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEffect
MultipleFramesOkay) |
| 317 { | 317 { |
| 318 KeyframeAnimationEffect::KeyframeVector framesSame; | 318 KeyframeAnimationEffect::KeyframeVector framesSame; |
| 319 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 0.0).get()); | 319 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 0.0).get()); |
| 320 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 1.0).get()); | 320 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:
:CompositeReplace, 1.0).get()); |
| 321 EXPECT_TRUE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frames
Same).get())); | 321 EXPECT_TRUE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frames
Same).get())); |
| 322 | 322 |
| 323 KeyframeAnimationEffect::KeyframeVector framesMixed; | 323 KeyframeAnimationEffect::KeyframeVector framesMixed; |
| 324 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect
::CompositeReplace, 0.0).get()); | 324 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect
::CompositeReplace, 0.0).get()); |
| 325 framesMixed.append(createDefaultKeyframe(CSSPropertyWebkitTransform, Animati
onEffect::CompositeReplace, 1.0).get()); | 325 framesMixed.append(createDefaultKeyframe(CSSPropertyWebkitTransform, Animati
onEffect::CompositeReplace, 1.0).get()); |
| 326 EXPECT_TRUE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frames
Mixed).get())); | 326 EXPECT_TRUE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frames
Mixed).get())); |
| 327 } | 327 } |
| 328 | 328 |
| 329 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEf
fectMultipleFramesNotOkay) | 329 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorKeyframeEffect
MultipleFramesNotOkay) |
| 330 { | 330 { |
| 331 KeyframeAnimationEffect::KeyframeVector framesSame; | 331 KeyframeAnimationEffect::KeyframeVector framesSame; |
| 332 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 0.0).get()); | 332 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 0.0).get()); |
| 333 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 1.0).get()); | 333 framesSame.append(createDefaultKeyframe(CSSPropertyColor, AnimationEffect::C
ompositeReplace, 1.0).get()); |
| 334 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sSame).get())); | 334 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sSame).get())); |
| 335 | 335 |
| 336 KeyframeAnimationEffect::KeyframeVector framesMixedProperties; | 336 KeyframeAnimationEffect::KeyframeVector framesMixedProperties; |
| 337 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Anima
tionEffect::CompositeReplace, 0.0).get()); | 337 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Anima
tionEffect::CompositeReplace, 0.0).get()); |
| 338 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, Animati
onEffect::CompositeReplace, 1.0).get()); | 338 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, Animati
onEffect::CompositeReplace, 1.0).get()); |
| 339 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sMixedProperties).get())); | 339 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sMixedProperties).get())); |
| 340 | 340 |
| 341 KeyframeAnimationEffect::KeyframeVector framesMixedOps; | 341 KeyframeAnimationEffect::KeyframeVector framesMixedOps; |
| 342 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeReplace, 0.0).get()); | 342 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeReplace, 0.0).get()); |
| 343 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeAdd, 1.0).get()); | 343 framesMixedOps.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEff
ect::CompositeAdd, 1.0).get()); |
| 344 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sMixedOps).get())); | 344 EXPECT_FALSE(isCandidateForCompositor(*KeyframeAnimationEffect::create(frame
sMixedOps).get())); |
| 345 } | 345 } |
| 346 | 346 |
| 347 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDel
ay) | 347 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) |
| 348 { | 348 { |
| 349 m_timing.iterationDuration = 20.0; | 349 m_timing.iterationDuration = 20.0; |
| 350 | 350 |
| 351 m_timing.startDelay = 2.0; | 351 m_timing.startDelay = 2.0; |
| 352 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 352 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 353 | 353 |
| 354 m_timing.startDelay = -2.0; | 354 m_timing.startDelay = -2.0; |
| 355 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 355 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 356 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); | 356 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); |
| 357 } | 357 } |
| 358 | 358 |
| 359 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorIteratio
nStart) | 359 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorIterationSta
rt) |
| 360 { | 360 { |
| 361 m_timing.iterationStart = 2.2; | 361 m_timing.iterationStart = 2.2; |
| 362 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 362 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 363 } | 363 } |
| 364 | 364 |
| 365 TEST_F(CoreAnimationCompositorAnimationsTest, DISABLED_ConvertTimingForComposito
rIterationCount) | 365 TEST_F(AnimationCompositorAnimationsTest, DISABLED_ConvertTimingForCompositorIte
rationCount) |
| 366 { | 366 { |
| 367 m_timing.iterationCount = 5.0; | 367 m_timing.iterationCount = 5.0; |
| 368 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 368 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 369 EXPECT_EQ(5, m_compositorTiming.adjustedIterationCount); | 369 EXPECT_EQ(5, m_compositorTiming.adjustedIterationCount); |
| 370 | 370 |
| 371 m_timing.iterationCount = 5.5; | 371 m_timing.iterationCount = 5.5; |
| 372 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 372 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 373 | 373 |
| 374 m_timing.iterationCount = std::numeric_limits<double>::infinity(); | 374 m_timing.iterationCount = std::numeric_limits<double>::infinity(); |
| 375 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 375 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 376 | 376 |
| 377 #ifndef NDEBUG | 377 #ifndef NDEBUG |
| 378 m_timing.iterationCount = -1; | 378 m_timing.iterationCount = -1; |
| 379 EXPECT_DEATH(convertTimingForCompositor(m_timing, m_compositorTiming), ""); | 379 EXPECT_DEATH(convertTimingForCompositor(m_timing, m_compositorTiming), ""); |
| 380 #endif | 380 #endif |
| 381 } | 381 } |
| 382 | 382 |
| 383 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorIteratio
nsAndStartDelay) | 383 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorIterationsAn
dStartDelay) |
| 384 { | 384 { |
| 385 m_timing.iterationCount = 4.0; | 385 m_timing.iterationCount = 4.0; |
| 386 m_timing.iterationDuration = 5.0; | 386 m_timing.iterationDuration = 5.0; |
| 387 | 387 |
| 388 m_timing.startDelay = -6.0; | 388 m_timing.startDelay = -6.0; |
| 389 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 389 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 390 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); | 390 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); |
| 391 EXPECT_DOUBLE_EQ(3.0, m_compositorTiming.adjustedIterationCount); | 391 EXPECT_DOUBLE_EQ(3.0, m_compositorTiming.adjustedIterationCount); |
| 392 EXPECT_FALSE(m_compositorTiming.reverse); | 392 EXPECT_FALSE(m_compositorTiming.reverse); |
| 393 | 393 |
| 394 m_timing.iterationCount = 1.0; | 394 m_timing.iterationCount = 1.0; |
| 395 m_timing.iterationDuration = 5.0; | 395 m_timing.iterationDuration = 5.0; |
| 396 m_timing.startDelay = -6.0; | 396 m_timing.startDelay = -6.0; |
| 397 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 397 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 398 | 398 |
| 399 m_timing.iterationCount = 5.0; | 399 m_timing.iterationCount = 5.0; |
| 400 m_timing.iterationDuration = 1.0; | 400 m_timing.iterationDuration = 1.0; |
| 401 m_timing.startDelay = -6.0; | 401 m_timing.startDelay = -6.0; |
| 402 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 402 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 403 } | 403 } |
| 404 | 404 |
| 405 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorPlayback
Rate) | 405 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorPlaybackRate
) |
| 406 { | 406 { |
| 407 m_timing.playbackRate = 2.0; | 407 m_timing.playbackRate = 2.0; |
| 408 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 408 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 409 | 409 |
| 410 m_timing.playbackRate = 0.0; | 410 m_timing.playbackRate = 0.0; |
| 411 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 411 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 412 | 412 |
| 413 m_timing.playbackRate = -2.0; | 413 m_timing.playbackRate = -2.0; |
| 414 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 414 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 415 } | 415 } |
| 416 | 416 |
| 417 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectio
n) | 417 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection) |
| 418 { | 418 { |
| 419 m_timing.direction = Timing::PlaybackDirectionAlternate; | 419 m_timing.direction = Timing::PlaybackDirectionAlternate; |
| 420 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 420 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 421 EXPECT_TRUE(m_compositorTiming.alternate); | 421 EXPECT_TRUE(m_compositorTiming.alternate); |
| 422 EXPECT_FALSE(m_compositorTiming.reverse); | 422 EXPECT_FALSE(m_compositorTiming.reverse); |
| 423 | 423 |
| 424 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 424 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
| 425 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 425 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 426 EXPECT_TRUE(m_compositorTiming.alternate); | 426 EXPECT_TRUE(m_compositorTiming.alternate); |
| 427 EXPECT_TRUE(m_compositorTiming.reverse); | 427 EXPECT_TRUE(m_compositorTiming.reverse); |
| 428 | 428 |
| 429 m_timing.direction = Timing::PlaybackDirectionReverse; | 429 m_timing.direction = Timing::PlaybackDirectionReverse; |
| 430 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 430 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 431 EXPECT_FALSE(m_compositorTiming.alternate); | 431 EXPECT_FALSE(m_compositorTiming.alternate); |
| 432 EXPECT_TRUE(m_compositorTiming.reverse); | 432 EXPECT_TRUE(m_compositorTiming.reverse); |
| 433 } | 433 } |
| 434 | 434 |
| 435 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectio
nIterationsAndStartDelay) | 435 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
rationsAndStartDelay) |
| 436 { | 436 { |
| 437 m_timing.direction = Timing::PlaybackDirectionAlternate; | 437 m_timing.direction = Timing::PlaybackDirectionAlternate; |
| 438 m_timing.iterationCount = 4.0; | 438 m_timing.iterationCount = 4.0; |
| 439 m_timing.iterationDuration = 5.0; | 439 m_timing.iterationDuration = 5.0; |
| 440 m_timing.startDelay = -6.0; | 440 m_timing.startDelay = -6.0; |
| 441 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 441 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 442 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); | 442 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); |
| 443 EXPECT_EQ(3, m_compositorTiming.adjustedIterationCount); | 443 EXPECT_EQ(3, m_compositorTiming.adjustedIterationCount); |
| 444 EXPECT_TRUE(m_compositorTiming.alternate); | 444 EXPECT_TRUE(m_compositorTiming.alternate); |
| 445 EXPECT_TRUE(m_compositorTiming.reverse); | 445 EXPECT_TRUE(m_compositorTiming.reverse); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 468 m_timing.iterationCount = 4.0; | 468 m_timing.iterationCount = 4.0; |
| 469 m_timing.iterationDuration = 5.0; | 469 m_timing.iterationDuration = 5.0; |
| 470 m_timing.startDelay = -11.0; | 470 m_timing.startDelay = -11.0; |
| 471 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 471 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 472 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); | 472 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); |
| 473 EXPECT_EQ(2, m_compositorTiming.adjustedIterationCount); | 473 EXPECT_EQ(2, m_compositorTiming.adjustedIterationCount); |
| 474 EXPECT_TRUE(m_compositorTiming.alternate); | 474 EXPECT_TRUE(m_compositorTiming.alternate); |
| 475 EXPECT_TRUE(m_compositorTiming.reverse); | 475 EXPECT_TRUE(m_compositorTiming.reverse); |
| 476 } | 476 } |
| 477 | 477 |
| 478 TEST_F(CoreAnimationCompositorAnimationsTest, ConvertTimingForCompositorInfinite
) | 478 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorInfinite) |
| 479 { | 479 { |
| 480 m_timing.iterationCount = std::numeric_limits<double>::infinity(); | 480 m_timing.iterationCount = std::numeric_limits<double>::infinity(); |
| 481 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 481 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 482 EXPECT_EQ(-1, m_compositorTiming.adjustedIterationCount); | 482 EXPECT_EQ(-1, m_compositorTiming.adjustedIterationCount); |
| 483 | 483 |
| 484 m_timing.iterationCount = std::numeric_limits<double>::infinity(); | 484 m_timing.iterationCount = std::numeric_limits<double>::infinity(); |
| 485 m_timing.iterationDuration = 5.0; | 485 m_timing.iterationDuration = 5.0; |
| 486 m_timing.startDelay = -6.0; | 486 m_timing.startDelay = -6.0; |
| 487 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); | 487 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); |
| 488 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); | 488 EXPECT_DOUBLE_EQ(-1.0, m_compositorTiming.scaledTimeOffset); |
| 489 EXPECT_EQ(-1, m_compositorTiming.adjustedIterationCount); | 489 EXPECT_EQ(-1, m_compositorTiming.adjustedIterationCount); |
| 490 } | 490 } |
| 491 | 491 |
| 492 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTiming) | 492 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTiming) |
| 493 { | 493 { |
| 494 EXPECT_TRUE(isCandidateForCompositor(m_timing, m_keyframeVector2)); | 494 EXPECT_TRUE(isCandidateForCompositor(m_timing, m_keyframeVector2)); |
| 495 | 495 |
| 496 m_timing.startDelay = 2.0; | 496 m_timing.startDelay = 2.0; |
| 497 EXPECT_FALSE(isCandidateForCompositor(m_timing, m_keyframeVector2)); | 497 EXPECT_FALSE(isCandidateForCompositor(m_timing, m_keyframeVector2)); |
| 498 } | 498 } |
| 499 | 499 |
| 500 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingTimi
ngFunctionPassThru) | 500 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingTimingFu
nctionPassThru) |
| 501 { | 501 { |
| 502 m_timing.timingFunction = m_stepTimingFunction; | 502 m_timing.timingFunction = m_stepTimingFunction; |
| 503 EXPECT_FALSE(isCandidateForCompositor(m_timing, m_keyframeVector2)); | 503 EXPECT_FALSE(isCandidateForCompositor(m_timing, m_keyframeVector2)); |
| 504 } | 504 } |
| 505 | 505 |
| 506 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionLinear) | 506 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
Linear) |
| 507 { | 507 { |
| 508 EXPECT_TRUE(isCandidateForCompositor(*m_linearTimingFunction.get(), &m_keyfr
ameVector2)); | 508 EXPECT_TRUE(isCandidateForCompositor(*m_linearTimingFunction.get(), &m_keyfr
ameVector2)); |
| 509 EXPECT_TRUE(isCandidateForCompositor(*m_linearTimingFunction.get(), &m_keyfr
ameVector5)); | 509 EXPECT_TRUE(isCandidateForCompositor(*m_linearTimingFunction.get(), &m_keyfr
ameVector5)); |
| 510 } | 510 } |
| 511 | 511 |
| 512 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionCubic) | 512 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
Cubic) |
| 513 { | 513 { |
| 514 // Cubic bezier are okay if we only have two keyframes | 514 // Cubic bezier are okay if we only have two keyframes |
| 515 EXPECT_TRUE(isCandidateForCompositor(*m_cubicEaseTimingFunction.get(), &m_ke
yframeVector2)); | 515 EXPECT_TRUE(isCandidateForCompositor(*m_cubicEaseTimingFunction.get(), &m_ke
yframeVector2)); |
| 516 EXPECT_FALSE(isCandidateForCompositor(*m_cubicEaseTimingFunction.get(), &m_k
eyframeVector5)); | 516 EXPECT_FALSE(isCandidateForCompositor(*m_cubicEaseTimingFunction.get(), &m_k
eyframeVector5)); |
| 517 | 517 |
| 518 EXPECT_TRUE(isCandidateForCompositor(*m_cubicCustomTimingFunction.get(), &m_
keyframeVector2)); | 518 EXPECT_TRUE(isCandidateForCompositor(*m_cubicCustomTimingFunction.get(), &m_
keyframeVector2)); |
| 519 EXPECT_FALSE(isCandidateForCompositor(*m_cubicCustomTimingFunction.get(), &m
_keyframeVector5)); | 519 EXPECT_FALSE(isCandidateForCompositor(*m_cubicCustomTimingFunction.get(), &m
_keyframeVector5)); |
| 520 } | 520 } |
| 521 | 521 |
| 522 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionSteps) | 522 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
Steps) |
| 523 { | 523 { |
| 524 RefPtr<TimingFunction> stepTiming = StepsTimingFunction::create(1, false); | 524 RefPtr<TimingFunction> stepTiming = StepsTimingFunction::create(1, false); |
| 525 EXPECT_FALSE(isCandidateForCompositor(*m_stepTimingFunction.get(), &m_keyfra
meVector2)); | 525 EXPECT_FALSE(isCandidateForCompositor(*m_stepTimingFunction.get(), &m_keyfra
meVector2)); |
| 526 EXPECT_FALSE(isCandidateForCompositor(*m_stepTimingFunction.get(), &m_keyfra
meVector5)); | 526 EXPECT_FALSE(isCandidateForCompositor(*m_stepTimingFunction.get(), &m_keyfra
meVector5)); |
| 527 } | 527 } |
| 528 | 528 |
| 529 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionChainedEmpty) | 529 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
ChainedEmpty) |
| 530 { | 530 { |
| 531 RefPtr<ChainedTimingFunction> chainedEmpty = ChainedTimingFunction::create()
; | 531 RefPtr<ChainedTimingFunction> chainedEmpty = ChainedTimingFunction::create()
; |
| 532 EXPECT_FALSE(isCandidateForCompositor(*chainedEmpty.get(), &m_keyframeVector
2)); | 532 EXPECT_FALSE(isCandidateForCompositor(*chainedEmpty.get(), &m_keyframeVector
2)); |
| 533 EXPECT_FALSE(isCandidateForCompositor(*chainedEmpty.get(), &m_keyframeVector
5)); | 533 EXPECT_FALSE(isCandidateForCompositor(*chainedEmpty.get(), &m_keyframeVector
5)); |
| 534 } | 534 } |
| 535 | 535 |
| 536 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionChainedLinear) | 536 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
ChainedLinear) |
| 537 { | 537 { |
| 538 RefPtr<ChainedTimingFunction> chainedLinearSingle = ChainedTimingFunction::c
reate(); | 538 RefPtr<ChainedTimingFunction> chainedLinearSingle = ChainedTimingFunction::c
reate(); |
| 539 chainedLinearSingle->appendSegment(1.0, m_linearTimingFunction.get()); | 539 chainedLinearSingle->appendSegment(1.0, m_linearTimingFunction.get()); |
| 540 EXPECT_TRUE(isCandidateForCompositor(*chainedLinearSingle.get(), &m_keyframe
Vector2)); | 540 EXPECT_TRUE(isCandidateForCompositor(*chainedLinearSingle.get(), &m_keyframe
Vector2)); |
| 541 | 541 |
| 542 RefPtr<ChainedTimingFunction> chainedLinearMultiple = ChainedTimingFunction:
:create(); | 542 RefPtr<ChainedTimingFunction> chainedLinearMultiple = ChainedTimingFunction:
:create(); |
| 543 chainedLinearMultiple->appendSegment(0.25, m_linearTimingFunction.get()); | 543 chainedLinearMultiple->appendSegment(0.25, m_linearTimingFunction.get()); |
| 544 chainedLinearMultiple->appendSegment(0.5, m_linearTimingFunction.get()); | 544 chainedLinearMultiple->appendSegment(0.5, m_linearTimingFunction.get()); |
| 545 chainedLinearMultiple->appendSegment(0.75, m_linearTimingFunction.get()); | 545 chainedLinearMultiple->appendSegment(0.75, m_linearTimingFunction.get()); |
| 546 chainedLinearMultiple->appendSegment(1.0, m_linearTimingFunction.get()); | 546 chainedLinearMultiple->appendSegment(1.0, m_linearTimingFunction.get()); |
| 547 EXPECT_TRUE(isCandidateForCompositor(*chainedLinearMultiple.get(), &m_keyfra
meVector5)); | 547 EXPECT_TRUE(isCandidateForCompositor(*chainedLinearMultiple.get(), &m_keyfra
meVector5)); |
| 548 | 548 |
| 549 // FIXME: Technically a chained timing function of linear functions don't | 549 // FIXME: Technically a chained timing function of linear functions don't |
| 550 // have to be aligned to keyframes. We don't support that currently as | 550 // have to be aligned to keyframes. We don't support that currently as |
| 551 // nothing generates that yet. | 551 // nothing generates that yet. |
| 552 } | 552 } |
| 553 | 553 |
| 554 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionChainedCubicMatchingOffsets) | 554 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
ChainedCubicMatchingOffsets) |
| 555 { | 555 { |
| 556 RefPtr<ChainedTimingFunction> chainedSingleAGood = ChainedTimingFunction::cr
eate(); | 556 RefPtr<ChainedTimingFunction> chainedSingleAGood = ChainedTimingFunction::cr
eate(); |
| 557 chainedSingleAGood->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 557 chainedSingleAGood->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| 558 EXPECT_TRUE(isCandidateForCompositor(*chainedSingleAGood.get(), &m_keyframeV
ector2)); | 558 EXPECT_TRUE(isCandidateForCompositor(*chainedSingleAGood.get(), &m_keyframeV
ector2)); |
| 559 | 559 |
| 560 RefPtr<ChainedTimingFunction> chainedSingleBGood = ChainedTimingFunction::cr
eate(); | 560 RefPtr<ChainedTimingFunction> chainedSingleBGood = ChainedTimingFunction::cr
eate(); |
| 561 chainedSingleBGood->appendSegment(1.0, m_cubicCustomTimingFunction.get()); | 561 chainedSingleBGood->appendSegment(1.0, m_cubicCustomTimingFunction.get()); |
| 562 EXPECT_TRUE(isCandidateForCompositor(*chainedSingleBGood.get(), &m_keyframeV
ector2)); | 562 EXPECT_TRUE(isCandidateForCompositor(*chainedSingleBGood.get(), &m_keyframeV
ector2)); |
| 563 | 563 |
| 564 RefPtr<ChainedTimingFunction> chainedMultipleGood = ChainedTimingFunction::c
reate(); | 564 RefPtr<ChainedTimingFunction> chainedMultipleGood = ChainedTimingFunction::c
reate(); |
| 565 chainedMultipleGood->appendSegment(0.25, m_cubicEaseTimingFunction.get()); | 565 chainedMultipleGood->appendSegment(0.25, m_cubicEaseTimingFunction.get()); |
| 566 chainedMultipleGood->appendSegment(0.5, m_cubicCustomTimingFunction.get()); | 566 chainedMultipleGood->appendSegment(0.5, m_cubicCustomTimingFunction.get()); |
| 567 chainedMultipleGood->appendSegment(0.75, m_cubicCustomTimingFunction.get()); | 567 chainedMultipleGood->appendSegment(0.75, m_cubicCustomTimingFunction.get()); |
| 568 chainedMultipleGood->appendSegment(1.0, m_cubicCustomTimingFunction.get()); | 568 chainedMultipleGood->appendSegment(1.0, m_cubicCustomTimingFunction.get()); |
| 569 EXPECT_TRUE(isCandidateForCompositor(*chainedMultipleGood.get(), &m_keyframe
Vector5)); | 569 EXPECT_TRUE(isCandidateForCompositor(*chainedMultipleGood.get(), &m_keyframe
Vector5)); |
| 570 } | 570 } |
| 571 | 571 |
| 572 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionChainedCubicNonMatchingOffsets) | 572 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
ChainedCubicNonMatchingOffsets) |
| 573 { | 573 { |
| 574 RefPtr<ChainedTimingFunction> chained0 = ChainedTimingFunction::create(); | 574 RefPtr<ChainedTimingFunction> chained0 = ChainedTimingFunction::create(); |
| 575 chained0->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 575 chained0->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 576 EXPECT_FALSE(isCandidateForCompositor(*chained0.get(), &m_keyframeVector2)); | 576 EXPECT_FALSE(isCandidateForCompositor(*chained0.get(), &m_keyframeVector2)); |
| 577 | 577 |
| 578 RefPtr<ChainedTimingFunction> chained1 = ChainedTimingFunction::create(); | 578 RefPtr<ChainedTimingFunction> chained1 = ChainedTimingFunction::create(); |
| 579 chained1->appendSegment(0.24, m_cubicEaseTimingFunction.get()); | 579 chained1->appendSegment(0.24, m_cubicEaseTimingFunction.get()); |
| 580 chained1->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 580 chained1->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 581 chained1->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 581 chained1->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 582 chained1->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 582 chained1->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 597 EXPECT_FALSE(isCandidateForCompositor(*chained3.get(), &m_keyframeVector5)); | 597 EXPECT_FALSE(isCandidateForCompositor(*chained3.get(), &m_keyframeVector5)); |
| 598 | 598 |
| 599 RefPtr<ChainedTimingFunction> chained4 = ChainedTimingFunction::create(); | 599 RefPtr<ChainedTimingFunction> chained4 = ChainedTimingFunction::create(); |
| 600 chained4->appendSegment(0.25, m_cubicEaseTimingFunction.get()); | 600 chained4->appendSegment(0.25, m_cubicEaseTimingFunction.get()); |
| 601 chained4->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 601 chained4->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 602 chained4->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 602 chained4->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 603 chained4->appendSegment(1.1, m_cubicEaseTimingFunction.get()); | 603 chained4->appendSegment(1.1, m_cubicEaseTimingFunction.get()); |
| 604 EXPECT_FALSE(isCandidateForCompositor(*chained4.get(), &m_keyframeVector5)); | 604 EXPECT_FALSE(isCandidateForCompositor(*chained4.get(), &m_keyframeVector5)); |
| 605 } | 605 } |
| 606 | 606 |
| 607 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionMissingFrames) | 607 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
MissingFrames) |
| 608 { | 608 { |
| 609 // Missing first | 609 // Missing first |
| 610 RefPtr<ChainedTimingFunction> chained1 = ChainedTimingFunction::create(); | 610 RefPtr<ChainedTimingFunction> chained1 = ChainedTimingFunction::create(); |
| 611 chained1->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 611 chained1->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 612 chained1->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 612 chained1->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 613 chained1->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 613 chained1->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| 614 EXPECT_FALSE(isCandidateForCompositor(*chained1.get(), &m_keyframeVector5)); | 614 EXPECT_FALSE(isCandidateForCompositor(*chained1.get(), &m_keyframeVector5)); |
| 615 | 615 |
| 616 // Missing middle | 616 // Missing middle |
| 617 RefPtr<ChainedTimingFunction> chained2 = ChainedTimingFunction::create(); | 617 RefPtr<ChainedTimingFunction> chained2 = ChainedTimingFunction::create(); |
| 618 chained2->appendSegment(0.25, m_cubicEaseTimingFunction.get()); | 618 chained2->appendSegment(0.25, m_cubicEaseTimingFunction.get()); |
| 619 chained2->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 619 chained2->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 620 chained2->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 620 chained2->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| 621 EXPECT_FALSE(isCandidateForCompositor(*chained2.get(), &m_keyframeVector5)); | 621 EXPECT_FALSE(isCandidateForCompositor(*chained2.get(), &m_keyframeVector5)); |
| 622 | 622 |
| 623 // Missing last | 623 // Missing last |
| 624 RefPtr<ChainedTimingFunction> chained3 = ChainedTimingFunction::create(); | 624 RefPtr<ChainedTimingFunction> chained3 = ChainedTimingFunction::create(); |
| 625 chained3->appendSegment(0.25, m_cubicEaseTimingFunction.get()); | 625 chained3->appendSegment(0.25, m_cubicEaseTimingFunction.get()); |
| 626 chained3->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 626 chained3->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 627 chained3->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 627 chained3->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 628 EXPECT_FALSE(isCandidateForCompositor(*chained3.get(), &m_keyframeVector5)); | 628 EXPECT_FALSE(isCandidateForCompositor(*chained3.get(), &m_keyframeVector5)); |
| 629 } | 629 } |
| 630 | 630 |
| 631 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionToManyFrames) | 631 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
ToManyFrames) |
| 632 { | 632 { |
| 633 RefPtr<ChainedTimingFunction> chained1 = ChainedTimingFunction::create(); | 633 RefPtr<ChainedTimingFunction> chained1 = ChainedTimingFunction::create(); |
| 634 chained1->appendSegment(0.1, m_cubicEaseTimingFunction.get()); | 634 chained1->appendSegment(0.1, m_cubicEaseTimingFunction.get()); |
| 635 chained1->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 635 chained1->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 636 EXPECT_FALSE(isCandidateForCompositor(*chained1.get(), &m_keyframeVector2)); | 636 EXPECT_FALSE(isCandidateForCompositor(*chained1.get(), &m_keyframeVector2)); |
| 637 | 637 |
| 638 RefPtr<ChainedTimingFunction> chained2 = ChainedTimingFunction::create(); | 638 RefPtr<ChainedTimingFunction> chained2 = ChainedTimingFunction::create(); |
| 639 chained2->appendSegment(0.1, m_cubicEaseTimingFunction.get()); | 639 chained2->appendSegment(0.1, m_cubicEaseTimingFunction.get()); |
| 640 chained2->appendSegment(0.25, m_cubicEaseTimingFunction.get()); | 640 chained2->appendSegment(0.25, m_cubicEaseTimingFunction.get()); |
| 641 chained2->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 641 chained2->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 642 chained2->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 642 chained2->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 643 chained2->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 643 chained2->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| 644 EXPECT_FALSE(isCandidateForCompositor(*chained2.get(), &m_keyframeVector5)); | 644 EXPECT_FALSE(isCandidateForCompositor(*chained2.get(), &m_keyframeVector5)); |
| 645 } | 645 } |
| 646 | 646 |
| 647 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionMixedGood) | 647 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
MixedGood) |
| 648 { | 648 { |
| 649 RefPtr<ChainedTimingFunction> chainedMixed = ChainedTimingFunction::create()
; | 649 RefPtr<ChainedTimingFunction> chainedMixed = ChainedTimingFunction::create()
; |
| 650 chainedMixed->appendSegment(0.25, m_linearTimingFunction.get()); | 650 chainedMixed->appendSegment(0.25, m_linearTimingFunction.get()); |
| 651 chainedMixed->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 651 chainedMixed->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 652 chainedMixed->appendSegment(0.75, m_cubicEaseTimingFunction.get()); | 652 chainedMixed->appendSegment(0.75, m_cubicEaseTimingFunction.get()); |
| 653 chainedMixed->appendSegment(1.0, m_linearTimingFunction.get()); | 653 chainedMixed->appendSegment(1.0, m_linearTimingFunction.get()); |
| 654 EXPECT_TRUE(isCandidateForCompositor(*chainedMixed.get(), &m_keyframeVector5
)); | 654 EXPECT_TRUE(isCandidateForCompositor(*chainedMixed.get(), &m_keyframeVector5
)); |
| 655 } | 655 } |
| 656 | 656 |
| 657 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionWithStepNotOkay) | 657 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
WithStepNotOkay) |
| 658 { | 658 { |
| 659 RefPtr<ChainedTimingFunction> chainedStepSingle = ChainedTimingFunction::cre
ate(); | 659 RefPtr<ChainedTimingFunction> chainedStepSingle = ChainedTimingFunction::cre
ate(); |
| 660 chainedStepSingle->appendSegment(1.0, m_stepTimingFunction.get()); | 660 chainedStepSingle->appendSegment(1.0, m_stepTimingFunction.get()); |
| 661 EXPECT_FALSE(isCandidateForCompositor(*chainedStepSingle.get(), &m_keyframeV
ector2)); | 661 EXPECT_FALSE(isCandidateForCompositor(*chainedStepSingle.get(), &m_keyframeV
ector2)); |
| 662 | 662 |
| 663 RefPtr<ChainedTimingFunction> chainedStepMixedA = ChainedTimingFunction::cre
ate(); | 663 RefPtr<ChainedTimingFunction> chainedStepMixedA = ChainedTimingFunction::cre
ate(); |
| 664 chainedStepMixedA->appendSegment(0.25, m_stepTimingFunction.get()); | 664 chainedStepMixedA->appendSegment(0.25, m_stepTimingFunction.get()); |
| 665 chainedStepMixedA->appendSegment(0.5, m_linearTimingFunction.get()); | 665 chainedStepMixedA->appendSegment(0.5, m_linearTimingFunction.get()); |
| 666 chainedStepMixedA->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 666 chainedStepMixedA->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| 667 EXPECT_FALSE(isCandidateForCompositor(*chainedStepMixedA.get(), &m_keyframeV
ector5)); | 667 EXPECT_FALSE(isCandidateForCompositor(*chainedStepMixedA.get(), &m_keyframeV
ector5)); |
| 668 | 668 |
| 669 RefPtr<ChainedTimingFunction> chainedStepMixedB = ChainedTimingFunction::cre
ate(); | 669 RefPtr<ChainedTimingFunction> chainedStepMixedB = ChainedTimingFunction::cre
ate(); |
| 670 chainedStepMixedB->appendSegment(0.25, m_linearTimingFunction.get()); | 670 chainedStepMixedB->appendSegment(0.25, m_linearTimingFunction.get()); |
| 671 chainedStepMixedB->appendSegment(0.5, m_stepTimingFunction.get()); | 671 chainedStepMixedB->appendSegment(0.5, m_stepTimingFunction.get()); |
| 672 chainedStepMixedB->appendSegment(1.0, m_cubicEaseTimingFunction.get()); | 672 chainedStepMixedB->appendSegment(1.0, m_cubicEaseTimingFunction.get()); |
| 673 EXPECT_FALSE(isCandidateForCompositor(*chainedStepMixedB.get(), &m_keyframeV
ector5)); | 673 EXPECT_FALSE(isCandidateForCompositor(*chainedStepMixedB.get(), &m_keyframeV
ector5)); |
| 674 | 674 |
| 675 RefPtr<ChainedTimingFunction> chainedStepMixedC = ChainedTimingFunction::cre
ate(); | 675 RefPtr<ChainedTimingFunction> chainedStepMixedC = ChainedTimingFunction::cre
ate(); |
| 676 chainedStepMixedC->appendSegment(0.25, m_linearTimingFunction.get()); | 676 chainedStepMixedC->appendSegment(0.25, m_linearTimingFunction.get()); |
| 677 chainedStepMixedC->appendSegment(0.5, m_cubicEaseTimingFunction.get()); | 677 chainedStepMixedC->appendSegment(0.5, m_cubicEaseTimingFunction.get()); |
| 678 chainedStepMixedC->appendSegment(1.0, m_stepTimingFunction.get()); | 678 chainedStepMixedC->appendSegment(1.0, m_stepTimingFunction.get()); |
| 679 EXPECT_FALSE(isCandidateForCompositor(*chainedStepMixedC.get(), &m_keyframeV
ector5)); | 679 EXPECT_FALSE(isCandidateForCompositor(*chainedStepMixedC.get(), &m_keyframeV
ector5)); |
| 680 } | 680 } |
| 681 | 681 |
| 682 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunc
tionNestedNotOkay) | 682 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositorTimingFunction
NestedNotOkay) |
| 683 { | 683 { |
| 684 RefPtr<ChainedTimingFunction> chainedChild = ChainedTimingFunction::create()
; | 684 RefPtr<ChainedTimingFunction> chainedChild = ChainedTimingFunction::create()
; |
| 685 chainedChild->appendSegment(1.0, m_linearTimingFunction.get()); | 685 chainedChild->appendSegment(1.0, m_linearTimingFunction.get()); |
| 686 | 686 |
| 687 RefPtr<ChainedTimingFunction> chainedParent = ChainedTimingFunction::create(
); | 687 RefPtr<ChainedTimingFunction> chainedParent = ChainedTimingFunction::create(
); |
| 688 chainedParent->appendSegment(0.25, m_linearTimingFunction.get()); | 688 chainedParent->appendSegment(0.25, m_linearTimingFunction.get()); |
| 689 chainedParent->appendSegment(0.5, chainedChild.get()); | 689 chainedParent->appendSegment(0.5, chainedChild.get()); |
| 690 chainedParent->appendSegment(0.75, m_linearTimingFunction.get()); | 690 chainedParent->appendSegment(0.75, m_linearTimingFunction.get()); |
| 691 chainedParent->appendSegment(1.0, m_linearTimingFunction.get()); | 691 chainedParent->appendSegment(1.0, m_linearTimingFunction.get()); |
| 692 EXPECT_FALSE(isCandidateForCompositor(*chainedParent.get(), &m_keyframeVecto
r5)); | 692 EXPECT_FALSE(isCandidateForCompositor(*chainedParent.get(), &m_keyframeVecto
r5)); |
| 693 } | 693 } |
| 694 | 694 |
| 695 TEST_F(CoreAnimationCompositorAnimationsTest, isCandidateForCompositor) | 695 TEST_F(AnimationCompositorAnimationsTest, isCandidateForCompositor) |
| 696 { | 696 { |
| 697 Timing linearTiming(createCompositableTiming()); | 697 Timing linearTiming(createCompositableTiming()); |
| 698 | 698 |
| 699 RefPtr<TimingFunction> cubicTimingFunc = CubicBezierTimingFunction::preset(C
ubicBezierTimingFunction::EaseIn); | 699 RefPtr<TimingFunction> cubicTimingFunc = CubicBezierTimingFunction::preset(C
ubicBezierTimingFunction::EaseIn); |
| 700 Timing cubicTiming(createCompositableTiming()); | 700 Timing cubicTiming(createCompositableTiming()); |
| 701 cubicTiming.timingFunction = cubicTimingFunc; | 701 cubicTiming.timingFunction = cubicTimingFunc; |
| 702 | 702 |
| 703 RefPtr<ChainedTimingFunction> chainedTimingFunc = ChainedTimingFunction::cre
ate(); | 703 RefPtr<ChainedTimingFunction> chainedTimingFunc = ChainedTimingFunction::cre
ate(); |
| 704 chainedTimingFunc->appendSegment(0.5, m_linearTimingFunction.get()); | 704 chainedTimingFunc->appendSegment(0.5, m_linearTimingFunction.get()); |
| 705 chainedTimingFunc->appendSegment(1.0, cubicTimingFunc.get()); | 705 chainedTimingFunc->appendSegment(1.0, cubicTimingFunc.get()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 723 RefPtr<KeyframeAnimationEffect> nonBasicFrames = KeyframeAnimationEffect::cr
eate(nonBasicFramesVector).get(); | 723 RefPtr<KeyframeAnimationEffect> nonBasicFrames = KeyframeAnimationEffect::cr
eate(nonBasicFramesVector).get(); |
| 724 | 724 |
| 725 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForCompositorAnimat
ion(linearTiming, *nonBasicFrames.get())); | 725 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForCompositorAnimat
ion(linearTiming, *nonBasicFrames.get())); |
| 726 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForCompositorAnima
tion(cubicTiming, *nonBasicFrames.get())); | 726 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForCompositorAnima
tion(cubicTiming, *nonBasicFrames.get())); |
| 727 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForCompositorAnimat
ion(chainedTiming, *nonBasicFrames.get())); | 727 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForCompositorAnimat
ion(chainedTiming, *nonBasicFrames.get())); |
| 728 } | 728 } |
| 729 | 729 |
| 730 // ----------------------------------------------------------------------- | 730 // ----------------------------------------------------------------------- |
| 731 // ----------------------------------------------------------------------- | 731 // ----------------------------------------------------------------------- |
| 732 | 732 |
| 733 TEST_F(CoreAnimationCompositorAnimationsTest, createSimpleOpacityAnimation) | 733 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) |
| 734 { | 734 { |
| 735 // Animation to convert | 735 // Animation to convert |
| 736 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 736 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 737 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 737 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 738 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 738 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 739 // -- | 739 // -- |
| 740 | 740 |
| 741 WebCompositorSupportMock mockCompositor; | 741 WebCompositorSupportMock mockCompositor; |
| 742 | 742 |
| 743 // Curve is created | 743 // Curve is created |
| (...skipping 24 matching lines...) Expand all Loading... |
| 768 .After(usesMockCurve); | 768 .After(usesMockCurve); |
| 769 | 769 |
| 770 // Go! | 770 // Go! |
| 771 setCompositorForTesting(mockCompositor); | 771 setCompositorForTesting(mockCompositor); |
| 772 Vector<OwnPtr<blink::WebAnimation> > result; | 772 Vector<OwnPtr<blink::WebAnimation> > result; |
| 773 getCompositorAnimations(m_timing, *effect.get(), result); | 773 getCompositorAnimations(m_timing, *effect.get(), result); |
| 774 EXPECT_EQ(1U, result.size()); | 774 EXPECT_EQ(1U, result.size()); |
| 775 result[0].clear(); | 775 result[0].clear(); |
| 776 } | 776 } |
| 777 | 777 |
| 778 TEST_F(CoreAnimationCompositorAnimationsTest, createSimpleOpacityAnimationDurati
on) | 778 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) |
| 779 { | 779 { |
| 780 // Animation to convert | 780 // Animation to convert |
| 781 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 781 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 782 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 782 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 783 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 783 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 784 | 784 |
| 785 m_timing.iterationDuration = 10.0; | 785 m_timing.iterationDuration = 10.0; |
| 786 // -- | 786 // -- |
| 787 | 787 |
| 788 WebCompositorSupportMock mockCompositor; | 788 WebCompositorSupportMock mockCompositor; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 815 .After(usesMockCurve); | 815 .After(usesMockCurve); |
| 816 | 816 |
| 817 // Go! | 817 // Go! |
| 818 setCompositorForTesting(mockCompositor); | 818 setCompositorForTesting(mockCompositor); |
| 819 Vector<OwnPtr<blink::WebAnimation> > result; | 819 Vector<OwnPtr<blink::WebAnimation> > result; |
| 820 getCompositorAnimations(m_timing, *effect.get(), result); | 820 getCompositorAnimations(m_timing, *effect.get(), result); |
| 821 EXPECT_EQ(1U, result.size()); | 821 EXPECT_EQ(1U, result.size()); |
| 822 result[0].clear(); | 822 result[0].clear(); |
| 823 } | 823 } |
| 824 | 824 |
| 825 TEST_F(CoreAnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnima
tionLinear) | 825 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Linear) |
| 826 { | 826 { |
| 827 // Animation to convert | 827 // Animation to convert |
| 828 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 828 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 829 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 829 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 830 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), | 830 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), |
| 831 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), | 831 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), |
| 832 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 832 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 833 | 833 |
| 834 m_timing.iterationCount = 5; | 834 m_timing.iterationCount = 5; |
| 835 m_timing.direction = Timing::PlaybackDirectionAlternate; | 835 m_timing.direction = Timing::PlaybackDirectionAlternate; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 .After(usesMockCurve); | 868 .After(usesMockCurve); |
| 869 | 869 |
| 870 // Go! | 870 // Go! |
| 871 setCompositorForTesting(mockCompositor); | 871 setCompositorForTesting(mockCompositor); |
| 872 Vector<OwnPtr<blink::WebAnimation> > result; | 872 Vector<OwnPtr<blink::WebAnimation> > result; |
| 873 getCompositorAnimations(m_timing, *effect.get(), result); | 873 getCompositorAnimations(m_timing, *effect.get(), result); |
| 874 EXPECT_EQ(1U, result.size()); | 874 EXPECT_EQ(1U, result.size()); |
| 875 result[0].clear(); | 875 result[0].clear(); |
| 876 } | 876 } |
| 877 | 877 |
| 878 TEST_F(CoreAnimationCompositorAnimationsTest, createSimpleOpacityAnimationNegati
veStartDelay) | 878 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationNegativeSt
artDelay) |
| 879 { | 879 { |
| 880 // Animation to convert | 880 // Animation to convert |
| 881 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 881 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 882 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 882 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 883 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 883 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 884 | 884 |
| 885 m_timing.iterationCount = 5.0; | 885 m_timing.iterationCount = 5.0; |
| 886 m_timing.iterationDuration = 1.75; | 886 m_timing.iterationDuration = 1.75; |
| 887 m_timing.startDelay = -3.25; | 887 m_timing.startDelay = -3.25; |
| 888 // -- | 888 // -- |
| (...skipping 28 matching lines...) Expand all Loading... |
| 917 .After(usesMockCurve); | 917 .After(usesMockCurve); |
| 918 | 918 |
| 919 // Go! | 919 // Go! |
| 920 setCompositorForTesting(mockCompositor); | 920 setCompositorForTesting(mockCompositor); |
| 921 Vector<OwnPtr<blink::WebAnimation> > result; | 921 Vector<OwnPtr<blink::WebAnimation> > result; |
| 922 getCompositorAnimations(m_timing, *effect.get(), result); | 922 getCompositorAnimations(m_timing, *effect.get(), result); |
| 923 EXPECT_EQ(1U, result.size()); | 923 EXPECT_EQ(1U, result.size()); |
| 924 result[0].clear(); | 924 result[0].clear(); |
| 925 } | 925 } |
| 926 | 926 |
| 927 TEST_F(CoreAnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnima
tionChained) | 927 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
Chained) |
| 928 { | 928 { |
| 929 // Animation to convert | 929 // Animation to convert |
| 930 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 930 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 931 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 931 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 932 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), | 932 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), |
| 933 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), | 933 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), |
| 934 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 934 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 935 | 935 |
| 936 RefPtr<ChainedTimingFunction> chainedTimingFunction = ChainedTimingFunction:
:create(); | 936 RefPtr<ChainedTimingFunction> chainedTimingFunction = ChainedTimingFunction:
:create(); |
| 937 chainedTimingFunction->appendSegment(0.25, m_cubicEaseTimingFunction.get()); | 937 chainedTimingFunction->appendSegment(0.25, m_cubicEaseTimingFunction.get()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 .After(usesMockCurve); | 977 .After(usesMockCurve); |
| 978 | 978 |
| 979 // Go! | 979 // Go! |
| 980 setCompositorForTesting(mockCompositor); | 980 setCompositorForTesting(mockCompositor); |
| 981 Vector<OwnPtr<blink::WebAnimation> > result; | 981 Vector<OwnPtr<blink::WebAnimation> > result; |
| 982 getCompositorAnimations(m_timing, *effect.get(), result); | 982 getCompositorAnimations(m_timing, *effect.get(), result); |
| 983 EXPECT_EQ(1U, result.size()); | 983 EXPECT_EQ(1U, result.size()); |
| 984 result[0].clear(); | 984 result[0].clear(); |
| 985 } | 985 } |
| 986 | 986 |
| 987 TEST_F(CoreAnimationCompositorAnimationsTest, createReversedOpacityAnimation) | 987 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) |
| 988 { | 988 { |
| 989 // Animation to convert | 989 // Animation to convert |
| 990 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 990 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 991 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 991 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 992 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), | 992 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1.
0).get(), 0.25), |
| 993 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), | 993 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20.
0).get(), 0.5), |
| 994 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 994 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 995 | 995 |
| 996 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti
on::create(0.0, 0.0, 0.0, 1.0); | 996 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti
on::create(0.0, 0.0, 0.0, 1.0); |
| 997 RefPtr<ChainedTimingFunction> chainedTimingFunction = ChainedTimingFunction:
:create(); | 997 RefPtr<ChainedTimingFunction> chainedTimingFunction = ChainedTimingFunction:
:create(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 .After(usesMockCurve); | 1037 .After(usesMockCurve); |
| 1038 | 1038 |
| 1039 // Go! | 1039 // Go! |
| 1040 setCompositorForTesting(mockCompositor); | 1040 setCompositorForTesting(mockCompositor); |
| 1041 Vector<OwnPtr<blink::WebAnimation> > result; | 1041 Vector<OwnPtr<blink::WebAnimation> > result; |
| 1042 getCompositorAnimations(m_timing, *effect.get(), result); | 1042 getCompositorAnimations(m_timing, *effect.get(), result); |
| 1043 EXPECT_EQ(1U, result.size()); | 1043 EXPECT_EQ(1U, result.size()); |
| 1044 result[0].clear(); | 1044 result[0].clear(); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 TEST_F(CoreAnimationCompositorAnimationsTest, createReversedOpacityAnimationNega
tiveStartDelay) | 1047 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
StartDelay) |
| 1048 { | 1048 { |
| 1049 // Animation to convert | 1049 // Animation to convert |
| 1050 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( | 1050 RefPtr<KeyframeAnimationEffect> effect = createKeyframeAnimationEffect( |
| 1051 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), | 1051 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0
).get(), 0), |
| 1052 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); | 1052 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0
).get(), 1.0)); |
| 1053 | 1053 |
| 1054 m_timing.iterationCount = 5.0; | 1054 m_timing.iterationCount = 5.0; |
| 1055 m_timing.iterationDuration = 2.0; | 1055 m_timing.iterationDuration = 2.0; |
| 1056 m_timing.startDelay = -3; | 1056 m_timing.startDelay = -3; |
| 1057 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; | 1057 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 // Go! | 1089 // Go! |
| 1090 setCompositorForTesting(mockCompositor); | 1090 setCompositorForTesting(mockCompositor); |
| 1091 Vector<OwnPtr<blink::WebAnimation> > result; | 1091 Vector<OwnPtr<blink::WebAnimation> > result; |
| 1092 getCompositorAnimations(m_timing, *effect.get(), result); | 1092 getCompositorAnimations(m_timing, *effect.get(), result); |
| 1093 EXPECT_EQ(1U, result.size()); | 1093 EXPECT_EQ(1U, result.size()); |
| 1094 result[0].clear(); | 1094 result[0].clear(); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 | 1097 |
| 1098 } // namespace WebCore | 1098 } // namespace WebCore |
| OLD | NEW |