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

Side by Side Diff: Source/core/css/MediaQueryEvaluatorTest.cpp

Issue 644813005: Floating point MQs should not match. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Brought everything back to double. DRYed up computeLength calls. Added tests. Created 6 years, 2 months 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 | « Source/core/css/MediaQueryEvaluator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
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/MediaQueryEvaluator.h" 6 #include "core/css/MediaQueryEvaluator.h"
7 7
8 #include "core/MediaTypeNames.h" 8 #include "core/MediaTypeNames.h"
9 #include "core/css/MediaList.h" 9 #include "core/css/MediaList.h"
10 #include "core/css/MediaValuesCached.h" 10 #include "core/css/MediaValuesCached.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 TestCase viewportTestCases[] = { 53 TestCase viewportTestCases[] = {
54 {"all and (min-width: 500px)", 1}, 54 {"all and (min-width: 500px)", 1},
55 {"(min-width: 500px)", 1}, 55 {"(min-width: 500px)", 1},
56 {"(min-width: 501px)", 0}, 56 {"(min-width: 501px)", 0},
57 {"(max-width: 500px)", 1}, 57 {"(max-width: 500px)", 1},
58 {"(max-width: 499px)", 0}, 58 {"(max-width: 499px)", 0},
59 {"(width: 500px)", 1}, 59 {"(width: 500px)", 1},
60 {"(width: 501px)", 0}, 60 {"(width: 501px)", 0},
61 {"(min-height: 500px)", 1}, 61 {"(min-height: 500px)", 1},
62 {"(min-height: 501px)", 0}, 62 {"(min-height: 501px)", 0},
63 {"(min-height: 500.001px)", 0},
63 {"(max-height: 500px)", 1}, 64 {"(max-height: 500px)", 1},
65 {"(max-height: 499.999px)", 0},
64 {"(max-height: 499px)", 0}, 66 {"(max-height: 499px)", 0},
65 {"(height: 500px)", 1}, 67 {"(height: 500px)", 1},
68 {"(height: 500.001px)", 0},
69 {"(height: 499.999px)", 0},
66 {"(height: 501px)", 0}, 70 {"(height: 501px)", 0},
71 {"(height)", 1},
72 {"(width)", 1},
73 {"(width: whatisthis)", 0},
67 {"screen and (min-width: 400px) and (max-width: 700px)", 1}, 74 {"screen and (min-width: 400px) and (max-width: 700px)", 1},
68 {0, 0} // Do not remove the terminator line. 75 {0, 0} // Do not remove the terminator line.
69 }; 76 };
70 77
71 TestCase printTestCases[] = { 78 TestCase printTestCases[] = {
72 {"print and (min-resolution: 1dppx)", 1}, 79 {"print and (min-resolution: 1dppx)", 1},
73 {"print and (min-resolution: 118dpcm)", 1}, 80 {"print and (min-resolution: 118dpcm)", 1},
74 {"print and (min-resolution: 119dpcm)", 0}, 81 {"print and (min-resolution: 119dpcm)", 0},
75 {0, 0} // Do not remove the terminator line. 82 {0, 0} // Do not remove the terminator line.
76 }; 83 };
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 RefPtr<FrameView> view = pageHolder->frame().view(); 135 RefPtr<FrameView> view = pageHolder->frame().view();
129 pageHolder->frame().setView(nullptr); 136 pageHolder->frame().setView(nullptr);
130 MediaQueryEvaluator mediaQueryEvaluator(&pageHolder->frame()); 137 MediaQueryEvaluator mediaQueryEvaluator(&pageHolder->frame());
131 RefPtrWillBeRawPtr<MediaQuerySet> querySet = MediaQuerySet::create("foobar") ; 138 RefPtrWillBeRawPtr<MediaQuerySet> querySet = MediaQuerySet::create("foobar") ;
132 bool output = false; 139 bool output = false;
133 ASSERT_EQ(output, mediaQueryEvaluator.eval(querySet.get())); 140 ASSERT_EQ(output, mediaQueryEvaluator.eval(querySet.get()));
134 pageHolder->frame().setView(view); 141 pageHolder->frame().setView(view);
135 } 142 }
136 143
137 } // namespace 144 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryEvaluator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698