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 if source editors are lazily initialized. michael@0: */ michael@0: michael@0: function ifWebGLSupported() { michael@0: let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL); michael@0: let { gFront, ShadersEditorsView } = panel.panelWin; michael@0: michael@0: try { michael@0: yield ShadersEditorsView._getEditor("vs"); michael@0: ok(false, "The promise for a vertex shader editor should be rejected."); michael@0: } catch (e) { michael@0: ok(true, "The vertex shader editors wasn't initialized."); michael@0: } michael@0: michael@0: try { michael@0: yield ShadersEditorsView._getEditor("fs"); michael@0: ok(false, "The promise for a fragment shader editor should be rejected."); michael@0: } catch (e) { michael@0: ok(true, "The fragment shader editors wasn't initialized."); michael@0: } michael@0: michael@0: reload(target); michael@0: yield once(gFront, "program-linked"); michael@0: michael@0: let vsEditor = yield ShadersEditorsView._getEditor("vs"); michael@0: let fsEditor = yield ShadersEditorsView._getEditor("fs"); michael@0: michael@0: ok(vsEditor, "A vertex shader editor was initialized."); michael@0: ok(fsEditor, "A fragment shader editor was initialized."); michael@0: michael@0: isnot(vsEditor, fsEditor, michael@0: "The vertex shader editor is distinct from the fragment shader editor."); michael@0: michael@0: let vsEditor2 = yield ShadersEditorsView._getEditor("vs"); michael@0: let fsEditor2 = yield ShadersEditorsView._getEditor("fs"); michael@0: michael@0: is(vsEditor, vsEditor2, michael@0: "The vertex shader editor instances are cached."); michael@0: is(fsEditor, fsEditor2, michael@0: "The fragment shader editor instances are cached."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }