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/common/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 | 10 |
11 // Trivial test case verifying assertions on left edge. | 11 // Trivial test case verifying assertions on left edge. |
12 TEST(MagnetismMatcherTest, TrivialLeft) { | 12 TEST(MagnetismMatcherTest, TrivialLeft) { |
13 const int distance = MagnetismMatcher::kMagneticDistance; | 13 const int distance = MagnetismMatcher::kMagneticDistance; |
14 const gfx::Rect initial_bounds(20, 10, 50, 60); | 14 const gfx::Rect initial_bounds(20, 10, 50, 60); |
15 MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges); | 15 MagnetismMatcher matcher(initial_bounds, kAllMagnetismEdges); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 EXPECT_FALSE(matcher.ShouldAttach( | 150 EXPECT_FALSE(matcher.ShouldAttach( |
151 gfx::Rect(initial_bounds.x() - 4, 160, 3, 20), &edge)); | 151 gfx::Rect(initial_bounds.x() - 4, 160, 3, 20), &edge)); |
152 // Should match the following which extends into non-overlapping region. | 152 // Should match the following which extends into non-overlapping region. |
153 EXPECT_TRUE(matcher.ShouldAttach( | 153 EXPECT_TRUE(matcher.ShouldAttach( |
154 gfx::Rect(initial_bounds.x() - 4, 140, 3, 20), &edge)); | 154 gfx::Rect(initial_bounds.x() - 4, 140, 3, 20), &edge)); |
155 EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge); | 155 EXPECT_EQ(MAGNETISM_EDGE_LEFT, edge.primary_edge); |
156 EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge); | 156 EXPECT_EQ(SECONDARY_MAGNETISM_EDGE_NONE, edge.secondary_edge); |
157 } | 157 } |
158 | 158 |
159 } // namespace ash | 159 } // namespace ash |
OLD | NEW |