OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/workspace/magnetism_matcher.h" | 5 #include "ash/wm/workspace/magnetism_matcher.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace ash { | 9 namespace ash { |
10 namespace internal { | |
11 | 10 |
12 // Trivial test case verifying assertions on left edge. | 11 // Trivial test case verifying assertions on left edge. |
13 TEST(MagnetismMatcherTest, TrivialLeft) { | 12 TEST(MagnetismMatcherTest, TrivialLeft) { |
14 const int distance = MagnetismMatcher::kMagneticDistance; | 13 const int distance = MagnetismMatcher::kMagneticDistance; |
15 const gfx::Rect initial_bounds(20, 10, 50, 60); | 14 const gfx::Rect initial_bounds(20, 10, 50, 60); |
16 MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges); | 15 MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges); |
17 EXPECT_FALSE(matcher.AreEdgesObscured()); | 16 EXPECT_FALSE(matcher.AreEdgesObscured()); |
18 MatchedEdge edge; | 17 MatchedEdge edge; |
19 EXPECT_FALSE(matcher.ShouldAttach( | 18 EXPECT_FALSE(matcher.ShouldAttach( |
20 gfx::Rect(initial_bounds.x() - distance - 10, | 19 gfx::Rect(initial_bounds.x() - distance - 10, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 gfx::Rect(initial_bounds.x() - 4, | 158 gfx::Rect(initial_bounds.x() - 4, |
160 160, 3, 20), &edge)); | 159 160, 3, 20), &edge)); |
161 // Should match the following which extends into non-overlapping region. | 160 // Should match the following which extends into non-overlapping region. |
162 EXPECT_TRUE(matcher.ShouldAttach( | 161 EXPECT_TRUE(matcher.ShouldAttach( |
163 gfx::Rect(initial_bounds.x() - 4, | 162 gfx::Rect(initial_bounds.x() - 4, |
164 140, 3, 20), &edge)); | 163 140, 3, 20), &edge)); |
165 EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge); | 164 EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge); |
166 EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge); | 165 EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge); |
167 } | 166 } |
168 | 167 |
169 } // namespace internal | |
170 } // namespace ash | 168 } // namespace ash |
171 | 169 |
OLD | NEW |