/src/mozilla-central/gfx/layers/apz/test/gtest/TestInputQueue.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "APZCTreeManagerTester.h" |
8 | | #include "APZTestCommon.h" |
9 | | #include "InputUtils.h" |
10 | | |
11 | | // Test of scenario described in bug 1269067 - that a continuing mouse drag |
12 | | // doesn't interrupt a wheel scrolling animation |
13 | 0 | TEST_F(APZCTreeManagerTester, WheelInterruptedByMouseDrag) { |
14 | 0 | // Set up a scrollable layer |
15 | 0 | CreateSimpleScrollingLayer(); |
16 | 0 | ScopedLayerTreeRegistration registration(manager, LayersId{0}, root, mcc); |
17 | 0 | manager->UpdateHitTestingTree(LayersId{0}, root, false, LayersId{0}, 0); |
18 | 0 | RefPtr<TestAsyncPanZoomController> apzc = ApzcOf(root); |
19 | 0 |
|
20 | 0 | uint64_t dragBlockId = 0; |
21 | 0 | uint64_t wheelBlockId = 0; |
22 | 0 | uint64_t tmpBlockId = 0; |
23 | 0 |
|
24 | 0 | // First start the mouse drag |
25 | 0 | MouseDown(apzc, ScreenIntPoint(5, 5), mcc->Time(), &dragBlockId); |
26 | 0 | MouseMove(apzc, ScreenIntPoint(6, 6), mcc->Time(), &tmpBlockId); |
27 | 0 | EXPECT_EQ(dragBlockId, tmpBlockId); |
28 | 0 |
|
29 | 0 | // Insert the wheel event, check that it has a new block id |
30 | 0 | SmoothWheel(apzc, ScreenIntPoint(6, 6), ScreenPoint(0, 1), mcc->Time(), &wheelBlockId); |
31 | 0 | EXPECT_NE(dragBlockId, wheelBlockId); |
32 | 0 |
|
33 | 0 | // Continue the drag, check that the block id is the same as before |
34 | 0 | MouseMove(apzc, ScreenIntPoint(7, 5), mcc->Time(), &tmpBlockId); |
35 | 0 | EXPECT_EQ(dragBlockId, tmpBlockId); |
36 | 0 |
|
37 | 0 | // Finish the wheel animation |
38 | 0 | apzc->AdvanceAnimationsUntilEnd(); |
39 | 0 |
|
40 | 0 | // Check that it scrolled |
41 | 0 | ParentLayerPoint scroll = apzc->GetCurrentAsyncScrollOffset(AsyncPanZoomController::eForHitTesting); |
42 | 0 | EXPECT_EQ(scroll.x, 0); |
43 | 0 | EXPECT_EQ(scroll.y, 10); // We scrolled 1 "line" or 10 pixels |
44 | 0 | } |