Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f1e7c22

Browse files
committed
Bug 1577155. Make image/test/mochitest/test_bug415761.html copy both the test and reference icon so the OS doesn't include an extra badge indicating it is a sym link. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D44082 --HG-- extra : moz-landing-system : lando
1 parent 5642dec commit f1e7c22

1 file changed

Lines changed: 23 additions & 14 deletions

File tree

image/test/mochitest/test_bug415761.html

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,24 @@
2828
fileURI.QueryInterface(Ci.nsIFileURL);
2929
var self = fileURI.file;
3030

31-
// Check if the non-ascii-named icon is still hanging around from a previous test
32-
var dest = self.parent;
33-
dest.append("\u263a.ico");
34-
if (dest.exists()) {
35-
dest.remove(false);
31+
// Check if the ref or test icon are still hanging around from a previous test
32+
var testDest = self.parent;
33+
var refDest = self.parent;
34+
testDest.append("\u263a.ico");
35+
refDest.append("bug415761-ref.ico");
36+
if (testDest.exists()) {
37+
testDest.remove(false);
38+
}
39+
if (refDest.exists()) {
40+
refDest.remove(false);
3641
}
3742

38-
// Copy the source icon so that we have an identical icon with non-ascii characters
39-
// in its name
43+
// Copy the source icon so that we have two identical icons with, one with
44+
// non-ascii characters in its name.
4045
var src = self.parent;
4146
src.append("bug415761.ico");
42-
src.copyTo(null, dest.leafName);
47+
src.copyTo(null, testDest.leafName);
48+
src.copyTo(null, refDest.leafName);
4349

4450
// Now load both icons in an Image() with a moz-icon URI
4551
var testImage = new Image();
@@ -74,19 +80,22 @@
7480
testCanvas.getContext('2d').drawImage(testImage, 0, 0, 32, 32);
7581

7682
// Assert that they should be the same.
77-
assertSnapshots(refCanvas, testCanvas, true, 0, "icon", "reference icon");
83+
assertSnapshots(testCanvas, refCanvas, true, 0, "icon", "reference icon");
7884
SimpleTest.finish();
7985
};
8086

81-
var testURI = io.newFileURI(dest).spec;
82-
var refURI = io.newFileURI(src).spec;
87+
var testURI = io.newFileURI(testDest).spec;
88+
var refURI = io.newFileURI(refDest).spec;
8389
testImage.src = "moz-icon:" + testURI;
8490
refImage.src = "moz-icon:" + refURI;
8591

8692
SimpleTest.registerCleanupFunction(function() {
87-
// Remove the copied file if it exists.
88-
if (dest.exists()) {
89-
dest.remove(false);
93+
// Remove the copied files if they exist.
94+
if (testDest.exists()) {
95+
testDest.remove(false);
96+
}
97+
if (refDest.exists()) {
98+
refDest.remove(false);
9099
}
91100
});
92101

0 commit comments

Comments
 (0)