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

Side by Side Diff: sky/engine/core/css/MediaValuesTest.cpp

Issue 788883005: Remove REM units. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « sky/engine/core/css/MediaValues.cpp ('k') | sky/engine/core/css/StyleSheetContents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/css/MediaValues.h" 6 #include "sky/engine/core/css/MediaValues.h"
7 7
8 #include "sky/engine/core/css/CSSPrimitiveValue.h" 8 #include "sky/engine/core/css/CSSPrimitiveValue.h"
9 #include "sky/engine/wtf/text/StringBuilder.h" 9 #include "sky/engine/wtf/text/StringBuilder.h"
10 10
11 #include <gtest/gtest.h> 11 #include <gtest/gtest.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 struct TestCase { 15 struct TestCase {
16 double value; 16 double value;
17 CSSPrimitiveValue::UnitType type; 17 CSSPrimitiveValue::UnitType type;
18 unsigned fontSize; 18 unsigned fontSize;
19 unsigned viewportWidth; 19 unsigned viewportWidth;
20 unsigned viewportHeight; 20 unsigned viewportHeight;
21 bool success; 21 bool success;
22 int output; 22 int output;
23 }; 23 };
24 24
25 TEST(MediaValuesTest, Basic) 25 TEST(MediaValuesTest, Basic)
26 { 26 {
27 TestCase testCases[] = { 27 TestCase testCases[] = {
28 { 40.0, CSSPrimitiveValue::CSS_PX, 16, 300, 300, true, 40 }, 28 { 40.0, CSSPrimitiveValue::CSS_PX, 16, 300, 300, true, 40 },
29 { 40.0, CSSPrimitiveValue::CSS_EMS, 16, 300, 300, true, 640 }, 29 { 40.0, CSSPrimitiveValue::CSS_EMS, 16, 300, 300, true, 640 },
30 { 40.0, CSSPrimitiveValue::CSS_REMS, 16, 300, 300, true, 640 },
31 { 40.0, CSSPrimitiveValue::CSS_EXS, 16, 300, 300, true, 320 }, 30 { 40.0, CSSPrimitiveValue::CSS_EXS, 16, 300, 300, true, 320 },
32 { 40.0, CSSPrimitiveValue::CSS_CHS, 16, 300, 300, true, 320 }, 31 { 40.0, CSSPrimitiveValue::CSS_CHS, 16, 300, 300, true, 320 },
33 { 43.0, CSSPrimitiveValue::CSS_VW, 16, 848, 976, true, 364 }, 32 { 43.0, CSSPrimitiveValue::CSS_VW, 16, 848, 976, true, 364 },
34 { 43.0, CSSPrimitiveValue::CSS_VH, 16, 848, 976, true, 419 }, 33 { 43.0, CSSPrimitiveValue::CSS_VH, 16, 848, 976, true, 419 },
35 { 43.0, CSSPrimitiveValue::CSS_VMIN, 16, 848, 976, true, 364 }, 34 { 43.0, CSSPrimitiveValue::CSS_VMIN, 16, 848, 976, true, 364 },
36 { 43.0, CSSPrimitiveValue::CSS_VMAX, 16, 848, 976, true, 419 }, 35 { 43.0, CSSPrimitiveValue::CSS_VMAX, 16, 848, 976, true, 419 },
37 { 1.3, CSSPrimitiveValue::CSS_CM, 16, 300, 300, true, 49 }, 36 { 1.3, CSSPrimitiveValue::CSS_CM, 16, 300, 300, true, 49 },
38 { 1.3, CSSPrimitiveValue::CSS_MM, 16, 300, 300, true, 4 }, 37 { 1.3, CSSPrimitiveValue::CSS_MM, 16, 300, 300, true, 4 },
39 { 1.3, CSSPrimitiveValue::CSS_IN, 16, 300, 300, true, 124 }, 38 { 1.3, CSSPrimitiveValue::CSS_IN, 16, 300, 300, true, 124 },
40 { 13, CSSPrimitiveValue::CSS_PT, 16, 300, 300, true, 17 }, 39 { 13, CSSPrimitiveValue::CSS_PT, 16, 300, 300, true, 17 },
(...skipping 11 matching lines...) Expand all
52 testCases[i].viewportWidth, 51 testCases[i].viewportWidth,
53 testCases[i].viewportHeight, 52 testCases[i].viewportHeight,
54 output); 53 output);
55 ASSERT_EQ(testCases[i].success, success); 54 ASSERT_EQ(testCases[i].success, success);
56 if (success) 55 if (success)
57 ASSERT_EQ(testCases[i].output, output); 56 ASSERT_EQ(testCases[i].output, output);
58 } 57 }
59 } 58 }
60 59
61 } // namespace 60 } // namespace
OLDNEW
« no previous file with comments | « sky/engine/core/css/MediaValues.cpp ('k') | sky/engine/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698