Closed Bug 1780121 Opened 2 years ago Closed 2 years ago

Add mochitest for pinching and panning in the same gesture

Categories

(Core :: Panning and Zooming, task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1751510

People

(Reporter: rzvncj, Assigned: rzvncj)

References

Details

Attachments

(1 obsolete file)

Quoting [:botond]'s comment from differential D151689 (bug 1751510):

[...] it would be nice to add a test that exercises the "pinching and panning in the same gesture" ability. We can do this using our "mochitest" framework (we have an existing test that exercises touchpad pinch gestures; it uses the SynthesizeNativeTouchpadPinch() codepath under the hood).

Depends on: 1751510
Summary: Add pinching and panning in the same gesture test → Add mochitest for pinching and panning in the same gesture
Priority: -- → P3

Thanks for filing. Here are some notes for how to get started:

  • The APZ mochitests are organized into "test groups" (files named test_group_*.html), which contain "subtests" (files named helper_*.html). The test I linked to, helper_zoom_with_touchpad.html, is contained in test_group_zoom-2.html.
    • For this bug, we can add a new subtest to test_group_zoom-2, called e.g. "helper_touchpad_pinch_and_pan". You can base it on "helper_zoom_with_touchpad" for the general test structure (except it's sufficient to test one scenario / gesture in the new test).
  • To synthesize a touchpad pinch gesture, helper_zoom_with_touchpad.html calls a function called pinchZoomInWithTouchpad(), which takes the coordinates of a focus point that remains constant for the duration of the gesture, and increases the span by some hard-coded amount.
  • The implementation of pinchZoomInWithTouchpad() can be found here. It uses another helper synthesizeTouchpadPinch() which in turn calls nsIDOMWindowUtils.sendNativeTouchpadPinch(). (The implementation of that is in C++ code, and eventually calls nsWindow::SynthesizeNativeTouchPadPinch().)
  • For our test, we'll want a sequence of calls to nsIDOMWindowUtils.sendNativeTouchpadPinch() where not only the scale is changing, but also the focus point (possibly at different times in the gesture, e.g. just scale changing first, and then just focus point changing). Feel free to use your judgment, and either write direct calls to sendNativeTouchpadPinch() (probably in a loop) in our new test, or add new helper functions.
  • The test should assert that the combined gesture (pinch + pan) caused not only zooming, but also scrolling. To test for scrolling, you can check window.visualViewport.offsetLeft and window.visualViewport.offsetTop and assert that they have increased past some threshold (larger than what the zoom alone would cause).

Let me know if that's enough to get started on. I'm happy to answer questions!

Assignee: nobody → rzvncj
Attachment #9286085 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: