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

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

Issue 10221028: Move DIP translation from ui/aura to ui/compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert change i made by accident Created 8 years, 7 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
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/monitor.h" 5 #include "ui/gfx/monitor.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 11 matching lines...) Expand all
22 EXPECT_EQ("0,0 50x50", monitor.bounds().ToString()); 22 EXPECT_EQ("0,0 50x50", monitor.bounds().ToString());
23 EXPECT_EQ("3,4 40x30", monitor.work_area().ToString()); 23 EXPECT_EQ("3,4 40x30", monitor.work_area().ToString());
24 24
25 monitor.SetSize(gfx::Size(200, 200)); 25 monitor.SetSize(gfx::Size(200, 200));
26 EXPECT_EQ("3,4 190x180", monitor.work_area().ToString()); 26 EXPECT_EQ("3,4 190x180", monitor.work_area().ToString());
27 27
28 monitor.UpdateWorkAreaFromInsets(gfx::Insets(3, 4, 5, 6)); 28 monitor.UpdateWorkAreaFromInsets(gfx::Insets(3, 4, 5, 6));
29 EXPECT_EQ("4,3 190x192", monitor.work_area().ToString()); 29 EXPECT_EQ("4,3 190x192", monitor.work_area().ToString());
30 } 30 }
31 31
32 #if defined(ENABLE_DIP)
33 TEST(MonitorTest, Scale) { 32 TEST(MonitorTest, Scale) {
34 gfx::Monitor monitor(0, gfx::Rect(0, 0, 100, 100)); 33 gfx::Monitor monitor(0, gfx::Rect(0, 0, 100, 100));
35 monitor.set_work_area(gfx::Rect(10, 10, 80, 80)); 34 monitor.set_work_area(gfx::Rect(10, 10, 80, 80));
36 EXPECT_EQ("0,0 100x100", monitor.bounds().ToString()); 35 EXPECT_EQ("0,0 100x100", monitor.bounds().ToString());
37 EXPECT_EQ("10,10 80x80", monitor.work_area().ToString()); 36 EXPECT_EQ("10,10 80x80", monitor.work_area().ToString());
38 37
39 // Scale it back to 2x 38 // Scale it back to 2x
40 monitor.SetScaleAndBounds(2.0f, gfx::Rect(0, 0, 140, 140)); 39 monitor.SetScaleAndBounds(2.0f, gfx::Rect(0, 0, 140, 140));
41 EXPECT_EQ("0,0 70x70", monitor.bounds().ToString()); 40 EXPECT_EQ("0,0 70x70", monitor.bounds().ToString());
42 EXPECT_EQ("10,10 50x50", monitor.work_area().ToString()); 41 EXPECT_EQ("10,10 50x50", monitor.work_area().ToString());
43 42
44 // Scale it back to 1x 43 // Scale it back to 1x
45 monitor.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100)); 44 monitor.SetScaleAndBounds(1.0f, gfx::Rect(0, 0, 100, 100));
46 EXPECT_EQ("0,0 100x100", monitor.bounds().ToString()); 45 EXPECT_EQ("0,0 100x100", monitor.bounds().ToString());
47 EXPECT_EQ("10,10 80x80", monitor.work_area().ToString()); 46 EXPECT_EQ("10,10 80x80", monitor.work_area().ToString());
48 } 47 }
49 #endif
50 48
51 } 49 }
OLDNEW
« ui/gfx/compositor/layer_unittest.cc ('K') | « ui/gfx/monitor.cc ('k') | ui/gfx/path.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698