Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/components/pdfjs/test/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  browser_pdfjs_jpeg2000.js

  Sprache: JAVA
 

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


const RELATIVE_DIR = "toolkit/components/pdfjs/test/";
const TESTROOT = "https://example.com/browser/" + RELATIVE_DIR;

/**
 * Get the the pixels on the drawn canvas.
 *
 * @param {object} browser
 * @returns {object}
 */

async function getPixels(browser) {
  return SpecialPowers.spawn(browser, [], async function () {
    const { document } = content;
    const canvas = document.querySelector("canvas");

    Assert.ok(!!canvas, "We must have a canvas");

    return new Uint32Array(
      canvas.getContext("2d").getImageData(00, canvas.width, canvas.height)
        .data.buffer
    );
  });
}

async function test_jpeg2000(enableWasm) {
  await SpecialPowers.pushPrefEnv({
    set: [["javascript.options.wasm", enableWasm]],
  });

  await BrowserTestUtils.withNewTab(
    { gBrowser, url: "about:blank" },
    async function (browser) {
      // check that PDF is opened with internal viewer
      await waitForPdfJSCanvas(
        browser,
        `${TESTROOT}file_pdfjs_jp2_image.pdf#zoom=100`
      );

      const data = await getPixels(browser);
      if (data.every(x => x === 0xff0000ff)) {
        Assert.ok(true"All pixels are red");
      } else {
        const i = data.findIndex(x => x !== 0xff0000ff);
        Assert.equal(
          data[i],
          0xff0000ff,
          `The pixel at index ${i} must be red`
        );
      }

      await waitForPdfJSClose(browser);
    }
  );
  await SpecialPowers.popPrefEnv();
}

add_task(async function test_wasm_enabled() {
  await test_jpeg2000(true);
});

add_task(async function test_wasm_disabled() {
  await test_jpeg2000(false);
});

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

¤ Dauer der Verarbeitung: 0.19 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.