Make Background a native feature
- Background replaces the Background Slideshow plugin and the background image of Appearance. It shows a folder as a slideshow, or one image. - It is on by default. Its module loads at launch only when a folder or an image is chosen. - Rust keeps the one folder in background-folder.json. The interface never sends a path. Eight background_* commands replace the six deprecated backgrounds_* commands. - The first start moves the slideshow folder and settings, and keeps the saved image as the image source. - One blur worker with a cache, fewer folder reads, and a decode before each fade. The hub writes only the changed properties. - Remove the deprecated folder methods of api.backgrounds. set, get, and subscribe stay for the Project Management plugin. - Show the view buttons in the workbench test without text, after UI-056. - Update the tests, the measurement tool, the docs, and UI-057.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// Theme variants: transparency slider in eight variants, custom theme fonts, a single tooltip, and slideshow command icons.
|
||||
// Theme variants: transparency slider in eight variants, custom theme fonts, a single tooltip, plugin command icons,
|
||||
// and the native Background commands in the command palette.
|
||||
import assert from 'node:assert/strict';
|
||||
import path from 'node:path';
|
||||
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
|
||||
@@ -53,13 +54,21 @@ await runSmoke('appearance/themeVariants', async ({ browser }) => {
|
||||
const main = await openPage(context); await main.goto(smokeUrl);
|
||||
await main.bringToFront();
|
||||
await main.getByRole('button', { name: 'Files', exact: true }).waitFor();
|
||||
// The commands of the native Background feature (src/lib/features/catalog.ts) are in the command palette, without the feature code.
|
||||
await main.keyboard.press('Control+Shift+P');
|
||||
const palette = main.getByRole('dialog', { name: 'Commands', exact: true });
|
||||
await palette.getByRole('textbox', { name: 'Find a command', exact: true }).fill('background');
|
||||
for (const title of ['Next background image', 'Pause background']) await palette.getByRole('button').filter({ hasText: title }).first().waitFor();
|
||||
assert.equal(await main.evaluate(async () => (await import('/src/lib/features/loader.ts')).featureRequested('background')), false, 'The palette lists the commands without the feature code');
|
||||
await main.keyboard.press('Escape');
|
||||
// A third-party plugin with command icons. The Commands menu lists plugin commands only (src/lib/plugins/PluginAccessMenu.svelte).
|
||||
await main.evaluate(async () => {
|
||||
const loaded = performance.getEntriesByType('resource').map(entry => entry.name).find(name => new URL(name).pathname === '/src/lib/plugins/external.ts');
|
||||
const { pluginTools, refreshPlugins } = await import(loaded || '/src/lib/plugins/external.ts');
|
||||
await refreshPlugins();
|
||||
const invoke = window.__TAURI_INTERNALS__.invoke;
|
||||
window.__TAURI_INTERNALS__.invoke = (command, args) => command === 'plugins_snapshot' ? Promise.resolve(null) : invoke(command, args);
|
||||
const commands = [{ owner: 'runestone.background-slideshow', id: 'next-image', title: 'Next background image', kind: 'command', surface: 'commands', icon: 'skip-forward' }, { owner: 'runestone.background-slideshow', id: 'pause-resume', title: 'Pause or resume background slideshow', kind: 'command', surface: 'commands', icon: 'pause' }];
|
||||
const commands = [{ owner: 'org.test.slideshow', id: 'next-image', title: 'Next test image', kind: 'command', surface: 'commands', icon: 'skip-forward' }, { owner: 'org.test.slideshow', id: 'pause-resume', title: 'Pause or resume test slideshow', kind: 'command', surface: 'commands', icon: 'pause' }];
|
||||
pluginTools.set(commands);
|
||||
});
|
||||
const visibleTooltips = () => main.locator('[role=tooltip]:visible').count();
|
||||
@@ -77,7 +86,7 @@ await runSmoke('appearance/themeVariants', async ({ browser }) => {
|
||||
await button.click(); await main.getByRole('menu').waitFor();
|
||||
const paths = await main.locator('.rs-menu svg').evaluateAll(nodes => nodes.map(node => node.innerHTML));
|
||||
assert(paths.some(path => path.includes('M7 4v16'))); assert(paths.some(path => path.includes('m4 4 12 8')));
|
||||
await main.screenshot({ path: path.join(output, `${mode}-slideshow-command-icons.png`) }); await main.keyboard.press('Escape');
|
||||
await main.screenshot({ path: path.join(output, `${mode}-plugin-command-icons.png`) }); await main.keyboard.press('Escape');
|
||||
}
|
||||
assert.deepEqual([...page.errors, ...main.errors], []);
|
||||
console.log('PASS: eight theme variants, slider endpoints, persistence, disabled states, narrow layout, font import/export, single tooltip, and command icons.');
|
||||
|
||||
Reference in New Issue
Block a user