Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Tests if highlighting a program works properly in tandem with blended |
michael@0 | 6 | * overlapping geometry. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | function ifWebGLSupported() { |
michael@0 | 10 | let [target, debuggee, panel] = yield initShaderEditor(BLENDED_GEOMETRY_CANVAS_URL); |
michael@0 | 11 | let { gFront, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; |
michael@0 | 12 | |
michael@0 | 13 | reload(target); |
michael@0 | 14 | let [[firstProgramActor, secondProgramActor]] = yield promise.all([ |
michael@0 | 15 | getPrograms(gFront, 2), |
michael@0 | 16 | once(panel.panelWin, EVENTS.SOURCES_SHOWN) |
michael@0 | 17 | ]); |
michael@0 | 18 | |
michael@0 | 19 | yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); |
michael@0 | 20 | yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); |
michael@0 | 21 | ok(true, "The canvas was correctly drawn."); |
michael@0 | 22 | |
michael@0 | 23 | ShadersListView._onProgramMouseEnter({ target: getItemLabel(panel, 0) }); |
michael@0 | 24 | |
michael@0 | 25 | yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 0, b: 32, a: 255 }, true); |
michael@0 | 26 | yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 0, b: 32, a: 127 }, true); |
michael@0 | 27 | ok(true, "The first program was correctly highlighted."); |
michael@0 | 28 | |
michael@0 | 29 | ShadersListView._onProgramMouseLeave({ target: getItemLabel(panel, 0) }); |
michael@0 | 30 | ShadersListView._onProgramMouseEnter({ target: getItemLabel(panel, 1) }); |
michael@0 | 31 | |
michael@0 | 32 | yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); |
michael@0 | 33 | yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 255, g: 0, b: 64, a: 255 }, true); |
michael@0 | 34 | ok(true, "The second program was correctly highlighted."); |
michael@0 | 35 | |
michael@0 | 36 | ShadersListView._onProgramMouseLeave({ target: getItemLabel(panel, 1) }); |
michael@0 | 37 | |
michael@0 | 38 | yield ensurePixelIs(debuggee, { x: 0, y: 0 }, { r: 127, g: 127, b: 127, a: 255 }, true); |
michael@0 | 39 | yield ensurePixelIs(debuggee, { x: 64, y: 64 }, { r: 0, g: 127, b: 127, a: 127 }, true); |
michael@0 | 40 | ok(true, "The two programs were correctly unhighlighted."); |
michael@0 | 41 | |
michael@0 | 42 | yield teardown(panel); |
michael@0 | 43 | finish(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function getItemLabel(aPanel, aIndex) { |
michael@0 | 47 | return aPanel.panelWin.document.querySelectorAll( |
michael@0 | 48 | ".side-menu-widget-item-contents")[aIndex]; |
michael@0 | 49 | } |