diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 22:59:21 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 22:59:21 +0000 |
commit | 4f6f9be344f7bef5de671a2b69ebedd98c42a1f2 (patch) | |
tree | 4057041a5de27aa8617e45aa68707d8d5ff876e9 /ash | |
parent | 2ce8ebf7dc12ffe8fa614804038778573472d269 (diff) | |
download | chromium_src-4f6f9be344f7bef5de671a2b69ebedd98c42a1f2.zip chromium_src-4f6f9be344f7bef5de671a2b69ebedd98c42a1f2.tar.gz chromium_src-4f6f9be344f7bef5de671a2b69ebedd98c42a1f2.tar.bz2 |
Increase min edge size that two displays have to share.
50 was too small and made me believe that mouse is not
working when display configuration was restored.
BUG=none
TEST=covered by test.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=165387
Review URL: https://chromiumcodereview.appspot.com/11365016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165539 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/display/display_controller.cc | 2 | ||||
-rw-r--r-- | ash/display/display_controller_unittest.cc | 45 | ||||
-rw-r--r-- | ash/display/mouse_cursor_event_filter_unittest.cc | 20 |
3 files changed, 54 insertions, 13 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index c078412..05364f5 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -43,7 +43,7 @@ const int kMaxValidOffset = 10000; // The number of pixels to overlap between the primary and secondary displays, // in case that the offset value is too large. -const int kMinimumOverlapForInvalidOffset = 50; +const int kMinimumOverlapForInvalidOffset = 100; bool GetPositionFromString(const base::StringPiece& position, DisplayLayout::Position* field) { diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 1dbf5a8..9e5836c 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -57,14 +57,20 @@ gfx::Display GetSecondaryDisplay() { Shell::GetAllRootWindows()[1]); } -void SetSecondaryDisplayLayout(DisplayLayout::Position position) { +void SetSecondaryDisplayLayoutAndOffset(DisplayLayout::Position position, + int offset) { DisplayController* display_controller = Shell::GetInstance()->display_controller(); DisplayLayout layout = display_controller->default_display_layout(); layout.position = position; + layout.offset = offset; display_controller->SetDefaultDisplayLayout(layout); } +void SetSecondaryDisplayLayout(DisplayLayout::Position position) { + SetSecondaryDisplayLayoutAndOffset(position, 0); +} + } // namespace typedef test::AshTestBase DisplayControllerTest; @@ -90,7 +96,7 @@ TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) { gfx::Insets insets(5, 5, 5, 5); secondary_display->UpdateWorkAreaFromInsets(insets); - // Default layout is LEFT. + // Default layout is RIGHT. EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); EXPECT_EQ("500,0 400x400", GetSecondaryDisplay().bounds().ToString()); EXPECT_EQ("505,5 390x390", GetSecondaryDisplay().work_area().ToString()); @@ -115,6 +121,41 @@ TEST_F(DisplayControllerTest, MAYBE_SecondaryDisplayLayout) { EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); EXPECT_EQ("0,-400 400x400", GetSecondaryDisplay().bounds().ToString()); EXPECT_EQ("5,-395 390x390", GetSecondaryDisplay().work_area().ToString()); + + // Layout to the right with an offset. + SetSecondaryDisplayLayoutAndOffset(DisplayLayout::RIGHT, 300); + EXPECT_EQ(1, observer.CountAndReset()); // resize and add + EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); + EXPECT_EQ("500,300 400x400", GetSecondaryDisplay().bounds().ToString()); + + // Keep the minimum 100. + SetSecondaryDisplayLayoutAndOffset(DisplayLayout::RIGHT, 490); + EXPECT_EQ(1, observer.CountAndReset()); // resize and add + EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); + EXPECT_EQ("500,400 400x400", GetSecondaryDisplay().bounds().ToString()); + + SetSecondaryDisplayLayoutAndOffset(DisplayLayout::RIGHT, -400); + EXPECT_EQ(1, observer.CountAndReset()); // resize and add + EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); + EXPECT_EQ("500,-300 400x400", GetSecondaryDisplay().bounds().ToString()); + + // Layout to the bottom with an offset. + SetSecondaryDisplayLayoutAndOffset(DisplayLayout::BOTTOM, -200); + EXPECT_EQ(1, observer.CountAndReset()); // resize and add + EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); + EXPECT_EQ("-200,500 400x400", GetSecondaryDisplay().bounds().ToString()); + + // Keep the minimum 100. + SetSecondaryDisplayLayoutAndOffset(DisplayLayout::BOTTOM, 490); + EXPECT_EQ(1, observer.CountAndReset()); // resize and add + EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); + EXPECT_EQ("400,500 400x400", GetSecondaryDisplay().bounds().ToString()); + + SetSecondaryDisplayLayoutAndOffset(DisplayLayout::BOTTOM, -400); + EXPECT_EQ(1, observer.CountAndReset()); // resize and add + EXPECT_EQ("0,0 500x500", GetPrimaryDisplay().bounds().ToString()); + EXPECT_EQ("-300,500 400x400", GetSecondaryDisplay().bounds().ToString()); + } TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) { diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc index 30a90ab..fb56dd2 100644 --- a/ash/display/mouse_cursor_event_filter_unittest.cc +++ b/ash/display/mouse_cursor_event_filter_unittest.cc @@ -224,14 +224,14 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnLeft) { EXPECT_EQ("-1,16 1x344", event_filter->src_indicator_bounds_.ToString()); EXPECT_EQ("0,0 1x360", event_filter->dst_indicator_bounds_.ToString()); - default_layout.offset = 300; + default_layout.offset = 250; controller->SetDefaultDisplayLayout(default_layout); event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */); - EXPECT_EQ("0,300 1x60", event_filter->src_indicator_bounds_.ToString()); - EXPECT_EQ("-1,300 1x60", event_filter->dst_indicator_bounds_.ToString()); + EXPECT_EQ("0,250 1x110", event_filter->src_indicator_bounds_.ToString()); + EXPECT_EQ("-1,250 1x110", event_filter->dst_indicator_bounds_.ToString()); event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); - EXPECT_EQ("-1,300 1x60", event_filter->src_indicator_bounds_.ToString()); - EXPECT_EQ("0,300 1x60", event_filter->dst_indicator_bounds_.ToString()); + EXPECT_EQ("-1,250 1x110", event_filter->src_indicator_bounds_.ToString()); + EXPECT_EQ("0,250 1x110", event_filter->dst_indicator_bounds_.ToString()); event_filter->HideSharedEdgeIndicator(); } @@ -252,14 +252,14 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) { EXPECT_EQ("0,-1 360x1", event_filter->src_indicator_bounds_.ToString()); EXPECT_EQ("0,0 360x1", event_filter->dst_indicator_bounds_.ToString()); - default_layout.offset = 300; + default_layout.offset = 250; controller->SetDefaultDisplayLayout(default_layout); event_filter->ShowSharedEdgeIndicator(root_windows[0] /* primary */); - EXPECT_EQ("300,0 60x1", event_filter->src_indicator_bounds_.ToString()); - EXPECT_EQ("300,-1 60x1", event_filter->dst_indicator_bounds_.ToString()); + EXPECT_EQ("250,0 110x1", event_filter->src_indicator_bounds_.ToString()); + EXPECT_EQ("250,-1 110x1", event_filter->dst_indicator_bounds_.ToString()); event_filter->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); - EXPECT_EQ("300,-1 60x1", event_filter->src_indicator_bounds_.ToString()); - EXPECT_EQ("300,0 60x1", event_filter->dst_indicator_bounds_.ToString()); + EXPECT_EQ("250,-1 110x1", event_filter->src_indicator_bounds_.ToString()); + EXPECT_EQ("250,0 110x1", event_filter->dst_indicator_bounds_.ToString()); default_layout.position = DisplayLayout::BOTTOM; default_layout.offset = 0; |