Commit 60d3bbe5 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

Break up some 'magic' numbers in ZcrRemoteShellTest

Also some slight refactoring.

Bug: 997768
Change-Id: I25c6f2815c12b6de5c737fd9f6831149a92b7675
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783663Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693857}
parent 7f4fc23d
......@@ -1224,8 +1224,6 @@ gfx::Insets GetWorkAreaInsetsInClientPixel(
float default_dsf,
const gfx::Size& size_in_client_pixel,
const gfx::Rect& work_area_in_dp) {
gfx::Rect work_area_in_display = display.work_area();
work_area_in_display.Offset(-display.bounds().x(), -display.bounds().y());
gfx::Rect local_work_area_in_dp = work_area_in_dp;
local_work_area_in_dp.Offset(-display.bounds().x(), -display.bounds().y());
gfx::Rect work_area_in_client_pixel = ScaleBoundsToPixelSnappedToParent(
......
......@@ -16,17 +16,21 @@ using ZcrRemoteShellTest = test::ExoTestBase;
TEST_F(ZcrRemoteShellTest, GetWorkAreaInsetsInClientPixel) {
UpdateDisplay("3000x2000*2.25,1920x1080");
auto display = display::Screen::GetScreen()->GetPrimaryDisplay();
const float device_scale_factor = display.device_scale_factor();
EXPECT_EQ(2.25f, device_scale_factor);
gfx::Insets insets = wayland::GetWorkAreaInsetsInClientPixel(
display, 2.25f, gfx::Size(3000, 2000), display.work_area());
EXPECT_EQ(gfx::Insets(0, 0, 128, 0), insets);
display, device_scale_factor, display.GetSizeInPixel(),
display.work_area());
EXPECT_EQ(gfx::Insets(0, 0, 128, 0).ToString(), insets.ToString());
auto secondary_display = GetSecondaryDisplay();
gfx::Size secondary_size(1920, 1080);
gfx::Size secondary_size(secondary_display.size());
gfx::Size secondary_size_in_client_pixel =
gfx::ScaleToRoundedSize(secondary_size, 2.25f);
gfx::ScaleToRoundedSize(secondary_size, device_scale_factor);
gfx::Insets secondary_insets = wayland::GetWorkAreaInsetsInClientPixel(
secondary_display, 2.25f, secondary_size_in_client_pixel,
secondary_display, device_scale_factor, secondary_size_in_client_pixel,
secondary_display.work_area());
EXPECT_EQ(gfx::Insets(0, 0, 126, 0).ToString(), secondary_insets.ToString());
......@@ -36,11 +40,11 @@ TEST_F(ZcrRemoteShellTest, GetWorkAreaInsetsInClientPixel) {
display = display::Screen::GetScreen()->GetPrimaryDisplay();
ASSERT_EQ(display.bounds(), display.work_area());
gfx::Insets stable_insets = wayland::GetWorkAreaInsetsInClientPixel(
display, 2.25f, gfx::Size(3000, 2000),
display, device_scale_factor, display.GetSizeInPixel(),
wayland::GetStableWorkArea(display));
EXPECT_EQ(gfx::Insets(0, 0, 128, 0).ToString(), stable_insets.ToString());
gfx::Insets secondary_stable_insets = wayland::GetWorkAreaInsetsInClientPixel(
secondary_display, 2.25f, secondary_size_in_client_pixel,
secondary_display, device_scale_factor, secondary_size_in_client_pixel,
wayland::GetStableWorkArea(secondary_display));
EXPECT_EQ(gfx::Insets(0, 0, 126, 0).ToString(),
secondary_stable_insets.ToString());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment