Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  test_getSubStringLength.xhtml   Sprache: unbekannt

 
Untersuchungsergebnis.xhtml Download desUnknown {[0] [0] [0]}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=420243
-->
<head>
  <title>Test for Bug 420243</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=420243">Mozilla Bug 420243</a>
<p id="display"></p>
<div id="content" style="display: none"></div>

<iframe id="svg" src="getSubStringLength-helper.svg"></iframe>

<pre id="test">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();

function runTests(text, charWidth) {
  function chars(n) { return charWidth * n; }

  function expectThrow(charnum, nchars) {
    try {
      text.getSubStringLength(charnum, nchars);
      ok(false,
         "text.getSubStringLength(" + charnum + "," + nchars + ") " +
         "should have thrown");
    } catch (e) {
      is(e.name, "IndexSizeError",
         "expected an index error for " +
         "text.getSubStringLength(" + charnum + "," + nchars + ")");
      is(e.code, DOMException.INDEX_SIZE_ERR,
         "expected an index error for " +
         "text.getSubStringLength(" + charnum + "," + nchars + ")");
    }
  }

  function expectValue(charnum, nchars, expected) {
    try {
      isfuzzy(text.getSubStringLength(charnum, nchars), expected, 0.01,
         "text.getSubStringLength(" + charnum + "," + nchars + ") " +
         "returned wrong value");
    } catch (e) {
      ok(false,
         "unexpected exception for " +
         "text.getSubStringLength(" + charnum + "," + nchars + ")");
    }
  }

  expectThrow(1002);
  expectThrow(1000);
  expectThrow(30);
  expectThrow(31);

  expectValue(13, chars(2));
  expectValue(04, chars(3));
  expectValue(00, chars(0));
  expectValue(10, chars(0));
  expectValue(20, chars(0));
  expectValue(01, chars(1));
  expectValue(11, chars(1));
  expectValue(21, chars(1));
  expectValue(02, chars(2));
  expectValue(12, chars(2));
  expectValue(03, chars(3));
  expectValue(1100, chars(2));
  expectValue(2100, chars(1));
}


function run() {
  try {
    var document = $("svg").contentWindow.document;
    var text = document.getElementById("text");

    runTests(text, text.getSubStringLength(01));
  } catch (e) {
    ok(false, "threw error: " + e);
  }

  SimpleTest.finish();
}

window.addEventListener("load", run);
</script>
</pre>
</body>
</html>

[Dauer der Verarbeitung: 0.28 Sekunden, vorverarbeitet 2026-08-25]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002