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

Unified Diff: ash/wm/system_modal_container_layout_manager_unittest.cc

Issue 277223004: Addressing dialog cropping by the virtual keyboard for M36 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/wm/system_modal_container_layout_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/system_modal_container_layout_manager_unittest.cc
diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc
index 9e6dbd00e57d72311039119de3850d0874076245..29e7eb1771791297c9b60f6e6a0c7ef47601355e 100644
--- a/ash/wm/system_modal_container_layout_manager_unittest.cc
+++ b/ash/wm/system_modal_container_layout_manager_unittest.cc
@@ -592,5 +592,68 @@ TEST_F(SystemModalContainerLayoutManagerTest,
EXPECT_EQ(modal_origin.x(), modal_window->bounds().x());
}
+// Test that windows will not get cropped through the visible virtual keyboard -
+// if centered.
+TEST_F(SystemModalContainerLayoutManagerTest,
+ SystemModalDialogGetPushedButNotCroppedFromKeyboard) {
+ const gfx::Rect& container_bounds = GetModalContainer()->bounds();
+ const gfx::Size screen_size = Shell::GetPrimaryRootWindow()->bounds().size();
+ // Place the window at the bottom of the screen.
+ gfx::Size modal_size(100, screen_size.height() - 70);
+ gfx::Point modal_origin = gfx::Point(
+ (container_bounds.right() - modal_size.width()) / 2, // X centered
+ container_bounds.bottom() - modal_size.height()); // at bottom
+ gfx::Rect modal_bounds = gfx::Rect(modal_origin, modal_size);
+
+ // Create a modal window.
+ scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false));
+ scoped_ptr<aura::Window> modal_window(
+ OpenTestWindowWithParent(parent.get(), true));
+ modal_window->SetBounds(modal_bounds);
+ parent->Show();
+ modal_window->Show();
+
+ EXPECT_EQ(modal_bounds.ToString(), modal_window->bounds().ToString());
+
+ // The keyboard gets shown and the dialog should get pushed up, but not get
+ // cropped (and aligned to the top).
+ ShowKeyboard(true);
+ EXPECT_EQ(modal_size.ToString(), modal_window->bounds().size().ToString());
+ EXPECT_EQ(modal_origin.x(), modal_window->bounds().x());
+ EXPECT_EQ(0, modal_window->bounds().y());
+
+ ShowKeyboard(false);
+}
+
+// Test that windows will not get cropped through the visible virtual keyboard -
+// if not centered.
+TEST_F(SystemModalContainerLayoutManagerTest,
+ SystemModalDialogGetPushedButNotCroppedFromKeyboardIfNotCentered) {
+ const gfx::Size screen_size = Shell::GetPrimaryRootWindow()->bounds().size();
+ // Place the window at the bottom of the screen.
+ gfx::Size modal_size(100, screen_size.height() - 70);
+ gfx::Point modal_origin = gfx::Point(10, 20);
+ gfx::Rect modal_bounds = gfx::Rect(modal_origin, modal_size);
+
+ // Create a modal window.
+ scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false));
+ scoped_ptr<aura::Window> modal_window(
+ OpenTestWindowWithParent(parent.get(), true));
+ modal_window->SetBounds(modal_bounds);
+ parent->Show();
+ modal_window->Show();
+
+ EXPECT_EQ(modal_bounds.ToString(), modal_window->bounds().ToString());
+
+ // The keyboard gets shown and the dialog should get pushed up, but not get
+ // cropped (and aligned to the top).
+ ShowKeyboard(true);
+ EXPECT_EQ(modal_size.ToString(), modal_window->bounds().size().ToString());
+ EXPECT_EQ(modal_origin.x(), modal_window->bounds().x());
+ EXPECT_EQ(0, modal_window->bounds().y());
+
+ ShowKeyboard(false);
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698