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

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: 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
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::CalibrationPointPair pair[4];
157 TouchCalibrationData::CalibrationPoints points;
158
159 pair[0].first = gfx::Point(10, 10);
160 pair[0].second = gfx::Point(11, 12);
161 points[0] = pair[0];
oshima 2016/11/23 21:52:42 std::make_pair
malaykeshav 2016/11/23 22:11:27 Done
162
163 pair[1].first = gfx::Point(190, 10);
164 pair[1].second = gfx::Point(195, 8);
165 points[1] = pair[1];
166
167 pair[2].first = gfx::Point(10, 90);
168 pair[2].second = gfx::Point(12, 94);
169 points[2] = pair[2];
170
171 pair[3].first = gfx::Point(190, 90);
172 pair[3].second = gfx::Point(189, 88);
173 points[3] = pair[3];
174
175 gfx::Size size(200, 100);
176
177 TouchCalibrationData expected_data(points, size);
178
179 // Add touch data for the display.
180 info.SetTouchCalibrationData(expected_data);
181
182 EXPECT_TRUE(info.has_touch_calibration_data());
183 TouchCalibrationData actual_data = info.GetTouchCalibrationData();
184 EXPECT_EQ(actual_data.bounds, size);
185 for (int i = 0; i < 4; i++) {
186 EXPECT_EQ(actual_data.point_pairs[i].first,
187 expected_data.point_pairs[i].first);
188
189 EXPECT_EQ(actual_data.point_pairs[i].second,
190 expected_data.point_pairs[i].second);
191 }
192
193 // Clear all touch calibration data for the display.
194 info.clear_touch_calibration_data();
195
196 EXPECT_FALSE(info.has_touch_calibration_data());
197 }
198
150 } // namespace display 199 } // namespace display
OLDNEW
« ui/display/manager/managed_display_info.h ('K') | « 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