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

Unified Diff: ash/magnifier/magnification_controller_unittest.cc

Issue 1564973002: Don't center screen magnification on empty focus rectangle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 4 years, 11 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/magnifier/magnification_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/magnifier/magnification_controller_unittest.cc
diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc
index fcd7381a8d4c4d947ee8480540f5f8c0ebb0dbed..6c5a2d85953087b5099f976ea670669caa8f4047 100644
--- a/ash/magnifier/magnification_controller_unittest.cc
+++ b/ash/magnifier/magnification_controller_unittest.cc
@@ -266,6 +266,33 @@ TEST_F(MagnificationControllerTest, PointOfInterest) {
EXPECT_EQ("450,350", CurrentPointOfInterest());
}
+TEST_F(MagnificationControllerTest, FollowFocusChanged) {
+ // Enables magnifier and confirm the viewport is at center.
+ GetMagnificationController()->SetEnabled(true);
+ EXPECT_EQ(2.0f, GetMagnificationController()->GetScale());
+ EXPECT_EQ("200,150 400x300", GetViewport().ToString());
+
+ // Don't move viewport when focusing edit box.
+ GetMagnificationController()->HandleFocusedNodeChanged(
+ true, gfx::Rect(0, 0, 10, 10));
+ EXPECT_EQ("200,150 400x300", GetViewport().ToString());
+
+ // Move viewport to element in upper left.
+ GetMagnificationController()->HandleFocusedNodeChanged(
+ false, gfx::Rect(0, 0, 10, 10));
+ EXPECT_EQ("0,0 400x300", GetViewport().ToString());
+
+ // Move viewport to element in lower right.
+ GetMagnificationController()->HandleFocusedNodeChanged(
+ false, gfx::Rect(790, 590, 10, 10));
+ EXPECT_EQ("400,300 400x300", GetViewport().ToString());
+
+ // Don't follow focus onto empty rectangle.
+ GetMagnificationController()->HandleFocusedNodeChanged(
+ false, gfx::Rect(0, 0, 0, 0));
+ EXPECT_EQ("400,300 400x300", GetViewport().ToString());
+}
+
TEST_F(MagnificationControllerTest, PanWindow2xLeftToRight) {
const aura::Env* env = aura::Env::GetInstance();
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698