|
28 | 28 | fileURI.QueryInterface(Ci.nsIFileURL); |
29 | 29 | var self = fileURI.file; |
30 | 30 |
|
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); |
36 | 41 | } |
37 | 42 |
|
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. |
40 | 45 | var src = self.parent; |
41 | 46 | src.append("bug415761.ico"); |
42 | | -src.copyTo(null, dest.leafName); |
| 47 | +src.copyTo(null, testDest.leafName); |
| 48 | +src.copyTo(null, refDest.leafName); |
43 | 49 |
|
44 | 50 | // Now load both icons in an Image() with a moz-icon URI |
45 | 51 | var testImage = new Image(); |
|
74 | 80 | testCanvas.getContext('2d').drawImage(testImage, 0, 0, 32, 32); |
75 | 81 |
|
76 | 82 | // 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"); |
78 | 84 | SimpleTest.finish(); |
79 | 85 | }; |
80 | 86 |
|
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; |
83 | 89 | testImage.src = "moz-icon:" + testURI; |
84 | 90 | refImage.src = "moz-icon:" + refURI; |
85 | 91 |
|
86 | 92 | 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); |
90 | 99 | } |
91 | 100 | }); |
92 | 101 |
|
|
0 commit comments