OLD | NEW |
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 "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 generator.PressMoveAndReleaseTouchTo(50, 50); | 291 generator.PressMoveAndReleaseTouchTo(50, 50); |
292 // Default test touches have radius_x/y = 1.0, with device scale | 292 // Default test touches have radius_x/y = 1.0, with device scale |
293 // factor = 2, the scaled radius_x/y should be 0.5. | 293 // factor = 2, the scaled radius_x/y should be 0.5. |
294 EXPECT_FLOAT_EQ(0.2f, event_handler.touch_radius_x()); | 294 EXPECT_FLOAT_EQ(0.2f, event_handler.touch_radius_x()); |
295 EXPECT_FLOAT_EQ(0.2f, event_handler.touch_radius_y()); | 295 EXPECT_FLOAT_EQ(0.2f, event_handler.touch_radius_y()); |
296 | 296 |
297 generator.ScrollSequence(gfx::Point(0,0), | 297 generator.ScrollSequence(gfx::Point(0,0), |
298 base::TimeDelta::FromMilliseconds(100), | 298 base::TimeDelta::FromMilliseconds(100), |
299 10.0, 1.0, 5, 1); | 299 10.0, 1.0, 5, 1); |
300 | 300 |
301 // With device scale factor = 2, ordinal_offset * 2 = offset. | 301 // ordinal_offset is invariant to the device scale factor. |
302 EXPECT_FLOAT_EQ(event_handler.scroll_x_offset(), | 302 EXPECT_FLOAT_EQ(event_handler.scroll_x_offset(), |
303 event_handler.scroll_x_offset_ordinal() * 2 * 2.5f); | 303 event_handler.scroll_x_offset_ordinal()); |
304 EXPECT_FLOAT_EQ(event_handler.scroll_y_offset(), | 304 EXPECT_FLOAT_EQ(event_handler.scroll_y_offset(), |
305 event_handler.scroll_y_offset_ordinal() * 2 * 2.5f); | 305 event_handler.scroll_y_offset_ordinal()); |
306 magnifier->SetEnabled(false); | 306 magnifier->SetEnabled(false); |
307 | 307 |
308 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 308 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
309 } | 309 } |
310 | 310 |
311 TEST_F(RootWindowTransformersTest, MAYBE_ConvertHostToRootCoords) { | 311 TEST_F(RootWindowTransformersTest, MAYBE_ConvertHostToRootCoords) { |
312 TestEventHandler event_handler; | 312 TestEventHandler event_handler; |
313 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 313 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
314 MagnificationController* magnifier = | 314 MagnificationController* magnifier = |
315 Shell::GetInstance()->magnification_controller(); | 315 Shell::GetInstance()->magnification_controller(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 407 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
408 | 408 |
409 UpdateDisplay("200x400,500x500"); | 409 UpdateDisplay("200x400,500x500"); |
410 // The aspect ratio is flipped, so X margin is now 125. | 410 // The aspect ratio is flipped, so X margin is now 125. |
411 transformer = test_api.CreateCurrentRootWindowTransformer(); | 411 transformer = test_api.CreateCurrentRootWindowTransformer(); |
412 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 412 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
413 } | 413 } |
414 | 414 |
415 } // namespace test | 415 } // namespace test |
416 } // namespace ash | 416 } // namespace ash |
OLD | NEW |