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