summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 15:37:17 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 15:37:17 +0000
commit64a215692234d2732f0aed1b8812989164a11714 (patch)
treedc7fdc29acc7fe693a0f843418113ab5ab4dc43b /ash
parent3c9b728fb46dffd4089760a3ecfaf26aa55b12a3 (diff)
downloadchromium_src-64a215692234d2732f0aed1b8812989164a11714.zip
chromium_src-64a215692234d2732f0aed1b8812989164a11714.tar.gz
chromium_src-64a215692234d2732f0aed1b8812989164a11714.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. Review URL: https://chromiumcodereview.appspot.com/11365016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/display/display_controller.cc2
-rw-r--r--ash/display/display_controller_unittest.cc45
2 files changed, 44 insertions, 3 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) {