From 7ea25cbbe8635c3e5bd306e4e7238027727dc283 Mon Sep 17 00:00:00 2001 From: GarboMuffin Date: Mon, 18 Jul 2022 16:32:20 -0500 Subject: [PATCH] Fix turbo mode stored in project not appearing in GUI state --- src/virtual-machine.js | 6 ++++++ test/fixtures/tw-stored-settings/turbo-mode.sb3 | Bin 0 -> 943 bytes test/unit/tw_stored_settings.js | 11 +++++++++++ 3 files changed, 17 insertions(+) create mode 100644 test/fixtures/tw-stored-settings/turbo-mode.sb3 diff --git a/src/virtual-machine.js b/src/virtual-machine.js index dad6eadb..b84fa32d 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -188,6 +188,12 @@ class VirtualMachine extends EventEmitter { this.runtime.on(Runtime.COMPILE_ERROR, (target, error) => { this.emit(Runtime.COMPILE_ERROR, target, error); }); + this.runtime.on(Runtime.TURBO_MODE_OFF, () => { + this.emit(Runtime.TURBO_MODE_OFF); + }); + this.runtime.on(Runtime.TURBO_MODE_ON, () => { + this.emit(Runtime.TURBO_MODE_ON); + }); this.extensionManager = new ExtensionManager(this.runtime); diff --git a/test/fixtures/tw-stored-settings/turbo-mode.sb3 b/test/fixtures/tw-stored-settings/turbo-mode.sb3 new file mode 100644 index 0000000000000000000000000000000000000000..060dff8c8888086792eaa123558a6d2208bcaa98 GIT binary patch literal 943 zcmWIWW@h1HU|`^2P+apVBU+-M_!g$T{@P1cvgznoxKL%?iXH~Yw?kFWmfL-${hRt zYPL!H9JvDS&39~%p2X|qx$ij78k3yE0;d!7_f89KpHtl?Z*QM#f2QvBZ*lY6-`9&B zzb?Q3Y5o~c8&yL&oAS+%9!_#x?yOUqw)vCas;GZot;6%zm%Z(AobBguEZpkPngv^G zucsEY6vd?!NZGNkUC~-3^;WF(ve1;rZ%w_e;o;eBq3c!km-W%)ywZuaI?>3dph zo1N>PmLY!XVn@BB>LvaNib_|`3lcG#vJN>13}T9!=ycm3ktmH*w3oYPYyu4z*X-cG##@3w&RdruusAr#$mC*QqL%kM~TRIAue= zg$i?cuaEOuwZ}gzmUaCs*%LV1*L0>&m!w$4`9R&YNt1hL@wfcbHa| z5_0sw>I=88M@{!lGn|<(eVs8(c+uz0PA65JifkiWMVn0XHf*_kb!N%ONX5w;7B=~w zzHH&%IxQo!#Y6LB$um2iMOvqWat^yMIk|ZD{Qpgx)@5(py@I>p+YyPF&ySdA%E{&L zD1GQRmzB-k{2z;*<)dZwoC!YSZ@+uj13ksaB*K6@I{ { t.end(); }); }); + +test('Stored turbo mode emits event on VM', async t => { + const vm = makeVM(); + const project = readFileToBuffer(path.resolve(__dirname, '../fixtures/tw-stored-settings/turbo-mode.sb3')); + t.plan(1); + vm.on('TURBO_MODE_ON', () => { + t.pass('emitted TURBO_MODE_ON'); + }); + await vm.loadProject(project); + t.end(); +});