Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: Source/core/animation/KeyframeEffectModelTest.cpp

Issue 1305383006: Oilpan: Unship CSSValues and AnimatableValues Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 #include "core/animation/animatable/AnimatableLength.h" 35 #include "core/animation/animatable/AnimatableLength.h"
36 #include "core/animation/animatable/AnimatableUnknown.h" 36 #include "core/animation/animatable/AnimatableUnknown.h"
37 #include "core/css/CSSPrimitiveValue.h" 37 #include "core/css/CSSPrimitiveValue.h"
38 #include "core/dom/Element.h" 38 #include "core/dom/Element.h"
39 #include <gtest/gtest.h> 39 #include <gtest/gtest.h>
40 40
41 namespace blink { 41 namespace blink {
42 42
43 const double duration = 1.0; 43 const double duration = 1.0;
44 44
45 PassRefPtrWillBeRawPtr<AnimatableValue> unknownAnimatableValue(double n) 45 PassRefPtr<AnimatableValue> unknownAnimatableValue(double n)
46 { 46 {
47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::UnitType::Unknown).get()); 47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::UnitType::Unknown).get());
48 } 48 }
49 49
50 PassRefPtrWillBeRawPtr<AnimatableValue> pixelAnimatableValue(double n) 50 PassRefPtr<AnimatableValue> pixelAnimatableValue(double n)
51 { 51 {
52 return AnimatableLength::create(Length(n, Fixed), 1); 52 return AnimatableLength::create(Length(n, Fixed), 1);
53 } 53 }
54 54
55 AnimatableValueKeyframeVector keyframesAtZeroAndOne(PassRefPtrWillBeRawPtr<Anima tableValue> zeroValue, PassRefPtrWillBeRawPtr<AnimatableValue> oneValue) 55 AnimatableValueKeyframeVector keyframesAtZeroAndOne(PassRefPtr<AnimatableValue> zeroValue, PassRefPtr<AnimatableValue> oneValue)
56 { 56 {
57 AnimatableValueKeyframeVector keyframes(2); 57 AnimatableValueKeyframeVector keyframes(2);
58 keyframes[0] = AnimatableValueKeyframe::create(); 58 keyframes[0] = AnimatableValueKeyframe::create();
59 keyframes[0]->setOffset(0.0); 59 keyframes[0]->setOffset(0.0);
60 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue.get()); 60 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue.get());
61 keyframes[1] = AnimatableValueKeyframe::create(); 61 keyframes[1] = AnimatableValueKeyframe::create();
62 keyframes[1]->setOffset(1.0); 62 keyframes[1]->setOffset(1.0);
63 keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue.get()); 63 keyframes[1]->setPropertyValue(CSSPropertyLeft, oneValue.get());
64 return keyframes; 64 return keyframes;
65 } 65 }
66 66
67 void expectProperty(CSSPropertyID property, PassRefPtrWillBeRawPtr<Interpolation > interpolationValue) 67 void expectProperty(CSSPropertyID property, PassRefPtrWillBeRawPtr<Interpolation > interpolationValue)
68 { 68 {
69 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); 69 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get());
70 ASSERT_EQ(property, interpolation->id()); 70 ASSERT_EQ(property, interpolation->id());
71 } 71 }
72 72
73 void expectDoubleValue(double expectedValue, PassRefPtrWillBeRawPtr<Interpolatio n> interpolationValue) 73 void expectDoubleValue(double expectedValue, PassRefPtrWillBeRawPtr<Interpolatio n> interpolationValue)
74 { 74 {
75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get()); 75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo lationValue.get());
76 RefPtrWillBeRawPtr<AnimatableValue> value = interpolation->currentValue(); 76 RefPtr<AnimatableValue> value = interpolation->currentValue();
77 77
78 ASSERT_TRUE(value->isLength() || value->isUnknown()); 78 ASSERT_TRUE(value->isLength() || value->isUnknown());
79 79
80 double actualValue; 80 double actualValue;
81 if (value->isLength()) 81 if (value->isLength())
82 actualValue = toAnimatableLength(value.get())->length(1, ValueRangeAll). value(); 82 actualValue = toAnimatableLength(value.get())->length(1, ValueRangeAll). value();
83 else 83 else
84 actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCS SValue().get())->getDoubleValue(); 84 actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCS SValue().get())->getDoubleValue();
85 85
86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); 86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue);
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); 564 EXPECT_DOUBLE_EQ(0.6, result[5]->offset());
565 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); 565 EXPECT_DOUBLE_EQ(0.7, result[6]->offset());
566 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); 566 EXPECT_DOUBLE_EQ(0.8, result[7]->offset());
567 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); 567 EXPECT_DOUBLE_EQ(0.85, result[8]->offset());
568 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); 568 EXPECT_DOUBLE_EQ(0.9, result[9]->offset());
569 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); 569 EXPECT_DOUBLE_EQ(0.95, result[10]->offset());
570 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); 570 EXPECT_DOUBLE_EQ(1.0, result[11]->offset());
571 } 571 }
572 572
573 } // namespace blink 573 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/KeyframeEffectModel.cpp ('k') | Source/core/animation/LegacyStyleInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698