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

Side by Side Diff: ui/display/manager/managed_display_info_unittest.cc

Issue 2521393002: Prepare ManagedDisplayInfo to store touch calibration associated data (Closed)
Patch Set: Resolve Comments Created 4 years 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
« no previous file with comments | « ui/display/manager/managed_display_info.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) 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/display/manager/managed_display_info.h" 5 #include "ui/display/manager/managed_display_info.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace display { 9 namespace display {
10 namespace { 10 namespace {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 EXPECT_EQ(11, info.input_devices()[1]); 140 EXPECT_EQ(11, info.input_devices()[1]);
141 141
142 ManagedDisplayInfo copy_info = 142 ManagedDisplayInfo copy_info =
143 ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10); 143 ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10);
144 copy_info.Copy(info); 144 copy_info.Copy(info);
145 EXPECT_EQ(2u, copy_info.input_devices().size()); 145 EXPECT_EQ(2u, copy_info.input_devices().size());
146 copy_info.ClearInputDevices(); 146 copy_info.ClearInputDevices();
147 EXPECT_EQ(0u, copy_info.input_devices().size()); 147 EXPECT_EQ(0u, copy_info.input_devices().size());
148 } 148 }
149 149
150 TEST_F(DisplayInfoTest, TouchCalibrationTest) {
151 ManagedDisplayInfo info =
152 ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10);
153
154 EXPECT_FALSE(info.has_touch_calibration_data());
155
156 TouchCalibrationData::CalibrationPointPairQuad points;
157
158 points[0] = std::make_pair(gfx::Point(10, 10), gfx::Point(11, 12));
159 points[1] = std::make_pair(gfx::Point(190, 10), gfx::Point(195, 8));
160 points[2] = std::make_pair(gfx::Point(10, 90), gfx::Point(12, 94));
161 points[3] = std::make_pair(gfx::Point(190, 90), gfx::Point(189, 88));
oshima 2016/11/24 00:36:40 nit: i believe you can also do points = { std::m
162
163 gfx::Size size(200, 100);
164
165 TouchCalibrationData expected_data(points, size);
166
167 // Add touch data for the display.
168 info.SetTouchCalibrationData(expected_data);
169
170 EXPECT_TRUE(info.has_touch_calibration_data());
171 TouchCalibrationData actual_data = info.GetTouchCalibrationData();
172 EXPECT_EQ(actual_data.bounds, size);
173 for (int i = 0; i < 4; i++) {
oshima 2016/11/24 00:36:40 can you use the arraysize instead of 4?
174 EXPECT_EQ(actual_data.point_pairs[i].first,
175 expected_data.point_pairs[i].first);
176
177 EXPECT_EQ(actual_data.point_pairs[i].second,
178 expected_data.point_pairs[i].second);
179 }
180
181 // Clear all touch calibration data for the display.
182 info.clear_touch_calibration_data();
183
184 EXPECT_FALSE(info.has_touch_calibration_data());
185 }
186
150 } // namespace display 187 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/managed_display_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698