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

Side by Side Diff: ash/display/root_window_transformers_unittest.cc

Issue 2426103004: Specify a default display UI scale to reset the zoom to (Closed)
Patch Set: Working test Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/display/root_window_transformers.h" 5 #include "ash/display/root_window_transformers.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/shelf/shelf_widget.h" 9 #include "ash/common/shelf/shelf_widget.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString()); 276 EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString());
277 EXPECT_EQ("450,0 500x300", display2.bounds().ToString()); 277 EXPECT_EQ("450,0 500x300", display2.bounds().ToString());
278 EXPECT_EQ(1.5f, GetStoredUIScale(display1.id())); 278 EXPECT_EQ(1.5f, GetStoredUIScale(display1.id()));
279 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); 279 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id()));
280 280
281 ui::test::EventGenerator generator(root_windows[0]); 281 ui::test::EventGenerator generator(root_windows[0]);
282 generator.MoveMouseToInHost(500, 200); 282 generator.MoveMouseToInHost(500, 200);
283 EXPECT_EQ("299,150", event_handler.GetLocationAndReset()); 283 EXPECT_EQ("299,150", event_handler.GetLocationAndReset());
284 magnifier->SetEnabled(false); 284 magnifier->SetEnabled(false);
285 285
286 display_manager()->SetDisplayUIScale(display1.id(), 1.25f); 286 test::DisplayManagerTestApi(display_manager())
287 .SetDisplayUIScale(display1.id(), 1.25f);
287 display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); 288 display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
288 display2 = display_manager()->GetSecondaryDisplay(); 289 display2 = display_manager()->GetSecondaryDisplay();
289 magnifier->SetEnabled(true); 290 magnifier->SetEnabled(true);
290 EXPECT_EQ(2.0f, magnifier->GetScale()); 291 EXPECT_EQ(2.0f, magnifier->GetScale());
291 EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); 292 EXPECT_EQ("0,0 375x250", display1.bounds().ToString());
292 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); 293 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString());
293 EXPECT_EQ("375,0 500x300", display2.bounds().ToString()); 294 EXPECT_EQ("375,0 500x300", display2.bounds().ToString());
294 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); 295 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id()));
295 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); 296 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id()));
296 magnifier->SetEnabled(false); 297 magnifier->SetEnabled(false);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. 432 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125.
432 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); 433 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString());
433 434
434 UpdateDisplay("200x400,500x500"); 435 UpdateDisplay("200x400,500x500");
435 // The aspect ratio is flipped, so X margin is now 125. 436 // The aspect ratio is flipped, so X margin is now 125.
436 transformer = CreateCurrentRootWindowTransformerForMirroring(); 437 transformer = CreateCurrentRootWindowTransformerForMirroring();
437 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); 438 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString());
438 } 439 }
439 440
440 } // namespace ash 441 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/display/window_tree_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698