Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
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 the shader editor works with bfcache. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | function ifWebGLSupported() { |
michael@0 | 9 | let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL); |
michael@0 | 10 | let { gFront, $, EVENTS, ShadersListView, ShadersEditorsView } = panel.panelWin; |
michael@0 | 11 | |
michael@0 | 12 | let reloaded = reload(target); |
michael@0 | 13 | let firstProgram = yield once(gFront, "program-linked"); |
michael@0 | 14 | yield reloaded; |
michael@0 | 15 | |
michael@0 | 16 | let navigated = navigate(target, MULTIPLE_CONTEXTS_URL); |
michael@0 | 17 | let [secondProgram, thirdProgram] = yield getPrograms(gFront, 2); |
michael@0 | 18 | yield navigated; |
michael@0 | 19 | |
michael@0 | 20 | let vsEditor = yield ShadersEditorsView._getEditor("vs"); |
michael@0 | 21 | let fsEditor = yield ShadersEditorsView._getEditor("fs"); |
michael@0 | 22 | |
michael@0 | 23 | yield navigateInHistory(target, "back", "will-navigate"); |
michael@0 | 24 | yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED); |
michael@0 | 25 | yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); |
michael@0 | 26 | |
michael@0 | 27 | is($("#content").hidden, false, |
michael@0 | 28 | "The tool's content should not be hidden."); |
michael@0 | 29 | is(ShadersListView.itemCount, 1, |
michael@0 | 30 | "The shaders list contains one entry after navigating back."); |
michael@0 | 31 | is(ShadersListView.selectedIndex, 0, |
michael@0 | 32 | "The shaders list has a correct selection after navigating back."); |
michael@0 | 33 | |
michael@0 | 34 | is(vsEditor.getText().indexOf("gl_Position"), 170, |
michael@0 | 35 | "The vertex shader editor contains the correct text."); |
michael@0 | 36 | is(fsEditor.getText().indexOf("gl_FragColor"), 97, |
michael@0 | 37 | "The fragment shader editor contains the correct text."); |
michael@0 | 38 | |
michael@0 | 39 | yield navigateInHistory(target, "forward", "will-navigate"); |
michael@0 | 40 | yield once(panel.panelWin, EVENTS.PROGRAMS_ADDED); |
michael@0 | 41 | yield once(panel.panelWin, EVENTS.SOURCES_SHOWN); |
michael@0 | 42 | |
michael@0 | 43 | is($("#content").hidden, false, |
michael@0 | 44 | "The tool's content should not be hidden."); |
michael@0 | 45 | is(ShadersListView.itemCount, 2, |
michael@0 | 46 | "The shaders list contains two entries after navigating forward."); |
michael@0 | 47 | is(ShadersListView.selectedIndex, 0, |
michael@0 | 48 | "The shaders list has a correct selection after navigating forward."); |
michael@0 | 49 | |
michael@0 | 50 | is(vsEditor.getText().indexOf("gl_Position"), 100, |
michael@0 | 51 | "The vertex shader editor contains the correct text."); |
michael@0 | 52 | is(fsEditor.getText().indexOf("gl_FragColor"), 89, |
michael@0 | 53 | "The fragment shader editor contains the correct text."); |
michael@0 | 54 | |
michael@0 | 55 | yield teardown(panel); |
michael@0 | 56 | finish(); |
michael@0 | 57 | } |