| Index: ash/wm/workspace/magnetism_matcher_unittest.cc
|
| diff --git a/ash/wm/workspace/magnetism_matcher_unittest.cc b/ash/wm/workspace/magnetism_matcher_unittest.cc
|
| index 44ec4f1ad54c4a8d32fc79bd03b7572c422392f6..c9c1c12b618dd7d8e3f4ea722f8693757e7eb9f7 100644
|
| --- a/ash/wm/workspace/magnetism_matcher_unittest.cc
|
| +++ b/ash/wm/workspace/magnetism_matcher_unittest.cc
|
| @@ -15,20 +15,20 @@ TEST(MagnetismMatcherTest, TrivialLeft) {
|
| MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges);
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| MatchedEdge edge;
|
| - EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - distance - 10,
|
| - initial_bounds.y() - distance - 10, 2, 3), &edge));
|
| + EXPECT_FALSE(
|
| + matcher.ShouldAttach(gfx::Rect(initial_bounds.x() - distance - 10,
|
| + initial_bounds.y() - distance - 10, 2, 3),
|
| + &edge));
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - 2, initial_bounds.y(), 1, 1),
|
| - &edge));
|
| + gfx::Rect(initial_bounds.x() - 2, initial_bounds.y(), 1, 1), &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_LEADING, edge.secondary_edge);
|
|
|
| - EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - 2,
|
| - initial_bounds.y() + distance + 1 , 1, 1),
|
| - &edge));
|
| + EXPECT_TRUE(
|
| + matcher.ShouldAttach(gfx::Rect(initial_bounds.x() - 2,
|
| + initial_bounds.y() + distance + 1, 1, 1),
|
| + &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge);
|
| }
|
| @@ -40,25 +40,28 @@ TEST(MagnetismMatcherTest, TrivialBottom) {
|
| MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges);
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| MatchedEdge edge;
|
| - EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - distance - 10,
|
| - initial_bounds.y() - distance - 10, 2, 3), &edge));
|
| + EXPECT_FALSE(
|
| + matcher.ShouldAttach(gfx::Rect(initial_bounds.x() - distance - 10,
|
| + initial_bounds.y() - distance - 10, 2, 3),
|
| + &edge));
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - 2,
|
| - initial_bounds.bottom() + 4, 10, 1), &edge));
|
| + gfx::Rect(initial_bounds.x() - 2, initial_bounds.bottom() + 4, 10, 1),
|
| + &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_BOTTOM, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_LEADING, edge.secondary_edge);
|
|
|
| - EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() + distance + 1,
|
| - initial_bounds.bottom() + 4, 10, 1), &edge));
|
| + EXPECT_TRUE(
|
| + matcher.ShouldAttach(gfx::Rect(initial_bounds.x() + distance + 1,
|
| + initial_bounds.bottom() + 4, 10, 1),
|
| + &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_BOTTOM, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge);
|
|
|
| - EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.right() - 10 - 1,
|
| - initial_bounds.bottom() + 4, 10, 1), &edge));
|
| + EXPECT_TRUE(
|
| + matcher.ShouldAttach(gfx::Rect(initial_bounds.right() - 10 - 1,
|
| + initial_bounds.bottom() + 4, 10, 1),
|
| + &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_BOTTOM, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_TRAILING, edge.secondary_edge);
|
| }
|
| @@ -70,24 +73,21 @@ TEST(MagnetismMatcherTest, ObscureLeading) {
|
| MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges);
|
| MatchedEdge edge;
|
| // Overlap with the upper right corner.
|
| - EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.right() - distance * 2,
|
| - initial_bounds.y() - distance - 2,
|
| - distance * 3,
|
| - (distance + 2) * 2), &edge));
|
| + EXPECT_FALSE(
|
| + matcher.ShouldAttach(gfx::Rect(initial_bounds.right() - distance * 2,
|
| + initial_bounds.y() - distance - 2,
|
| + distance * 3, (distance + 2) * 2),
|
| + &edge));
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| // Verify doesn't match the following which is obscured by first.
|
| EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.right() + 1,
|
| - initial_bounds.y(),
|
| - distance,
|
| - 5), &edge));
|
| + gfx::Rect(initial_bounds.right() + 1, initial_bounds.y(), distance, 5),
|
| + &edge));
|
| // Should match the following which extends into non-overlapping region.
|
| EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.right() + 1,
|
| - initial_bounds.y() + distance + 1,
|
| - distance,
|
| - 15), &edge));
|
| + gfx::Rect(initial_bounds.right() + 1, initial_bounds.y() + distance + 1,
|
| + distance, 15),
|
| + &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_RIGHT, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge);
|
| }
|
| @@ -100,17 +100,15 @@ TEST(MagnetismMatcherTest, DontObscureOtherSide) {
|
| MatchedEdge edge;
|
| // Overlap with the left side.
|
| EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - distance + 1,
|
| - initial_bounds.y() + 2,
|
| - distance * 2 + 2,
|
| - initial_bounds.height() + distance * 4), &edge));
|
| + gfx::Rect(initial_bounds.x() - distance + 1, initial_bounds.y() + 2,
|
| + distance * 2 + 2, initial_bounds.height() + distance * 4),
|
| + &edge));
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| // Should match the right side since it isn't obscured.
|
| EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.right() - 1,
|
| - initial_bounds.y() + distance + 1,
|
| - distance,
|
| - 5), &edge));
|
| + gfx::Rect(initial_bounds.right() - 1, initial_bounds.y() + distance + 1,
|
| + distance, 5),
|
| + &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_RIGHT, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge);
|
| }
|
| @@ -123,19 +121,16 @@ TEST(MagnetismMatcherTest, ObscureCenter) {
|
| MatchedEdge edge;
|
| // Overlap with the center bottom edge.
|
| EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(100, initial_bounds.bottom() - distance - 2,
|
| - 20,
|
| - (distance + 2) * 2), &edge));
|
| + gfx::Rect(100, initial_bounds.bottom() - distance - 2, 20,
|
| + (distance + 2) * 2),
|
| + &edge));
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| // Verify doesn't match the following which is obscured by first.
|
| EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(110, initial_bounds.bottom() + 1,
|
| - 10, 5), &edge));
|
| + gfx::Rect(110, initial_bounds.bottom() + 1, 10, 5), &edge));
|
| // Should match the following which extends into non-overlapping region.
|
| EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(90,
|
| - initial_bounds.bottom() + 1,
|
| - 10, 5), &edge));
|
| + gfx::Rect(90, initial_bounds.bottom() + 1, 10, 5), &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_BOTTOM, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge);
|
| }
|
| @@ -148,22 +143,17 @@ TEST(MagnetismMatcherTest, ObscureTrailing) {
|
| MatchedEdge edge;
|
| // Overlap with the trailing left edge.
|
| EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - distance - 2,
|
| - 150,
|
| - (distance + 2) * 2,
|
| - 50), &edge));
|
| + gfx::Rect(initial_bounds.x() - distance - 2, 150, (distance + 2) * 2, 50),
|
| + &edge));
|
| EXPECT_FALSE(matcher.AreEdgesObscured());
|
| // Verify doesn't match the following which is obscured by first.
|
| EXPECT_FALSE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - 4,
|
| - 160, 3, 20), &edge));
|
| + gfx::Rect(initial_bounds.x() - 4, 160, 3, 20), &edge));
|
| // Should match the following which extends into non-overlapping region.
|
| EXPECT_TRUE(matcher.ShouldAttach(
|
| - gfx::Rect(initial_bounds.x() - 4,
|
| - 140, 3, 20), &edge));
|
| + gfx::Rect(initial_bounds.x() - 4, 140, 3, 20), &edge));
|
| EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge);
|
| EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge);
|
| }
|
|
|
| } // namespace ash
|
| -
|
|
|