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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 12746002: Re-implement overscan & Implement Display Rotation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/system/chromeos/tray_display.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 1109e20d6ad19ae5063e229d56baf94928401761..8f945f133c231bde7a0e9d5e5eab9de90d987ec4 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -233,8 +233,15 @@ TEST_F(DisplayManagerTest, OverscanInsetsTest) {
EXPECT_EQ(display_info2.id(), changed_displays[0].id());
EXPECT_EQ("0,0 500x500",
GetDisplayInfoAt(0).bounds_in_pixel().ToString());
- EXPECT_EQ("12,514 378x376",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ DisplayInfo updated_display_info2 = GetDisplayInfoAt(1);
+ EXPECT_EQ("0,501 400x400",
+ updated_display_info2.bounds_in_pixel().ToString());
+ EXPECT_EQ("378x376",
+ updated_display_info2.size_in_pixel().ToString());
+ EXPECT_EQ("13,12,11,10",
+ updated_display_info2.overscan_insets_in_dip().ToString());
+ EXPECT_EQ("500,0 378x376",
+ ScreenAsh::GetSecondaryDisplay().bounds().ToString());
// Make sure that SetOverscanInsets() is idempotent.
display_manager()->SetOverscanInsets(display_info1.id(), gfx::Insets());
@@ -242,15 +249,22 @@ TEST_F(DisplayManagerTest, OverscanInsetsTest) {
display_info2.id(), gfx::Insets(13, 12, 11, 10));
EXPECT_EQ("0,0 500x500",
GetDisplayInfoAt(0).bounds_in_pixel().ToString());
- EXPECT_EQ("12,514 378x376",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ updated_display_info2 = GetDisplayInfoAt(1);
+ EXPECT_EQ("0,501 400x400",
+ updated_display_info2.bounds_in_pixel().ToString());
+ EXPECT_EQ("378x376",
+ updated_display_info2.size_in_pixel().ToString());
+ EXPECT_EQ("13,12,11,10",
+ updated_display_info2.overscan_insets_in_dip().ToString());
display_manager()->SetOverscanInsets(
display_info2.id(), gfx::Insets(10, 11, 12, 13));
EXPECT_EQ("0,0 500x500",
GetDisplayInfoAt(0).bounds_in_pixel().ToString());
- EXPECT_EQ("11,511 376x378",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ EXPECT_EQ("376x378",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
+ EXPECT_EQ("10,11,12,13",
+ GetDisplayInfoAt(1).overscan_insets_in_dip().ToString());
// Recreate a new 2nd display. It won't apply the overscan inset because the
// new display has a different ID.
@@ -270,8 +284,11 @@ TEST_F(DisplayManagerTest, OverscanInsetsTest) {
display_manager()->OnNativeDisplaysChanged(display_info_list);
EXPECT_EQ("1,1 500x500",
GetDisplayInfoAt(0).bounds_in_pixel().ToString());
- EXPECT_EQ("11,511 376x378",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ updated_display_info2 = GetDisplayInfoAt(1);
+ EXPECT_EQ("376x378",
+ updated_display_info2.size_in_pixel().ToString());
+ EXPECT_EQ("10,11,12,13",
+ updated_display_info2.overscan_insets_in_dip().ToString());
// HiDPI but overscan display. The specified insets size should be doubled.
UpdateDisplay("0+0-500x500,0+501-400x400*2");
@@ -279,19 +296,29 @@ TEST_F(DisplayManagerTest, OverscanInsetsTest) {
display_manager()->GetDisplayAt(1)->id(), gfx::Insets(4, 5, 6, 7));
EXPECT_EQ("0,0 500x500",
GetDisplayInfoAt(0).bounds_in_pixel().ToString());
- EXPECT_EQ("10,509 376x380",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
- EXPECT_EQ("188x190", display_manager()->GetDisplayAt(1)->size().ToString());
+ updated_display_info2 = GetDisplayInfoAt(1);
+ EXPECT_EQ("0,501 400x400",
+ updated_display_info2.bounds_in_pixel().ToString());
+ EXPECT_EQ("376x380",
+ updated_display_info2.size_in_pixel().ToString());
+ EXPECT_EQ("4,5,6,7",
+ updated_display_info2.overscan_insets_in_dip().ToString());
+ EXPECT_EQ("8,10,12,14",
+ updated_display_info2.GetOverscanInsetsInPixel().ToString());
// Make sure switching primary display applies the overscan offset only once.
ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplay(
ScreenAsh::GetSecondaryDisplay());
+ EXPECT_EQ("-500,0 500x500",
+ ScreenAsh::GetSecondaryDisplay().bounds().ToString());
EXPECT_EQ("0,0 500x500",
GetDisplayInfo(ScreenAsh::GetSecondaryDisplay()).
bounds_in_pixel().ToString());
- EXPECT_EQ("10,509 376x380",
- GetDisplayInfo(gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()).
+ EXPECT_EQ("0,501 400x400",
+ GetDisplayInfo(Shell::GetScreen()->GetPrimaryDisplay()).
bounds_in_pixel().ToString());
+ EXPECT_EQ("0,0 188x190",
+ Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
}
TEST_F(DisplayManagerTest, ZeroOverscanInsets) {
@@ -564,27 +591,50 @@ TEST_F(DisplayManagerTest, AutomaticOverscanInsets) {
// SetDefaultOverscanInsets(&display_info_list[1]);
display_manager()->OnNativeDisplaysChanged(display_info_list);
// It has overscan insets, although SetOverscanInsets() isn't called.
- EXPECT_EQ("11,211 380x380",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ EXPECT_EQ("380x380",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
// If custom overscan insets is specified, the specified value is used.
display_manager()->SetOverscanInsets(id, gfx::Insets(5, 6, 7, 8));
display_manager()->OnNativeDisplaysChanged(display_info_list);
- EXPECT_EQ("7,206 386x388",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ EXPECT_EQ("386x388",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
// Do not overscan even though it has 'has_overscan' flag, if the custom
// insets is empty.
display_manager()->SetOverscanInsets(id, gfx::Insets());
display_manager()->OnNativeDisplaysChanged(display_info_list);
- EXPECT_EQ("1,201 400x400",
- GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ EXPECT_EQ("400x400",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
// Clearing the custom overscan should set the bounds to
// original.
display_manager()->ClearCustomOverscanInsets(id);
- EXPECT_EQ("11,211 380x380",
+ EXPECT_EQ("380x380",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
+}
+
+TEST_F(DisplayManagerTest, Rotate) {
+ UpdateDisplay("100x200/r,300x400/l");
+ EXPECT_EQ("1,1 100x200",
+ GetDisplayInfoAt(0).bounds_in_pixel().ToString());
+ EXPECT_EQ("200x100",
+ GetDisplayInfoAt(0).size_in_pixel().ToString());
+
+ EXPECT_EQ("1,201 300x400",
+ GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ EXPECT_EQ("400x300",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
+ UpdateDisplay("100x200/b,300x400");
+ EXPECT_EQ("1,1 100x200",
+ GetDisplayInfoAt(0).bounds_in_pixel().ToString());
+ EXPECT_EQ("100x200",
+ GetDisplayInfoAt(0).size_in_pixel().ToString());
+
+ EXPECT_EQ("1,201 300x400",
GetDisplayInfoAt(1).bounds_in_pixel().ToString());
+ EXPECT_EQ("300x400",
+ GetDisplayInfoAt(1).size_in_pixel().ToString());
}
} // namespace internal
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/system/chromeos/tray_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698