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

Unified Diff: Source/web/tests/WebViewTest.cpp

Issue 1071383002: Round when calculating minimum height of WebViews (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added test that rounds down Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebViewTest.cpp
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
index 6b78e957be83451e0436d406b9e88ac0067071eb..a787d88956e1fb89c3cf2659adfaee245159fa76 100644
--- a/Source/web/tests/WebViewTest.cpp
+++ b/Source/web/tests/WebViewTest.cpp
@@ -2349,6 +2349,18 @@ TEST_F(WebViewTest, PreferredSize)
EXPECT_EQ(200, size.width);
EXPECT_EQ(200, size.height);
+ // Verify that both width and height are rounded (in this case up)
+ webView->setZoomLevel(WebView::zoomFactorToZoomLevel(0.9995));
+ size = webView->contentsPreferredMinimumSize();
+ EXPECT_EQ(100, size.width);
+ EXPECT_EQ(100, size.height);
+
+ // Verify that both width and height are rounded (in this case down)
+ webView->setZoomLevel(WebView::zoomFactorToZoomLevel(1.0005));
+ size = webView->contentsPreferredMinimumSize();
+ EXPECT_EQ(100, size.width);
+ EXPECT_EQ(100, size.height);
+
url = m_baseURL + "specify_size.html?1.5px:1.5px";
URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html");
webView = m_webViewHelper.initializeAndLoad(url, true);
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698