| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->
toLength(style.get(), style.get(), 3, NonNegativeValues)); | 168 EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->
toLength(style.get(), style.get(), 3, NonNegativeValues)); |
| 169 | 169 |
| 170 EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)
->toLength(style.get(), style.get(), 1)); | 170 EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)
->toLength(style.get(), style.get(), 1)); |
| 171 EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)
->toLength(style.get(), style.get(), 3)); | 171 EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)
->toLength(style.get(), style.get(), 3)); |
| 172 EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)-
>toLength(style.get(), style.get(), 1, NonNegativeValues)); | 172 EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)-
>toLength(style.get(), style.get(), 1, NonNegativeValues)); |
| 173 EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)-
>toLength(style.get(), style.get(), 3, NonNegativeValues)); | 173 EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)-
>toLength(style.get(), style.get(), 3, NonNegativeValues)); |
| 174 | 174 |
| 175 EXPECT_EQ( | 175 EXPECT_EQ( |
| 176 Length(CalculationValue::create( | 176 Length(CalculationValue::create( |
| 177 adoptPtr(new CalcExpressionBinaryOperation( | 177 adoptPtr(new CalcExpressionBinaryOperation( |
| 178 adoptPtr(new CalcExpressionNumber(-5)), | 178 adoptPtr(new CalcExpressionLength(Length(-5, WebCore::Fixed))), |
| 179 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), | 179 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), |
| 180 CalcAdd)), | 180 CalcAdd)), |
| 181 CalculationRangeAll)), | 181 CalculationRangeAll)), |
| 182 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 1)); | 182 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 1)); |
| 183 EXPECT_EQ( | 183 EXPECT_EQ( |
| 184 Length(CalculationValue::create( | 184 Length(CalculationValue::create( |
| 185 adoptPtr(new CalcExpressionBinaryOperation( | 185 adoptPtr(new CalcExpressionBinaryOperation( |
| 186 adoptPtr(new CalcExpressionNumber(-15)), | 186 adoptPtr(new CalcExpressionLength(Length(-15, WebCore::Fixed))), |
| 187 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), | 187 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), |
| 188 CalcAdd)), | 188 CalcAdd)), |
| 189 CalculationRangeAll)), | 189 CalculationRangeAll)), |
| 190 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 3)); | 190 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 3)); |
| 191 EXPECT_EQ( | 191 EXPECT_EQ( |
| 192 Length(CalculationValue::create( | 192 Length(CalculationValue::create( |
| 193 adoptPtr(new CalcExpressionBinaryOperation( | 193 adoptPtr(new CalcExpressionBinaryOperation( |
| 194 adoptPtr(new CalcExpressionNumber(-5)), | 194 adoptPtr(new CalcExpressionLength(Length(-5, WebCore::Fixed))), |
| 195 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), | 195 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), |
| 196 CalcAdd)), | 196 CalcAdd)), |
| 197 CalculationRangeNonNegative)), | 197 CalculationRangeNonNegative)), |
| 198 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 1, NonNegativeValues)); | 198 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 1, NonNegativeValues)); |
| 199 EXPECT_EQ( | 199 EXPECT_EQ( |
| 200 Length(CalculationValue::create( | 200 Length(CalculationValue::create( |
| 201 adoptPtr(new CalcExpressionBinaryOperation( | 201 adoptPtr(new CalcExpressionBinaryOperation( |
| 202 adoptPtr(new CalcExpressionNumber(-15)), | 202 adoptPtr(new CalcExpressionLength(Length(-15, WebCore::Fixed))), |
| 203 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), | 203 adoptPtr(new CalcExpressionLength(Length(-5, Percent))), |
| 204 CalcAdd)), | 204 CalcAdd)), |
| 205 CalculationRangeNonNegative)), | 205 CalculationRangeNonNegative)), |
| 206 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 3, NonNegativeValues)); | 206 create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENT
AGE)->toLength(style.get(), style.get(), 3, NonNegativeValues)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 TEST_F(AnimatableLengthTest, Interpolate) | 209 TEST_F(AnimatableLengthTest, Interpolate) |
| 210 { | 210 { |
| 211 RefPtr<AnimatableLength> from10px = create(10, CSSPrimitiveValue::CSS_PX); | 211 RefPtr<AnimatableLength> from10px = create(10, CSSPrimitiveValue::CSS_PX); |
| 212 RefPtr<AnimatableLength> to20pxAsInches = create(20.0 / 96, CSSPrimitiveValu
e::CSS_IN); | 212 RefPtr<AnimatableLength> to20pxAsInches = create(20.0 / 96, CSSPrimitiveValu
e::CSS_IN); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_EMS).get(), | 248 CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_EMS).get(), |
| 249 create(10, CSSPrimitiveValue::CSS_EMS).get(), | 249 create(10, CSSPrimitiveValue::CSS_EMS).get(), |
| 250 create(0, CSSPrimitiveValue::CSS_REMS).get())); | 250 create(0, CSSPrimitiveValue::CSS_REMS).get())); |
| 251 EXPECT_TRUE(testAdd( | 251 EXPECT_TRUE(testAdd( |
| 252 CSSPrimitiveValue::create(20, CSSPrimitiveValue::CSS_REMS).get(), | 252 CSSPrimitiveValue::create(20, CSSPrimitiveValue::CSS_REMS).get(), |
| 253 create(0, CSSPrimitiveValue::CSS_EMS).get(), | 253 create(0, CSSPrimitiveValue::CSS_EMS).get(), |
| 254 create(20, CSSPrimitiveValue::CSS_REMS).get())); | 254 create(20, CSSPrimitiveValue::CSS_REMS).get())); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } | 257 } |
| OLD | NEW |