7599553: [rust png] Chromium: Update png to version 0.18.1.

https://chromium-review.googlesource.com/c/chromium/src/+/7599553
Chromium updated their to Rust PNG implementation which produces
different (but valid) PNG output. Update tests to compare raw bitmap
data instead of encoded PNG data URLs.
This commit is contained in:
John Kleinschmidt
2026-02-25 13:34:09 -05:00
parent ab3e39fadd
commit de2aede56b

View File

@@ -549,10 +549,13 @@ describe('nativeImage module', () => {
expect(image.isEmpty()).to.be.false();
expect(image.getSize()).to.deep.equal({ width: 1, height: 1 });
expect(image.toDataURL({ scaleFactor: 1.0 })).to.equal(imageDataOne.dataUrl);
expect(image.toDataURL({ scaleFactor: 2.0 })).to.equal(imageDataTwo.dataUrl);
expect(image.toDataURL({ scaleFactor: 3.0 })).to.equal(imageDataThree.dataUrl);
expect(image.toDataURL({ scaleFactor: 4.0 })).to.equal(imageDataThree.dataUrl);
const expectedOne = nativeImage.createFromPath(imageDataOne.path);
const expectedTwo = nativeImage.createFromPath(imageDataTwo.path);
const expectedThree = nativeImage.createFromPath(imageDataThree.path);
expect(image.toBitmap({ scaleFactor: 1.0 }).equals(expectedOne.toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 2.0 }).equals(expectedTwo.toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 3.0 }).equals(expectedThree.toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 4.0 }).equals(expectedThree.toBitmap())).to.be.true();
});
it('supports adding a data URL representation for a scale factor', () => {
@@ -584,10 +587,13 @@ describe('nativeImage module', () => {
expect(image.isEmpty()).to.be.false();
expect(image.getSize()).to.deep.equal({ width: 1, height: 1 });
expect(image.toDataURL({ scaleFactor: 1.0 })).to.equal(imageDataOne.dataUrl);
expect(image.toDataURL({ scaleFactor: 2.0 })).to.equal(imageDataTwo.dataUrl);
expect(image.toDataURL({ scaleFactor: 3.0 })).to.equal(imageDataThree.dataUrl);
expect(image.toDataURL({ scaleFactor: 4.0 })).to.equal(imageDataThree.dataUrl);
const expectedOne = nativeImage.createFromPath(imageDataOne.path);
const expectedTwo = nativeImage.createFromPath(imageDataTwo.path);
const expectedThree = nativeImage.createFromPath(imageDataThree.path);
expect(image.toBitmap({ scaleFactor: 1.0 }).equals(expectedOne.toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 2.0 }).equals(expectedTwo.toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 3.0 }).equals(expectedThree.toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 4.0 }).equals(expectedThree.toBitmap())).to.be.true();
});
it('supports adding a representation to an existing image', () => {
@@ -606,8 +612,9 @@ describe('nativeImage module', () => {
dataURL: imageDataThree.dataUrl
});
expect(image.toDataURL({ scaleFactor: 1.0 })).to.equal(imageDataOne.dataUrl);
expect(image.toDataURL({ scaleFactor: 2.0 })).to.equal(imageDataTwo.dataUrl);
const expectedTwo = nativeImage.createFromPath(imageDataTwo.path);
expect(image.toBitmap({ scaleFactor: 1.0 }).equals(nativeImage.createFromPath(imageDataOne.path).toBitmap())).to.be.true();
expect(image.toBitmap({ scaleFactor: 2.0 }).equals(expectedTwo.toBitmap())).to.be.true();
});
});
});