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 thumbnails are correctly linked with other UI elements like michael@0: * function call items and their respective screenshots. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL); michael@0: let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; michael@0: michael@0: yield reload(target); michael@0: michael@0: let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); michael@0: let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED); michael@0: let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: yield promise.all([ michael@0: recordingFinished, michael@0: callListPopulated, michael@0: thumbnailsDisplayed, michael@0: screenshotDisplayed michael@0: ]); michael@0: michael@0: is($all(".filmstrip-thumbnail[highlighted]").length, 0, michael@0: "There should be no highlighted thumbnail available yet."); michael@0: is(CallsListView.selectedIndex, -1, michael@0: "There should be no selected item in the calls list view."); michael@0: michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".filmstrip-thumbnail")[0], window); michael@0: yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); michael@0: info("The first draw call was selected, by clicking the first thumbnail."); michael@0: michael@0: isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null, michael@0: "There should be a highlighted thumbnail available now, for the first draw call."); michael@0: is($all(".filmstrip-thumbnail[highlighted]").length, 1, michael@0: "There should be only one highlighted thumbnail available now."); michael@0: is(CallsListView.selectedIndex, 0, michael@0: "The first draw call should be selected in the calls list view."); michael@0: michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[1], window); michael@0: yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); michael@0: info("The second context call was selected, by clicking the second call item."); michael@0: michael@0: isnot($(".filmstrip-thumbnail[highlighted][index='0']"), null, michael@0: "There should be a highlighted thumbnail available, for the first draw call."); michael@0: is($all(".filmstrip-thumbnail[highlighted]").length, 1, michael@0: "There should be only one highlighted thumbnail available."); michael@0: is(CallsListView.selectedIndex, 1, michael@0: "The second draw call should be selected in the calls list view."); michael@0: michael@0: EventUtils.sendMouseEvent({ type: "mousedown" }, $all(".call-item-view")[2], window); michael@0: yield once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED); michael@0: info("The second draw call was selected, by clicking the third call item."); michael@0: michael@0: isnot($(".filmstrip-thumbnail[highlighted][index='2']"), null, michael@0: "There should be a highlighted thumbnail available, for the second draw call."); michael@0: is($all(".filmstrip-thumbnail[highlighted]").length, 1, michael@0: "There should be only one highlighted thumbnail available."); michael@0: is(CallsListView.selectedIndex, 2, michael@0: "The second draw call should be selected in the calls list view."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }