Commit be56a2a5 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Fix DialogTest.BoundsAccommodateTitle under SecondaryUiMd

Under MD, the close button takes up more vertical space than the
dialog title, so it dominates the title insets.

Make the test work for both by removing the close buttons from the layout.

Bug: 713030
Change-Id: Ibead5d002dcbe36d6fda65a3a9a8e01695e4f1a8
Reviewed-on: https://chromium-review.googlesource.com/741381
Commit-Queue: Trent Apted <tapted@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512424}
parent eb4596e2
......@@ -309,6 +309,16 @@ TEST_F(DialogTest, BoundsAccommodateTitle) {
dialog2->set_title(base::ASCIIToUTF16("Title"));
DialogDelegate::CreateDialogWidget(dialog2, GetContext(), nullptr);
// Remove the close button so it doesn't influence the bounds if it's taller
// than the title.
dialog()->set_show_close_button(false);
dialog2->set_show_close_button(false);
dialog()->GetWidget()->non_client_view()->ResetWindowControls();
dialog2->GetWidget()->non_client_view()->ResetWindowControls();
EXPECT_FALSE(dialog()->ShouldShowWindowTitle());
EXPECT_TRUE(dialog2->ShouldShowWindowTitle());
// Titled dialogs have taller initial frame bounds than untitled dialogs.
View* frame1 = dialog()->GetWidget()->non_client_view()->frame_view();
View* frame2 = dialog2->GetWidget()->non_client_view()->frame_view();
......@@ -317,6 +327,8 @@ TEST_F(DialogTest, BoundsAccommodateTitle) {
// Giving the default test dialog a title will yield the same bounds.
dialog()->set_title(base::ASCIIToUTF16("Title"));
EXPECT_TRUE(dialog()->ShouldShowWindowTitle());
dialog()->GetWidget()->UpdateWindowTitle();
EXPECT_EQ(frame1->GetPreferredSize().height(),
frame2->GetPreferredSize().height());
......
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