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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 261 |
262 EXPECT_TRUE(parent.Contains(&parent)); | 262 EXPECT_TRUE(parent.Contains(&parent)); |
263 EXPECT_TRUE(parent.Contains(&child1)); | 263 EXPECT_TRUE(parent.Contains(&child1)); |
264 EXPECT_TRUE(parent.Contains(&child2)); | 264 EXPECT_TRUE(parent.Contains(&child2)); |
265 | 265 |
266 EXPECT_FALSE(parent.Contains(NULL)); | 266 EXPECT_FALSE(parent.Contains(NULL)); |
267 EXPECT_FALSE(child1.Contains(&parent)); | 267 EXPECT_FALSE(child1.Contains(&parent)); |
268 EXPECT_FALSE(child2.Contains(&child1)); | 268 EXPECT_FALSE(child2.Contains(&child1)); |
269 } | 269 } |
270 | 270 |
| 271 TEST_F(WindowTest, ContainsPointInRoot) { |
| 272 scoped_ptr<Window> w( |
| 273 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 5, 5), NULL)); |
| 274 EXPECT_FALSE(w->ContainsPointInRoot(gfx::Point(9, 9))); |
| 275 EXPECT_TRUE(w->ContainsPointInRoot(gfx::Point(10, 10))); |
| 276 EXPECT_TRUE(w->ContainsPointInRoot(gfx::Point(14, 14))); |
| 277 EXPECT_FALSE(w->ContainsPointInRoot(gfx::Point(15, 15))); |
| 278 EXPECT_FALSE(w->ContainsPointInRoot(gfx::Point(20, 20))); |
| 279 } |
| 280 |
| 281 TEST_F(WindowTest, ContainsPoint) { |
| 282 scoped_ptr<Window> w( |
| 283 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 5, 5), NULL)); |
| 284 EXPECT_TRUE(w->ContainsPoint(gfx::Point(0, 0))); |
| 285 EXPECT_TRUE(w->ContainsPoint(gfx::Point(4, 4))); |
| 286 EXPECT_FALSE(w->ContainsPoint(gfx::Point(5, 5))); |
| 287 EXPECT_FALSE(w->ContainsPoint(gfx::Point(10, 10))); |
| 288 } |
| 289 |
271 TEST_F(WindowTest, ConvertPointToWindow) { | 290 TEST_F(WindowTest, ConvertPointToWindow) { |
272 // Window::ConvertPointToWindow is mostly identical to | 291 // Window::ConvertPointToWindow is mostly identical to |
273 // Layer::ConvertPointToLayer, except NULL values for |source| are permitted, | 292 // Layer::ConvertPointToLayer, except NULL values for |source| are permitted, |
274 // in which case the function just returns. | 293 // in which case the function just returns. |
275 scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); | 294 scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); |
276 gfx::Point reference_point(100, 100); | 295 gfx::Point reference_point(100, 100); |
277 gfx::Point test_point = reference_point; | 296 gfx::Point test_point = reference_point; |
278 Window::ConvertPointToWindow(NULL, w1.get(), &test_point); | 297 Window::ConvertPointToWindow(NULL, w1.get(), &test_point); |
279 EXPECT_EQ(reference_point, test_point); | 298 EXPECT_EQ(reference_point, test_point); |
280 } | 299 } |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); | 2431 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
2413 | 2432 |
2414 // No bounds changed notification at the end of animation since layer | 2433 // No bounds changed notification at the end of animation since layer |
2415 // delegate is NULL. | 2434 // delegate is NULL. |
2416 EXPECT_FALSE(delegate.bounds_changed()); | 2435 EXPECT_FALSE(delegate.bounds_changed()); |
2417 EXPECT_NE("0,0 100x100", window->bounds().ToString()); | 2436 EXPECT_NE("0,0 100x100", window->bounds().ToString()); |
2418 } | 2437 } |
2419 | 2438 |
2420 } // namespace test | 2439 } // namespace test |
2421 } // namespace aura | 2440 } // namespace aura |
OLD | NEW |