OLD | NEW |
1 // Use of this source code is governed by a BSD-style license that can be | 1 // Use of this source code is governed by a BSD-style license that can be |
2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
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/css/MediaValues.h" | 6 #include "core/css/MediaValues.h" |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "wtf/text/StringBuilder.h" | 9 #include "wtf/text/StringBuilder.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 { 40.0, CSSPrimitiveValue::UnitType::Chs, 16, 300, 300, true, 320 }, | 32 { 40.0, CSSPrimitiveValue::UnitType::Chs, 16, 300, 300, true, 320 }, |
33 { 43.0, CSSPrimitiveValue::UnitType::ViewportWidth, 16, 848, 976, true,
364 }, | 33 { 43.0, CSSPrimitiveValue::UnitType::ViewportWidth, 16, 848, 976, true,
364 }, |
34 { 43.0, CSSPrimitiveValue::UnitType::ViewportHeight, 16, 848, 976, true,
419 }, | 34 { 43.0, CSSPrimitiveValue::UnitType::ViewportHeight, 16, 848, 976, true,
419 }, |
35 { 43.0, CSSPrimitiveValue::UnitType::ViewportMin, 16, 848, 976, true, 36
4 }, | 35 { 43.0, CSSPrimitiveValue::UnitType::ViewportMin, 16, 848, 976, true, 36
4 }, |
36 { 43.0, CSSPrimitiveValue::UnitType::ViewportMax, 16, 848, 976, true, 41
9 }, | 36 { 43.0, CSSPrimitiveValue::UnitType::ViewportMax, 16, 848, 976, true, 41
9 }, |
37 { 1.3, CSSPrimitiveValue::UnitType::Centimeters, 16, 300, 300, true, 49
}, | 37 { 1.3, CSSPrimitiveValue::UnitType::Centimeters, 16, 300, 300, true, 49
}, |
38 { 1.3, CSSPrimitiveValue::UnitType::Millimeters, 16, 300, 300, true, 4 }
, | 38 { 1.3, CSSPrimitiveValue::UnitType::Millimeters, 16, 300, 300, true, 4 }
, |
39 { 1.3, CSSPrimitiveValue::UnitType::Inches, 16, 300, 300, true, 124 }, | 39 { 1.3, CSSPrimitiveValue::UnitType::Inches, 16, 300, 300, true, 124 }, |
40 { 13, CSSPrimitiveValue::UnitType::Points, 16, 300, 300, true, 17 }, | 40 { 13, CSSPrimitiveValue::UnitType::Points, 16, 300, 300, true, 17 }, |
41 { 1.3, CSSPrimitiveValue::UnitType::Picas, 16, 300, 300, true, 20 }, | 41 { 1.3, CSSPrimitiveValue::UnitType::Picas, 16, 300, 300, true, 20 }, |
| 42 { 40.0, CSSPrimitiveValue::UnitType::UserUnits, 16, 300, 300, true, 40 }
, |
42 { 1.3, CSSPrimitiveValue::UnitType::Unknown, 16, 300, 300, false, 20 }, | 43 { 1.3, CSSPrimitiveValue::UnitType::Unknown, 16, 300, 300, false, 20 }, |
43 { 0.0, CSSPrimitiveValue::UnitType::Unknown, 0, 0, 0, false, 0.0 } // Do
not remove the terminating line. | 44 { 0.0, CSSPrimitiveValue::UnitType::Unknown, 0, 0, 0, false, 0.0 } // Do
not remove the terminating line. |
44 }; | 45 }; |
45 | 46 |
46 | 47 |
47 for (unsigned i = 0; testCases[i].viewportWidth; ++i) { | 48 for (unsigned i = 0; testCases[i].viewportWidth; ++i) { |
48 int output = 0; | 49 int output = 0; |
49 bool success = MediaValues::computeLength(testCases[i].value, | 50 bool success = MediaValues::computeLength(testCases[i].value, |
50 testCases[i].type, | 51 testCases[i].type, |
51 testCases[i].fontSize, | 52 testCases[i].fontSize, |
52 testCases[i].viewportWidth, | 53 testCases[i].viewportWidth, |
53 testCases[i].viewportHeight, | 54 testCases[i].viewportHeight, |
54 output); | 55 output); |
55 ASSERT_EQ(testCases[i].success, success); | 56 ASSERT_EQ(testCases[i].success, success); |
56 if (success) | 57 if (success) |
57 ASSERT_EQ(testCases[i].output, output); | 58 ASSERT_EQ(testCases[i].output, output); |
58 } | 59 } |
59 } | 60 } |
60 | 61 |
61 } // namespace | 62 } // namespace |
OLD | NEW |