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

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

Issue 1225553002: CSSValue Immediates: Make CSSPrimitiveValue a container (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_1
Patch Set: Rebase Created 5 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/animation/LengthStyleInterpolation.h" 6 #include "core/animation/LengthStyleInterpolation.h"
7 7
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/StylePropertySet.h" 9 #include "core/css/StylePropertySet.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) 52 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i)
53 lengthArray.at(i) = 0; 53 lengthArray.at(i) = 0;
54 } 54 }
55 55
56 CSSLengthArray& setLengthArray(CSSLengthArray& lengthArray, String text) 56 CSSLengthArray& setLengthArray(CSSLengthArray& lengthArray, String text)
57 { 57 {
58 CSSPrimitiveValue::CSSLengthTypeArray lengthTypeArray; 58 CSSPrimitiveValue::CSSLengthTypeArray lengthTypeArray;
59 initLengthArray(lengthArray); 59 initLengthArray(lengthArray);
60 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStylePr opertySet::create(); 60 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStylePr opertySet::create();
61 propertySet->setProperty(CSSPropertyLeft, text); 61 propertySet->setProperty(CSSPropertyLeft, text);
62 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft))-> accumulateLengthArray(lengthArray); 62 toCSSPrimitiveValue(*propertySet->getPropertyCSSValue(CSSPropertyLeft)). accumulateLengthArray(lengthArray);
63 return lengthArray; 63 return lengthArray;
64 } 64 }
65 }; 65 };
66 66
67 #define TEST_PRIMITIVE_VALUE(ACTUAL_VALUE, EXPECTED_DOUBLE_VALUE, EXPECTED_UNIT_ TYPE) \ 67 #define TEST_PRIMITIVE_VALUE(ACTUAL_VALUE, EXPECTED_DOUBLE_VALUE, EXPECTED_UNIT_ TYPE) \
68 EXPECT_TRUE((ACTUAL_VALUE).isPrimitiveValue()); \ 68 EXPECT_TRUE((ACTUAL_VALUE).isPrimitiveValue()); \
69 EXPECT_EQ((EXPECTED_DOUBLE_VALUE), toCSSPrimitiveValue((ACTUAL_VALUE)).getDouble Value()); \ 69 EXPECT_EQ((EXPECTED_DOUBLE_VALUE), toCSSPrimitiveValue((ACTUAL_VALUE)).getDouble Value()); \
70 EXPECT_EQ((EXPECTED_UNIT_TYPE), toCSSPrimitiveValue((ACTUAL_VALUE)).primitiveTyp e()); 70 EXPECT_EQ((EXPECTED_UNIT_TYPE), toCSSPrimitiveValue((ACTUAL_VALUE)).primitiveTyp e());
71 71
72 #define EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(EXPECTED, ACTUAL) \ 72 #define EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(EXPECTED, ACTUAL) \
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 initLengthArray(expectation); 163 initLengthArray(expectation);
164 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2); 164 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2);
165 result->set(0, createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10)); 165 result->set(0, createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10));
166 result->set(1, createInterpolableLength(1, 1, 1, 1, 0, 1, 0, 1, 1, 1)); 166 result->set(1, createInterpolableLength(1, 1, 1, 1, 0, 1, 0, 1, 1, 1));
167 toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accum ulateLengthArray(expectation); 167 toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accum ulateLengthArray(expectation);
168 setLengthArray(actual, "calc(0px + 10% + 0em + 10ex + 10ch + 10vh + 0vmin + 10vmax)"); 168 setLengthArray(actual, "calc(0px + 10% + 0em + 10ex + 10ch + 10vh + 0vmin + 10vmax)");
169 EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual); 169 EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
170 } 170 }
171 171
172 } 172 }
OLDNEW
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/animation/ListStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698