fix(camera): make lighting checks advisory only
This commit is contained in:
@@ -55,15 +55,17 @@ assert(check(face(-45), { target: 'left' }).ok);
|
||||
assert(check(face(-45), { target: 'right', mirrored: true }).ok);
|
||||
assert(check(face(-45), { target: 'right', ignoreDirection: true }).ok);
|
||||
assert(!check(face(23), { target: 'left', ignoreDirection: true }).ok);
|
||||
for (const luma of [null, 50, 240, NaN]) assert(!check(face(), { luma }).ok);
|
||||
assert.equal(check(face(), { luma: 50 }).reason, 'quality', 'lighting must not trigger angle vibration');
|
||||
for (const luma of [null, 0, 50, 240, 255, NaN]) assert(check(face(), { luma }).ok, 'lighting is advisory, not blocking');
|
||||
assert.equal(check(face(), { luma: 50 }).reason, undefined, 'lighting must not trigger angle vibration');
|
||||
assert.equal(check(null).reason, 'quality');
|
||||
assert.equal(check(face(), { count: 2 }).reason, 'quality');
|
||||
const brokenLandmarks = face(); brokenLandmarks.landmarks.positions = [];
|
||||
assert.equal(check(brokenLandmarks).reason, 'quality', 'unreadable pose is not confirmed wrong angle');
|
||||
for (const luma of [110,110.01,120,149.99,180,219.99,220]) assert(check(face(), { luma }).ok);
|
||||
for (const luma of [65,100,109.99]) assert.equal(check(face(),{luma}).hint,'请到光线充足处');
|
||||
for (const luma of [220.01,235,255]) assert.equal(check(face(),{luma}).hint,'光线过强,请避开强光');
|
||||
for (const target of ['front','left','right']) for (const luma of [0,65,100,109.99,110,220,220.01,235,255,null,NaN]) {
|
||||
const verdict=check(face(target==='front'?0:target==='left'?-45:45),{target,luma});
|
||||
assert(verdict.ok);assert.equal(verdict.warning,Number.isFinite(luma)&&luma<110?'建议到光线明亮处拍摄':Number.isFinite(luma)&&luma>220?'光线过强,建议避开强光':'');
|
||||
}
|
||||
assert(check(face(), { offsetX: .15 }).ok);
|
||||
assert(!check(face(), { offsetX: .17 }).ok);
|
||||
for (const changes of [{ height: 190 }, { height: 400 }, { y: 8 }]) {
|
||||
@@ -121,7 +123,7 @@ assert.equal(Diagnostics.assess(raw).views.right.status, 'valid');
|
||||
const normalized = Diagnostics.normalize({ version: Quality.config.version, secret: 'discard', views: { front: { mode: 'live', yaw: 1, score: .9, luma: Infinity, secret: 'discard' }, left: { mode: 'unchecked', reason: 'model-unavailable' } } });
|
||||
assert.equal(normalized.policy.capture.holdMs, 450);
|
||||
assert.equal(normalized.policy.capture.minFrames, 2);
|
||||
assert.equal(normalized.version, '2026-10-16-confidence-v9');
|
||||
assert.equal(normalized.version, '2026-10-16-light-advisory-v10');
|
||||
assert.equal(normalized.views.front.luma, undefined);
|
||||
assert(!JSON.stringify(normalized).includes('discard'));
|
||||
assert.equal(Diagnostics.normalize({ version: '<script>' }).version, 'unknown');
|
||||
|
||||
Reference in New Issue
Block a user