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

Unified Diff: ui/display/manager/managed_display_info_unittest.cc

Issue 2521393002: Prepare ManagedDisplayInfo to store touch calibration associated data (Closed)
Patch Set: nits Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/manager/managed_display_info.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b27dcc4327421a5b28233fa46d485ffb19e3f985 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 = {{
+ std::make_pair(gfx::Point(10, 10), gfx::Point(11, 12)),
+ std::make_pair(gfx::Point(190, 10), gfx::Point(195, 8)),
+ std::make_pair(gfx::Point(10, 90), gfx::Point(12, 94)),
+ std::make_pair(gfx::Point(190, 90), gfx::Point(189, 88))
+ }};
+
+ 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 (size_t i = 0; i < expected_data.point_pairs.size(); 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
« 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