From 8c92d195f7104bf053c8a5e0f0ad0f83b8ab845a Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Mon, 11 Feb 2019 10:59:07 -0500 Subject: [PATCH 1/2] Update monitors sb2 integration test for editing locally. I cannot open the sb2 file without modifying the width/height of the lists, and editing+rezipping does not seem to work for me, so I need to change this width/height before I can make real changes to the tests. --- test/fixtures/monitors.sb2 | Bin 55130 -> 55046 bytes test/integration/monitors_sb2.js | 4 ++-- test/integration/monitors_sb2_to_sb3.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fixtures/monitors.sb2 b/test/fixtures/monitors.sb2 index 2b9ede37694c59364eef883646987904c4ebb05d..850b1decf2676f51243ae4f53337d3987978a597 100644 GIT binary patch delta 1482 zcmcb$j=60ebA5m}GYc030|N)c-7rT#rr6hFu`CP>6#@(lJV4QcqWrAX_aC~jGrMDnhv&}J$+j#Rx00Aebi3p{CT_a7VA zyBBtcdz<|3jM=+327deSwSH=35`$M?uWM6=l)7QRkz3J`q$Y)Ki}S3fA9GBsD0MGC z$ErKqDJILkHpW6S!PR=R7=z-LGoPZSUb(??P$DgC``v9{_)jV6g}7~=A9Iy=!)n7@ zUEjYruCU86Va{Lo>qYVuBOQfS!9$jU4k-q{fpeI|99fh$Wv$x!S$+2;v;Xy7+w`{0 zU9&n+g+bIhyDLa(|XKI==Zf3^Cj8mGEn^wKX!o;p0)_2`hy`ky8lE>DklZe|H+ z@$id0#L}mE-f7CE7N@oVw_x$-KVtoNeZSJVY32WaC5w+QVK1B1{cBN%*_9b<3gl0^ ziNzc@db>`4y4y*=hCr_3lNF0JU!BQ37F_T9qCt4k#@`!faHp%yy|;7uoW-{)y==qm z863>Nn3lM>9xo~J@f2>HIqO-KmTRp!o4sciPl8Bj8;8Hsq0J&n5}QMgBu)wPDR7IJ z=fB8mf~bebq#c^tx*X0ndK>lEX?|jEl=V8pcW}p-ea8+k=4>|i*F53SV<{YvpywiT zm_@yQ&f*Eohi#mnvXf6--6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monitors_sb2.js +++ b/test/integration/monitors_sb2.js @@ -61,8 +61,8 @@ test('importing sb2 project with monitors', t => { t.equal(monitorRecord.opcode, 'data_listcontents'); t.equal(monitorRecord.mode, 'list'); t.equal(monitorRecord.visible, true); - t.equal(monitorRecord.width, 104); // Make sure these are imported from lists. - t.equal(monitorRecord.height, 204); + t.equal(monitorRecord.width, 106); // Make sure these are imported from lists. + t.equal(monitorRecord.height, 206); // Backdrop name monitor is visible, not sprite specific // should get imported with id that references the name parameter diff --git a/test/integration/monitors_sb2_to_sb3.js b/test/integration/monitors_sb2_to_sb3.js index 4fb26bbf8..64a4818c9 100644 --- a/test/integration/monitors_sb2_to_sb3.js +++ b/test/integration/monitors_sb2_to_sb3.js @@ -78,8 +78,8 @@ test('saving and loading sb2 project with monitors preserves sliderMin and slide t.equal(monitorRecord.opcode, 'data_listcontents'); t.equal(monitorRecord.mode, 'list'); t.equal(monitorRecord.visible, true); - t.equal(monitorRecord.width, 104); // Make sure these are imported from lists. - t.equal(monitorRecord.height, 204); + t.equal(monitorRecord.width, 106); // Make sure these are imported from lists. + t.equal(monitorRecord.height, 206); // Backdrop name monitor is visible, not sprite specific // should get imported with id that references the name parameter From 6754fa9334273d044285fc10025c065c03099688 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Mon, 11 Feb 2019 11:09:01 -0500 Subject: [PATCH 2/2] Add isDiscrete to monitor record, update sb2,3 and conversion tests --- src/engine/monitor-record.js | 1 + src/serialization/sb2.js | 1 + src/serialization/sb3.js | 1 + test/fixtures/monitors.sb2 | Bin 55046 -> 55049 bytes test/integration/monitors_sb2.js | 1 + test/integration/monitors_sb2_to_sb3.js | 1 + test/integration/monitors_sb3.js | 3 +-- 7 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/monitor-record.js b/src/engine/monitor-record.js index daa6f9db1..1259d5252 100644 --- a/src/engine/monitor-record.js +++ b/src/engine/monitor-record.js @@ -12,6 +12,7 @@ const MonitorRecord = Record({ mode: 'default', sliderMin: 0, sliderMax: 100, + isDiscrete: true, x: null, // (x: null, y: null) Indicates that the monitor should be auto-positioned y: null, width: 0, diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index e925929fd..9f3417183 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -381,6 +381,7 @@ const parseMonitorObject = (object, runtime, targets, extensions) => { mode: object.mode, sliderMin: object.sliderMin, sliderMax: object.sliderMax, + isDiscrete: object.isDiscrete, x: object.x, y: object.y, width: object.width, diff --git a/src/serialization/sb3.js b/src/serialization/sb3.js index 6c4a9ba8d..f4d254b25 100644 --- a/src/serialization/sb3.js +++ b/src/serialization/sb3.js @@ -504,6 +504,7 @@ const serializeMonitors = function (monitors) { if (monitorData.mode !== 'list') { serializedMonitor.sliderMin = monitorData.sliderMin; serializedMonitor.sliderMax = monitorData.sliderMax; + serializedMonitor.isDiscrete = monitorData.isDiscrete; } return serializedMonitor; }); diff --git a/test/fixtures/monitors.sb2 b/test/fixtures/monitors.sb2 index 850b1decf2676f51243ae4f53337d3987978a597..5874889056c47a0e3c7f558f8ced5651a47b8b0e 100644 GIT binary patch delta 1480 zcmZo$$K1J&xjw*~nT3mifq{cTAl%VU$0qzk0t*8}r2qp14^XtAC_gJTxkN9kI6v=f zcwqi)D~Vdade)MHhS)1bZc9(cGzgi2+Aj6)+v}W-5iDDI zqoz-qbjd~6CuXPVi+BYdc9$*lcVxNV{ruOyg>(7WV2N1X z^td|ZPmubn%7rBjqA$TI7o z;p-M5ud*Ww)2p`c_?5I}XYNh;Us?A&4|`q?)3hzHYeg=B_r_!8#PH=toF-3gg`(mY3t>k*cW<(z|_SGzYE_vQ`VLh|ojAQGLC*{qVS^DeAyyCv9=bGOm{<{bk z^zUo$+wo#Xf1hQhkU{a~JN}~6%awng3{q~q7-D%uhu845F@vL%@w}EoHvu=xWv+%Z zUmXYw?7Dn~H!_=1U{PULZL#keex9-n!`~9U!SAbetQvB^ib-~U(s1l4Iw1Ji#?PTE z=vaNi2_>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MjZ@t(dg+%VPaU4@dUQx;{ZEq&m#4=&H?st^ zc=$ygV(HU7?=?8=Na1@b4| z#A1#cy}dHog=^B2Ijs|p z?y69jC+w5a!+9wG%t_f>C%KY@lrKM@pSw>+A-=ZdTW5~9`zmroYU^8fuKN^q_^+ewyqnF^s{-Ax zMwPT5)zIF__8wwQ^*@`oKj?lSFLcd#{z|L)7w_g@l1Xjg^x5crf8ytPYgN1XPWtK2 zJ1@TXO~qyLi?-7)sdH3|zbURce&*Z$%G1t%d{SpOYX3VM{4PaPPpd9<-CD_yL1DKA zOV1>7b?&~U_NaQ&7+F+XU;pxAC90ioeHM|M9cA=lQqs z^Q)hzn^(>I9enoH>G_rGd}~|V?|l^bU+y1hY07YLo9L?~TOFx8e6^>A)*X6!+(th| zb=v=en=k(u@cG6o&px;Hz{7^SPv`qSsnr*LqXblQH6W#3{lf86&y%YsZ0vovanFLc z$37Po7p}a&_Px_zW&^nz(^dZ#Rxgv;7tK?$Y!b^cg{ynNKEC-FULG+3%cITHSOi#^ zfb~sYQe+ diff --git a/test/integration/monitors_sb2.js b/test/integration/monitors_sb2.js index 628c10d58..12ab92a83 100644 --- a/test/integration/monitors_sb2.js +++ b/test/integration/monitors_sb2.js @@ -37,6 +37,7 @@ test('importing sb2 project with monitors', t => { t.equal(monitorRecord.mode, 'slider'); t.equal(monitorRecord.sliderMin, -200); // Make sure these are imported for sliders. t.equal(monitorRecord.sliderMax, 30); + t.equal(monitorRecord.isDiscrete, false); t.equal(monitorRecord.x, 5); // These are imported for all monitors, just check once. t.equal(monitorRecord.y, 59); t.equal(monitorRecord.visible, true); diff --git a/test/integration/monitors_sb2_to_sb3.js b/test/integration/monitors_sb2_to_sb3.js index 64a4818c9..ec881c2d3 100644 --- a/test/integration/monitors_sb2_to_sb3.js +++ b/test/integration/monitors_sb2_to_sb3.js @@ -54,6 +54,7 @@ test('saving and loading sb2 project with monitors preserves sliderMin and slide t.equal(monitorRecord.mode, 'slider'); t.equal(monitorRecord.sliderMin, -200); // Make sure these are imported for sliders. t.equal(monitorRecord.sliderMax, 30); + t.equal(monitorRecord.isDiscrete, false); t.equal(monitorRecord.x, 5); // These are imported for all monitors, just check once. t.equal(monitorRecord.y, 59); t.equal(monitorRecord.visible, true); diff --git a/test/integration/monitors_sb3.js b/test/integration/monitors_sb3.js index 3c5c08f9e..f55edb864 100644 --- a/test/integration/monitors_sb3.js +++ b/test/integration/monitors_sb3.js @@ -39,10 +39,9 @@ test('importing sb3 project with monitors', t => { t.equal(monitorRecord.opcode, 'data_variable'); t.equal(monitorRecord.mode, 'default'); // The following few properties are imported for all monitors, just check once. - // sliderMin and sliderMax are currently not implemented, - // but should still get default values serialized and deserialized correctly t.equal(monitorRecord.sliderMin, 0); t.equal(monitorRecord.sliderMax, 100); + t.equal(monitorRecord.isDiscrete, true); // The default if not present t.equal(monitorRecord.x, 10); t.equal(monitorRecord.y, 62); // Height and width are only used for list monitors and should default to 0