OLD | NEW |
1 // The buffer to store the results. We output the results after all | 1 // The buffer to store the results. We output the results after all |
2 // tests finish. Note that we cannot have a DOM element where the | 2 // tests finish. Note that we cannot have a DOM element where the |
3 // results are stored in HTMLs because the DOM element to store | 3 // results are stored in HTMLs because the DOM element to store |
4 // results may change the number of pages. | 4 // results may change the number of pages. |
5 var _results = ''; | 5 var _results = ''; |
6 var _errored = false; | 6 var _errored = false; |
7 | 7 |
8 function appendResult(result) | 8 function appendResult(result) |
9 { | 9 { |
10 _results += '<br>' + result; | 10 _results += '<br>' + result; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 var resultElement = document.createElement('p'); | 57 var resultElement = document.createElement('p'); |
58 resultElement.innerHTML = _results; | 58 resultElement.innerHTML = _results; |
59 var output = document.getElementById("console") || document.body; | 59 var output = document.getElementById("console") || document.body; |
60 output.appendChild(resultElement); | 60 output.appendChild(resultElement); |
61 } | 61 } |
62 | 62 |
63 function ratioToPageHeightToPixels(heightInRatioToPageHeight) | 63 function ratioToPageHeightToPixels(heightInRatioToPageHeight) |
64 { | 64 { |
65 var pageHeightInPixels = 600 * 1.333; | 65 var pageHeightInPixels = 600 * 1.25; |
66 return Math.floor(pageHeightInPixels * heightInRatioToPageHeight); | 66 return Math.floor(pageHeightInPixels * heightInRatioToPageHeight); |
67 } | 67 } |
68 | 68 |
69 function createBlockWithRatioToPageHeight(id, heightInRatioToPageHeight) | 69 function createBlockWithRatioToPageHeight(id, heightInRatioToPageHeight) |
70 { | 70 { |
71 var element = document.createElement("div"); | 71 var element = document.createElement("div"); |
72 element.id = id; | 72 element.id = id; |
73 element.style.height = ratioToPageHeightToPixels(heightInRatioToPageHeight)
+ "px"; | 73 element.style.height = ratioToPageHeightToPixels(heightInRatioToPageHeight)
+ "px"; |
74 document.getElementById("sandbox").appendChild(element); | 74 document.getElementById("sandbox").appendChild(element); |
75 return element; | 75 return element; |
76 } | 76 } |
77 | 77 |
78 function createBlockWithNumberOfLines(id, childLines) | 78 function createBlockWithNumberOfLines(id, childLines) |
79 { | 79 { |
80 var element = document.createElement("div"); | 80 var element = document.createElement("div"); |
81 element.id = id; | 81 element.id = id; |
82 for (var i = 0; i < childLines; ++i) { | 82 for (var i = 0; i < childLines; ++i) { |
83 element.appendChild(document.createTextNode("line" + i)); | 83 element.appendChild(document.createTextNode("line" + i)); |
84 element.appendChild(document.createElement("br")); | 84 element.appendChild(document.createElement("br")); |
85 } | 85 } |
86 // Make sure that one page has about 20 lines. | 86 // Make sure that one page has about 20 lines. |
87 element.style.lineHeight = ratioToPageHeightToPixels(0.05) + "px"; | 87 element.style.lineHeight = ratioToPageHeightToPixels(0.05) + "px"; |
88 document.getElementById("sandbox").appendChild(element); | 88 document.getElementById("sandbox").appendChild(element); |
89 return element; | 89 return element; |
90 } | 90 } |
OLD | NEW |