OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/viz/host/hit_test/hit_test_query.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace viz { |
| 10 namespace hit_test { |
| 11 namespace test { |
| 12 |
| 13 class HitTestQueryTest : public testing::Test { |
| 14 public: |
| 15 HitTestQueryTest() {} |
| 16 ~HitTestQueryTest() override {} |
| 17 |
| 18 HitTestQuery hit_test_query_; |
| 19 |
| 20 private: |
| 21 // testing::Test: |
| 22 void SetUp() override {} |
| 23 void TearDown() override {} |
| 24 |
| 25 DISALLOW_COPY_AND_ASSIGN(HitTestQueryTest); |
| 26 }; |
| 27 |
| 28 // One surface. |
| 29 // |
| 30 // +e---------+ |
| 31 // | | |
| 32 // | | |
| 33 // | | |
| 34 // +----------+ |
| 35 // |
| 36 TEST_F(HitTestQueryTest, OneSurface) { |
| 37 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 38 gfx::Rect e_bounds = gfx::Rect(0, 0, 600, 600); |
| 39 gfx::Transform transform_e_to_e; |
| 40 DisplayHitTestData display_hit_test_data_list = { |
| 41 {e_id, e_bounds, transform_e_to_e, 1 /* HIT_TEST_MINE */, 0} // e |
| 42 }; |
| 43 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 44 |
| 45 // All points are in e's coordinate system when we reach this case. |
| 46 gfx::Point point1(1, 1); |
| 47 gfx::Point point2(600, 600); |
| 48 gfx::Point point3(0, 0); |
| 49 |
| 50 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 51 EXPECT_EQ(e_id, target1.id); |
| 52 EXPECT_EQ(point1, target1.location_in_target); |
| 53 EXPECT_TRUE(target1.flags); |
| 54 |
| 55 // point2 is on the bounds of e so no target found. |
| 56 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 57 EXPECT_EQ(cc::FrameSinkId(), target2.id); |
| 58 EXPECT_EQ(gfx::Point(), target2.location_in_target); |
| 59 EXPECT_FALSE(target2.flags); |
| 60 |
| 61 // There's a valid Target for point3, see Rect::Contains. |
| 62 Target target3 = hit_test_query_.FindTargetForLocation(point3); |
| 63 EXPECT_EQ(e_id, target3.id); |
| 64 EXPECT_EQ(point3, target3.location_in_target); |
| 65 EXPECT_TRUE(target3.flags); |
| 66 } |
| 67 |
| 68 // One embedder with two children. |
| 69 // |
| 70 // +e------------+ Point maps to |
| 71 // | +c1-+ +c2---| ----- ------- |
| 72 // |1| | | | 1 e |
| 73 // | | 2 | | 3 | 4 2 c1 |
| 74 // | +---+ | | 3 c2 |
| 75 // +-------------+ 4 none |
| 76 // |
| 77 TEST_F(HitTestQueryTest, OneEmbedderTwoChildren) { |
| 78 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 79 cc::FrameSinkId c1_id = cc::FrameSinkId(2, 2); |
| 80 cc::FrameSinkId c2_id = cc::FrameSinkId(3, 3); |
| 81 gfx::Rect e_bounds_in_e = gfx::Rect(0, 0, 600, 600); |
| 82 gfx::Rect c1_bounds_in_e = gfx::Rect(0, 0, 200, 200); |
| 83 gfx::Rect c2_bounds_in_e = gfx::Rect(0, 0, 400, 400); |
| 84 gfx::Transform transform_e_to_e, transform_e_to_c1, transform_e_to_c2; |
| 85 transform_e_to_c1.Translate(-100, -100); |
| 86 transform_e_to_c2.Translate(-300, -300); |
| 87 DisplayHitTestData display_hit_test_data_list = { |
| 88 {e_id, e_bounds_in_e, transform_e_to_e, 1 /* HIT_TEST_MINE */, 2}, // e |
| 89 {c1_id, c1_bounds_in_e, transform_e_to_c1, 1 /* HIT_TEST_MINE */, |
| 90 0}, // c1 |
| 91 {c2_id, c2_bounds_in_e, transform_e_to_c2, 1 /* HIT_TEST_MINE */, |
| 92 0} // c2 |
| 93 }; |
| 94 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 95 |
| 96 // All points are in e's coordinate system when we reach this case. |
| 97 gfx::Point point1(99, 200); |
| 98 gfx::Point point2(150, 150); |
| 99 gfx::Point point3(400, 400); |
| 100 gfx::Point point4(650, 350); |
| 101 |
| 102 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 103 EXPECT_EQ(e_id, target1.id); |
| 104 EXPECT_EQ(point1, target1.location_in_target); |
| 105 EXPECT_TRUE(target1.flags); |
| 106 |
| 107 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 108 EXPECT_EQ(c1_id, target2.id); |
| 109 EXPECT_EQ(gfx::Point(50, 50), target2.location_in_target); |
| 110 EXPECT_TRUE(target2.flags); |
| 111 |
| 112 Target target3 = hit_test_query_.FindTargetForLocation(point3); |
| 113 EXPECT_EQ(c2_id, target3.id); |
| 114 EXPECT_EQ(gfx::Point(100, 100), target3.location_in_target); |
| 115 EXPECT_TRUE(target3.flags); |
| 116 |
| 117 Target target4 = hit_test_query_.FindTargetForLocation(point4); |
| 118 EXPECT_EQ(cc::FrameSinkId(), target4.id); |
| 119 EXPECT_EQ(gfx::Point(), target4.location_in_target); |
| 120 EXPECT_FALSE(target4.flags); |
| 121 } |
| 122 |
| 123 // One embedder with a rotated child. |
| 124 TEST_F(HitTestQueryTest, OneEmbedderRotatedChild) { |
| 125 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 126 cc::FrameSinkId c_id = cc::FrameSinkId(2, 2); |
| 127 gfx::Rect e_bounds_in_e = gfx::Rect(0, 0, 600, 600); |
| 128 gfx::Rect c_bounds_in_e = gfx::Rect(0, 0, 1000, 1000); |
| 129 gfx::Transform transform_e_to_e, transform_e_to_c; |
| 130 transform_e_to_c.Translate(-100, -100); |
| 131 transform_e_to_c.Skew(2, 3); |
| 132 transform_e_to_c.Scale(.5f, .7f); |
| 133 |
| 134 DisplayHitTestData display_hit_test_data_list = { |
| 135 {e_id, e_bounds_in_e, transform_e_to_e, 1 /* HIT_TEST_MINE */, 1}, // e |
| 136 {c_id, c_bounds_in_e, transform_e_to_c, 1 /* HIT_TEST_MINE */, 0} // c |
| 137 }; |
| 138 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 139 |
| 140 // All points are in e's coordinate system when we reach this case. |
| 141 gfx::Point point1(150, 120); // Point(-22, -12) after transform. |
| 142 gfx::Point point2(550, 400); // Point(185, 194) after transform. |
| 143 |
| 144 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 145 EXPECT_EQ(e_id, target1.id); |
| 146 EXPECT_EQ(point1, target1.location_in_target); |
| 147 EXPECT_TRUE(target1.flags); |
| 148 |
| 149 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 150 EXPECT_EQ(c_id, target2.id); |
| 151 EXPECT_EQ(gfx::Point(185, 194), target2.location_in_target); |
| 152 EXPECT_TRUE(target2.flags); |
| 153 } |
| 154 |
| 155 // Children that are multiple layers deep. |
| 156 // |
| 157 // +e--------------------+ Point maps to |
| 158 // | +c1---------+ +c2---| ----- ------- |
| 159 // |1| +a-------+| | | 1 e |
| 160 // | | |+b-----+|| | | 2 g |
| 161 // | | ||+g--+ ||| | | 3 c2 |
| 162 // | | ||| 2 | ||| | 3 | |
| 163 // | | ||+---+ ||| | | |
| 164 // | | |+------+|| | | |
| 165 // | | +--------+| | | |
| 166 // | +-----------+ | | |
| 167 // +---------------------+ |
| 168 // |
| 169 TEST_F(HitTestQueryTest, MultipleLayerChild) { |
| 170 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 171 cc::FrameSinkId a_id = cc::FrameSinkId(2, 2); |
| 172 cc::FrameSinkId b_id = cc::FrameSinkId(3, 3); |
| 173 cc::FrameSinkId g_id = cc::FrameSinkId(4, 4); |
| 174 cc::FrameSinkId c2_id = cc::FrameSinkId(5, 5); |
| 175 gfx::Rect e_bounds_in_e = gfx::Rect(0, 0, 1000, 1000); |
| 176 gfx::Rect c1_bounds_in_e = gfx::Rect(0, 0, 600, 600); |
| 177 gfx::Rect a_bounds_in_c1 = gfx::Rect(0, 0, 500, 500); |
| 178 gfx::Rect b_bounds_in_c1 = gfx::Rect(0, 0, 400, 400); |
| 179 gfx::Rect g_bounds_in_c1 = gfx::Rect(0, 0, 200, 200); |
| 180 gfx::Rect c2_bounds_in_e = gfx::Rect(0, 0, 800, 800); |
| 181 gfx::Transform transform_e_to_e, transform_e_to_c1, transform_c1_to_a, |
| 182 transform_c1_to_b, transform_c1_to_g, transform_e_to_c2; |
| 183 transform_e_to_c1.Translate(-100, -100); |
| 184 transform_c1_to_b.Translate(-50, -30); |
| 185 transform_c1_to_g.Translate(-150, -200); |
| 186 transform_e_to_c2.Translate(-800, -100); |
| 187 DisplayHitTestData display_hit_test_data_list = { |
| 188 {e_id, e_bounds_in_e, transform_e_to_e, 1 /* HIT_TEST_MINE */, 5}, // e |
| 189 {e_id, c1_bounds_in_e, transform_e_to_c1, 0 /* HIT_TEST_BOUND */, |
| 190 3}, // c1 |
| 191 {a_id, a_bounds_in_c1, transform_c1_to_a, 1 /* HIT_TEST_MINE */, 2}, // a |
| 192 {b_id, b_bounds_in_c1, transform_c1_to_b, 1 /* HIT_TEST_MINE */, 1}, // b |
| 193 {g_id, g_bounds_in_c1, transform_c1_to_g, 1 /* HIT_TEST_MINE */, 0}, // g |
| 194 {c2_id, c2_bounds_in_e, transform_e_to_c2, 1 /* HIT_TEST_MINE */, |
| 195 0} // c2 |
| 196 }; |
| 197 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 198 |
| 199 // All points are in e's coordinate system when we reach this case. |
| 200 gfx::Point point1(1, 1); |
| 201 gfx::Point point2(300, 350); |
| 202 gfx::Point point3(900, 350); |
| 203 |
| 204 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 205 EXPECT_EQ(e_id, target1.id); |
| 206 EXPECT_EQ(point1, target1.location_in_target); |
| 207 EXPECT_TRUE(target1.flags); |
| 208 |
| 209 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 210 EXPECT_EQ(g_id, target2.id); |
| 211 EXPECT_EQ(gfx::Point(0, 20), target2.location_in_target); |
| 212 EXPECT_TRUE(target2.flags); |
| 213 |
| 214 Target target3 = hit_test_query_.FindTargetForLocation(point3); |
| 215 EXPECT_EQ(c2_id, target3.id); |
| 216 EXPECT_EQ(gfx::Point(100, 250), target3.location_in_target); |
| 217 EXPECT_TRUE(target3.flags); |
| 218 } |
| 219 |
| 220 // One embedder with a clipped child with a tab and transparent background. |
| 221 // |
| 222 // +e-------------+ |
| 223 // | +c---------| Point maps to |
| 224 // | 1 |+a--+ | ----- ------- |
| 225 // | || 2 | 3 | 1 e |
| 226 // | |+b--------| 2 a |
| 227 // | || | 3 e ( transparent area in c ) |
| 228 // | || 4 | 4 b |
| 229 // +--------------+ |
| 230 // |
| 231 TEST_F(HitTestQueryTest, ClippedChildWithTabAndTransparentBackground) { |
| 232 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 233 cc::FrameSinkId a_id = cc::FrameSinkId(2, 2); |
| 234 cc::FrameSinkId b_id = cc::FrameSinkId(3, 3); |
| 235 gfx::Rect e_bounds_in_e = gfx::Rect(0, 0, 600, 600); |
| 236 gfx::Rect c_bounds_in_e = gfx::Rect(0, 0, 800, 800); |
| 237 gfx::Rect a_bounds_in_c = gfx::Rect(0, 0, 200, 100); |
| 238 gfx::Rect b_bounds_in_c = gfx::Rect(0, 0, 800, 600); |
| 239 gfx::Transform transform_e_to_e, transform_e_to_c, transform_c_to_a, |
| 240 transform_c_to_b; |
| 241 transform_e_to_c.Translate(-200, -100); |
| 242 transform_c_to_b.Translate(0, -100); |
| 243 DisplayHitTestData display_hit_test_data_list = { |
| 244 {e_id, e_bounds_in_e, transform_e_to_e, 1 /* HIT_TEST_MINE */, 3}, // e |
| 245 {e_id, c_bounds_in_e, transform_e_to_c, 0 /* HIT_TEST_BOUND */, 2}, // c |
| 246 {a_id, a_bounds_in_c, transform_c_to_a, 1 /* HIT_TEST_MINE */, 0}, // a |
| 247 {b_id, b_bounds_in_c, transform_c_to_b, 1 /* HIT_TEST_MINE */, 0} // b |
| 248 }; |
| 249 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 250 |
| 251 // All points are in e's coordinate system when we reach this case. |
| 252 gfx::Point point1(1, 1); |
| 253 gfx::Point point2(202, 102); |
| 254 gfx::Point point3(403, 103); |
| 255 gfx::Point point4(202, 202); |
| 256 |
| 257 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 258 EXPECT_EQ(e_id, target1.id); |
| 259 EXPECT_EQ(point1, target1.location_in_target); |
| 260 EXPECT_TRUE(target1.flags); |
| 261 |
| 262 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 263 EXPECT_EQ(a_id, target2.id); |
| 264 EXPECT_EQ(gfx::Point(2, 2), target2.location_in_target); |
| 265 EXPECT_TRUE(target2.flags); |
| 266 |
| 267 Target target3 = hit_test_query_.FindTargetForLocation(point3); |
| 268 EXPECT_EQ(e_id, target3.id); |
| 269 EXPECT_EQ(point3, target3.location_in_target); |
| 270 EXPECT_TRUE(target3.flags); |
| 271 |
| 272 Target target4 = hit_test_query_.FindTargetForLocation(point4); |
| 273 EXPECT_EQ(b_id, target4.id); |
| 274 EXPECT_EQ(gfx::Point(2, 2), target4.location_in_target); |
| 275 EXPECT_TRUE(target4.flags); |
| 276 } |
| 277 |
| 278 // One embedder with a clipped child with a tab and transparent background, and |
| 279 // a child d under that. |
| 280 // |
| 281 // +e-------------+ |
| 282 // | +d------| |
| 283 // | +c-|-------| Point maps to |
| 284 // | 1 |+a|-+ | ----- ------- |
| 285 // | || 2 | 3 | 1 e |
| 286 // | |+b|-------| 2 a |
| 287 // | || | | 3 d |
| 288 // | || | 4 | 4 b |
| 289 // +--------------+ |
| 290 // |
| 291 TEST_F(HitTestQueryTest, ClippedChildWithChildUnderneath) { |
| 292 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 293 cc::FrameSinkId a_id = cc::FrameSinkId(2, 2); |
| 294 cc::FrameSinkId b_id = cc::FrameSinkId(3, 3); |
| 295 cc::FrameSinkId d_id = cc::FrameSinkId(4, 4); |
| 296 gfx::Rect e_bounds_in_e = gfx::Rect(0, 0, 600, 600); |
| 297 gfx::Rect c_bounds_in_e = gfx::Rect(0, 0, 800, 800); |
| 298 gfx::Rect a_bounds_in_c = gfx::Rect(0, 0, 200, 100); |
| 299 gfx::Rect b_bounds_in_c = gfx::Rect(0, 0, 800, 600); |
| 300 gfx::Rect d_bounds_in_e = gfx::Rect(0, 0, 800, 800); |
| 301 gfx::Transform transform_e_to_e, transform_e_to_c, transform_c_to_a, |
| 302 transform_c_to_b, transform_e_to_d; |
| 303 transform_e_to_c.Translate(-200, -100); |
| 304 transform_c_to_b.Translate(0, -100); |
| 305 transform_e_to_d.Translate(-400, -50); |
| 306 DisplayHitTestData display_hit_test_data_list = { |
| 307 {e_id, e_bounds_in_e, transform_e_to_e, 1 /* HIT_TEST_MINE */, 4}, // e |
| 308 {d_id, d_bounds_in_e, transform_e_to_d, 1 /* HIT_TEST_MINE */, 0}, // d |
| 309 {e_id, c_bounds_in_e, transform_e_to_c, 0 /* HIT_TEST_BOUND */, 2}, // c |
| 310 {a_id, a_bounds_in_c, transform_c_to_a, 1 /* HIT_TEST_MINE */, 0}, // a |
| 311 {b_id, b_bounds_in_c, transform_c_to_b, 1 /* HIT_TEST_MINE */, 0} // b |
| 312 }; |
| 313 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 314 |
| 315 // All points are in e's coordinate system when we reach this case. |
| 316 gfx::Point point1(1, 1); |
| 317 gfx::Point point2(202, 102); |
| 318 gfx::Point point3(450, 150); |
| 319 gfx::Point point4(202, 202); |
| 320 |
| 321 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 322 EXPECT_EQ(e_id, target1.id); |
| 323 EXPECT_EQ(point1, target1.location_in_target); |
| 324 EXPECT_TRUE(target1.flags); |
| 325 |
| 326 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 327 EXPECT_EQ(a_id, target2.id); |
| 328 EXPECT_EQ(gfx::Point(2, 2), target2.location_in_target); |
| 329 EXPECT_TRUE(target2.flags); |
| 330 |
| 331 Target target3 = hit_test_query_.FindTargetForLocation(point3); |
| 332 EXPECT_EQ(d_id, target3.id); |
| 333 EXPECT_EQ(gfx::Point(50, 100), target3.location_in_target); |
| 334 EXPECT_TRUE(target3.flags); |
| 335 |
| 336 Target target4 = hit_test_query_.FindTargetForLocation(point4); |
| 337 EXPECT_EQ(b_id, target4.id); |
| 338 EXPECT_EQ(gfx::Point(2, 2), target4.location_in_target); |
| 339 EXPECT_TRUE(target4.flags); |
| 340 } |
| 341 |
| 342 // One embedder with two clipped children with a tab and transparent background. |
| 343 // |
| 344 // +e-------------+ |
| 345 // | +c1--------| Point maps to |
| 346 // | 1 |+a--+ | ----- ------- |
| 347 // | || 2 | 3 | 1 e |
| 348 // | |+b--------| 2 a |
| 349 // | || | 3 e ( transparent area in c1 ) |
| 350 // | || 4 | 4 b |
| 351 // | +----------| 5 g |
| 352 // | +c2--------| 6 e ( transparent area in c2 ) |
| 353 // | |+g--+ | 7 h |
| 354 // | || 5 | 6 | |
| 355 // | |+h--------| |
| 356 // | || | |
| 357 // | || 7 | |
| 358 // +--------------+ |
| 359 // |
| 360 TEST_F(HitTestQueryTest, ClippedChildrenWithTabAndTransparentBackground) { |
| 361 cc::FrameSinkId e_id = cc::FrameSinkId(1, 1); |
| 362 cc::FrameSinkId a_id = cc::FrameSinkId(2, 2); |
| 363 cc::FrameSinkId b_id = cc::FrameSinkId(3, 3); |
| 364 cc::FrameSinkId g_id = cc::FrameSinkId(4, 4); |
| 365 cc::FrameSinkId h_id = cc::FrameSinkId(5, 5); |
| 366 gfx::Rect e_bounds_in_e = gfx::Rect(0, 0, 600, 1200); |
| 367 gfx::Rect c1_bounds_in_e = gfx::Rect(0, 0, 800, 500); |
| 368 gfx::Rect a_bounds_in_c1 = gfx::Rect(0, 0, 200, 100); |
| 369 gfx::Rect b_bounds_in_c1 = gfx::Rect(0, 0, 800, 400); |
| 370 gfx::Rect c2_bounds_in_e = gfx::Rect(0, 0, 800, 500); |
| 371 gfx::Rect g_bounds_in_c2 = gfx::Rect(0, 0, 200, 100); |
| 372 gfx::Rect h_bounds_in_c2 = gfx::Rect(0, 0, 800, 800); |
| 373 gfx::Transform transform_e_to_e, transform_e_to_c1, transform_c1_to_a, |
| 374 transform_c1_to_b, transform_e_to_c2, transform_c2_to_g, |
| 375 transform_c2_to_h; |
| 376 transform_e_to_c1.Translate(-200, -100); |
| 377 transform_c1_to_b.Translate(0, -100); |
| 378 transform_e_to_c2.Translate(-200, -700); |
| 379 transform_c2_to_h.Translate(0, -100); |
| 380 DisplayHitTestData display_hit_test_data_list = { |
| 381 {e_id, e_bounds_in_e, transform_e_to_e, 1 /* HIT_TEST_MINE */, 6}, // e |
| 382 {e_id, c1_bounds_in_e, transform_e_to_c1, 0 /* HIT_TEST_BOUND */, |
| 383 2}, // c1 |
| 384 {a_id, a_bounds_in_c1, transform_c1_to_a, 1 /* HIT_TEST_MINE */, 0}, // a |
| 385 {b_id, b_bounds_in_c1, transform_c1_to_b, 1 /* HIT_TEST_MINE */, 0}, // b |
| 386 {e_id, c2_bounds_in_e, transform_e_to_c2, 0 /* HIT_TEST_BOUND */, |
| 387 2}, // c2 |
| 388 {g_id, g_bounds_in_c2, transform_c2_to_g, 1 /* HIT_TEST_MINE */, 0}, // g |
| 389 {h_id, h_bounds_in_c2, transform_c2_to_h, 1 /* HIT_TEST_MINE */, 0} // h |
| 390 }; |
| 391 hit_test_query_.set_display_hit_test_data_list(display_hit_test_data_list); |
| 392 |
| 393 // All points are in e's coordinate system when we reach this case. |
| 394 gfx::Point point1(1, 1); |
| 395 gfx::Point point2(202, 102); |
| 396 gfx::Point point3(403, 103); |
| 397 gfx::Point point4(202, 202); |
| 398 gfx::Point point5(250, 750); |
| 399 gfx::Point point6(450, 750); |
| 400 gfx::Point point7(350, 1100); |
| 401 |
| 402 Target target1 = hit_test_query_.FindTargetForLocation(point1); |
| 403 EXPECT_EQ(e_id, target1.id); |
| 404 EXPECT_EQ(point1, target1.location_in_target); |
| 405 EXPECT_TRUE(target1.flags); |
| 406 |
| 407 Target target2 = hit_test_query_.FindTargetForLocation(point2); |
| 408 EXPECT_EQ(a_id, target2.id); |
| 409 EXPECT_EQ(gfx::Point(2, 2), target2.location_in_target); |
| 410 EXPECT_TRUE(target2.flags); |
| 411 |
| 412 Target target3 = hit_test_query_.FindTargetForLocation(point3); |
| 413 EXPECT_EQ(e_id, target3.id); |
| 414 EXPECT_EQ(point3, target3.location_in_target); |
| 415 EXPECT_TRUE(target3.flags); |
| 416 |
| 417 Target target4 = hit_test_query_.FindTargetForLocation(point4); |
| 418 EXPECT_EQ(b_id, target4.id); |
| 419 EXPECT_EQ(gfx::Point(2, 2), target4.location_in_target); |
| 420 EXPECT_TRUE(target4.flags); |
| 421 |
| 422 Target target5 = hit_test_query_.FindTargetForLocation(point5); |
| 423 EXPECT_EQ(g_id, target5.id); |
| 424 EXPECT_EQ(gfx::Point(50, 50), target5.location_in_target); |
| 425 EXPECT_TRUE(target5.flags); |
| 426 |
| 427 Target target6 = hit_test_query_.FindTargetForLocation(point6); |
| 428 EXPECT_EQ(e_id, target6.id); |
| 429 EXPECT_EQ(point6, target6.location_in_target); |
| 430 EXPECT_TRUE(target6.flags); |
| 431 |
| 432 Target target7 = hit_test_query_.FindTargetForLocation(point7); |
| 433 EXPECT_EQ(h_id, target7.id); |
| 434 EXPECT_EQ(gfx::Point(150, 300), target7.location_in_target); |
| 435 EXPECT_TRUE(target7.flags); |
| 436 } |
| 437 |
| 438 } // namespace test |
| 439 } // namespace hit_test |
| 440 } // namespace viz |
OLD | NEW |