From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../webaudioeditor/test/browser_wa_graph-zoom.js | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js (limited to 'devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js') diff --git a/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js b/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js new file mode 100644 index 000000000..240b6d5a1 --- /dev/null +++ b/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js @@ -0,0 +1,43 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests that the graph's scale and position is reset on a page reload. + */ + +add_task(function* () { + let { target, panel } = yield initWebAudioEditor(SIMPLE_CONTEXT_URL); + let { panelWin } = panel; + let { gFront, $, $$, EVENTS, ContextView } = panelWin; + + let started = once(gFront, "start-context"); + + yield Promise.all([ + waitForGraphRendered(panelWin, 3, 2), + reload(target), + ]); + + is(ContextView.getCurrentScale(), 1, "Default graph scale is 1."); + is(ContextView.getCurrentTranslation()[0], 20, "Default x-translation is 20."); + is(ContextView.getCurrentTranslation()[1], 20, "Default y-translation is 20."); + + // Change both attribute and D3's internal store + panelWin.d3.select("#graph-target").attr("transform", "translate([100, 400]) scale(10)"); + ContextView._zoomBinding.scale(10); + ContextView._zoomBinding.translate([100, 400]); + + is(ContextView.getCurrentScale(), 10, "After zoom, scale is 10."); + is(ContextView.getCurrentTranslation()[0], 100, "After zoom, x-translation is 100."); + is(ContextView.getCurrentTranslation()[1], 400, "After zoom, y-translation is 400."); + + yield Promise.all([ + waitForGraphRendered(panelWin, 3, 2), + reload(target), + ]); + + is(ContextView.getCurrentScale(), 1, "After refresh, graph scale is 1."); + is(ContextView.getCurrentTranslation()[0], 20, "After refresh, x-translation is 20."); + is(ContextView.getCurrentTranslation()[1], 20, "After refresh, y-translation is 20."); + + yield teardown(target); +}); -- cgit v1.2.3