function snapshotWindow(win, withCaret) { return SpecialPowers.snapshotWindow(win, withCaret);
}
function snapshotRect(win, rect) { return SpecialPowers.snapshotRect(win, rect);
}
// If the two snapshots don't compare as expected (true for equal, false for // unequal), returns their serializations as data URIs. In all cases, returns // whether the comparison was as expected. function compareSnapshots(s1, s2, expectEqual, fuzz) { if (s1.width != s2.width || s1.height != s2.height) {
ok( false, "Snapshot canvases are not the same size: " +
s1.width + "x" +
s1.height + " vs. " +
s2.width + "x" +
s2.height
); return [false];
} var passed = false; var numDifferentPixels; var maxDifference = { value: undefined }; if (gWindowUtils) { var equal; try {
numDifferentPixels = gWindowUtils.compareCanvases(s1, s2, maxDifference); if (!fuzz) {
equal = numDifferentPixels == 0;
} else {
equal =
numDifferentPixels <= fuzz.numDifferentPixels &&
maxDifference.value <= fuzz.maxDifference;
}
passed = equal == expectEqual;
} catch (e) {
ok(false, "Exception thrown from compareCanvases: " + e);
}
}
var s1DataURI, s2DataURI; if (!passed) {
s1DataURI = s1.toDataURL();
s2DataURI = s2.toDataURL();
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.