瀏覽代碼

add comments about puppeteer/browserless PNG generation (#670)

sschmid 5 年之前
父節點
當前提交
d1bf85f63d
共有 2 個文件被更改,包括 14 次插入5 次删除
  1. 11 5
      test/Util/generateDiffImagesPuppeteerLocalhost.js
  2. 3 0
      test/Util/generateImages_browserless.js

+ 11 - 5
test/Util/generateDiffImagesPuppeteerLocalhost.js

@@ -1,14 +1,20 @@
 /*
 /*
-  Render each OSMD sample, grab the generated images, and
+  Render each OSMD sample in a headless browser
+  (using puppeteer, requires ~100MB chromium download),
+  grab the generated images, and
   dump them into a local directory as PNG files.
   dump them into a local directory as PNG files.
 
 
+  You may have to install puppeteer as dev dependency to run this:
+  npm i puppeteer --save-dev
+  (will download ~100MB for Chromium)
+
+  This script is made obsolete by the ~2x faster generateImages_browserless.js,
+  but may be useful for comparison.
+
   inspired by Vexflow's generate_png_images and vexflow-tests.js
   inspired by Vexflow's generate_png_images and vexflow-tests.js
 
 
   This is meant to be used with the visual regression test system in
   This is meant to be used with the visual regression test system in
-  `tools/visual_regression.sh`. (TODO)
-
-  You may have to install puppeteer as dev dependency to run this:
-  npm i puppeteer --save-dev
+  `tools/visual_regression.sh`.
 */
 */
 
 
 function sleep (ms) {
 function sleep (ms) {

+ 3 - 0
test/Util/generateImages_browserless.js

@@ -11,6 +11,9 @@
   Note: this script needs to "fake" quite a few browser elements, like window, document, and a Canvas HTMLElement.
   Note: this script needs to "fake" quite a few browser elements, like window, document, and a Canvas HTMLElement.
   For that it needs the canvas package installed.
   For that it needs the canvas package installed.
   There are also some hacks needed to set the container size (offsetWidth) correctly.
   There are also some hacks needed to set the container size (offsetWidth) correctly.
+
+  Otherwise you'd need to run a headless browser, which is way slower,
+  see the semi-obsolete generateDiffImagesPuppeteerLocalhost.js
 */
 */
 
 
 function sleep (ms) {
 function sleep (ms) {