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 program and shader actors are cached in the frontend. michael@0: */ michael@0: michael@0: function ifWebGLSupported() { michael@0: let [target, debuggee, panel] = yield initShaderEditor(MULTIPLE_CONTEXTS_URL); michael@0: let { EVENTS, gFront, ShadersListView, ShadersEditorsView } = panel.panelWin; michael@0: michael@0: reload(target); michael@0: let [[programActor]] = yield promise.all([ michael@0: getPrograms(gFront, 1), michael@0: once(panel.panelWin, EVENTS.SOURCES_SHOWN) michael@0: ]); michael@0: michael@0: let programItem = ShadersListView.selectedItem; michael@0: michael@0: is(programItem.attachment.programActor, programActor, michael@0: "The correct program actor is cached for the selected item."); michael@0: michael@0: is((yield programActor.getVertexShader()), michael@0: (yield programItem.attachment.vs), michael@0: "The cached vertex shader promise returns the correct actor."); michael@0: michael@0: is((yield programActor.getFragmentShader()), michael@0: (yield programItem.attachment.fs), michael@0: "The cached fragment shader promise returns the correct actor."); michael@0: michael@0: is((yield (yield programActor.getVertexShader()).getText()), michael@0: (yield (yield ShadersEditorsView._getEditor("vs")).getText()), michael@0: "The cached vertex shader promise returns the correct text."); michael@0: michael@0: is((yield (yield programActor.getFragmentShader()).getText()), michael@0: (yield (yield ShadersEditorsView._getEditor("fs")).getText()), michael@0: "The cached fragment shader promise returns the correct text."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }