Index: ash/dip_unittest.cc |
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc |
index 9869a0105205296cb0fb5c2a863942bc03bd424f..4a6745a14d7ac8990b3cd42da473a4ccd9ec0fb0 100644 |
--- a/ash/dip_unittest.cc |
+++ b/ash/dip_unittest.cc |
@@ -5,6 +5,7 @@ |
#include <algorithm> |
#include <vector> |
+#include "ash/ash_switches.h" |
#include "ash/display/display_manager.h" |
#include "ash/launcher/launcher.h" |
#include "ash/shelf/shelf_widget.h" |
@@ -12,6 +13,7 @@ |
#include "ash/test/ash_test_base.h" |
#include "ash/wm/window_properties.h" |
#include "ash/wm/window_util.h" |
+#include "base/command_line.h" |
#include "base/memory/scoped_ptr.h" |
#include "ui/aura/client/activation_client.h" |
#include "ui/aura/root_window.h" |
@@ -39,6 +41,45 @@ TEST_F(DIPTest, WorkArea) { |
EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
gfx::Rect work_area = display.work_area(); |
+ EXPECT_EQ("0,0 1000x853", work_area.ToString()); |
+ EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString()); |
+ |
+ UpdateDisplay("2000x1800*2.0f"); |
+ gfx::Screen* screen = Shell::GetScreen(); |
+ |
+ const gfx::Display display_2x = screen->GetDisplayNearestWindow(root); |
+ const internal::DisplayInfo display_info_2x = |
+ Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); |
+ |
+ // The |bounds_in_pixel()| should report bounds in pixel coordinate. |
+ EXPECT_EQ("1,1 2000x1800", |
+ display_info_2x.bounds_in_pixel().ToString()); |
+ |
+ // Aura and views coordinates are in DIP, so they their bounds do not change. |
+ EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); |
+ work_area = display_2x.work_area(); |
+ EXPECT_EQ("0,0 1000x853", work_area.ToString()); |
+ EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString()); |
+ |
+ // Sanity check if the workarea's inset hight is same as |
+ // the launcher's height. |
+ Launcher* launcher = Launcher::ForPrimaryDisplay(); |
+ EXPECT_EQ( |
+ display_2x.bounds().InsetsFrom(work_area).height(), |
+ launcher->shelf_widget()->GetNativeView()->layer()->bounds().height()); |
+} |
+ |
+TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) { |
+ CommandLine::ForCurrentProcess()->AppendSwitch( |
+ ash::switches::kAshDisableAlternateShelfLayout); |
+ UpdateDisplay("1000x900*1.0f"); |
+ |
+ aura::RootWindow* root = Shell::GetPrimaryRootWindow(); |
+ const gfx::Display display = |
+ Shell::GetScreen()->GetDisplayNearestWindow(root); |
+ |
+ EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); |
+ gfx::Rect work_area = display.work_area(); |
EXPECT_EQ("0,0 1000x852", work_area.ToString()); |
EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); |