Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/modules/tests/browser/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  browser_LayoutUtils.js   Sprache: JAVA

 
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */


add_task(async function test_rectToBrowserRect() {
  const tab = await BrowserTestUtils.openNewForegroundTab(
    gBrowser,
    "data:text/html;charset=utf-8,test"
  );

  SpecialPowers.addTaskImport(
    "LayoutUtils",
    "resource://gre/modules/LayoutUtils.sys.mjs"
  );

  // Convert (12, 34) in a content document coordinates into this browser window
  // coordinates.
  const positionInBrowser = await SpecialPowers.spawn(
    tab.linkedBrowser,
    [],
    () => {
      /* global LayoutUtils */
      return LayoutUtils.rectToTopLevelWidgetRect(content.window, {
        left: 12,
        top: 34,
        width: 0,
        height: 0,
      });
    }
  );

  // Dispatch a mousedown event on the browser window coordinates position to
  // see whether it's fired on the correct position in the content document.
  const mouseDownPromise = BrowserTestUtils.waitForContentEvent(
    tab.linkedBrowser,
    "mousedown",
    false,
    event => {
      dump(`mousedown on (${event.clientX}, ${event.clientY})`);
      return event.clientX == 12 && event.clientY == 34;
    }
  );

  // A workaround for bug 1743857.
  await SpecialPowers.spawn(tab.linkedBrowser, [], async () => {
    await Promise.resolve();
  });

  EventUtils.synthesizeMouseAtPoint(
    positionInBrowser.x / window.devicePixelRatio,
    positionInBrowser.y / window.devicePixelRatio,
    { type: "mousedown", button: 1 }
  );
  await mouseDownPromise;

  Assert.ok(true"LayoutUtils.rectToBrowserRect() works as expected");

  BrowserTestUtils.removeTab(tab);
});

Messung V0.5
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.27 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.