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

Side by Side Diff: ui/gfx/display_unittest.cc

Issue 11140006: Fix code around display overscan settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« ui/gfx/display.cc ('K') | « ui/gfx/display.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gfx/display.h" 5 #include "ui/gfx/display.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/insets.h" 8 #include "ui/gfx/insets.h"
9 9
10 namespace { 10 namespace {
(...skipping 28 matching lines...) Expand all
39 display.SetScaleAndBounds(2.0f, gfx::Rect(0, 0, 140, 140)); 39 display.SetScaleAndBounds(2.0f, gfx::Rect(0, 0, 140, 140));
40 EXPECT_EQ("0,0 70x70", display.bounds().ToString()); 40 EXPECT_EQ("0,0 70x70", display.bounds().ToString());
41 EXPECT_EQ("10,10 50x50", display.work_area().ToString()); 41 EXPECT_EQ("10,10 50x50", display.work_area().ToString());
42 42
43 // Scale it back to 1x 43 // Scale it back to 1x
44 display.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100)); 44 display.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100));
45 EXPECT_EQ("0,0 100x100", display.bounds().ToString()); 45 EXPECT_EQ("0,0 100x100", display.bounds().ToString());
46 EXPECT_EQ("10,10 80x80", display.work_area().ToString()); 46 EXPECT_EQ("10,10 80x80", display.work_area().ToString());
47 } 47 }
48 48
49 TEST(DisplayTest, OverscanInsets) {
50 gfx::Display display(0, gfx::Rect(0, 0, 100, 100));
51 display.SetOverscanInsets(gfx::Insets(3, 4, 5, 6));
52 EXPECT_EQ("4,3 90x92", display.bounds_in_pixel().ToString());
53 display.SetOverscanInsets(gfx::Insets(6, 5, 4, 3));
54 EXPECT_EQ("5,6 92x90", display.bounds_in_pixel().ToString());
55
56 gfx::Display hidpi_display(0, gfx::Rect(0, 0, 100, 100));
57 hidpi_display.set_device_scale_factor(2.0f);
58 hidpi_display.SetOverscanInsets(gfx::Insets(3, 4, 5, 6));
59 EXPECT_EQ("8,6 80x84", hidpi_display.bounds_in_pixel().ToString());
60 hidpi_display.SetOverscanInsets(gfx::Insets(6, 5, 4, 3));
61 EXPECT_EQ("10,12 84x80", hidpi_display.bounds_in_pixel().ToString());
49 } 62 }
63
64 }
OLDNEW
« ui/gfx/display.cc ('K') | « ui/gfx/display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698