| OLD | NEW |
| 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 Loading... |
| 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 std::make_pair(gfx::Point(10, 10), gfx::Point(11, 12)), |
| 158 std::make_pair(gfx::Point(190, 10), gfx::Point(195, 8)), |
| 159 std::make_pair(gfx::Point(10, 90), gfx::Point(12, 94)), |
| 160 std::make_pair(gfx::Point(190, 90), gfx::Point(189, 88)) |
| 161 }}; |
| 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 (size_t i = 0; i < expected_data.point_pairs.size(); i++) { |
| 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 |
| OLD | NEW |