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

Quelle  browser_pdfjs_form.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 = "http://example.com/browser/" + RELATIVE_DIR;

async function checkFormState(formsEnabled) {
  ok(
    content.document.querySelector("div#viewer"),
    "document content has viewer UI"
  );

  let formInput = content.document.querySelector("#viewerContainer input");

  if (formsEnabled) {
    ok(formInput, "Form input available");
  } else {
    ok(!formInput, "Form input not available");
  }
}

add_task(async function test_defaults() {
  // Ensure the default preference is set to the expected value.
  let defaultBranch = Services.prefs.getDefaultBranch("pdfjs.");
  let prefType = defaultBranch.getPrefType("annotationMode");
  let renderForms = Services.prefs.getIntPref("pdfjs.annotationMode") === 2;

  is(
    prefType,
    Ci.nsIPrefBranch.PREF_INT,
    "The form pref is defined by default"
  );

  ok(renderForms, "Forms are enabled");

  // Test that the forms state matches the pref.
  await BrowserTestUtils.withNewTab(
    { gBrowser, url: "about:blank" },
    async function (browser) {
      await waitForPdfJSAnnotationLayer(
        browser,
        TESTROOT + "file_pdfjs_form.pdf"
      );

      await SpecialPowers.spawn(browser, [true], checkFormState);
      await waitForPdfJSClose(browser);
    }
  );
});

// Test disabling forms with pref.
add_task(async function test_disabling() {
  await BrowserTestUtils.withNewTab(
    { gBrowser, url: "about:blank" },
    async function (browser) {
      // First, make sure they are enabled.
      await SpecialPowers.pushPrefEnv({
        set: [["pdfjs.annotationMode", 2]],
      });
      await waitForPdfJSAnnotationLayer(
        browser,
        TESTROOT + "file_pdfjs_form.pdf"
      );
      await SpecialPowers.spawn(
        browser,
        [true /* formsEnabled */],
        checkFormState
      );
      // Now disable the forms.
      await SpecialPowers.pushPrefEnv({
        set: [["pdfjs.annotationMode", 1]],
      });
      await waitForPdfJSAnnotationLayer(
        browser,
        TESTROOT + "file_pdfjs_form.pdf"
      );
      await SpecialPowers.spawn(
        browser,
        [false /* formsEnabled */],
        checkFormState
      );
      await waitForPdfJSClose(browser);
      await SpecialPowers.popPrefEnv();
    }
  );
});

Messung V0.5
C=93 H=100 G=96

¤ Dauer der Verarbeitung: 0.0 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.