Private
Public Access
Release 0.12.0
This commit is contained in:
1 parent
f74a658097
commit
7f6eeab39e
48 files changed
+3617
-1266
No files matched your search
@@ -22,6 +22,9 @@ const grant=requests.find(r=>r.uri.includes('hbchannel'));assert.deepEqual(grant
|
||||
const grantCount=requests.filter(r=>r.uri.includes('hbchannel')).length;
|
||||
elements.autostart.onclick();flush();assert(!enabled);assert.equal(requests.filter(r=>r.uri.includes('hbchannel')).length,grantCount);
|
||||
uid=1000;deny=true;elements.autostart.onclick();flush();assert(!enabled && !elements.autostart.disabled && !elements.grantRoot.disabled);assert(elements.error.textContent.includes('could not grant root'));
|
||||
const retainedError=elements.error.textContent;c.call('status',c.display);assert.equal(elements.error.textContent,retainedError);
|
||||
c.showActionError('Invalid receiver settings');c.call('status',c.display);assert.equal(elements.error.textContent,'Invalid receiver settings');
|
||||
deny=false;delayRoot=true;elements.grantRoot.onclick();elements.autostart.onclick();assert(pendingRoot && c.rootWaiters.length===2);
|
||||
delayRoot=false;pendingRoot.onservicecallback(JSON.stringify({returnValue:true}));flush();assert(enabled && !elements.autostart.disabled && !c.rootWaiters.length);
|
||||
assert.equal(c.actionError,'');
|
||||
console.log('PASS: root-required autostart repairs only own service, confirms root after restart, retries setting, avoids unnecessary elevation and reports denial');
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Version drift must fail before an inconsistent package can be built."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import sync_version
|
||||
|
||||
|
||||
class VersionTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.directory = tempfile.TemporaryDirectory()
|
||||
self.previous_root = sync_version.ROOT
|
||||
sync_version.ROOT = Path(self.directory.name)
|
||||
for name in ('app', 'package', 'native'):
|
||||
(sync_version.ROOT / name).mkdir()
|
||||
(sync_version.ROOT / 'VERSION').write_text('1.2.3\n')
|
||||
for name in ('app/appinfo.json', 'package/packageinfo.json'):
|
||||
(sync_version.ROOT / name).write_text(json.dumps({'version': '1.0.0', 'id': 'unchanged'}))
|
||||
|
||||
def tearDown(self):
|
||||
sync_version.ROOT = self.previous_root
|
||||
self.directory.cleanup()
|
||||
|
||||
def test_check_rejects_drift_without_writing(self):
|
||||
with self.assertRaises(ValueError):
|
||||
sync_version.synchronize(check=True)
|
||||
self.assertFalse((sync_version.ROOT / 'native/version.h').exists())
|
||||
|
||||
def test_sync_preserves_metadata_and_produces_runtime_version(self):
|
||||
self.assertEqual(sync_version.synchronize(), '1.2.3')
|
||||
sync_version.synchronize(check=True)
|
||||
app = json.loads((sync_version.ROOT / 'app/appinfo.json').read_text())
|
||||
self.assertEqual(app, {'version': '1.2.3', 'id': 'unchanged'})
|
||||
self.assertIn('"1.2.3"', (sync_version.ROOT / 'native/version.h').read_text())
|
||||
|
||||
def test_invalid_version_is_rejected(self):
|
||||
(sync_version.ROOT / 'VERSION').write_text('1.2\n')
|
||||
with self.assertRaises(ValueError):
|
||||
sync_version.synchronize()
|
||||
|
||||
def test_native_drift_is_rejected(self):
|
||||
sync_version.synchronize()
|
||||
(sync_version.ROOT / 'native/version.h').write_text('old version')
|
||||
with self.assertRaises(ValueError):
|
||||
sync_version.synchronize(check=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
const assert=require('assert'),fs=require('fs'),vm=require('vm');
|
||||
const elements={},events={},requests=[];let active=false,sequence=0,globalResponse=false;
|
||||
const elements={},events={},requests=[];let active=false,sequence=0,globalResponse=false,holdStatus=false,heldStatus=null;
|
||||
['calibrationVideo','cancelCalibration','calibrate','validateCalibration','wizardStatus','customProfile'].forEach(id=>elements[id]={style:{},disabled:false,currentTime:0,textContent:'',value:'',events:{},focus(){},pause(){},play(){return Promise.resolve();},addEventListener(k,f){this.events[k]=f;}});
|
||||
const c={profile:'auto',profileDirty:false,targetDirty:false,showProfile(){},display(){},setInterval(){return 1;},clearInterval(){},setTimeout(){},Date,Array,JSON,
|
||||
window:{addEventListener(k,f){events[k]=f;}},document:{getElementById(id){return elements[id];},addEventListener(k,f){events[k]=f;}},
|
||||
call(method,done,data){
|
||||
requests.push({method,data});if(method==='calibrationSession')active=data.enabled;
|
||||
requests.push({method,data});if(method==='status' && holdStatus){heldStatus=done;return;}if(method==='calibrationSession')active=data.enabled;
|
||||
const t=elements.calibrationVideo.currentTime,step=t<4?-1:Math.floor((t-4)/2);
|
||||
const regions=Array.from({length:16},(_,r)=>{
|
||||
const center=r*2+.5,d=Math.min(Math.abs(step-center),32-Math.abs(step-center));
|
||||
@@ -29,4 +29,6 @@ c.profileDirty=false;globalResponse=true;measure();assert(elements.wizardStatus.
|
||||
globalResponse=false;elements.calibrate.onclick();elements.cancelCalibration.onclick();assert(!active && !c.wizard);
|
||||
elements.validateCalibration.onclick();assert.equal(elements.calibrationVideo.currentTime,68);elements.calibrationVideo.events.ended();assert(!active && elements.wizardStatus.textContent.includes('Top-left red'));
|
||||
elements.calibrate.onclick();let prevented=false;events.keydown({keyCode:461,preventDefault(){prevented=true;}});assert(prevented && !active);
|
||||
elements.calibrate.onclick();holdStatus=true;elements.calibrationVideo.currentTime=1;c.wizardSample();assert(heldStatus);const oldReply=heldStatus;
|
||||
elements.cancelCalibration.onclick();holdStatus=false;elements.calibrate.onclick();const newSession=c.wizard;oldReply({returnValue:false,errorText:'Old failure'});assert.strictEqual(c.wizard,newSession);assert(!c.wizard.busy);elements.cancelCalibration.onclick();
|
||||
console.log('PASS: guided measurement, proposal without save, invalid-response preservation, validation, cancel/Back and scoped remote navigation');
|
||||
Reference in new issue
Block a user