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:
@@ -88,6 +88,18 @@ export async function chooseView(scope, name) {
|
||||
return scope.getByRole("radiogroup", { name: "View", exact: true }).getByRole("radio", { name, exact: true }).click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the image source of Background, so that the saved image of `appearance.newTabBackground` shows
|
||||
* (src/lib/features/backgroundSettings.ts). Call it after the test saves an image. It waits until the frame is on the body.
|
||||
*/
|
||||
export async function showSavedImage(page) {
|
||||
await page.evaluate(async () => {
|
||||
const { readBackground, writeBackground } = await import("/src/lib/features/backgroundSettings.ts");
|
||||
await writeBackground({ ...readBackground(), source: "image" });
|
||||
});
|
||||
await page.waitForFunction(() => document.body.style.getPropertyValue("--rs-background-image").includes("blob:"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock the Tauri IPC layer before the app loads. The mock handles the event plugin.
|
||||
*
|
||||
@@ -195,7 +207,7 @@ function installMock(options, commands) {
|
||||
if (target !== pageId) channel.postMessage({ event, payload, target });
|
||||
};
|
||||
const SETTINGS_FILE = "runestone.smoke.settings-file", TRANSFERS = "runestone.smoke.tab-transfers";
|
||||
const SECTIONS = ["general", "appearance", "customThemes", "customThemesLegacy", "language", "features"];
|
||||
const SECTIONS = ["general", "appearance", "customThemes", "customThemesLegacy", "language", "features", "background"];
|
||||
const readJson = (key, fallback) => { try { return JSON.parse(localStorage.getItem(key)) ?? fallback; } catch { return fallback; } };
|
||||
const settingsFile = () => readJson(SETTINGS_FILE, null);
|
||||
const snapshot = () => {
|
||||
@@ -227,6 +239,9 @@ function installMock(options, commands) {
|
||||
features_legacy: () => [],
|
||||
// The editor asks for the Git line of the cursor while the Git feature is on. Tests of Git replace it.
|
||||
git_blame: () => null,
|
||||
// src-tauri/src/backgrounds.rs: the host has no background folder. Tests of the Background folder replace these.
|
||||
background_folder: () => null,
|
||||
background_migrate: () => null,
|
||||
settings_migrate: ({ sections }) => {
|
||||
if (!settingsFile()) localStorage.setItem(SETTINGS_FILE, JSON.stringify({ schema: 1, revision: 1, ...sections }));
|
||||
return snapshot();
|
||||
|
||||
Reference in New Issue
Block a user