Wunsch Maintainer 17.11.: Umbau-Farben nicht mehr hart, Farbe oder Stift wählbar, weniger leuchtendes Gelb und Rot. Vorgabe (renovation::default_style, eine Stelle für Plan, Schnitt, Ansicht, Axo, 3D, Cycles-Umbaufarben, Panel): Abbruch #e8c35a statt #ffd800, Neu #c8524a mit Linie #9e3a33 statt #e3001b/#c00016, Bestand #a6a6a6 unverändert. Begründung im Bild (doc/review-275/01, 01b, 02): Ocker bleibt auf weissem Papier klar gelb und neben dem Grau unterscheidbar, hat aber mehr Kontrast als das Signalgelb (Leuchtdichte ~0.58 statt ~0.70); das Ziegelrot ist ruhig, die Wand-Füllung deutlich gegen den grauen Bestand. Richtwerte unverändert übernommen. Eine eigene Abbruch-Linie (dunkles Ocker #ad8a2c) wurde ausprobiert: Möbel und Baum „zu fällen“ werden kräftiger, aber die Wandkontur wird ocker statt schwarz gestrichelt und verschwimmt mit der Füllung — darum Linie weiter „wie ohne Filter“ (dünnes Abbruch-Strichwerk bleibt blass, offen in TODO). Modell (Rust, gen:types): RenovationStyle.fillPen/linePen (ColorPen-Id; Farbe aus dem aktiven Stiftsatz beim Lesen, nicht eingebacken: ein S/W-Stiftsatz färbt den Umbauplan um; Stift ohne Eintrag ⇒ freie Farbe/Vorgabe), RenovationPhase.styles (eigene Farben der Etappe über der Projektfarbe). Kern: renovation::style/phase_style/apply_own, View.phase_styles; View::treat nimmt die Etappen-Farbe, solange das Element seinen eigenen Status zeigt (im Stand einer späteren Etappe ist es Bestand), Ersatzstücke nach der Etappe ihrer Öffnung, Sanierung je Schicht über treat; colors() (Tusche behält Farben) und key() mit Etappen-Farben. Abfrage renovationStyles (Vorgabe, Projekt, Etappen aufgelöst) — TS rechnet keine Farben mehr (DEFAULT_RENOVATION_STYLES entfernt, renovationStyleOf fragt den Kern). project_refs prüft die Stifte. Oberfläche: gemeinsamer Editor ui/RenovationStyleEditor.tsx mit dem PenColorField der App (Frei/Stift), gestrichelt, Zurücksetzen je Status — im Umbau-Panel (Abschnitt „Darstellung“, Knopf „SIA-Vorgabe“; je Etappe ein Farbmuster-Knopf mit eigenem Editor und „Farben des Projekts verwenden“) und im Ressourcen-Tab „Umbau“ (ersetzt die input type=color). Ops setRenovationStylesOps/setPhaseStylesOps/patchRenovationStyles (Farbe und Stift schliessen sich aus). Statusleisten-Punkt in der Projektfarbe (useRenovationSwatches, hört nur auf Umbau/Stiftsätze). CSS-Muster über --reno-*. Beispiel :umbau: Etappe 2 (Anbau) Neu gedämpft blau #5b84b1. Geprüft: Kern cargo test --release (1913 + robustness 14) und --features web robustness_web (3) grün, neu renovation_style_tests (6); WASM build:core --no-opt; tsc; vitest gesamt 3640 grün (neu model/renovationStyles.test.ts), Goldens ohne Änderung (kein Golden mit Umbau-Farben); e2e renovation271, renovationPanel271, renovation274, renderCount (43 Renders je Wand-Änderung, unverändert) und neu renovationStyles275 grün (Port 5196). Angesehen: CLI-SVG --hatch Grundriss EG 1:50 und Schnitt C vorher/nachher, Etappe 2 blau, Panel hell/dunkel im Browser-Build (Chromium/Linux). Nicht geprüft: Tauri/Mac, 3D-Fenster (render3d) und Cycles-Bild mit den neuen Farben (nur über Tests), Ressourcen-Tab nur per tsc (nicht angesehen).
117 lines
6.0 KiB
TypeScript
117 lines
6.0 KiB
TypeScript
// [275] Umbau-Panel, Abschnitt „Darstellung“: Farbe einer Status-Füllung ändern (Plan folgt, Undo), Stift statt Farbe,
|
|
// „SIA-Vorgabe“, gestrichelt beim Abbruch, eigene Farbe einer Etappe. Port: E2E_PORT=5196.
|
|
import type { Locator, Page } from "@playwright/test";
|
|
import { blurFocus, commandInput, expect, finishCommand, openTab, test, typeCommand } from "./app";
|
|
|
|
test.use({ viewport: { width: 1280, height: 900 } });
|
|
|
|
const RED = "#c8524a";
|
|
const OWN = "#336699";
|
|
const PHASE = "#5b84b1";
|
|
|
|
/** Füllfarbe im Popover des Farb-/Stiftfelds als Hex setzen. */
|
|
async function setHex(page: Page, field: Locator, hex: string) {
|
|
const pop = page.locator(".pen-color-popover");
|
|
await field.scrollIntoViewIfNeeded();
|
|
// Ein Scrollen des Panels schliesst das Popover (PenColorField): bis es offen bleibt.
|
|
await expect(async () => {
|
|
if (!(await pop.isVisible())) await field.locator(".pen-color-swatch").click();
|
|
await expect(pop).toBeVisible({ timeout: 1000 });
|
|
}).toPass({ timeout: 10_000 });
|
|
await pop.getByRole("button", { name: "Frei", exact: true }).click();
|
|
await pop.locator("input.pen-color-input").fill(hex);
|
|
await page.keyboard.press("Escape");
|
|
await page.mouse.click(5, 895);
|
|
}
|
|
|
|
test("Umbau-Panel Darstellung: Farbe oder Stift je Status, SIA-Vorgabe, Etappen-Farbe ([275])", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
await page.goto("/?dossierTest");
|
|
await page.getByRole("button", { name: /Neues Projekt/ }).first().click();
|
|
await expect(page.getByRole("group", { name: "Befehlszeile" })).toBeVisible();
|
|
const ren = () => page.evaluate(() => window.__dossierTest!.renovation());
|
|
const fills = async () => Object.keys(await page.evaluate(() => window.__dossierTest!.planFillColors()));
|
|
|
|
await openTab(page, "Umbau");
|
|
const panel = page.getByTestId("renovation-dock");
|
|
await panel.getByTestId("reno-draw-new").click();
|
|
await page.getByRole("button", { name: "Wand", exact: true }).click();
|
|
await commandInput(page).focus();
|
|
await typeCommand(page, "0,0");
|
|
await typeCommand(page, "5,0");
|
|
await finishCommand(page);
|
|
await blurFocus(page);
|
|
await panel.getByTestId("reno-filter-umbauplan").click();
|
|
await expect.poll(fills).toContain(RED);
|
|
|
|
// Abschnitt Darstellung: Neu zeigt die gedämpfte Vorgabe.
|
|
const styles = panel.getByTestId("reno-styles");
|
|
await expect(styles).toBeVisible();
|
|
const rowNew = styles.getByTestId("reno-style-new");
|
|
await expect(rowNew).toHaveAttribute("data-fill", RED);
|
|
await expect(styles.getByTestId("reno-style-sia")).toBeDisabled();
|
|
await styles.scrollIntoViewIfNeeded();
|
|
await page.screenshot({ path: "test-results/renovation275-darstellung-hell.png" });
|
|
|
|
// Freie Farbe: Plan folgt; ein Undo-Schritt stellt zurück.
|
|
await setHex(page, styles.getByTestId("reno-style-new-fill"), OWN);
|
|
await expect(rowNew).toHaveAttribute("data-fill", OWN);
|
|
await expect.poll(fills).toContain(OWN);
|
|
await expect.poll(fills).not.toContain(RED);
|
|
await blurFocus(page);
|
|
await page.keyboard.press("ControlOrMeta+z");
|
|
await expect(rowNew).toHaveAttribute("data-fill", RED);
|
|
await expect.poll(fills).toContain(RED);
|
|
|
|
// Stift statt Farbe: die Füllung nimmt die Farbe des Stifts im aktiven Stiftsatz; Plan zeigt sie.
|
|
await styles.getByTestId("reno-style-new-fill").locator(".pen-color-swatch").click();
|
|
const pop = page.locator(".pen-color-popover");
|
|
await pop.getByRole("button", { name: "Stift", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
await page.mouse.click(5, 895);
|
|
await expect(styles.getByTestId("reno-style-new-fill").locator(".pen-color-badge")).toBeVisible();
|
|
const penFill = await rowNew.getAttribute("data-fill");
|
|
expect(penFill).toMatch(/^#[0-9a-f]{6}$/i);
|
|
await expect.poll(fills).toContain(penFill!);
|
|
|
|
// SIA-Vorgabe setzt alles zurück.
|
|
await expect(styles.getByTestId("reno-style-sia")).toBeEnabled();
|
|
await styles.getByTestId("reno-style-sia").click();
|
|
await expect(rowNew).toHaveAttribute("data-fill", RED);
|
|
await expect(styles.getByTestId("reno-style-sia")).toBeDisabled();
|
|
await expect.poll(fills).toContain(RED);
|
|
|
|
// Gestrichelt nur beim Abbruch angeboten.
|
|
await expect(styles.getByTestId("reno-style-demolish-dashed")).toBeChecked();
|
|
await expect(styles.getByTestId("reno-style-new-dashed")).toHaveCount(0);
|
|
await styles.getByTestId("reno-style-demolish-dashed").uncheck();
|
|
await expect(styles.getByTestId("reno-style-demolish")).toHaveAttribute("data-dashed", "false");
|
|
await styles.getByTestId("reno-style-demolish-reset").click();
|
|
await expect(styles.getByTestId("reno-style-demolish")).toHaveAttribute("data-dashed", "true");
|
|
|
|
// Etappe mit eigener Farbe: Wand in Etappe 1, deren Neu-Farbe blau.
|
|
await panel.getByTestId("reno-phase-add").click();
|
|
const wallId = Object.keys((await ren()).walls)[0];
|
|
await page.evaluate((id) => window.__dossierTest!.select({ walls: [id] }), wallId);
|
|
const phaseId = await panel.getByTestId("reno-sel-phase").locator("option").nth(1).getAttribute("value");
|
|
await panel.getByTestId("reno-sel-phase").selectOption(phaseId!);
|
|
await panel.getByTestId("reno-phase-style").click();
|
|
const phaseBox = panel.getByTestId("reno-phase-styles");
|
|
await expect(phaseBox).toBeVisible();
|
|
await setHex(page, phaseBox.getByTestId("reno-phase-style-new-fill"), PHASE);
|
|
await expect(phaseBox.getByTestId("reno-phase-style-new")).toHaveAttribute("data-fill", PHASE);
|
|
await expect.poll(fills).toContain(PHASE);
|
|
await expect.poll(fills).not.toContain(RED);
|
|
// Projektfarbe bleibt unverändert.
|
|
await expect(rowNew).toHaveAttribute("data-fill", RED);
|
|
await phaseBox.scrollIntoViewIfNeeded();
|
|
await page.screenshot({ path: "test-results/renovation275-etappe.png" });
|
|
await page.evaluate(() => document.documentElement.setAttribute("data-theme", "dark"));
|
|
await styles.scrollIntoViewIfNeeded();
|
|
await page.screenshot({ path: "test-results/renovation275-darstellung-dunkel.png" });
|
|
await page.evaluate(() => document.documentElement.setAttribute("data-theme", "light"));
|
|
await phaseBox.getByTestId("reno-phase-style-reset").click();
|
|
await expect.poll(fills).toContain(RED);
|
|
await expect.poll(fills).not.toContain(PHASE);
|
|
});
|