michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if blackboxing a program works properly in tandem with blended michael@0: * overlapping geometry. michael@0: */ michael@0: michael@0: function ifWebGLSupported() { michael@0: let [target, debuggee, panel] = yield initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL); michael@0: let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; michael@0: michael@0: reload(target); michael@0: let [[firstProgramActor, secondProgramActor]] = yield promise.all([ michael@0: getPrograms(gFront, 2), michael@0: once(panel.panelWin, EVENTS.SOURCES_SHOWN) michael@0: ]); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); michael@0: ok(true, "The canvas was correctly drawn."); michael@0: michael@0: getBlackBoxCheckbox(panel, 0).click(); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 127 }, true); michael@0: ok(true, "The first program was correctly blackboxed."); michael@0: michael@0: getBlackBoxCheckbox(panel, 0).click(); michael@0: getBlackBoxCheckbox(panel, 1).click(); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 127, g: 127, b: 127, a: 255 }, true); michael@0: ok(true, "The second program was correctly blackboxed."); michael@0: michael@0: getBlackBoxCheckbox(panel, 1).click(); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); michael@0: ok(true, "The two programs were correctly unblackboxed."); michael@0: michael@0: getBlackBoxCheckbox(panel, 0).click(); michael@0: getBlackBoxCheckbox(panel, 1).click(); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 0, g: 0, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 0, a: 255 }, true); michael@0: ok(true, "The two programs were correctly blackboxed again."); michael@0: michael@0: getBlackBoxCheckbox(panel, 0).click(); michael@0: getBlackBoxCheckbox(panel, 1).click(); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); michael@0: ok(true, "The two programs were correctly unblackboxed again."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: } michael@0: michael@0: function getBlackBoxCheckbox(aPanel, aIndex) { michael@0: return aPanel.panelWin.document.querySelectorAll( michael@0: ".side-menu-widget-item-checkbox")[aIndex]; michael@0: }