gecko/browser/devtools/shadereditor/test/browser_se_editors-contents.js

38 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created.");
/**
* Tests if the editors contain the correct text when a program
* becomes available.
*/
function ifWebGLSupported() {
let { target, panel } = yield initShaderEditor(SIMPLE_CANVAS_URL);
let { gFront, ShadersEditorsView, EVENTS } = panel.panelWin;
reload(target);
yield promise.all([
once(gFront, "program-linked"),
once(panel.panelWin, EVENTS.SOURCES_SHOWN)
]);
let vsEditor = yield ShadersEditorsView._getEditor("vs");
let fsEditor = yield ShadersEditorsView._getEditor("fs");
is(vsEditor.getText().indexOf("gl_Position"), 170,
"The vertex shader editor contains the correct text.");
is(fsEditor.getText().indexOf("gl_FragColor"), 97,
"The fragment shader editor contains the correct text.");
yield teardown(panel);
finish();
}