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

Side by Side Diff: Source/core/css/CSSCalculationValueTest.cpp

Issue 209433004: Do not zero-initialize RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compilation on gcc and msvc Created 6 years, 9 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 EXPECT_TRUE( 47 EXPECT_TRUE(
48 expression->equals( 48 expression->equals(
49 *CSSCalcValue::createExpressionNode( 49 *CSSCalcValue::createExpressionNode(
50 expression->toCalcValue(CSSToLengthConversionData(style, style, 0)).get(), 50 expression->toCalcValue(CSSToLengthConversionData(style, style, 0)).get(),
51 style->effectiveZoom()).get())); 51 style->effectiveZoom()).get()));
52 } 52 }
53 53
54 TEST(CSSCalculationValue, CreateExpressionNodeFromLength) 54 TEST(CSSCalculationValue, CreateExpressionNodeFromLength)
55 { 55 {
56 RefPtr<RenderStyle> style = RenderStyle::create(); 56 RefPtr<RenderStyle> style = RenderStyle::create();
57 RefPtrWillBeRawPtr<CSSCalcExpressionNode> expected; 57 RefPtrWillBeRawPtr<CSSCalcExpressionNode> expected = nullptr;
58 RefPtrWillBeRawPtr<CSSCalcExpressionNode> actual; 58 RefPtrWillBeRawPtr<CSSCalcExpressionNode> actual = nullptr;
59 59
60 expected = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true); 60 expected = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true);
61 actual = CSSCalcValue::createExpressionNode(Length(10, WebCore::Fixed), styl e->effectiveZoom()); 61 actual = CSSCalcValue::createExpressionNode(Length(10, WebCore::Fixed), styl e->effectiveZoom());
62 EXPECT_TRUE(actual->equals(*expected.get())); 62 EXPECT_TRUE(actual->equals(*expected.get()));
63 63
64 expected = CSSCalcValue::createExpressionNode( 64 expected = CSSCalcValue::createExpressionNode(
65 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrim itiveValue::CSS_PX), true), 65 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrim itiveValue::CSS_PX), true),
66 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(20, CSSPrim itiveValue::CSS_PX), true), 66 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(20, CSSPrim itiveValue::CSS_PX), true),
67 CalcAdd); 67 CalcAdd);
68 actual = CSSCalcValue::createExpressionNode( 68 actual = CSSCalcValue::createExpressionNode(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 actual = CSSCalcValue::createExpressionNode( 102 actual = CSSCalcValue::createExpressionNode(
103 Length(CalculationValue::create( 103 Length(CalculationValue::create(
104 adoptPtr(new CalcExpressionBlendLength(Length(50, WebCore::Fixed), L ength(60, WebCore::Fixed), 0.75)), 104 adoptPtr(new CalcExpressionBlendLength(Length(50, WebCore::Fixed), L ength(60, WebCore::Fixed), 0.75)),
105 ValueRangeAll)), 105 ValueRangeAll)),
106 style->effectiveZoom()); 106 style->effectiveZoom());
107 EXPECT_TRUE(actual->equals(*expected.get())); 107 EXPECT_TRUE(actual->equals(*expected.get()));
108 } 108 }
109 109
110 TEST(CSSCalculationValue, CreateExpressionNodeFromLengthFromExpressionNode) 110 TEST(CSSCalculationValue, CreateExpressionNodeFromLengthFromExpressionNode)
111 { 111 {
112 RefPtrWillBeRawPtr<CSSCalcExpressionNode> expression;
113 RefPtr<RenderStyle> style = RenderStyle::createDefaultStyle(); 112 RefPtr<RenderStyle> style = RenderStyle::createDefaultStyle();
114 style->setEffectiveZoom(5); 113 style->setEffectiveZoom(5);
115 114
116 testExpression( 115 testExpression(
117 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrim itiveValue::CSS_PX), true), 116 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrim itiveValue::CSS_PX), true),
118 style.get()); 117 style.get());
119 118
120 testExpression( 119 testExpression(
121 CSSCalcValue::createExpressionNode( 120 CSSCalcValue::createExpressionNode(
122 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSS PrimitiveValue::CSS_PX), true), 121 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSS PrimitiveValue::CSS_PX), true),
(...skipping 16 matching lines...) Expand all
139 CalcMultiply), 138 CalcMultiply),
140 CSSCalcValue::createExpressionNode( 139 CSSCalcValue::createExpressionNode(
141 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60, CSSPrimitiveValue::CSS_PX), true), 140 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60, CSSPrimitiveValue::CSS_PX), true),
142 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.7 5, CSSPrimitiveValue::CSS_NUMBER), false), 141 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.7 5, CSSPrimitiveValue::CSS_NUMBER), false),
143 CalcMultiply), 142 CalcMultiply),
144 CalcAdd), 143 CalcAdd),
145 style.get()); 144 style.get());
146 } 145 }
147 146
148 } 147 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValue.cpp ('k') | Source/core/css/CSSComputedStyleDeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698