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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 870363005: Remove scroll_delta flooring hack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index cb33686994eb0189f68ae46929aee297b4113d44..8270943edc5394a865847d4c9212ef25907f3d77 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -197,13 +197,14 @@ class LayerTreeHostImplTest : public testing::Test,
static void ExpectContains(const ScrollAndScaleSet& scroll_info,
int id,
- const gfx::Vector2d& scroll_delta) {
+ const gfx::Vector2dF& scroll_delta) {
int times_encountered = 0;
for (size_t i = 0; i < scroll_info.scrolls.size(); ++i) {
if (scroll_info.scrolls[i].layer_id != id)
continue;
- EXPECT_VECTOR_EQ(scroll_delta, scroll_info.scrolls[i].scroll_delta);
+ EXPECT_VECTOR2DF_NEAR(scroll_delta, scroll_info.scrolls[i].scroll_delta,
+ 1.0e-10);
times_encountered++;
}
@@ -3548,9 +3549,8 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
// The layer should have scrolled down in its local coordinates.
scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas();
- ExpectContains(*scroll_info.get(),
- scroll_layer->id(),
- gfx::Vector2d(0, gesture_scroll_delta.x()));
+ ExpectContains(*scroll_info.get(), scroll_layer->id(),
+ gfx::Vector2dF(0, gesture_scroll_delta.x()));
// Reset and scroll down with the wheel.
scroll_layer->SetScrollDelta(gfx::Vector2dF());
@@ -3611,10 +3611,9 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
// The child layer should have scrolled down in its local coordinates an
// amount proportional to the angle between it and the input scroll delta.
- gfx::Vector2d expected_scroll_delta(
- 0,
- gesture_scroll_delta.y() *
- std::cos(MathUtil::Deg2Rad(child_layer_angle)));
+ gfx::Vector2dF expected_scroll_delta(
+ 0, gesture_scroll_delta.y() *
+ std::cos(MathUtil::Deg2Rad(child_layer_angle)));
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
ExpectContains(*scroll_info.get(), child_layer_id, expected_scroll_delta);
@@ -3635,17 +3634,16 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
// The child layer should have scrolled down in its local coordinates an
// amount proportional to the angle between it and the input scroll delta.
- gfx::Vector2d expected_scroll_delta(
- 0,
- -gesture_scroll_delta.x() *
- std::sin(MathUtil::Deg2Rad(child_layer_angle)));
+ gfx::Vector2dF expected_scroll_delta(
+ 0, -gesture_scroll_delta.x() *
+ std::sin(MathUtil::Deg2Rad(child_layer_angle)));
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
ExpectContains(*scroll_info.get(), child_layer_id, expected_scroll_delta);
// The root scroll layer should have scrolled more, since the input scroll
// delta was mostly orthogonal to the child layer's vertical scroll axis.
- gfx::Vector2d expected_root_scroll_delta(
+ gfx::Vector2dF expected_root_scroll_delta(
gesture_scroll_delta.x() *
std::pow(std::cos(MathUtil::Deg2Rad(child_layer_angle)), 2),
0);
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698