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 that the blackbox/unblackbox operations work as expected with michael@0: * overlapping geometry. michael@0: */ michael@0: michael@0: function ifWebGLSupported() { michael@0: let [target, debuggee, front] = yield initBackend(OVERLAPPING_GEOMETRY_CANVAS_URL); michael@0: front.setup({ reload: true }); michael@0: michael@0: let [firstProgramActor, secondProgramActor] = yield getPrograms(front, 2); michael@0: michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: ok(true, "The corner vs. center pixel colors are correct before blackboxing."); michael@0: michael@0: yield firstProgramActor.blackbox(); 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: 255, b: 255, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 0, a: 255 }, true); michael@0: ok(true, "The corner vs. center pixel colors are correct after blackboxing (1)."); michael@0: michael@0: yield firstProgramActor.unblackbox(); michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: ok(true, "The corner vs. center pixel colors are correct after unblackboxing (1)."); michael@0: michael@0: yield secondProgramActor.blackbox(); michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: ok(true, "The corner vs. center pixel colors are correct after blackboxing (2)."); michael@0: michael@0: yield secondProgramActor.unblackbox(); michael@0: yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 255, b: 255, a: 255 }, true); michael@0: yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true); michael@0: ok(true, "The corner vs. center pixel colors are correct after unblackboxing (2)."); michael@0: michael@0: yield removeTab(target.tab); michael@0: finish(); michael@0: }