Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  browser_text_leaf.js

  Sprache: JAVA
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


"use strict";

/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });

/**
 * Test accessibles aren't created for linebreaks.
 */

addAccessibleTask(
  `hello<br>world`,
  async (browser, accDoc) => {
    let doc = accDoc.nativeInterface.QueryInterface(
      Ci.nsIAccessibleMacInterface
    );
    let children = doc.getAttributeValue("AXChildren");
    is(children.length, 2"The document contains 2 children");

    // verify first child is correct
    is(
      children[0].getAttributeValue("AXRole"),
      "AXStaticText",
      "First child is a text node"
    );
    is(
      children[0].getAttributeValue("AXValue"),
      "hello",
      "First child is hello text"
    );

    // verify second child is correct
    is(
      children[1].getAttributeValue("AXRole"),
      "AXStaticText",
      "Second child is a text node"
    );

    is(
      children[1].getAttributeValue("AXValue"),
      gIsIframe && !gIsRemoteIframe ? "world" : "world ",
      "Second child is world text"
    );
    // we have a trailing space in here due to bug 1577028
    // but this appears fixed in non-remote iframes
  },
  { chrome: true, iframe: true, remoteIframe: true }
);

addAccessibleTask(
  `<p id="p">hello, this is a test</p>`,
  async (browser, accDoc) => {
    let p = getNativeInterface(accDoc, "p");
    let textLeaf = p.getAttributeValue("AXChildren")[0];
    ok(textLeaf, "paragraph has a text leaf");

    let str = textLeaf.getParameterizedAttributeValue(
      "AXStringForRange",
      NSRange(36)
    );

    is(str, "lo, th""AXStringForRange matches.");

    let smallBounds = textLeaf.getParameterizedAttributeValue(
      "AXBoundsForRange",
      NSRange(36)
    );

    let largeBounds = textLeaf.getParameterizedAttributeValue(
      "AXBoundsForRange",
      NSRange(38)
    );

    Assert.less(
      smallBounds.size[0],
      largeBounds.size[0],
      "longer range is wider"
    );
  },
  { chrome: true, iframe: true, remoteIframe: true }
);

// Text leaf inherits container's AXLanguage, and container's default AXLanguage is the doc one.
addAccessibleTask(
  `<p id="ar">العربية</p>
   <p id="es" lang="es">Español</p>`,
  async (browser, accDoc) => {
    const es = getNativeInterface(accDoc, "es");
    const ar = getNativeInterface(accDoc, "ar");
    const firstChild = a => a.getAttributeValue("AXChildren")[0];

    is(es.getAttributeValue("AXLanguage"), "es");
    is(firstChild(es).getAttributeValue("AXLanguage"), "es");

    is(ar.getAttributeValue("AXLanguage"), "ar");
    is(firstChild(ar).getAttributeValue("AXLanguage"), "ar");
  },
  { chrome: true, contentDocBodyAttrs: { lang: "ar" } }
);

Messung V0.5 in Prozent
C=94 H=94 G=93

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik