Chromium Code Reviews| Index: ui/display/manager/managed_display_info_unittest.cc |
| diff --git a/ui/display/manager/managed_display_info_unittest.cc b/ui/display/manager/managed_display_info_unittest.cc |
| index 8a06a19e354a07ebba467cd9e79338ff3e2d56fa..69d1b260823f5d0811408742458cc0a29b56db26 100644 |
| --- a/ui/display/manager/managed_display_info_unittest.cc |
| +++ b/ui/display/manager/managed_display_info_unittest.cc |
| @@ -147,4 +147,41 @@ TEST_F(DisplayInfoTest, InputDevicesTest) { |
| EXPECT_EQ(0u, copy_info.input_devices().size()); |
| } |
| +TEST_F(DisplayInfoTest, TouchCalibrationTest) { |
| + ManagedDisplayInfo info = |
| + ManagedDisplayInfo::CreateFromSpecWithID("200x100", 10); |
| + |
| + EXPECT_FALSE(info.has_touch_calibration_data()); |
| + |
| + TouchCalibrationData::CalibrationPointPairQuad points; |
| + |
| + points[0] = std::make_pair(gfx::Point(10, 10), gfx::Point(11, 12)); |
| + points[1] = std::make_pair(gfx::Point(190, 10), gfx::Point(195, 8)); |
| + points[2] = std::make_pair(gfx::Point(10, 90), gfx::Point(12, 94)); |
| + 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
|
| + |
| + gfx::Size size(200, 100); |
| + |
| + TouchCalibrationData expected_data(points, size); |
| + |
| + // Add touch data for the display. |
| + info.SetTouchCalibrationData(expected_data); |
| + |
| + EXPECT_TRUE(info.has_touch_calibration_data()); |
| + TouchCalibrationData actual_data = info.GetTouchCalibrationData(); |
| + EXPECT_EQ(actual_data.bounds, size); |
| + for (int i = 0; i < 4; i++) { |
|
oshima
2016/11/24 00:36:40
can you use the arraysize instead of 4?
|
| + EXPECT_EQ(actual_data.point_pairs[i].first, |
| + expected_data.point_pairs[i].first); |
| + |
| + EXPECT_EQ(actual_data.point_pairs[i].second, |
| + expected_data.point_pairs[i].second); |
| + } |
| + |
| + // Clear all touch calibration data for the display. |
| + info.clear_touch_calibration_data(); |
| + |
| + EXPECT_FALSE(info.has_touch_calibration_data()); |
| +} |
| + |
| } // namespace display |