|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests that program and shader actors are cached in the frontend. |
|
6 */ |
|
7 |
|
8 function ifWebGLSupported() { |
|
9 let [target, debuggee, panel] = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); |
|
10 let { EVENTS, gFront, ShadersListView, ShadersEditorsView } = panel.panelWin; |
|
11 |
|
12 reload(target); |
|
13 let [[programActor]] = yield promise.all([ |
|
14 getPrograms(gFront, 1), |
|
15 once(panel.panelWin, EVENTS.SOURCES_SHOWN) |
|
16 ]); |
|
17 |
|
18 let programItem = ShadersListView.selectedItem; |
|
19 |
|
20 is(programItem.attachment.programActor, programActor, |
|
21 "The correct program actor is cached for the selected item."); |
|
22 |
|
23 is((yield programActor.getVertexShader()), |
|
24 (yield programItem.attachment.vs), |
|
25 "The cached vertex shader promise returns the correct actor."); |
|
26 |
|
27 is((yield programActor.getFragmentShader()), |
|
28 (yield programItem.attachment.fs), |
|
29 "The cached fragment shader promise returns the correct actor."); |
|
30 |
|
31 is((yield (yield programActor.getVertexShader()).getText()), |
|
32 (yield (yield ShadersEditorsView._getEditor("vs")).getText()), |
|
33 "The cached vertex shader promise returns the correct text."); |
|
34 |
|
35 is((yield (yield programActor.getFragmentShader()).getText()), |
|
36 (yield (yield ShadersEditorsView._getEditor("fs")).getText()), |
|
37 "The cached fragment shader promise returns the correct text."); |
|
38 |
|
39 yield teardown(panel); |
|
40 finish(); |
|
41 } |