OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/touch/touch_transformer_controller.h" | 5 #include "ash/touch/touch_transformer_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ui/aura/window_tree_host.h" | 9 #include "ui/aura/window_tree_host.h" |
10 #include "ui/events/devices/device_data_manager.h" | 10 #include "ui/events/devices/device_data_manager.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 typedef test::AshTestBase TouchTransformerControllerTest; | 39 typedef test::AshTestBase TouchTransformerControllerTest; |
40 | 40 |
41 TEST_F(TouchTransformerControllerTest, MirrorModeLetterboxing) { | 41 TEST_F(TouchTransformerControllerTest, MirrorModeLetterboxing) { |
42 // The internal display has native resolution of 2560x1700, and in | 42 // The internal display has native resolution of 2560x1700, and in |
43 // mirror mode it is configured as 1920x1200. This is in letterboxing | 43 // mirror mode it is configured as 1920x1200. This is in letterboxing |
44 // mode. | 44 // mode. |
45 DisplayInfo internal_display_info = | 45 DisplayInfo internal_display_info = |
46 CreateDisplayInfo(1, 10u, gfx::Rect(0, 0, 1920, 1200)); | 46 CreateDisplayInfo(1, 10u, gfx::Rect(0, 0, 1920, 1200)); |
47 internal_display_info.set_is_aspect_preserving_scaling(true); | 47 internal_display_info.set_is_aspect_preserving_scaling(true); |
48 std::vector<DisplayMode> internal_modes; | 48 std::vector<DisplayMode> internal_modes; |
49 internal_modes.push_back( | 49 internal_modes.push_back(DisplayMode(gfx::Size(2560, 1700), 60, false, true)); |
50 DisplayMode(gfx::Size(2560, 1700), 60, false, true)); | |
51 internal_modes.push_back( | 50 internal_modes.push_back( |
52 DisplayMode(gfx::Size(1920, 1200), 60, false, false)); | 51 DisplayMode(gfx::Size(1920, 1200), 60, false, false)); |
53 internal_display_info.SetDisplayModes(internal_modes); | 52 internal_display_info.SetDisplayModes(internal_modes); |
54 | 53 |
55 DisplayInfo external_display_info = | 54 DisplayInfo external_display_info = |
56 CreateDisplayInfo(2, 11u, gfx::Rect(0, 0, 1920, 1200)); | 55 CreateDisplayInfo(2, 11u, gfx::Rect(0, 0, 1920, 1200)); |
57 | 56 |
58 gfx::Size fb_size(1920, 1200); | 57 gfx::Size fb_size(1920, 1200); |
59 | 58 |
60 // Create the touchscreens with the same size as the framebuffer so we can | 59 // Create the touchscreens with the same size as the framebuffer so we can |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 109 } |
111 | 110 |
112 TEST_F(TouchTransformerControllerTest, MirrorModePillarboxing) { | 111 TEST_F(TouchTransformerControllerTest, MirrorModePillarboxing) { |
113 // The internal display has native resolution of 1366x768, and in | 112 // The internal display has native resolution of 1366x768, and in |
114 // mirror mode it is configured as 1024x768. This is in pillarboxing | 113 // mirror mode it is configured as 1024x768. This is in pillarboxing |
115 // mode. | 114 // mode. |
116 DisplayInfo internal_display_info = | 115 DisplayInfo internal_display_info = |
117 CreateDisplayInfo(1, 10, gfx::Rect(0, 0, 1024, 768)); | 116 CreateDisplayInfo(1, 10, gfx::Rect(0, 0, 1024, 768)); |
118 internal_display_info.set_is_aspect_preserving_scaling(true); | 117 internal_display_info.set_is_aspect_preserving_scaling(true); |
119 std::vector<DisplayMode> internal_modes; | 118 std::vector<DisplayMode> internal_modes; |
120 internal_modes.push_back( | 119 internal_modes.push_back(DisplayMode(gfx::Size(1366, 768), 60, false, true)); |
121 DisplayMode(gfx::Size(1366, 768), 60, false, true)); | 120 internal_modes.push_back(DisplayMode(gfx::Size(1024, 768), 60, false, false)); |
122 internal_modes.push_back( | |
123 DisplayMode(gfx::Size(1024, 768), 60, false, false)); | |
124 internal_display_info.SetDisplayModes(internal_modes); | 121 internal_display_info.SetDisplayModes(internal_modes); |
125 | 122 |
126 DisplayInfo external_display_info = | 123 DisplayInfo external_display_info = |
127 CreateDisplayInfo(2, 11, gfx::Rect(0, 0, 1024, 768)); | 124 CreateDisplayInfo(2, 11, gfx::Rect(0, 0, 1024, 768)); |
128 | 125 |
129 gfx::Size fb_size(1024, 768); | 126 gfx::Size fb_size(1024, 768); |
130 | 127 |
131 // Create the touchscreens with the same size as the framebuffer so we can | 128 // Create the touchscreens with the same size as the framebuffer so we can |
132 // share the tests between Ozone & X11. | 129 // share the tests between Ozone & X11. |
133 ui::TouchscreenDevice internal_touchscreen = | 130 ui::TouchscreenDevice internal_touchscreen = |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); | 340 CreateTouchscreenDevice(5, gfx::Size(1001, 1001)); |
344 | 341 |
345 TouchTransformerController* tt_controller = | 342 TouchTransformerController* tt_controller = |
346 Shell::GetInstance()->touch_transformer_controller(); | 343 Shell::GetInstance()->touch_transformer_controller(); |
347 // Default touchscreen position range is 1001x1001; | 344 // Default touchscreen position range is 1001x1001; |
348 EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), | 345 EXPECT_EQ(sqrt((2560.0 * 1600.0) / (1001.0 * 1001.0)), |
349 tt_controller->GetTouchResolutionScale(display, touch_device)); | 346 tt_controller->GetTouchResolutionScale(display, touch_device)); |
350 } | 347 } |
351 | 348 |
352 } // namespace ash | 349 } // namespace ash |
OLD | NEW |