3 Commits
6 changed files with 20 additions and 48 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
node_modules/
node_modules
build/
dist/
sign/*.pem
-1
View File
@@ -1 +0,0 @@
/tmp/hw/node_modules
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 20 KiB

+17 -2
View File
@@ -1,4 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 192 192">
<rect width="192" height="192" rx="48" fill="#ff6900"/>
<text x="96" y="116" text-anchor="middle" font-family="DejaVu Sans, sans-serif" font-size="72" font-weight="700" fill="#ffffff">Hi</text>
<circle cx="96" cy="96" r="96" fill="#0e1f3a"/>
<g fill="#ffc93c">
<polygon points="96,96 96,20 118,22"/>
<polygon points="96,96 118,22 146,40"/>
<polygon points="96,96 146,40 170,76"/>
<polygon points="96,96 170,76 172,96"/>
<polygon points="96,96 172,96 170,116"/>
<polygon points="96,96 170,116 146,152"/>
<polygon points="96,96 146,152 118,170"/>
<polygon points="96,96 118,170 96,172"/>
<polygon points="96,96 96,172 74,170"/>
<polygon points="96,96 74,170 46,152"/>
<polygon points="96,96 46,152 22,116"/>
<polygon points="96,96 22,116 20,96"/>
<polygon points="96,96 20,96 22,76"/>
</g>
<circle cx="96" cy="96" r="30" fill="#ffc93c"/>
</svg>

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 797 B

+2 -2
View File
@@ -2,8 +2,8 @@
"package": "com.ilias.sundial",
"name": "SUNDIAL",
"icon": "/common/icon.png",
"versionName": "0.3",
"versionCode": 3,
"versionName": "0.4",
"versionCode": 4,
"minAPILevel": 1,
"deviceTypeList": [
"watch"
-42
View File
@@ -1,42 +0,0 @@
const fs = require('node:fs');
const vm = require('node:vm');
const assert = require('node:assert/strict');
const ux = fs.readFileSync('src/pages/index/index.ux', 'utf8');
const script = ux.match(/<script>([\s\S]*?)<\/script>/)[1];
function page() {
const spec = vm.runInNewContext(script.replace('export default', 'globalThis.spec =') + '\nspec');
return Object.assign({}, spec.private, spec);
}
const p = page();
assert.equal(typeof p.press, 'function', 'Keypress handler must exist');
['2','+','3','='].forEach(k => p.press(k));
assert.equal(p.display, '5');
console.log('PASS addition through page keypress handler');
const cases = [
['subtract',['9','-','4','='],'5'],
['multiply',['6','x','7','='],'42'],
['divide',['8','/','2','='],'4'],
['decimals',['0','.','1','+','0','.','2','='],'0.3'],
['duplicate dot',['1','.','.','2'],'1.2'],
['sign',['5','+/-','x','2','='],'-10'],
['percent',['5','0','%'],'0.5'],
['percent add',['2','0','0','+','1','0','%','='],'220'],
['percent multiply',['2','0','0','x','1','0','%','='],'20'],
['clear',['9','+','AC','2','='],'2'],
['zero division',['8','/','0','='],'Error'],
['recover',['8','/','0','=','3'],'3'],
['chain',['2','+','3','x','4','='],'20'],
['replace operator',['2','+','x','3','='],'6'],
['repeat equals',['2','+','3','=','=', '='],'11'],
['fresh entry',['2','+','3','=','7'],'7'],
['input cap',Array(20).fill('9'),'999999999'],
['leading zero',['0','0','2'],'2']
];
for(const [name,keys,expected] of cases) {
const c=page(); keys.forEach(k=>c.press(k)); assert.equal(c.display,expected,name);
}
assert.match(ux, /\{\{ display \}\}/);
const keys=[...ux.matchAll(/<text[^>]*onclick="press\('([^']+)'\)"/g)].map(m=>m[1]);
assert.equal(keys.length,19,'every button must have handler');
assert.equal(new Set(keys).size,19);
console.log('PASS',cases.length,'edge cases and all 19 button bindings');