diff --git a/scripts/calibrazione_pagina.py b/scripts/calibrazione_pagina.py index c4db8a3..842f0cc 100644 --- a/scripts/calibrazione_pagina.py +++ b/scripts/calibrazione_pagina.py @@ -569,7 +569,7 @@ function zoomBy(v, f) { applica(v); if (zoomata(v)) { p.scrollLeft = cx * z - p.clientWidth / 2; p.scrollTop = cy * z - p.clientHeight / 2; } } -function adatta(v) { +function adattaVisore(v) { // #111: nome distinto da adatta(d, v) dei parametri camera v.adatta = true; v.z = 0; applica(v); @@ -604,7 +604,7 @@ function creaVisore(chiave, suf, idCornice, idImg) { V[chiave] = v; $("zoomMeno" + suf).onclick = function () { zoomBy(v, 1 / PASSO); }; $("zoomPiu" + suf).onclick = function () { zoomBy(v, PASSO); }; - $("zoomAdatta" + suf).onclick = function () { adatta(v); }; + $("zoomAdatta" + suf).onclick = function () { adattaVisore(v); }; // #111: Ctrl+rotella = zoom; senza Ctrl la rotella scorre la pagina v.palco.addEventListener("wheel", function (ev) { if (!ev.ctrlKey) return; diff --git a/scripts/tests/test_pagina_acquisizione.py b/scripts/tests/test_pagina_acquisizione.py index 8ceaa52..453263e 100644 --- a/scripts/tests/test_pagina_acquisizione.py +++ b/scripts/tests/test_pagina_acquisizione.py @@ -71,3 +71,10 @@ def test_zoom_visori(): # #111 # la barra e' sorella del palco che scorre (non dentro): resta ferma durante lo scorrimento assert PAGINA.count('
') == 3 + + +def test_nessuna_funzione_dichiarata_due_volte(): # #111: in JS vince l'ultima dichiarazione, in silenzio + script = re.search(r"", PAGINA, re.S).group(1) + nomi = re.findall(r"function\s+([A-Za-z0-9_$]+)\s*\(", script) + doppi = sorted({n for n in nomi if nomi.count(n) > 1}) + assert not doppi, "funzioni dichiarate piu' volte: " + ", ".join(doppi)