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..c64885b8746d3de6d8039ebe66d212ca5e09b2d4 100644 |
| --- a/ui/display/manager/managed_display_info_unittest.cc |
| +++ b/ui/display/manager/managed_display_info_unittest.cc |
| @@ -147,4 +147,53 @@ 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::CalibrationPointPair pair[4]; |
| + TouchCalibrationData::CalibrationPoints points; |
| + |
| + pair[0].first = gfx::Point(10, 10); |
| + pair[0].second = gfx::Point(11, 12); |
| + points[0] = pair[0]; |
|
oshima
2016/11/23 21:52:42
std::make_pair
malaykeshav
2016/11/23 22:11:27
Done
|
| + |
| + pair[1].first = gfx::Point(190, 10); |
| + pair[1].second = gfx::Point(195, 8); |
| + points[1] = pair[1]; |
| + |
| + pair[2].first = gfx::Point(10, 90); |
| + pair[2].second = gfx::Point(12, 94); |
| + points[2] = pair[2]; |
| + |
| + pair[3].first = gfx::Point(190, 90); |
| + pair[3].second = gfx::Point(189, 88); |
| + points[3] = pair[3]; |
| + |
| + 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++) { |
| + 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 |