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

Side by Side Diff: ui/snapshot/snapshot_aura_unittest.cc

Issue 1922783002: Move gfx::Display/Screen to display::Display/Screen in aura/events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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/snapshot/snapshot.h" 5 #include "ui/snapshot/snapshot.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 gfx::Rect test_bounds(100, 100, 300, 200); 208 gfx::Rect test_bounds(100, 100, 300, 200);
209 SetupTestWindow(test_bounds); 209 SetupTestWindow(test_bounds);
210 WaitForDraw(); 210 WaitForDraw();
211 211
212 gfx::Image snapshot = GrabSnapshotForTestWindow(); 212 gfx::Image snapshot = GrabSnapshotForTestWindow();
213 EXPECT_EQ(test_bounds.size().ToString(), snapshot.Size().ToString()); 213 EXPECT_EQ(test_bounds.size().ToString(), snapshot.Size().ToString());
214 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); 214 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot));
215 } 215 }
216 216
217 TEST_F(SnapshotAuraTest, Rotated) { 217 TEST_F(SnapshotAuraTest, Rotated) {
218 test_screen()->SetDisplayRotation(gfx::Display::ROTATE_90); 218 test_screen()->SetDisplayRotation(display::Display::ROTATE_90);
219 219
220 gfx::Rect test_bounds(100, 100, 300, 200); 220 gfx::Rect test_bounds(100, 100, 300, 200);
221 SetupTestWindow(test_bounds); 221 SetupTestWindow(test_bounds);
222 WaitForDraw(); 222 WaitForDraw();
223 223
224 gfx::Image snapshot = GrabSnapshotForTestWindow(); 224 gfx::Image snapshot = GrabSnapshotForTestWindow();
225 EXPECT_EQ(test_bounds.size().ToString(), snapshot.Size().ToString()); 225 EXPECT_EQ(test_bounds.size().ToString(), snapshot.Size().ToString());
226 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); 226 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot));
227 } 227 }
228 228
(...skipping 27 matching lines...) Expand all
256 256
257 gfx::Image snapshot = GrabSnapshotForTestWindow(); 257 gfx::Image snapshot = GrabSnapshotForTestWindow();
258 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), 258 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(),
259 snapshot.Size().ToString()); 259 snapshot.Size().ToString());
260 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); 260 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2));
261 } 261 }
262 262
263 TEST_F(SnapshotAuraTest, RotateAndUIScale) { 263 TEST_F(SnapshotAuraTest, RotateAndUIScale) {
264 const float kUIScale = 1.25f; 264 const float kUIScale = 1.25f;
265 test_screen()->SetUIScale(kUIScale); 265 test_screen()->SetUIScale(kUIScale);
266 test_screen()->SetDisplayRotation(gfx::Display::ROTATE_90); 266 test_screen()->SetDisplayRotation(display::Display::ROTATE_90);
267 267
268 gfx::Rect test_bounds(100, 100, 300, 200); 268 gfx::Rect test_bounds(100, 100, 300, 200);
269 SetupTestWindow(test_bounds); 269 SetupTestWindow(test_bounds);
270 WaitForDraw(); 270 WaitForDraw();
271 271
272 // Snapshot always captures the physical pixels. 272 // Snapshot always captures the physical pixels.
273 gfx::SizeF snapshot_size(test_bounds.size()); 273 gfx::SizeF snapshot_size(test_bounds.size());
274 274
275 gfx::Image snapshot = GrabSnapshotForTestWindow(); 275 gfx::Image snapshot = GrabSnapshotForTestWindow();
276 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), 276 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(),
277 snapshot.Size().ToString()); 277 snapshot.Size().ToString());
278 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot)); 278 EXPECT_EQ(0u, GetFailedPixelsCount(snapshot));
279 } 279 }
280 280
281 TEST_F(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) { 281 TEST_F(SnapshotAuraTest, RotateAndUIScaleAndScaleFactor) {
282 test_screen()->SetDeviceScaleFactor(2.0f); 282 test_screen()->SetDeviceScaleFactor(2.0f);
283 const float kUIScale = 1.25f; 283 const float kUIScale = 1.25f;
284 test_screen()->SetUIScale(kUIScale); 284 test_screen()->SetUIScale(kUIScale);
285 test_screen()->SetDisplayRotation(gfx::Display::ROTATE_90); 285 test_screen()->SetDisplayRotation(display::Display::ROTATE_90);
286 286
287 gfx::Rect test_bounds(20, 30, 150, 100); 287 gfx::Rect test_bounds(20, 30, 150, 100);
288 SetupTestWindow(test_bounds); 288 SetupTestWindow(test_bounds);
289 WaitForDraw(); 289 WaitForDraw();
290 290
291 // Snapshot always captures the physical pixels. 291 // Snapshot always captures the physical pixels.
292 gfx::SizeF snapshot_size(test_bounds.size()); 292 gfx::SizeF snapshot_size(test_bounds.size());
293 snapshot_size.Scale(2.0f); 293 snapshot_size.Scale(2.0f);
294 294
295 gfx::Image snapshot = GrabSnapshotForTestWindow(); 295 gfx::Image snapshot = GrabSnapshotForTestWindow();
296 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), 296 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(),
297 snapshot.Size().ToString()); 297 snapshot.Size().ToString());
298 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); 298 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2));
299 } 299 }
300 300
301 } // namespace ui 301 } // namespace ui
OLDNEW
« ui/aura/client/cursor_client.h ('K') | « ui/snapshot/snapshot_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698