OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/views/widget/desktop_aura/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 displays.clear(); | 206 displays.clear(); |
207 displays.push_back( | 207 displays.push_back( |
208 display::Display(kSecondDisplay, gfx::Rect(0, 0, 1024, 768))); | 208 display::Display(kSecondDisplay, gfx::Rect(0, 0, 1024, 768))); |
209 NotifyDisplaysChanged(displays); | 209 NotifyDisplaysChanged(displays); |
210 | 210 |
211 EXPECT_EQ(1u, changed_display_.size()); | 211 EXPECT_EQ(1u, changed_display_.size()); |
212 EXPECT_EQ(0u, added_display_.size()); | 212 EXPECT_EQ(0u, added_display_.size()); |
213 EXPECT_EQ(1u, removed_display_.size()); | 213 EXPECT_EQ(1u, removed_display_.size()); |
214 } | 214 } |
215 | 215 |
216 TEST_F(DesktopScreenX11Test, GetDisplayById) { | |
sky
2016/11/19 15:01:40
Can you clarify why you need the same test for eac
| |
217 std::vector<display::Display> displays; | |
218 displays.push_back( | |
219 display::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); | |
220 displays.push_back( | |
221 display::Display(kSecondDisplay, gfx::Rect(640, 0, 1024, 768))); | |
222 NotifyDisplaysChanged(displays); | |
223 | |
224 display::Display display1; | |
225 bool has_display1 = | |
226 screen()->GetDisplayWithDisplayId(kFirstDisplay, &display1); | |
227 display::Display display2; | |
228 bool has_display2 = | |
229 screen()->GetDisplayWithDisplayId(kSecondDisplay, &display2); | |
230 EXPECT_TRUE(has_display1); | |
231 EXPECT_TRUE(has_display2); | |
232 EXPECT_EQ(kFirstDisplay, display1.id()); | |
233 EXPECT_EQ(kSecondDisplay, display2.id()); | |
234 } | |
235 | |
216 TEST_F(DesktopScreenX11Test, GetDisplayNearestPoint) { | 236 TEST_F(DesktopScreenX11Test, GetDisplayNearestPoint) { |
217 std::vector<display::Display> displays; | 237 std::vector<display::Display> displays; |
218 displays.push_back( | 238 displays.push_back( |
219 display::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); | 239 display::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); |
220 displays.push_back( | 240 displays.push_back( |
221 display::Display(kSecondDisplay, gfx::Rect(640, 0, 1024, 768))); | 241 display::Display(kSecondDisplay, gfx::Rect(640, 0, 1024, 768))); |
222 NotifyDisplaysChanged(displays); | 242 NotifyDisplaysChanged(displays); |
223 | 243 |
224 EXPECT_EQ(kFirstDisplay, | 244 EXPECT_EQ(kFirstDisplay, |
225 screen()->GetDisplayNearestPoint(gfx::Point(630, 10)).id()); | 245 screen()->GetDisplayNearestPoint(gfx::Point(630, 10)).id()); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 EXPECT_EQ(2u, changed_display_.size()); | 502 EXPECT_EQ(2u, changed_display_.size()); |
483 | 503 |
484 displays[0].set_device_scale_factor(1.f); | 504 displays[0].set_device_scale_factor(1.f); |
485 displays[1].set_device_scale_factor(1.f); | 505 displays[1].set_device_scale_factor(1.f); |
486 NotifyDisplaysChanged(displays); | 506 NotifyDisplaysChanged(displays); |
487 EXPECT_EQ(4u, changed_display_.size()); | 507 EXPECT_EQ(4u, changed_display_.size()); |
488 EXPECT_EQ(1.f, gfx::GetFontRenderParamsDeviceScaleFactor()); | 508 EXPECT_EQ(1.f, gfx::GetFontRenderParamsDeviceScaleFactor()); |
489 } | 509 } |
490 | 510 |
491 } // namespace views | 511 } // namespace views |
OLD | NEW |