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

Unified Diff: third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp

Issue 1496683002: Avoid rounding down viewport dimensions in Media Queries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved to double Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
index 6770c7e4d7155579b1ce622d917d7b1d6e30b481..25ee2ce726fc27c3786f07e45e45df8198d70f64 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp
@@ -92,6 +92,30 @@ TestCase viewportTestCases[] = {
{0, 0} // Do not remove the terminator line.
};
+TestCase floatViewportTestCases[] = {
+ {"all and (min-width: 600.5px)", 1},
+ {"(min-width: 600px)", 1},
+ {"(min-width: 600.5px)", 1},
+ {"(min-width: 601px)", 0},
+ {"(max-width: 600px)", 0},
+ {"(max-width: 600.5px)", 1},
+ {"(max-width: 601px)", 1},
+ {"(width: 600.5px)", 1},
+ {"(width: 601px)", 0},
+ {"(min-height: 700px)", 1},
+ {"(min-height: 700.125px)", 1},
+ {"(min-height: 701px)", 0},
+ {"(min-height: 700.126px)", 0},
+ {"(max-height: 701px)", 1},
+ {"(max-height: 700.125px)", 1},
+ {"(max-height: 700px)", 0},
+ {"(height: 700.125px)", 1},
+ {"(height: 700.126px)", 0},
+ {"(height: 700.124px)", 0},
+ {"(height: 701px)", 0},
+ {0, 0} // Do not remove the terminator line.
+};
+
TestCase printTestCases[] = {
{"print and (min-resolution: 1dppx)", 1},
{"print and (min-resolution: 118dpcm)", 1},
@@ -159,4 +183,15 @@ TEST(MediaQueryEvaluatorTest, DynamicNoView)
EXPECT_FALSE(mediaQueryEvaluator.eval(querySet.get()));
}
+TEST(MediaQueryEvaluatorTest, CachedFloatViewport)
+{
+ MediaValuesCached::MediaValuesCachedData data;
+ data.viewportWidth = 600.5;
+ data.viewportHeight = 700.125;
+ RefPtrWillBeRawPtr<MediaValues> mediaValues = MediaValuesCached::create(data);
+
+ MediaQueryEvaluator mediaQueryEvaluator(*mediaValues);
+ testMQEvaluator(floatViewportTestCases, mediaQueryEvaluator);
+}
+
} // namespace
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp ('k') | third_party/WebKit/Source/core/css/MediaValues.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698