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

Unified Diff: cc/tiles/tile_manager_unittest.cc

Issue 1721403002: Scale test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager_unittest.cc
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index 18013899a699594b4370b3fc9fffe323e81690c8..39b79c4dbb9efc6cda6358248350aba05cd33958 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -1960,5 +1960,38 @@ TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
false /* partial_raster_enabled */);
}
+#define PRECISION (15)
+void TestScale(float lw, float lh, float s) {
+ long slw = std::lround(lw * s);
+ long slh = std::lround(lh * s);
+
+ std::cout << "\nGiven Scale = " << std::setprecision(PRECISION) << s;
+ std::cout << "\nLayer Size = " << lw << " x " << lh;
+ std::cout << "\nScaled Layer Size = " << std::setprecision(PRECISION)
+ << (lw * s) << " x " << std::setprecision(PRECISION) << (lh * s);
+ std::cout << "\nRounded Scaled Layer Size = " << slw << " x " << slh;
+ std::cout << "\nApproximated Scale [sx, sy] = ["
+ << std::setprecision(PRECISION) << (slw / lw) << ", "
+ << std::setprecision(PRECISION) << (slh / lh) << "] <====";
+
+ std::cout << "\n\n";
+}
+
+TEST_F(TileManagerTest, ScaleTestSmallLayerSize) {
+ // Almost equal scales.
+ float scale1 = 7.33907556533813f;
+ float scale2 = 7.33907508850098f;
+ TestScale(501.f, 502.f, scale1);
+ TestScale(501.f, 502.f, scale2);
+}
+
+TEST_F(TileManagerTest, ScaleTestVeryBigLayerSize) {
+ // Almost equal scales.
+ float scale1 = 7.33907556533813f;
+ float scale2 = 7.33907508850098f;
+ TestScale(5010000.f, 5020000.f, scale1);
+ TestScale(5010000.f, 5020000.f, scale2);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698