| OLD | NEW |
| 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results | 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results |
| 2 if (self.testRunner) { | 2 if (self.testRunner) { |
| 3 if (self.enablePixelTesting) | 3 if (self.enablePixelTesting) |
| 4 testRunner.dumpAsTextWithPixelResults(); | 4 testRunner.dumpAsTextWithPixelResults(); |
| 5 else | 5 else |
| 6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 var description, debug, successfullyParsed; | 9 var description, debug, successfullyParsed; |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return true; | 151 return true; |
| 152 } | 152 } |
| 153 | 153 |
| 154 function isMinusZero(n) | 154 function isMinusZero(n) |
| 155 { | 155 { |
| 156 // the only way to tell 0 from -0 in JS is the fact that 1/-0 is | 156 // the only way to tell 0 from -0 in JS is the fact that 1/-0 is |
| 157 // -Infinity instead of Infinity | 157 // -Infinity instead of Infinity |
| 158 return n === 0 && 1/n < 0; | 158 return n === 0 && 1/n < 0; |
| 159 } | 159 } |
| 160 | 160 |
| 161 function isNewSVGTearOffType(v) |
| 162 { |
| 163 return ['[object SVGLength]', '[object SVGLengthList]'].indexOf(""+v) != -1; |
| 164 } |
| 165 |
| 161 function isResultCorrect(actual, expected) | 166 function isResultCorrect(actual, expected) |
| 162 { | 167 { |
| 163 if (expected === 0) | 168 if (expected === 0) |
| 164 return actual === expected && (1/actual) === (1/expected); | 169 return actual === expected && (1/actual) === (1/expected); |
| 165 if (actual === expected) | 170 if (actual === expected) |
| 166 return true; | 171 return true; |
| 172 // http://crbug.com/308818 : The new implementation of SVGListProperties do
not necessary return the same wrapper object, so === operator would not work. We
compare for their string representation instead. |
| 173 if (isNewSVGTearOffType(expected) && typeof(expected) == typeof(actual) && a
ctual.valueAsString == expected.valueAsString) |
| 174 return true; |
| 167 if (typeof(expected) == "number" && isNaN(expected)) | 175 if (typeof(expected) == "number" && isNaN(expected)) |
| 168 return typeof(actual) == "number" && isNaN(actual); | 176 return typeof(actual) == "number" && isNaN(actual); |
| 169 if (expected && (Object.prototype.toString.call(expected) == Object.prototyp
e.toString.call([]))) | 177 if (expected && (Object.prototype.toString.call(expected) == Object.prototyp
e.toString.call([]))) |
| 170 return areArraysEqual(actual, expected); | 178 return areArraysEqual(actual, expected); |
| 171 return false; | 179 return false; |
| 172 } | 180 } |
| 173 | 181 |
| 174 function stringify(v) | 182 function stringify(v) |
| 175 { | 183 { |
| 184 if (isNewSVGTearOffType(v)) |
| 185 return v.valueAsString; |
| 176 if (v === 0 && 1/v < 0) | 186 if (v === 0 && 1/v < 0) |
| 177 return "-0"; | 187 return "-0"; |
| 178 else return "" + v; | 188 else return "" + v; |
| 179 } | 189 } |
| 180 | 190 |
| 181 function evalAndLog(_a, _quiet) | 191 function evalAndLog(_a, _quiet) |
| 182 { | 192 { |
| 183 if (typeof _a != "string") | 193 if (typeof _a != "string") |
| 184 debug("WARN: tryAndLog() expects a string argument"); | 194 debug("WARN: tryAndLog() expects a string argument"); |
| 185 | 195 |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 testPassed = function(msg) { | 765 testPassed = function(msg) { |
| 756 workerPort.postMessage('PASS:' + msg); | 766 workerPort.postMessage('PASS:' + msg); |
| 757 }; | 767 }; |
| 758 finishJSTest = function() { | 768 finishJSTest = function() { |
| 759 workerPort.postMessage('DONE:'); | 769 workerPort.postMessage('DONE:'); |
| 760 }; | 770 }; |
| 761 debug = function(msg) { | 771 debug = function(msg) { |
| 762 workerPort.postMessage(msg); | 772 workerPort.postMessage(msg); |
| 763 }; | 773 }; |
| 764 } | 774 } |
| OLD | NEW |