Fix unsolicited radial menu activation by retiring global drag detection

This commit is contained in:
nordik committed 2026-10-27 12:13:15 +01:00
1 parent 569f0324d6
commit e3c9581f3e
19 files changed
+112 -88

No files matched your search

+7
View File
@@ -10,6 +10,8 @@ const root=path.resolve(__dirname,'..'),out=path.join(root,'test-results');
(async()=>{
await fs.mkdir(out,{recursive:true});
const profile=await fs.mkdtemp(path.join(out,'profile-'));
// An upgraded profile must not restore the retired automatic drag trigger.
await fs.writeFile(path.join(profile,'settings.json'),JSON.stringify({dragWheel:true}));
const app=await electron.launch({executablePath:process.env.FILEBOW_EXECUTABLE||require('electron'),args:process.env.FILEBOW_EXECUTABLE?[]:[root],env:{...process.env,FILEBOW_TEST:'1',FILEBOW_USER_DATA:profile},timeout:30000});
const errors=[];app.on('window',window=>window.on('pageerror',error=>errors.push(error.message)));
app.process().stderr.on('data',data=>{const text=data.toString();if(/Error|Exception/.test(text))process.stderr.write(text);});
@@ -19,6 +21,11 @@ const root=path.resolve(__dirname,'..'),out=path.join(root,'test-results');
assert.equal(await page.locator('html').getAttribute('lang'),'en');
assert.equal(await app.evaluate(({app})=>app.getLocale()),'en-US');
const state=await page.evaluate(()=>window.orbit.state());assert.equal(state.name,'FileBow');assert.ok(state.native.available,state.native.error);
assert.equal(Object.hasOwn(state.settings,'dragWheel'),false);
assert.equal(await page.locator('[data-setting="dragWheel"]').count(),0);
const legacySettings=await page.evaluate(()=>window.orbit.settings({dragWheel:true}));
assert.equal(Object.hasOwn(legacySettings.settings,'dragWheel'),false);
assert.equal(Object.hasOwn(JSON.parse(await fs.readFile(path.join(profile,'settings.json'),'utf8')),'dragWheel'),false);
const textFile=path.join(out,'Beispiel.txt');await fs.writeFile(textFile,'FileBow\nGrüße aus Köln.\nLokale Dateikonvertierung.');
await page.evaluate(file=>window.orbit.selectFiles([file]),textFile);
await page.locator('[data-action="convert-pdf"]').click();