Commit f7d98d65 authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1395512 - Make dom/svg/test/test_text_2.html produce useful and...

Bug 1395512 - Make dom/svg/test/test_text_2.html produce useful and non-inverted error messages. r=jfkthame

MozReview-Commit-ID: KJHRBmbbuBq
parent 7a7e0c5a
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -14,9 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=655877
<p id="display"></p>
<div id="content">
  <svg width="400" height="200">
    <text x="100" y="100" style="font: 16px sans-serif">
      abc אבג 123 דהו defg
    </text>
    <text x="100" y="100" style="font: 16px sans-serif">abc אבג 123 דהו defg</text>
  </svg>
</div>

@@ -25,7 +23,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=655877
SimpleTest.waitForExplicitFinish();

function close(x, y, message) {
  ok(Math.abs(x - y) < 1e-4, message);
  if (Math.abs(x - y) < 1e-4) {
    ok(true, message);
  } else {
    // Use is() so that the difference is actually printed in the error message
    is(x, y, message);
  }
}

function runTest() {
@@ -43,12 +46,12 @@ function runTest() {
  for (var i = 0; i < 20; i++) {
    sum += text.getSubStringLength(i, 1);
  }
  close(total, sum, "sum getSubStringLength 1");
  close(sum, total, "sum getSubStringLength 1");

  // split the text up into three chunks and add them together
  close(total, text.getSubStringLength(0, 6) +
  close(text.getSubStringLength(0, 6) +
        text.getSubStringLength(6, 8) +
               text.getSubStringLength(14, 6), "sum getSubStringLength 2");
        text.getSubStringLength(14, 6), total, "sum getSubStringLength 2");

  SimpleTest.finish();
}