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

Side by Side Diff: remoting/host/screen_resolution_unittest.cc

Issue 12678008: Reworked the plumbing required to pass the client resolution to the desktop resizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback Created 7 years, 9 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
« no previous file with comments | « remoting/host/screen_resolution.cc ('k') | remoting/host/session_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/host/screen_resolution.h"
6
7 #include <limits>
8
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace remoting {
13
14 TEST(ScreenResolutionTest, Empty) {
15 ScreenResolution resolution;
16 EXPECT_TRUE(resolution.IsEmpty());
17
18 resolution.dimensions_.set(-1, 0);
19 EXPECT_TRUE(resolution.IsEmpty());
20
21 resolution.dimensions_.set(0, -1);
22 EXPECT_TRUE(resolution.IsEmpty());
23
24 resolution.dimensions_.set(-1, -1);
25 EXPECT_TRUE(resolution.IsEmpty());
26
27 resolution.dpi_.set(-1, 0);
28 EXPECT_TRUE(resolution.IsEmpty());
29
30 resolution.dpi_.set(0, -1);
31 EXPECT_TRUE(resolution.IsEmpty());
32
33 resolution.dpi_.set(-1, -1);
34 EXPECT_TRUE(resolution.IsEmpty());
35 }
36
37 TEST(ScreenResolutionTest, Invalid) {
38 ScreenResolution resolution;
39 EXPECT_TRUE(resolution.IsValid());
40
41 resolution.dimensions_.set(-1, 0);
42 EXPECT_FALSE(resolution.IsValid());
43
44 resolution.dimensions_.set(0, -1);
45 EXPECT_FALSE(resolution.IsValid());
46
47 resolution.dimensions_.set(-1, -1);
48 EXPECT_FALSE(resolution.IsValid());
49
50 resolution.dpi_.set(-1, 0);
51 EXPECT_FALSE(resolution.IsValid());
52
53 resolution.dpi_.set(0, -1);
54 EXPECT_FALSE(resolution.IsValid());
55
56 resolution.dpi_.set(-1, -1);
57 EXPECT_FALSE(resolution.IsValid());
58 }
59
60 TEST(ScreenResolutionTest, Scaling) {
61 ScreenResolution resolution(
62 SkISize::Make(100, 100), SkIPoint::Make(10, 10));
63
64 EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(5, 5)),
65 SkISize::Make(50, 50));
66
67 EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(20, 20)),
68 SkISize::Make(200, 200));
69 }
70
71 TEST(ScreenResolutionTest, ScalingSaturation) {
72 ScreenResolution resolution(
73 SkISize::Make(10000000, 1000000), SkIPoint::Make(1, 1));
74
75 EXPECT_EQ(resolution.ScaleDimensionsToDpi(SkIPoint::Make(1000000, 1000000)),
76 SkISize::Make(std::numeric_limits<int32>::max(),
77 std::numeric_limits<int32>::max()));
78 }
79
80 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/screen_resolution.cc ('k') | remoting/host/session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698