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 error tooltips can be opened from the editor's gutter when there's michael@0: * a shader compilation error. michael@0: */ michael@0: michael@0: function ifWebGLSupported() { michael@0: let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL); michael@0: let { gFront, EVENTS, ShadersEditorsView } = panel.panelWin; michael@0: michael@0: reload(target); michael@0: yield promise.all([ michael@0: once(gFront, "program-linked"), michael@0: once(panel.panelWin, EVENTS.SOURCES_SHOWN) michael@0: ]); michael@0: michael@0: let vsEditor = yield ShadersEditorsView._getEditor("vs"); michael@0: let fsEditor = yield ShadersEditorsView._getEditor("fs"); michael@0: michael@0: vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 }); michael@0: yield once(panel.panelWin, EVENTS.SHADER_COMPILED); michael@0: michael@0: // Synthesizing 'mouseenter' events doesn't work, hack around this by michael@0: // manually calling the event listener with the expected arguments. michael@0: let editorDocument = vsEditor.container.contentDocument; michael@0: let marker = editorDocument.querySelector(".error"); michael@0: let parsed = ShadersEditorsView._errors.vs[0].messages; michael@0: ShadersEditorsView._onMarkerMouseEnter(7, marker, parsed); michael@0: michael@0: let tooltip = marker._markerErrorsTooltip; michael@0: ok(tooltip, "A tooltip was created successfully."); michael@0: michael@0: let content = tooltip.content; michael@0: ok(tooltip.content, michael@0: "Some tooltip's content was set."); michael@0: ok(tooltip.content.className.contains("devtools-tooltip-simple-text-container"), michael@0: "The tooltip's content container was created correctly."); michael@0: michael@0: let messages = content.childNodes; michael@0: is(messages.length, 2, michael@0: "There are two messages displayed in the tooltip."); michael@0: ok(messages[0].className.contains("devtools-tooltip-simple-text"), michael@0: "The first message was created correctly."); michael@0: ok(messages[1].className.contains("devtools-tooltip-simple-text"), michael@0: "The second message was created correctly."); michael@0: michael@0: ok(messages[0].textContent.contains("'constructor' : too many arguments"), michael@0: "The first message contains the correct text."); michael@0: ok(messages[1].textContent.contains("'assign' : cannot convert"), michael@0: "The second message contains the correct text."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }