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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 2852653004: Remove aura::Window::hit_test_bounds_override_inner_ (Closed)
Patch Set: . Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « ui/aura/window.cc ('k') | ui/keyboard/content/keyboard_ui_content.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits.h> 7 #include <limits.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 EXPECT_EQ(NULL, root->GetEventHandlerForPoint(gfx::Point(5, 5))); 537 EXPECT_EQ(NULL, root->GetEventHandlerForPoint(gfx::Point(5, 5)));
538 EXPECT_EQ(w1.get(), root->GetEventHandlerForPoint(gfx::Point(11, 11))); 538 EXPECT_EQ(w1.get(), root->GetEventHandlerForPoint(gfx::Point(11, 11)));
539 EXPECT_EQ(w11.get(), root->GetEventHandlerForPoint(gfx::Point(16, 16))); 539 EXPECT_EQ(w11.get(), root->GetEventHandlerForPoint(gfx::Point(16, 16)));
540 EXPECT_EQ(w111.get(), root->GetEventHandlerForPoint(gfx::Point(21, 21))); 540 EXPECT_EQ(w111.get(), root->GetEventHandlerForPoint(gfx::Point(21, 21)));
541 EXPECT_EQ(w1111.get(), root->GetEventHandlerForPoint(gfx::Point(26, 26))); 541 EXPECT_EQ(w1111.get(), root->GetEventHandlerForPoint(gfx::Point(26, 26)));
542 EXPECT_EQ(w12.get(), root->GetEventHandlerForPoint(gfx::Point(21, 431))); 542 EXPECT_EQ(w12.get(), root->GetEventHandlerForPoint(gfx::Point(21, 431)));
543 EXPECT_EQ(w121.get(), root->GetEventHandlerForPoint(gfx::Point(26, 436))); 543 EXPECT_EQ(w121.get(), root->GetEventHandlerForPoint(gfx::Point(26, 436)));
544 EXPECT_EQ(w13.get(), root->GetEventHandlerForPoint(gfx::Point(26, 481))); 544 EXPECT_EQ(w13.get(), root->GetEventHandlerForPoint(gfx::Point(26, 481)));
545 } 545 }
546 546
547 TEST_P(WindowTest, GetEventHandlerForPointWithOverride) { 547 TEST_P(WindowTest, GetEventHandlerForPointInCornerOfChildBounds) {
548 // If our child is flush to our top-left corner it gets events just inside the 548 // If our child is flush to our top-left corner it gets events just inside the
549 // window edges. 549 // window edges.
550 std::unique_ptr<Window> parent(CreateTestWindow( 550 std::unique_ptr<Window> parent(CreateTestWindow(
551 SK_ColorWHITE, 1, gfx::Rect(10, 20, 400, 500), root_window())); 551 SK_ColorWHITE, 1, gfx::Rect(10, 20, 400, 500), root_window()));
552 std::unique_ptr<Window> child( 552 std::unique_ptr<Window> child(
553 CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get())); 553 CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get()));
554 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0))); 554 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
555 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1))); 555 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
556
557 // We can override the hit test bounds of the parent to make the parent grab
558 // events along that edge.
559 parent->set_hit_test_bounds_override_inner(gfx::Insets(1, 1, 1, 1));
560 EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
561 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
562 } 556 }
563 557
564 TEST_P(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) { 558 TEST_P(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) {
565 std::unique_ptr<SelfEventHandlingWindowDelegate> parent_delegate( 559 std::unique_ptr<SelfEventHandlingWindowDelegate> parent_delegate(
566 new SelfEventHandlingWindowDelegate); 560 new SelfEventHandlingWindowDelegate);
567 std::unique_ptr<Window> parent(CreateTestWindowWithDelegate( 561 std::unique_ptr<Window> parent(CreateTestWindowWithDelegate(
568 parent_delegate.get(), 1, gfx::Rect(10, 20, 400, 500), root_window())); 562 parent_delegate.get(), 1, gfx::Rect(10, 20, 400, 500), root_window()));
569 std::unique_ptr<Window> child(CreateTestWindow( 563 std::unique_ptr<Window> child(CreateTestWindow(
570 SK_ColorRED, 2, gfx::Rect(0, 0, 390, 480), parent.get())); 564 SK_ColorRED, 2, gfx::Rect(0, 0, 390, 480), parent.get()));
571 565
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 ::testing::Values(BackendType::CLASSIC, 2899 ::testing::Values(BackendType::CLASSIC,
2906 BackendType::MUS)); 2900 BackendType::MUS));
2907 2901
2908 INSTANTIATE_TEST_CASE_P(/* no prefix */, 2902 INSTANTIATE_TEST_CASE_P(/* no prefix */,
2909 WindowObserverTest, 2903 WindowObserverTest,
2910 ::testing::Values(BackendType::CLASSIC, 2904 ::testing::Values(BackendType::CLASSIC,
2911 BackendType::MUS)); 2905 BackendType::MUS));
2912 2906
2913 } // namespace test 2907 } // namespace test
2914 } // namespace aura 2908 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/keyboard/content/keyboard_ui_content.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698