function simulateEvent(type, x, y, modifiers, button) {
    modifiers = modifiers || {};
    const viewport = map.getViewport();
    // calculated in case body has top < 0 (test runner with small window)
    const position = viewport.getBoundingClientRect();
    const pointerEvent = new PointerEvent(type, {
      clientX: position.left + x + width / 2,
      clientY: position.top + y + height / 2,
      shiftKey: modifiers.shift || false,
      altKey: modifiers.alt || false,
      button: button,
      pointerId: 1,
      isPrimary: true,
    });
    Object.defineProperty(pointerEvent, 'target', {
      writable: false,
      value: viewport.firstChild,
    });
    const event = new MapBrowserEvent(type, map, pointerEvent);
    map.handleMapBrowserEvent(event);
  }
Simulates a browser event on the map viewport.  The client x/y location
will be adjusted as if the map were centered at 0,0.
@param {string} type Event type.
@param {number} x Horizontal offset from map center.
@param {number} y Vertical offset from map center.
@param {Object} modifiers Lookup of modifier keys.
@param {number} button The mouse button.