perf(输入法): 降低查词与候选内存开销并放大等尺寸26键
这个提交包含在:
1 父节点
100757f684
当前提交
7cd1ab906c
33 个文件已更改
+513
-126
没有与搜索条件相匹配的文件
@@ -26,7 +26,8 @@ for(var mode of ['py','en'])for(var upper of [false,true]){
|
||||
p.invalidate();p.secret=false;p.text='';p.cursor=0;p.composition='';p.mode=mode;p.upper=upper;p.renderKeys();p.updateDisplay();await tc.wait(.15);
|
||||
var alphabet='qwertyuiopasdfghjklzxcvbnm',keys=[];
|
||||
for(var letter of alphabet)keys.push({key:letter,rect:await rect('ime-key-'+letter)});
|
||||
console.log('PROBE_CAPTURE '+JSON.stringify({name:theme+'-'+mode+'-'+(upper?'upper':'lower'),theme:theme,kind:'qwerty',keys:keys}));await tc.wait(1.1);}
|
||||
var controls=[];for(var id of ['ime-chinese','ime-14','ime-english','ime-tools','ime-space','ime-delete','ime-finish'])controls.push({key:id,rect:await rect(id)});
|
||||
console.log('PROBE_CAPTURE '+JSON.stringify({name:theme+'-'+mode+'-'+(upper?'upper':'lower'),theme:theme,kind:'qwerty',keys:keys,controls:controls}));await tc.wait(1.1);}
|
||||
}
|
||||
p.invalidate();p.secret=false;p.text='';p.cursor=0;p.composition='';p.mode='en';p.upper=false;p.renderKeys();p.updateDisplay();await tc.wait(.2);
|
||||
await tc.getById('ime-key-q').click();await tc.getById('ime-english').click();await tc.wait(.15);check(p.upper,'uppercase enabled');await tc.getById('ime-key-q').click();await tc.getById('ime-english').click();await tc.wait(.15);check(!p.upper,'lowercase restored');await tc.getById('ime-key-q').click();check(p.text==='qQq','actual native keys commit qQq');
|
||||
@@ -81,11 +82,18 @@ def main():
|
||||
state['passed']=abs(state['left_gap_px'])<=1 and abs(state['right_gap_px'])<=1 and 0<caret[2]<=2 and preview[0]<=caret[0]and caret[0]+caret[2]<=preview[0]+preview[2]
|
||||
else:
|
||||
width=466 if profile.startswith('round')else 390;height=466 if profile.startswith('round')else 450;failures=[]
|
||||
widths=[];heights=[]
|
||||
for key in state['keys']:
|
||||
x,y,w,h=rectangle(key['rect'])
|
||||
widths.append(w);heights.append(h)
|
||||
if w<=0 or h<=0 or x<0 or y<0 or x+w>width or y+h>height:failures.append(key['key'])
|
||||
if profile.startswith('round')and max(math.hypot(tx-233,ty-233)for tx in [x,x+w]for ty in [y,y+h])>231:failures.append(key['key'])
|
||||
state.update(failures=failures,passed=len(state['keys'])==26 and not failures)
|
||||
equal=max(widths)-min(widths)<=1 and max(heights)-min(heights)<=1
|
||||
for control in state['controls']:
|
||||
x,y,w,h=rectangle(control['rect'])
|
||||
if w<=0 or h<=0 or x<0 or y<0 or x+w>width or y+h>height:failures.append(control['key'])
|
||||
if profile.startswith('round')and max(math.hypot(tx-233,ty-233)for tx in [x,x+w]for ty in [y,y+h])>231:failures.append(control['key'])
|
||||
state.update(failures=failures,key_width_px=[min(widths),max(widths)],key_height_px=[min(heights),max(heights)],equal_size=equal,passed=len(state['keys'])==26 and not failures and equal)
|
||||
captures+=1;report['cases'].append(state);native.save(args.output/'caret-results.json',report);print(json.dumps(state,ensure_ascii=False),flush=True)
|
||||
if 'PROBE_DONE'in line:finished=True
|
||||
if finished:break
|
||||
|
||||
在新工单中引用
屏蔽一个用户