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 26 matching lines...) Expand all Loading... |
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 PassRefPtrWillBeRawPtr<AnimatableValue> unknownAnimatableValue(double n) |
46 { | 46 { |
47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa
lue::CSS_UNKNOWN).get()); | 47 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa
lue::CSS_UNKNOWN)); |
48 } | 48 } |
49 | 49 |
50 PassRefPtrWillBeRawPtr<AnimatableValue> pixelAnimatableValue(double n) | 50 PassRefPtrWillBeRawPtr<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(PassRefPtrWillBeRawPtr<Anima
tableValue> zeroValue, PassRefPtrWillBeRawPtr<AnimatableValue> oneValue) |
56 { | 56 { |
57 AnimatableValueKeyframeVector keyframes(2); | 57 AnimatableValueKeyframeVector keyframes(2); |
(...skipping 16 matching lines...) Expand all Loading... |
74 { | 74 { |
75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo
lationValue.get()); | 75 LegacyStyleInterpolation* interpolation = toLegacyStyleInterpolation(interpo
lationValue.get()); |
76 RefPtrWillBeRawPtr<AnimatableValue> value = interpolation->currentValue(); | 76 RefPtrWillBeRawPtr<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()).getDoubleValue(); |
85 | 85 |
86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); | 86 EXPECT_FLOAT_EQ(static_cast<float>(expectedValue), actualValue); |
87 } | 87 } |
88 | 88 |
89 Interpolation* findValue(WillBeHeapVector<RefPtrWillBeMember<Interpolation>>& va
lues, CSSPropertyID id) | 89 Interpolation* findValue(WillBeHeapVector<RefPtrWillBeMember<Interpolation>>& va
lues, CSSPropertyID id) |
90 { | 90 { |
91 for (auto& value : values) { | 91 for (auto& value : values) { |
92 if (toLegacyStyleInterpolation(value.get())->id() == id) | 92 if (toLegacyStyleInterpolation(value.get())->id() == id) |
93 return value.get(); | 93 return value.get(); |
94 } | 94 } |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); | 564 EXPECT_DOUBLE_EQ(0.6, result[5]->offset()); |
565 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); | 565 EXPECT_DOUBLE_EQ(0.7, result[6]->offset()); |
566 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); | 566 EXPECT_DOUBLE_EQ(0.8, result[7]->offset()); |
567 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); | 567 EXPECT_DOUBLE_EQ(0.85, result[8]->offset()); |
568 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); | 568 EXPECT_DOUBLE_EQ(0.9, result[9]->offset()); |
569 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); | 569 EXPECT_DOUBLE_EQ(0.95, result[10]->offset()); |
570 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); | 570 EXPECT_DOUBLE_EQ(1.0, result[11]->offset()); |
571 } | 571 } |
572 | 572 |
573 } // namespace blink | 573 } // namespace blink |
OLD | NEW |