browser/devtools/shadereditor/test/browser_se_programs-blackbox-02.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests if blackboxing a program works properly in tandem with blended
     6  * overlapping geometry.
     7  */
     9 function ifWebGLSupported() {
    10   let [target, debuggee, panel] = yield initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL);
    11   let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin;
    13   reload(target);
    14   let [[firstProgramActor, secondProgramActor]] = yield promise.all([
    15     getPrograms(gFront, 2),
    16     once(panel.panelWin, EVENTS.SOURCES_SHOWN)
    17   ]);
    19   yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
    20   yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
    21   ok(true, "The canvas was correctly drawn.");
    23   getBlackBoxCheckbox(panel, 0).click();
    25   yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
    26   yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true);
    27   ok(true, "The first program was correctly blackboxed.");
    29   getBlackBoxCheckbox(panel, 0).click();
    30   getBlackBoxCheckbox(panel, 1).click();
    32   yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
    33   yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true);
    34   ok(true, "The second program was correctly blackboxed.");
    36   getBlackBoxCheckbox(panel, 1).click();
    38   yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
    39   yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
    40   ok(true, "The two programs were correctly unblackboxed.");
    42   getBlackBoxCheckbox(panel, 0).click();
    43   getBlackBoxCheckbox(panel, 1).click();
    45   yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true);
    46   yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true);
    47   ok(true, "The two programs were correctly blackboxed again.");
    49   getBlackBoxCheckbox(panel, 0).click();
    50   getBlackBoxCheckbox(panel, 1).click();
    52   yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true);
    53   yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true);
    54   ok(true, "The two programs were correctly unblackboxed again.");
    56   yield teardown(panel);
    57   finish();
    58 }
    60 function getBlackBoxCheckbox(aPanel, aIndex) {
    61   return aPanel.panelWin.document.querySelectorAll(
    62     ".side-menu-widget-item-checkbox")[aIndex];
    63 }

mercurial