// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/viz/common/hit_test/hit_test_query.h" #include <cstdint> #include "components/viz/common/hit_test/hit_test_region_list.h" #include "testing/gtest/include/gtest/gtest.h" namespace viz { namespace test { class HitTestQueryTest : public testing::Test { … }; // One surface. // // +e---------+ // | | // | | // | | // +----------+ // TEST_F(HitTestQueryTest, OneSurface) { … } // One embedder with two children. // // +e------------+ Point maps to // | +c1-+ +c2---| ----- ------- // |1| | | | 1 e // | | 2 | | 3 | 4 2 c1 // | +---+ | | 3 c2 // +-------------+ 4 none // TEST_F(HitTestQueryTest, OneEmbedderTwoChildren) { … } // One embedder with a rotated child. TEST_F(HitTestQueryTest, OneEmbedderRotatedChild) { … } // One embedder with a clipped child with a tab and transparent background. // // +e-------------+ // | +c---------| Point maps to // | 1 |+a--+ | ----- ------- // | || 2 | 3 | 1 e // | |+b--------| 2 a // | || | 3 e ( transparent area in c ) // | || 4 | 4 b // +--------------+ // TEST_F(HitTestQueryTest, ClippedChildWithTabAndTransparentBackground) { … } // One embedder with a clipped child with a tab and transparent background, and // a child d under that. // // +e-------------+ // | +d------| // | +c-|-------| Point maps to // | 1 |+a|-+ | ----- ------- // | || 2 | 3 | 1 e // | |+b|-------| 2 a // | || | | 3 d // | || | 4 | 4 b // +--------------+ // TEST_F(HitTestQueryTest, ClippedChildWithChildUnderneath) { … } // Tests transforming location to be in target's coordinate system given the // target's ancestor list, in the case of ClippedChildWithChildUnderneath test. TEST_F(HitTestQueryTest, ClippedChildWithChildUnderneathTransform) { … } // One embedder with two clipped children with a tab and transparent background. // // +e-------------+ // | +c1--------| Point maps to // | 1 |+a--+ | ----- ------- // | || 2 | 3 | 1 e // | |+b--------| 2 a // | || | 3 e ( transparent area in c1 ) // | || 4 | 4 b // | +----------| 5 g // | +c2--------| 6 e ( transparent area in c2 ) // | |+g--+ | 7 h // | || 5 | 6 | // | |+h--------| // | || | // | || 7 | // +--------------+ // TEST_F(HitTestQueryTest, ClippedChildrenWithTabAndTransparentBackground) { … } // Tests transforming location to be in target's coordinate system given the // target's ancestor list, in the case of // ClippedChildrenWithTabAndTransparentBackground test. TEST_F(HitTestQueryTest, ClippedChildrenWithTabAndTransparentBackgroundTransform) { … } // Children that are multiple layers deep. // // +e--------------------+ // | +c2--------| Point maps to // | +c1------|----+ | ----- ------- // |1| +a-----|---+| | 1 e // | | |+b----|--+|| | 2 g // | | ||+g--+| ||| | 3 b // | | ||| 2 || 3||| 4 | 4 c2 // | | ||+---+| ||| | // | | |+-----|--+|| | // | | +------| --+| | // | +--------|----+ | // +---------------------+ // TEST_F(HitTestQueryTest, MultipleLayerChild) { … } // Multiple layers deep of transparent children. // // +e--------------------+ // | +c2--------| Point maps to // | +c1------|----+ | ----- ------- // |1| +a-----|---+| | 1 e // | | |+b----|--+|| | 2 e // | | ||+g--+| ||| | 3 c2 // | | ||| 2 || 3||| 4 | 4 c2 // | | ||+---+| ||| | // | | |+-----|--+|| | // | | +------| --+| | // | +--------|----+ | // +---------------------+ // TEST_F(HitTestQueryTest, MultipleLayerTransparentChild) { … } TEST_F(HitTestQueryTest, InvalidAggregatedHitTestRegionData) { … } // Tests flags kHitTestMouse and kHitTestTouch. TEST_F(HitTestQueryTest, MouseTouchFlags) { … } TEST_F(HitTestQueryTest, RootHitTestAskFlag) { … } // One embedder with two children. // // +e------------+ Point maps to // | +c1-+ +c2---| ----- ------- // |1| | | | 1 e // | | 2 | | 3 | 2 c1 // | +---+ | | 3 c2 // +-------------+ // TEST_F(HitTestQueryTest, ChildHitTestAskFlag) { … } // One embedder with nested OOPIFs. When the mid-level iframe has kHitTestAsk // flag we should do async hit test and skip checking its descendants. // // +e-------------+ // | +c---------| Point maps to // | 1 | 2 | ----- ------- // | | | 1 e // | |+b--------| 2 c // | || | 3 c // | || 3 | // +--------------+ // TEST_F(HitTestQueryTest, NestedOOPIFs) { … } // Tests getting the transform from root to a given target. TEST_F(HitTestQueryTest, GetTransformToTarget) { … } // Region c1 is transparent and on top of e, c2 is a child of e, d1 is a // child of c1. Any events outside of d1 should go to either c2 or e instead // of being taken by the transparent c1 region. // // +e/c1----------+ // | | Point maps to // | +c2-+ | ----- ------- // | | 1 | | 1 c2 // | +d1--------| 2 d1 // | | 2 | // | | | // +--------------+ // TEST_F(HitTestQueryTest, TransparentOverlayRegions) { … } TEST_F(HitTestQueryTest, FindTargetForLocationStartingFrom) { … } // One embedder with nested OOPIFs. When the root view is overlapped we should // continue checking its descendants rather than doing async hit test. // // +e-------------+ // | +c---------| Point maps to // | 1 | 2 | ----- ------- // | | | 1 e // | | | 2 c // | | | // | | | // +--------------+ // TEST_F(HitTestQueryTest, OverlappedRootView) { … } } // namespace test } // namespace viz