diff --git a/apps/accellog/app.js b/apps/accellog/app.js index 0da56b6ea..dcc7702c9 100644 --- a/apps/accellog/app.js +++ b/apps/accellog/app.js @@ -105,7 +105,6 @@ function startRecord(force) { showMenu(); }} ]); - layout.update(); layout.render(); // now start writing diff --git a/tests/Layout/bin/espruino b/tests/Layout/bin/espruino index 29d44789b..3a423c185 100755 Binary files a/tests/Layout/bin/espruino and b/tests/Layout/bin/espruino differ diff --git a/tests/Layout/bin/runalltests.sh b/tests/Layout/bin/runalltests.sh index 99a834d90..3a7aac50b 100755 --- a/tests/Layout/bin/runalltests.sh +++ b/tests/Layout/bin/runalltests.sh @@ -1,5 +1,4 @@ #!/bin/bash -cd `dirname $0` -cd ../tests -ls *.js | xargs ../bin/runtest.sh +cd `dirname $0`/.. +ls tests/*.js | xargs -I{} bin/runtest.sh {} diff --git a/tests/Layout/bin/runtest.sh b/tests/Layout/bin/runtest.sh index 72071a63b..5ce2ab21f 100755 --- a/tests/Layout/bin/runtest.sh +++ b/tests/Layout/bin/runtest.sh @@ -2,35 +2,38 @@ # Requires Linux x64 (for ./espruino) # Also imagemagick for display -cd `dirname $0` +cd `dirname $0`/.. if [ "$#" -ne 1 ]; then echo "USAGE:" - echo " bin/runtest.sh testxyz.js" + echo " bin/runtest.sh tests/testxyz.js" exit 1 fi # temporary test files -TESTJS=tmp.js -TESTBMP=tmp.bmp +TESTJS=bin/tmp.js +TESTBMP=bin/tmp.bmp # actual source files -SRCDIR=../tests/ +SRCDIR=tests SRCJS=$1 -SRCBMP=`basename $SRCJS .js`.bmp +SRCBMP=$SRCDIR/`basename $SRCJS .js`.bmp echo "TEST $SRCJS ($SRCBMP)" -cat ../../../modules/Layout.js > $TESTJS +cat ../../modules/Layout.js > $TESTJS +echo 'Bangle = {};BTN1=0;process.env = process.env;process.env.HWVERSION=2;' >> $TESTJS echo 'g = Graphics.createArrayBuffer(176,176,4);' >> $TESTJS -cat $SRCDIR/$SRCJS >> $TESTJS || exit 1 +cat $SRCJS >> $TESTJS || exit 1 echo 'layout.render()' >> $TESTJS -echo 'layout.debug()' >> $TESTJS +#echo 'layout.debug()' >> $TESTJS echo 'require("fs").writeFileSync("'$TESTBMP'",g.asBMP())' >> $TESTJS -./espruino $TESTJS || exit 1 -if ! cmp $TESTBMP $SRCDIR/$SRCBMP >/dev/null 2>&1 +bin/espruino $TESTJS || exit 1 +if ! cmp $TESTBMP $SRCBMP >/dev/null 2>&1 then - echo Files differ - convert "+append" $TESTBMP $SRCDIR/$SRCBMP ../testresult.bmp - display ../testresult.bmp + echo ============================================= + echo $TESTBMP $SRCBMP differ + echo ============================================== + convert "+append" $TESTBMP $SRCBMP testresult.bmp + display testresult.bmp exit 1 else echo Files are the same diff --git a/tests/Layout/tests/accellog.bmp b/tests/Layout/tests/accellog.bmp new file mode 100644 index 000000000..7ebe01b21 Binary files /dev/null and b/tests/Layout/tests/accellog.bmp differ diff --git a/tests/Layout/tests/accellog.js b/tests/Layout/tests/accellog.js new file mode 100644 index 000000000..4ae865f4f --- /dev/null +++ b/tests/Layout/tests/accellog.js @@ -0,0 +1,13 @@ +// Based on accellog usage +var layout = new Layout({ type: "v", c: [ + {type:"txt", font:"6x8", label:"Samples", pad:2}, + {type:"txt", id:"samples", font:"6x8:2", label:" - ", pad:5}, + {type:"txt", font:"6x8", label:"Time", pad:2}, + {type:"txt", id:"time", font:"6x8:2", label:" - ", pad:5}, + {type:"txt", font:"6x8:2", label:"RECORDING", bgCol:"#f00", pad:5, fillx:1}, + ] +},[ // Buttons... + {label:"STOP", cb:()=>{}} +]); +layout.samples.label = "123"; +layout.time.label = "123s"; diff --git a/tests/Layout/tests/padding_issue819.bmp b/tests/Layout/tests/padding_issue819.bmp index 82bcb9acb..22d59c5ec 100644 Binary files a/tests/Layout/tests/padding_issue819.bmp and b/tests/Layout/tests/padding_issue819.bmp differ