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

Side by Side Diff: Source/core/animation/LengthBoxStyleInterpolationTest.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/LengthBoxStyleInterpolation.h" 6 #include "core/animation/LengthBoxStyleInterpolation.h"
7 7
8 #include "core/animation/LengthStyleInterpolation.h" 8 #include "core/animation/LengthStyleInterpolation.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/Rect.h" 10 #include "core/css/Rect.h"
(...skipping 18 matching lines...) Expand all
29 static CSSValue roundTrip(CSSValue value) 29 static CSSValue roundTrip(CSSValue value)
30 { 30 {
31 return interpolableValueToLengthBox(lengthBoxToInterpolableValue(value). get(), value, value); 31 return interpolableValueToLengthBox(lengthBoxToInterpolableValue(value). get(), value, value);
32 } 32 }
33 33
34 static void testPrimitiveValue(CSSValue value, double left, double right, do uble top, double bottom, CSSPrimitiveValue::UnitType unitType) 34 static void testPrimitiveValue(CSSValue value, double left, double right, do uble top, double bottom, CSSPrimitiveValue::UnitType unitType)
35 { 35 {
36 EXPECT_TRUE(value.isPrimitiveValue()); 36 EXPECT_TRUE(value.isPrimitiveValue());
37 Rect* rect = toCSSPrimitiveValue(value).getRectValue(); 37 Rect* rect = toCSSPrimitiveValue(value).getRectValue();
38 38
39 EXPECT_EQ(rect->left()->getDoubleValue(), left); 39 EXPECT_EQ(rect->left().getDoubleValue(), left);
40 EXPECT_EQ(rect->right()->getDoubleValue(), right); 40 EXPECT_EQ(rect->right().getDoubleValue(), right);
41 EXPECT_EQ(rect->top()->getDoubleValue(), top); 41 EXPECT_EQ(rect->top().getDoubleValue(), top);
42 EXPECT_EQ(rect->bottom()->getDoubleValue(), bottom); 42 EXPECT_EQ(rect->bottom().getDoubleValue(), bottom);
43 43
44 EXPECT_EQ(unitType, rect->left()->primitiveType()); 44 EXPECT_EQ(unitType, rect->left().primitiveType());
45 EXPECT_EQ(unitType, rect->right()->primitiveType()); 45 EXPECT_EQ(unitType, rect->right().primitiveType());
46 EXPECT_EQ(unitType, rect->top()->primitiveType()); 46 EXPECT_EQ(unitType, rect->top().primitiveType());
47 EXPECT_EQ(unitType, rect->bottom()->primitiveType()); 47 EXPECT_EQ(unitType, rect->bottom().primitiveType());
48 } 48 }
49 }; 49 };
50 50
51 TEST_F(AnimationLengthBoxStyleInterpolationTest, ZeroLengthBox) 51 TEST_F(AnimationLengthBoxStyleInterpolationTest, ZeroLengthBox)
52 { 52 {
53 RefPtrWillBeRawPtr<Rect> rectPx = Rect::create(); 53 RefPtrWillBeRawPtr<Rect> rectPx = Rect::create();
54 rectPx->setLeft(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX)); 54 rectPx->setLeft(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
55 rectPx->setRight(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX)); 55 rectPx->setRight(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
56 rectPx->setTop(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX)); 56 rectPx->setTop(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
57 rectPx->setBottom(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX)); 57 rectPx->setBottom(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 rectPer->setLeft(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PERCEN TAGE)); 113 rectPer->setLeft(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PERCEN TAGE));
114 rectPer->setRight(CSSPrimitiveValue::create(-30, CSSPrimitiveValue::CSS_PERC ENTAGE)); 114 rectPer->setRight(CSSPrimitiveValue::create(-30, CSSPrimitiveValue::CSS_PERC ENTAGE));
115 rectPer->setTop(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PERCENT AGE)); 115 rectPer->setTop(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PERCENT AGE));
116 rectPer->setBottom(CSSPrimitiveValue::create(-30, CSSPrimitiveValue::CSS_PER CENTAGE)); 116 rectPer->setBottom(CSSPrimitiveValue::create(-30, CSSPrimitiveValue::CSS_PER CENTAGE));
117 117
118 value = roundTrip(CSSPrimitiveValue::create(rectPer.release())); 118 value = roundTrip(CSSPrimitiveValue::create(rectPer.release()));
119 testPrimitiveValue(value, 30, -30, 30, -30, CSSPrimitiveValue::CSS_PERCENTAG E); 119 testPrimitiveValue(value, 30, -30, 30, -30, CSSPrimitiveValue::CSS_PERCENTAG E);
120 } 120 }
121 121
122 } 122 }
OLDNEW
« no previous file with comments | « Source/core/animation/LengthBoxStyleInterpolation.cpp ('k') | Source/core/animation/LengthPairStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698