| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |