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,4 @@
|
||||
// The empty tab background image: set it in Settings, keep it after a reload, remove it, and leave Reset background disabled.
|
||||
// The empty tab background image: set it in Settings, keep it after a reload, and remove it. The source stays Image.
|
||||
import assert from "node:assert/strict";
|
||||
import path from "node:path";
|
||||
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
@@ -24,13 +24,14 @@ await runSmoke(name, async ({ browser }) => {
|
||||
await settings.goto(smokeUrl + "/?settingsWindow=true");
|
||||
await settings.getByRole("button", { name: "Appearance", exact: true }).click();
|
||||
const png = Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jM1sAAAAASUVORK5CYII=", "base64");
|
||||
// The image now lives on the work area layer behind the empty tab (src/lib/layout/Workbench.svelte:1258, :1543-1549).
|
||||
// The image lives on the work area layer behind the empty tab (src/lib/theme/background.css).
|
||||
const layer = ".workarea-background";
|
||||
await settings.getByLabel("Background image file", { exact: true }).setInputFiles({ name: "test.png", mimeType: "image/png", buffer: png });
|
||||
await page.waitForFunction(layer => getComputedStyle(document.querySelector(layer)).backgroundImage.includes("blob:"), layer);
|
||||
assert.equal(await page.evaluate(() => window.__TEST__.settings("background").source), "image", "A chosen image selects the image source");
|
||||
await page.reload();
|
||||
await page.locator(".empty").waitFor();
|
||||
assert.ok(await page.locator(layer).evaluate(node => getComputedStyle(node).backgroundImage.includes("blob:")), "Background survives restart");
|
||||
await page.waitForFunction(layer => getComputedStyle(document.querySelector(layer)).backgroundImage.includes("blob:"), layer);
|
||||
await settings.getByRole("button", { name: "Remove image", exact: true }).click();
|
||||
await page.waitForFunction(layer => getComputedStyle(document.querySelector(layer)).backgroundImage === "none", layer);
|
||||
for (const mode of ["light", "dark"]) {
|
||||
@@ -42,8 +43,10 @@ await runSmoke(name, async ({ browser }) => {
|
||||
await settings.setViewportSize({ width: 650, height: 760 });
|
||||
await settings.screenshot({ path: path.join(output, `appearance-${mode}-narrow.png`) });
|
||||
}
|
||||
assert.equal(await settings.getByRole("button", { name: "Reset background", exact: true }).isDisabled(), true);
|
||||
assert.equal(await settings.getByRole("button", { name: "Reset background", exact: true }).count(), 0);
|
||||
assert.equal(await settings.getByRole("button", { name: "Background source", exact: true }).innerText(), "Image");
|
||||
assert.equal(await settings.getByRole("button", { name: "Choose image…", exact: true }).count(), 1);
|
||||
await page.waitForFunction(() => !window.__TEST__.settings("appearance").newTabBackground);
|
||||
assert.deepEqual([...page.errors, ...settings.errors], []);
|
||||
console.log("PASS: background image applies, survives a reload, and is removed; Reset background is disabled");
|
||||
console.log("PASS: background image applies, survives a reload, and is removed; the image source stays selected");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user