browser_webgl-actor-test-18.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests the `getPixel` actor method works across threads.
  5. */
  6. function* ifWebGLSupported() {
  7. let { target, front } = yield initBackend(MULTIPLE_CONTEXTS_URL);
  8. front.setup({ reload: true });
  9. yield getPrograms(front, 2);
  10. // Wait a frame to ensure rendering
  11. yield front.waitForFrame();
  12. let pixel = yield front.getPixel({ selector: "#canvas1", position: { x: 0, y: 0 }});
  13. is(pixel.r, 255, "correct `r` value for first canvas.");
  14. is(pixel.g, 255, "correct `g` value for first canvas.");
  15. is(pixel.b, 0, "correct `b` value for first canvas.");
  16. is(pixel.a, 255, "correct `a` value for first canvas.");
  17. pixel = yield front.getPixel({ selector: "#canvas2", position: { x: 0, y: 0 }});
  18. is(pixel.r, 0, "correct `r` value for second canvas.");
  19. is(pixel.g, 255, "correct `g` value for second canvas.");
  20. is(pixel.b, 255, "correct `b` value for second canvas.");
  21. is(pixel.a, 255, "correct `a` value for second canvas.");
  22. yield removeTab(target.tab);
  23. finish();
  24. }