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

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

Issue 1320013005: Make CSSParserMode parameter not optional for MutableStylePropertySet::create() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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
« no previous file with comments | « no previous file | Source/core/animation/StringKeyframe.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 { 50 {
51 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); 51 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount);
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(HTMLQuirksMode);
61 propertySet->setProperty(CSSPropertyLeft, text); 61 propertySet->setProperty(CSSPropertyLeft, text);
62 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft).ge t())->accumulateLengthArray(lengthArray); 62 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft).ge t())->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).get()) ->getDoubleValue()); \ 69 EXPECT_EQ((EXPECTED_DOUBLE_VALUE), toCSSPrimitiveValue((ACTUAL_VALUE).get()) ->getDoubleValue()); \
70 EXPECT_EQ((EXPECTED_UNIT_TYPE), toCSSPrimitiveValue((ACTUAL_VALUE).get())->t ypeWithCalcResolved()); 70 EXPECT_EQ((EXPECTED_UNIT_TYPE), toCSSPrimitiveValue((ACTUAL_VALUE).get())->t ypeWithCalcResolved());
(...skipping 92 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).get()) ->accumulateLengthArray(expectation); 167 toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll).get()) ->accumulateLengthArray(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 | « no previous file | Source/core/animation/StringKeyframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698