OLD | NEW |
(Empty) | |
| 1 function verifyTextPoints(shape, numLines, tolerance, side) { |
| 2 var failed = false; |
| 3 if (tolerance === undefined) |
| 4 tolerance = 0.5; |
| 5 if (side === undefined) |
| 6 side = "left"; |
| 7 |
| 8 if (side === "right") |
| 9 shape.roundedRect.x = shape.containerWidth - (shape.roundedRect.x + shap
e.roundedRect.width); |
| 10 |
| 11 var expected = getRoundedRectLeftEdge(shape); |
| 12 |
| 13 for(var i = 0; i < numLines; i++) { |
| 14 var line = document.getElementById('test'+i); |
| 15 var actual = line.getBoundingClientRect().left; |
| 16 if (side === "right") |
| 17 actual = shape.containerWidth - (actual + line.getBoundingClientRect
().width); |
| 18 |
| 19 if( Math.abs( (actual - expected[i])) > tolerance ){ |
| 20 line.style.setProperty('color', 'red'); |
| 21 console.log('diff: ' + Math.abs(actual - expected[i])); |
| 22 failed = true; |
| 23 } |
| 24 } |
| 25 if (window.done) { |
| 26 assert_false(failed, "Lines positioned properly around the shape."); |
| 27 done(); |
| 28 } |
| 29 } |
OLD | NEW |