michael@0: /* michael@0: * Tests for imgITools michael@0: */ michael@0: michael@0: const Ci = Components.interfaces; michael@0: const Cc = Components.classes; michael@0: michael@0: michael@0: /* michael@0: * dumpToFile() michael@0: * michael@0: * For test development, dumps the specified array to a file. michael@0: * Call |dumpToFile(outData);| in a test to file to a file. michael@0: */ michael@0: function dumpToFile(aData) { michael@0: var outputFile = do_get_tempdir(); michael@0: outputFile.append("testdump.png"); michael@0: michael@0: var outputStream = Cc["@mozilla.org/network/file-output-stream;1"]. michael@0: createInstance(Ci.nsIFileOutputStream); michael@0: // WR_ONLY|CREAT|TRUNC michael@0: outputStream.init(outputFile, 0x02 | 0x08 | 0x20, 0644, null); michael@0: michael@0: var bos = Cc["@mozilla.org/binaryoutputstream;1"]. michael@0: createInstance(Ci.nsIBinaryOutputStream); michael@0: bos.setOutputStream(outputStream); michael@0: michael@0: bos.writeByteArray(aData, aData.length); michael@0: michael@0: outputStream.close(); michael@0: } michael@0: michael@0: michael@0: /* michael@0: * getFileInputStream() michael@0: * michael@0: * Returns an input stream for the specified file. michael@0: */ michael@0: function getFileInputStream(aFile) { michael@0: var inputStream = Cc["@mozilla.org/network/file-input-stream;1"]. michael@0: createInstance(Ci.nsIFileInputStream); michael@0: // init the stream as RD_ONLY, -1 == default permissions. michael@0: inputStream.init(aFile, 0x01, -1, null); michael@0: michael@0: // Blah. The image decoders use ReadSegments, which isn't implemented on michael@0: // file input streams. Use a buffered stream to make it work. michael@0: var bis = Cc["@mozilla.org/network/buffered-input-stream;1"]. michael@0: createInstance(Ci.nsIBufferedInputStream); michael@0: bis.init(inputStream, 1024); michael@0: michael@0: return bis; michael@0: } michael@0: michael@0: michael@0: /* michael@0: * streamToArray() michael@0: * michael@0: * Consumes an input stream, and returns its bytes as an array. michael@0: */ michael@0: function streamToArray(aStream) { michael@0: var size = aStream.available(); michael@0: michael@0: // use a binary input stream to grab the bytes. michael@0: var bis = Cc["@mozilla.org/binaryinputstream;1"]. michael@0: createInstance(Ci.nsIBinaryInputStream); michael@0: bis.setInputStream(aStream); michael@0: michael@0: var bytes = bis.readByteArray(size); michael@0: if (size != bytes.length) michael@0: throw "Didn't read expected number of bytes"; michael@0: michael@0: return bytes; michael@0: } michael@0: michael@0: michael@0: /* michael@0: * compareArrays michael@0: * michael@0: * Compares two arrays, and throws if there's a difference. michael@0: */ michael@0: function compareArrays(aArray1, aArray2) { michael@0: do_check_eq(aArray1.length, aArray2.length); michael@0: michael@0: for (var i = 0; i < aArray1.length; i++) michael@0: if (aArray1[i] != aArray2[i]) michael@0: throw "arrays differ at index " + i; michael@0: } michael@0: michael@0: michael@0: /* michael@0: * checkExpectedError michael@0: * michael@0: * Checks to see if a thrown error was expected or not, and if it michael@0: * matches the expected value. michael@0: */ michael@0: function checkExpectedError (aExpectedError, aActualError) { michael@0: if (aExpectedError) { michael@0: if (!aActualError) michael@0: throw "Didn't throw as expected (" + aExpectedError + ")"; michael@0: michael@0: if (!aExpectedError.test(aActualError)) michael@0: throw "Threw (" + aActualError + "), not (" + aExpectedError; michael@0: michael@0: // We got the expected error, so make a note in the test log. michael@0: dump("...that error was expected.\n\n"); michael@0: } else if (aActualError) { michael@0: throw "Threw unexpected error: " + aActualError; michael@0: } michael@0: } michael@0: michael@0: michael@0: function run_test() { michael@0: michael@0: try { michael@0: michael@0: michael@0: /* ========== 0 ========== */ michael@0: var testnum = 0; michael@0: var testdesc = "imgITools setup"; michael@0: var err = null; michael@0: michael@0: var imgTools = Cc["@mozilla.org/image/tools;1"]. michael@0: getService(Ci.imgITools); michael@0: michael@0: if (!imgTools) michael@0: throw "Couldn't get imgITools service" michael@0: michael@0: // Ugh, this is an ugly hack. The pixel values we get in Windows are sometimes michael@0: // +/- 1 value compared to other platforms, so we need to compare against a michael@0: // different set of reference images. nsIXULRuntime.OS doesn't seem to be michael@0: // available in xpcshell, so we'll use this as a kludgy way to figure out if michael@0: // we're running on Windows. michael@0: var isWindows = ("@mozilla.org/windows-registry-key;1" in Cc); michael@0: michael@0: michael@0: /* ========== 1 ========== */ michael@0: testnum++; michael@0: testdesc = "test decoding a PNG"; michael@0: michael@0: // 64x64 png, 8415 bytes. michael@0: var imgName = "image1.png"; michael@0: var inMimeType = "image/png"; michael@0: var imgFile = do_get_file(imgName); michael@0: michael@0: var istream = getFileInputStream(imgFile); michael@0: do_check_eq(istream.available(), 8415); michael@0: michael@0: // Use decodeImageData for this test even though it's deprecated to ensure that michael@0: // it correctly forwards to decodeImage and continues to work. michael@0: var outParam = { value: null }; michael@0: imgTools.decodeImageData(istream, inMimeType, outParam); michael@0: var container = outParam.value; michael@0: michael@0: // It's not easy to look at the pixel values from JS, so just michael@0: // check the container's size. michael@0: do_check_eq(container.width, 64); michael@0: do_check_eq(container.height, 64); michael@0: michael@0: michael@0: /* ========== 2 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding a scaled JPEG"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, "image/jpeg", 16, 16); michael@0: michael@0: var encodedBytes = streamToArray(istream); michael@0: // Get bytes for exected result michael@0: var refName = "image1png16x16.jpg"; michael@0: var refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1078); michael@0: var referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 3 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding an unscaled JPEG"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeImage(container, "image/jpeg"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image1png64x64.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 4503); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 4 ========== */ michael@0: testnum++; michael@0: testdesc = "test decoding a JPEG"; michael@0: michael@0: // 32x32 jpeg, 3494 bytes. michael@0: imgName = "image2.jpg"; michael@0: inMimeType = "image/jpeg"; michael@0: imgFile = do_get_file(imgName); michael@0: michael@0: istream = getFileInputStream(imgFile); michael@0: do_check_eq(istream.available(), 3494); michael@0: michael@0: container = imgTools.decodeImage(istream, inMimeType); michael@0: michael@0: // It's not easy to look at the pixel values from JS, so just michael@0: // check the container's size. michael@0: do_check_eq(container.width, 32); michael@0: do_check_eq(container.height, 32); michael@0: michael@0: michael@0: /* ========== 5 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding a scaled PNG"; michael@0: michael@0: if (!isWindows) { michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, "image/png", 16, 16); michael@0: michael@0: encodedBytes = streamToArray(istream); michael@0: // Get bytes for exected result michael@0: refName = isWindows ? "image2jpg16x16-win.png" : "image2jpg16x16.png"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 948); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: } michael@0: michael@0: michael@0: /* ========== 6 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding an unscaled PNG"; michael@0: michael@0: if (!isWindows) { michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeImage(container, "image/png"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = isWindows ? "image2jpg32x32-win.png" : "image2jpg32x32.png"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 3105); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: } michael@0: michael@0: michael@0: /* ========== 7 ========== */ michael@0: testnum++; michael@0: testdesc = "test decoding a ICO"; michael@0: michael@0: // 16x16 ico, 1406 bytes. michael@0: imgName = "image3.ico"; michael@0: inMimeType = "image/x-icon"; michael@0: imgFile = do_get_file(imgName); michael@0: michael@0: istream = getFileInputStream(imgFile); michael@0: do_check_eq(istream.available(), 1406); michael@0: michael@0: container = imgTools.decodeImage(istream, inMimeType); michael@0: michael@0: // It's not easy to look at the pixel values from JS, so just michael@0: // check the container's size. michael@0: do_check_eq(container.width, 16); michael@0: do_check_eq(container.height, 16); michael@0: michael@0: michael@0: /* ========== 8 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding a scaled PNG"; // note that we're scaling UP michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, "image/png", 32, 32); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image3ico32x32.png"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 2285); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 9 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding an unscaled PNG"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeImage(container, "image/png"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image3ico16x16.png"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 330); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 10 ========== */ michael@0: testnum++; michael@0: testdesc = "test decoding a GIF"; michael@0: michael@0: // 32x32 gif, 1809 bytes. michael@0: imgName = "image4.gif"; michael@0: inMimeType = "image/gif"; michael@0: imgFile = do_get_file(imgName); michael@0: michael@0: istream = getFileInputStream(imgFile); michael@0: do_check_eq(istream.available(), 1809); michael@0: michael@0: container = imgTools.decodeImage(istream, inMimeType); michael@0: michael@0: // It's not easy to look at the pixel values from JS, so just michael@0: // check the container's size. michael@0: do_check_eq(container.width, 32); michael@0: do_check_eq(container.height, 32); michael@0: michael@0: /* ========== 11 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding an unscaled ICO with format options " + michael@0: "(format=bmp;bpp=32)"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeImage(container, michael@0: "image/vnd.microsoft.icon", michael@0: "format=bmp;bpp=32"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image4gif32x32bmp32bpp.ico"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 4286); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: /* ========== 12 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding a scaled ICO with format options " + michael@0: "(format=bmp;bpp=32)"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, michael@0: "image/vnd.microsoft.icon", michael@0: 16, michael@0: 16, michael@0: "format=bmp;bpp=32"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image4gif16x16bmp32bpp.ico"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1150); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: /* ========== 13 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding an unscaled ICO with format options " + michael@0: "(format=bmp;bpp=24)"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeImage(container, michael@0: "image/vnd.microsoft.icon", michael@0: "format=bmp;bpp=24"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image4gif32x32bmp24bpp.ico"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 3262); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: /* ========== 14 ========== */ michael@0: testnum++; michael@0: testdesc = "test encoding a scaled ICO with format options " + michael@0: "(format=bmp;bpp=24)"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, michael@0: "image/vnd.microsoft.icon", michael@0: 16, michael@0: 16, michael@0: "format=bmp;bpp=24"); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image4gif16x16bmp24bpp.ico"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 894); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 15 ========== */ michael@0: testnum++; michael@0: testdesc = "test cropping a JPG"; michael@0: michael@0: // 32x32 jpeg, 3494 bytes. michael@0: imgName = "image2.jpg"; michael@0: inMimeType = "image/jpeg"; michael@0: imgFile = do_get_file(imgName); michael@0: michael@0: istream = getFileInputStream(imgFile); michael@0: do_check_eq(istream.available(), 3494); michael@0: michael@0: container = imgTools.decodeImage(istream, inMimeType); michael@0: michael@0: // It's not easy to look at the pixel values from JS, so just michael@0: // check the container's size. michael@0: do_check_eq(container.width, 32); michael@0: do_check_eq(container.height, 32); michael@0: michael@0: // encode a cropped image michael@0: istream = imgTools.encodeCroppedImage(container, "image/jpeg", 0, 0, 16, 16); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg16x16cropped.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 879); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 16 ========== */ michael@0: testnum++; michael@0: testdesc = "test cropping a JPG with an offset"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeCroppedImage(container, "image/jpeg", 16, 16, 16, 16); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg16x16cropped2.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 878); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 17 ========== */ michael@0: testnum++; michael@0: testdesc = "test cropping a JPG without a given height"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeCroppedImage(container, "image/jpeg", 0, 0, 16, 0); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg16x32cropped3.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1127); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 18 ========== */ michael@0: testnum++; michael@0: testdesc = "test cropping a JPG without a given width"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeCroppedImage(container, "image/jpeg", 0, 0, 0, 16); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg32x16cropped4.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1135); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 19 ========== */ michael@0: testnum++; michael@0: testdesc = "test cropping a JPG without a given width and height"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeCroppedImage(container, "image/jpeg", 0, 0, 0, 0); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg32x32.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1634); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 20 ========== */ michael@0: testnum++; michael@0: testdesc = "test scaling a JPG without a given width"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, "image/jpeg", 0, 16); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg32x16scaled.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1227); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 21 ========== */ michael@0: testnum++; michael@0: testdesc = "test scaling a JPG without a given height"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, "image/jpeg", 16, 0); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg16x32scaled.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1219); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 22 ========== */ michael@0: testnum++; michael@0: testdesc = "test scaling a JPG without a given width and height"; michael@0: michael@0: // we'll reuse the container from the previous test michael@0: istream = imgTools.encodeScaledImage(container, "image/jpeg", 0, 0); michael@0: encodedBytes = streamToArray(istream); michael@0: michael@0: // Get bytes for exected result michael@0: refName = "image2jpg32x32.jpg"; michael@0: refFile = do_get_file(refName); michael@0: istream = getFileInputStream(refFile); michael@0: do_check_eq(istream.available(), 1634); michael@0: referenceBytes = streamToArray(istream); michael@0: michael@0: // compare the encoder's output to the reference file. michael@0: compareArrays(encodedBytes, referenceBytes); michael@0: michael@0: michael@0: /* ========== 22 ========== */ michael@0: testnum++; michael@0: testdesc = "test invalid arguments for cropping"; michael@0: michael@0: var numErrors = 0; michael@0: michael@0: try { michael@0: // width/height can't be negative michael@0: imgTools.encodeScaledImage(container, "image/jpeg", -1, -1); michael@0: } catch (e) { numErrors++; } michael@0: michael@0: try { michael@0: // offsets can't be negative michael@0: imgTools.encodeCroppedImage(container, "image/jpeg", -1, -1, 16, 16); michael@0: } catch (e) { numErrors++; } michael@0: michael@0: try { michael@0: // width/height can't be negative michael@0: imgTools.encodeCroppedImage(container, "image/jpeg", 0, 0, -1, -1); michael@0: } catch (e) { numErrors++; } michael@0: michael@0: try { michael@0: // out of bounds michael@0: imgTools.encodeCroppedImage(container, "image/jpeg", 17, 17, 16, 16); michael@0: } catch (e) { numErrors++; } michael@0: michael@0: try { michael@0: // out of bounds michael@0: imgTools.encodeCroppedImage(container, "image/jpeg", 0, 0, 33, 33); michael@0: } catch (e) { numErrors++; } michael@0: michael@0: try { michael@0: // out of bounds michael@0: imgTools.encodeCroppedImage(container, "image/jpeg", 1, 1, 0, 0); michael@0: } catch (e) { numErrors++; } michael@0: michael@0: do_check_eq(numErrors, 6); michael@0: michael@0: michael@0: /* ========== bug 363986 ========== */ michael@0: testnum = 363986; michael@0: testdesc = "test PNG and JPEG encoders' Read/ReadSegments methods"; michael@0: michael@0: var testData = michael@0: [{preImage: "image3.ico", michael@0: preImageMimeType: "image/x-icon", michael@0: refImage: "image3ico16x16.png", michael@0: refImageMimeType: "image/png"}, michael@0: {preImage: "image1.png", michael@0: preImageMimeType: "image/png", michael@0: refImage: "image1png64x64.jpg", michael@0: refImageMimeType: "image/jpeg"}]; michael@0: michael@0: for(var i=0; i