Commit 5e308857 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

split view: Clean up overly complicated unit test

SplitViewOverviewSessionInClamshellTestMultiDisplayOnly.GetSnappedBounds
is overly complicated, because as you can tell by reading the code
comment, I thought that it is advantageous to use EXPECT_EQ with string
representations of rects so that such string representations will be
included in the output of failures. Actually, you can just pass the
rects themselves to EXPECT_EQ, and the nice string representations will
still show up in failure output. The code can be much nicer that way!

Bug: 970013
Change-Id: I1832f1e877b9580ce2aae9181c6770af2186e221
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888532
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710809}
parent a06bb5be
......@@ -5331,68 +5331,26 @@ TEST_P(SplitViewOverviewSessionInClamshellTestMultiDisplayOnly,
UpdateDisplay("800x600,800x600");
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2u, root_windows.size());
// This unit test assumes a shelf height of 56, as currently hard coded in
// |AppListTestViewDelegate::GetShelfHeight|. There is a TODO to change that
// value to 48, and the code below will just have to be updated then. The
// |EXPECT_EQ| calls produce better failure output if they compare string
// representations of bounds rects rather than individual components of
// origins and sizes. Those string representations of bounds rects are most
// readable when hard-coded.
if (chromeos::switches::ShouldShowShelfHotseat()) {
ASSERT_EQ(
"0,0 800x552",
screen_util::GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(
root_windows[0])
.ToString());
ASSERT_EQ(
"800,0 800x552",
screen_util::GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(
root_windows[1])
.ToString());
EXPECT_EQ("0,0 400x552",
SplitViewController::Get(root_windows[0])
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT)
.ToString());
EXPECT_EQ("400,0 400x552",
SplitViewController::Get(root_windows[0])
->GetSnappedWindowBoundsInScreen(SplitViewController::RIGHT)
.ToString());
EXPECT_EQ("800,0 400x552",
SplitViewController::Get(root_windows[1])
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT)
.ToString());
EXPECT_EQ("1200,0 400x552",
SplitViewController::Get(root_windows[1])
->GetSnappedWindowBoundsInScreen(SplitViewController::RIGHT)
.ToString());
return;
}
ASSERT_EQ("0,0 800x544",
const int height = 600 - ShelfConfig::Get()->shelf_size();
ASSERT_EQ(gfx::Rect(0, 0, 800, height),
screen_util::GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(
root_windows[0])
.ToString());
ASSERT_EQ("800,0 800x544",
root_windows[0]));
ASSERT_EQ(gfx::Rect(800, 0, 800, height),
screen_util::GetDisplayWorkAreaBoundsInScreenForActiveDeskContainer(
root_windows[1])
.ToString());
root_windows[1]));
EXPECT_EQ("0,0 400x544",
EXPECT_EQ(gfx::Rect(0, 0, 400, height),
SplitViewController::Get(root_windows[0])
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT)
.ToString());
EXPECT_EQ("400,0 400x544",
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT));
EXPECT_EQ(gfx::Rect(400, 0, 400, height),
SplitViewController::Get(root_windows[0])
->GetSnappedWindowBoundsInScreen(SplitViewController::RIGHT)
.ToString());
EXPECT_EQ("800,0 400x544",
->GetSnappedWindowBoundsInScreen(SplitViewController::RIGHT));
EXPECT_EQ(gfx::Rect(800, 0, 400, height),
SplitViewController::Get(root_windows[1])
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT)
.ToString());
EXPECT_EQ("1200,0 400x544",
->GetSnappedWindowBoundsInScreen(SplitViewController::LEFT));
EXPECT_EQ(gfx::Rect(1200, 0, 400, height),
SplitViewController::Get(root_windows[1])
->GetSnappedWindowBoundsInScreen(SplitViewController::RIGHT)
.ToString());
->GetSnappedWindowBoundsInScreen(SplitViewController::RIGHT));
}
// Test that if clamshell split view is started by snapping a window that is the
......
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