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:
@@ -4,7 +4,9 @@ import { writeFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
|
||||
|
||||
// The image is painted on .workarea-background, not on the empty tab (src/lib/layout/Workbench.svelte:1258, 1543).
|
||||
// The image is painted on .workarea-background, not on the empty tab (src/lib/theme/background.css).
|
||||
// Background (src/lib/features/background/) loads after the first render, so each check waits for the image.
|
||||
const waitForImage = page => page.waitForFunction(() => getComputedStyle(document.querySelector('.workarea-background')).backgroundImage.includes('blob:'));
|
||||
|
||||
await runSmoke('appearance/backgroundImages', async ({ browser }) => {
|
||||
const output = await outputDir('appearance/backgroundImages');
|
||||
@@ -50,7 +52,7 @@ await runSmoke('appearance/backgroundImages', async ({ browser }) => {
|
||||
await main.waitForFunction(() => getComputedStyle(document.querySelector('.workarea-background')).backgroundImage.includes('blob:'));
|
||||
let url = await background();
|
||||
assert.equal(await decoded(main, url), 700, 'The actual new-tab image decodes');
|
||||
await main.reload(); await main.locator('.empty').waitFor();
|
||||
await main.reload(); await main.locator('.empty').waitFor(); await waitForImage(main);
|
||||
url = await background(); assert.equal(await decoded(main, url), 700, 'The saved image survives reload');
|
||||
|
||||
const pixel = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jM1sAAAAASUVORK5CYII=', 'base64');
|
||||
@@ -60,8 +62,7 @@ await runSmoke('appearance/backgroundImages', async ({ browser }) => {
|
||||
await main.waitForFunction(old => /url\("(blob:[^"]+)"\)/.exec(getComputedStyle(document.querySelector('.workarea-background')).backgroundImage)?.[1] !== old, url);
|
||||
url = await background(); assert.equal(await decoded(main, url), 1, '50 MiB image decodes');
|
||||
assert.ok(await settings.evaluate(() => JSON.stringify(window.__TEST__.settings('appearance')).length < 500), 'Image bytes stay outside the settings file');
|
||||
await main.reload(); await main.locator('.empty').waitFor();
|
||||
await main.waitForFunction(() => getComputedStyle(document.querySelector('.workarea-background')).backgroundImage.includes('blob:'));
|
||||
await main.reload(); await main.locator('.empty').waitFor(); await waitForImage(main);
|
||||
url = await background(); assert.equal(await decoded(main, url), 1, '50 MiB image survives reload');
|
||||
|
||||
const acceptedId = await savedImageId();
|
||||
|
||||
Reference in New Issue
Block a user