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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 void PrintTo(const CSSLengthArray& lengthArray, ::std::ostream* os) | 45 void PrintTo(const CSSLengthArray& lengthArray, ::std::ostream* os) |
46 { | 46 { |
47 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) | 47 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) |
48 *os << lengthArray.at(i) << ' '; | 48 *os << lengthArray.at(i) << ' '; |
49 } | 49 } |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 void testAccumulatePixelsAndPercent(const CSSToLengthConversionData& conversionD
ata, PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> expression, float expectedPix
els, float expectedPercent) | 53 void testAccumulatePixelsAndPercent(const CSSToLengthConversionData& conversionD
ata, PassRefPtr<CSSCalcExpressionNode> expression, float expectedPixels, float e
xpectedPercent) |
54 { | 54 { |
55 PixelsAndPercent value(0, 0); | 55 PixelsAndPercent value(0, 0); |
56 expression->accumulatePixelsAndPercent(conversionData, value); | 56 expression->accumulatePixelsAndPercent(conversionData, value); |
57 EXPECT_EQ(expectedPixels, value.pixels); | 57 EXPECT_EQ(expectedPixels, value.pixels); |
58 EXPECT_EQ(expectedPercent, value.percent); | 58 EXPECT_EQ(expectedPercent, value.percent); |
59 } | 59 } |
60 | 60 |
61 void initLengthArray(CSSLengthArray& lengthArray) | 61 void initLengthArray(CSSLengthArray& lengthArray) |
62 { | 62 { |
63 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); | 63 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 expectation.at(CSSPrimitiveValue::UnitTypePixels) = 15; | 188 expectation.at(CSSPrimitiveValue::UnitTypePixels) = 15; |
189 expectation.at(CSSPrimitiveValue::UnitTypeFontSize) = 20; | 189 expectation.at(CSSPrimitiveValue::UnitTypeFontSize) = 20; |
190 expectation.at(CSSPrimitiveValue::UnitTypePercentage) = -40; | 190 expectation.at(CSSPrimitiveValue::UnitTypePercentage) = -40; |
191 EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc((1 *
2) * (5px + 20em / 2) - 80% / (3 - 1) + 5px)"))); | 191 EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc((1 *
2) * (5px + 20em / 2) - 80% / (3 - 1) + 5px)"))); |
192 } | 192 } |
193 | 193 |
194 } // anonymous namespace | 194 } // anonymous namespace |
195 | 195 |
196 } // namespace blink | 196 } // namespace blink |
OLD | NEW |