From 7f4fedb83d3116c3188ea385e028257570f88791 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 19:55:04 +0000 Subject: [PATCH 1/3] App name: the internal names neutral, the literal ones held by a test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The names nobody outside the process reads carry no name: the script host's argument is `--script-host`, the prelude's entry points `__prelude`, the network thread `network`, an in-memory library's folder `in-memory-library-…`. The `DEVNOTES_` variables stay, the owner's choice. The names Cargo and the file system keep literal (the binary, the packager's, the deb's and the rpm's names and paths, the desktop entry, the copyright, the master icon) are held by `crates/app/tests/names.rs`: it fails while one differs from the values. Part of #1896 (steps 5, 6) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BbVs5tCyTr9AasGra3Zzg3 --- crates/app/Cargo.toml | 2 + crates/app/tests/names.rs | 69 +++++++++++++++++++ crates/engine/src/bin/script-host.rs | 2 +- crates/engine/src/db.rs | 2 +- crates/engine/src/http/scripts/child.rs | 2 +- crates/engine/src/http/scripts/engine.rs | 10 +-- crates/engine/src/http/scripts/prelude.js | 2 +- crates/ui/src/backend.rs | 2 +- docs/architecture/engine.md | 2 +- .../http/environments-and-scripts.md | 2 +- docs/architecture/logs.md | 2 +- docs/architecture/overview.md | 8 +++ 12 files changed, 92 insertions(+), 13 deletions(-) create mode 100644 crates/app/tests/names.rs diff --git a/crates/app/Cargo.toml b/crates/app/Cargo.toml index 86f7eba11..f061716da 100644 --- a/crates/app/Cargo.toml +++ b/crates/app/Cargo.toml @@ -106,6 +106,8 @@ image.workspace = true resvg.workspace = true tempfile.workspace = true tokio = { workspace = true, features = ["rt-multi-thread"] } +# `tests/names.rs`, which reads the manifest's literal names. +toml.workspace = true [lints] workspace = true diff --git a/crates/app/tests/names.rs b/crates/app/tests/names.rs new file mode 100644 index 000000000..490657637 --- /dev/null +++ b/crates/app/tests/names.rs @@ -0,0 +1,69 @@ +//! The names Cargo and the file system keep literal (D36): edited by hand at a rename, each is +//! held here against the values, so that none is left behind. + +use std::path::{Path, PathBuf}; + +fn here(file: &str) -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")).join(file) +} + +fn read(file: &str) -> String { + std::fs::read_to_string(here(file)).unwrap() +} + +/// A path with the slug written `{slug}`: one still spelling another slug stays as it was. +fn shaped(path: &toml::Value) -> String { + path.as_str().unwrap().replace(brand::SLUG, "{slug}") +} + +#[test] +fn the_binary_and_the_packages_are_named_by_the_values() { + let manifest: toml::Table = toml::from_str(&read("Cargo.toml")).unwrap(); + let metadata = &manifest["package"]["metadata"]; + let packager = &metadata["packager"]; + let rpm = &metadata["generate-rpm"]; + + assert_eq!(manifest["bin"][0]["name"].as_str(), Some(brand::SLUG)); + assert_eq!(packager["product-name"].as_str(), Some(brand::NAME)); + assert_eq!(packager["identifier"].as_str(), Some(brand::IDENTIFIER)); + assert_eq!(packager["binaries"][0]["path"].as_str(), Some(brand::SLUG)); + assert_eq!(packager["deb"]["package-name"].as_str(), Some(brand::SLUG)); + assert_eq!(rpm["name"].as_str(), Some(brand::SLUG)); + + let mut deb: Vec = packager["deb"]["files"].as_table().unwrap().values().map(shaped).collect(); + deb.sort(); + assert_eq!(deb, ["usr/share/doc/{slug}/changelog.gz", "usr/share/doc/{slug}/copyright"]); + let assets: Vec = rpm["assets"] + .as_array() + .unwrap() + .iter() + .map(|asset| format!("{} → {}", shaped(&asset["source"]), shaped(&asset["dest"]))) + .collect(); + assert_eq!( + assets, + [ + "target/release/{slug} → /usr/bin/{slug}", + "packaging/{slug}.desktop → /usr/share/applications/{slug}.desktop", + "icons/32x32.png → /usr/share/icons/hicolor/32x32/apps/{slug}.png", + "icons/128x128.png → /usr/share/icons/hicolor/128x128/apps/{slug}.png", + "icons/icon.png → /usr/share/icons/hicolor/512x512/apps/{slug}.png", + "../../LICENSE → /usr/share/licenses/{slug}/LICENSE", + "target/release/notes/changelog.gz → /usr/share/doc/{slug}/changelog.gz", + ] + ); +} + +#[test] +fn the_desktop_entry_the_copyright_and_the_icon_are_named_by_the_values() { + let entry = read(&format!("packaging/{}.desktop", brand::SLUG)); + let copyright = read("packaging/copyright"); + + for line in + [format!("Exec={}", brand::SLUG), format!("Icon={}", brand::SLUG), format!("Name={}", brand::NAME)] + { + assert!(entry.lines().any(|written| written == line), "{line}"); + } + let upstream = format!("Upstream-Name: {}", brand::NAME); + assert!(copyright.lines().any(|written| written == upstream), "{upstream}"); + assert!(here(&format!("icons/{}.svg", brand::SLUG)).is_file()); +} diff --git a/crates/engine/src/bin/script-host.rs b/crates/engine/src/bin/script-host.rs index 46a854c00..0bc55dc97 100644 --- a/crates/engine/src/bin/script-host.rs +++ b/crates/engine/src/bin/script-host.rs @@ -1,5 +1,5 @@ //! The script host alone, for this crate's tests: the application relaunches itself with -//! `--devnotes-script-host`, but no application binary is built here. +//! `--script-host`, but no application binary is built here. fn main() { std::process::exit(engine::serve_scripts()); diff --git a/crates/engine/src/db.rs b/crates/engine/src/db.rs index f2e1b15eb..f66c4a0c5 100644 --- a/crates/engine/src/db.rs +++ b/crates/engine/src/db.rs @@ -228,7 +228,7 @@ pub fn open_in_memory() -> Result { connection, vault: Arc::new(test_vault()?), // Named, never created: a test writing beside the library fails loudly. - directory: std::env::temp_dir().join(format!("devnotes-in-memory-{}", uuid::Uuid::new_v4())), + directory: std::env::temp_dir().join(format!("in-memory-library-{}", uuid::Uuid::new_v4())), number: next_number(), }) } diff --git a/crates/engine/src/http/scripts/child.rs b/crates/engine/src/http/scripts/child.rs index 7764791f1..66ac8bc03 100644 --- a/crates/engine/src/http/scripts/child.rs +++ b/crates/engine/src/http/scripts/child.rs @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize}; use super::engine::{Engine, Host}; use super::model::{FailureKind, Job, LogEntry, Outcome, ScriptFailure}; -pub const ARG: &str = "--devnotes-script-host"; +pub const ARG: &str = "--script-host"; /// The thread `QuickJS` runs on: a script that recurses meets its own limit long before the /// thread's end. diff --git a/crates/engine/src/http/scripts/engine.rs b/crates/engine/src/http/scripts/engine.rs index 9be8e6197..f4af8cb01 100644 --- a/crates/engine/src/http/scripts/engine.rs +++ b/crates/engine/src/http/scripts/engine.rs @@ -194,14 +194,14 @@ fn drive(ctx: &Ctx<'_>, job: &Job, deadline: Instant, time: Duration) -> Outcome Err(failure) => return Outcome::failed(failure), }; let started = (|| -> rquickjs::Result<(Promise<'_>, Loop<'_>)> { - let devnotes: Object<'_> = ctx.globals().get("__devnotes")?; - let phase: Function<'_> = devnotes.get("phase")?; + let prelude: Object<'_> = ctx.globals().get("__prelude")?; + let phase: Function<'_> = prelude.get("phase")?; let given = ctx.json_parse(serde_json::to_string(job).unwrap_or_default())?; let promise: Promise<'_> = phase.call((given, functions))?; let driven = Loop { - next_timer: devnotes.get("nextTimer")?, - fire_timers: devnotes.get("fireTimers")?, - wake_idle: devnotes.get("wakeIdle")?, + next_timer: prelude.get("nextTimer")?, + fire_timers: prelude.get("fireTimers")?, + wake_idle: prelude.get("wakeIdle")?, }; Ok((promise, driven)) })(); diff --git a/crates/engine/src/http/scripts/prelude.js b/crates/engine/src/http/scripts/prelude.js index f02a0d2de..0c135d6ba 100644 --- a/crates/engine/src/http/scripts/prelude.js +++ b/crates/engine/src/http/scripts/prelude.js @@ -1597,5 +1597,5 @@ }); } - define(global, '__devnotes', { phase, nextTimer, fireTimers, wakeIdle }); + define(global, '__prelude', { phase, nextTimer, fireTimers, wakeIdle }); })(globalThis.__native); diff --git a/crates/ui/src/backend.rs b/crates/ui/src/backend.rs index 78f7a97b5..ede44b29b 100644 --- a/crates/ui/src/backend.rs +++ b/crates/ui/src/backend.rs @@ -79,7 +79,7 @@ impl Backend { ) -> std::io::Result { let runtime = tokio::runtime::Builder::new_multi_thread() .worker_threads(2) - .thread_name("devnotes-network") + .thread_name("network") .enable_all() .build()?; let engine = Arc::new(Engine::new(paths, events, runtime.handle().clone())); diff --git a/docs/architecture/engine.md b/docs/architecture/engine.md index 2493d63d3..8ec8632c4 100644 --- a/docs/architecture/engine.md +++ b/docs/architecture/engine.md @@ -23,7 +23,7 @@ restoring a copy closes the sockets and cancels the sends and runs first ### The binary, its profile and its window -`crates/app` builds `devnotes`. `main` reads `--devnotes-script-host` before anything else +`crates/app` builds `devnotes`. `main` reads `--script-host` before anything else (the core's `serve_scripts`: no window, no log), then `--profile `, which puts the whole profile, its logs and the window's geometry in that directory — tests and development only. Without it, `platform::paths::Locations::installed` resolves the profile diff --git a/docs/architecture/http/environments-and-scripts.md b/docs/architecture/http/environments-and-scripts.md index 6eab92e0c..daf28e1bd 100644 --- a/docs/architecture/http/environments-and-scripts.md +++ b/docs/architecture/http/environments-and-scripts.md @@ -111,7 +111,7 @@ written again with `GOLDEN_WRITE=1`, then read before they are kept). (#492, `http/scripts/`). The WebView cannot run it — its CSP forbids `eval`, and should — and the application's own process holds the library's key and every note: an engine bug there reaches them. So `ScriptProcess::start` (`process.rs`) launches `current_exe()` with -`--devnotes-script-host`, which `main` reads **before Tauri** (no window, no single instance, no +`--script-host`, which `main` reads **before Tauri** (no window, no single instance, no library), its environment cleared but for what loads the executable (`SystemRoot`, `LD_LIBRARY_PATH`). The host (`child.rs`) reads one JSON message a line on its standard input and answers on its standard output. diff --git a/docs/architecture/logs.md b/docs/architecture/logs.md index 435c6b70a..169f48bac 100644 --- a/docs/architecture/logs.md +++ b/docs/architecture/logs.md @@ -69,7 +69,7 @@ ran, and its outcome. ```text 2026-12-04 10:12:05.033 DEBUG [db] ui::backend: db #412 notes::get 2 ms ok -2026-12-04 10:12:05.348 DEBUG [devnotes-network] ui::backend: spawn #415 http::send 312 ms HttpTimeout +2026-12-04 10:12:05.348 DEBUG [network] ui::backend: spawn #415 http::send 312 ms HttpTimeout 2026-12-04 10:12:06.001 DEBUG [db] ui::backend: db - notes::query 4 ms ok ``` diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md index 9466998db..def2cb4dd 100644 --- a/docs/architecture/overview.md +++ b/docs/architecture/overview.md @@ -71,6 +71,14 @@ crate, so that `engine`, `i18n`, `richtext`, `platform`, `ui` and `app` take a n never from one another (D10). The `DEVNOTES_` prefix of the environment variables stays as it is for now: the owner's choice. +**A few names stay literal**, where Cargo and the file system read no variable: the binary's +`[[bin]] name` and `CARGO_BIN_EXE_…`, the packager's `product-name`, `identifier` and `binaries`, +the deb's `package-name` and file paths, the rpm's `name` and paths, `packaging/.desktop` +(`Exec=`, `Icon=`, `Name=`), `Upstream-Name` in `packaging/copyright` and `icons/.svg`. A +rename edits them by hand, and `crates/app/tests/names.rs` fails while one differs from the values. +The names nobody outside the process reads carry none: the `--script-host` argument, the +`__prelude` of the request scripts, the `network` thread. + **What a rename costs**, accepted and not migrated: an archive exported under the previous extension is no longer offered by the import's filter, and a request history holding the previous User-Agent shows it as a header of its own; a library, its preferences and its arrangement are not From 6e201320caa0e86d81ada46729946af9b994d0fb Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 19:57:40 +0000 Subject: [PATCH 2/3] App name: `DevNotesApp` renamed `App` Mechanical: the type, its uses, the wiki and the egui skill, then `cargo fmt`. Nothing else changes. Part of #1896 (step 9) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BbVs5tCyTr9AasGra3Zzg3 --- .claude/skills/egui-ui/SKILL.md | 2 +- crates/app/src/main.rs | 4 +- crates/app/src/sight.rs | 4 +- crates/ui/src/app.rs | 64 ++++++++++++------------ crates/ui/src/app/area_switch_tests.rs | 8 +-- crates/ui/src/app/captures.rs | 47 +++++++++-------- crates/ui/src/app/docs_tests.rs | 16 +++--- crates/ui/src/app/gate_update_tests.rs | 8 +-- crates/ui/src/app/global_key_tests.rs | 10 ++-- crates/ui/src/app/library_panel_tests.rs | 8 +-- crates/ui/src/app/modal_tests.rs | 8 +-- crates/ui/src/app/palette_copy_tests.rs | 4 +- crates/ui/src/app/perf.rs | 6 +-- crates/ui/src/app/preferences_tests.rs | 26 +++++----- crates/ui/src/app/prompt_tests.rs | 8 +-- crates/ui/src/app/rail_toggle_tests.rs | 6 +-- crates/ui/src/app/screens.rs | 6 +-- crates/ui/src/app/titlebar_tests.rs | 18 +++---- crates/ui/src/app/update_prompt_tests.rs | 8 +-- crates/ui/src/app/window_tests.rs | 16 +++--- crates/ui/src/lib.rs | 2 +- docs/architecture/backend.md | 2 +- docs/architecture/libraries.md | 4 +- docs/architecture/testing.md | 2 +- 24 files changed, 142 insertions(+), 145 deletions(-) diff --git a/.claude/skills/egui-ui/SKILL.md b/.claude/skills/egui-ui/SKILL.md index ef68829b0..4c69b2bb0 100644 --- a/.claude/skills/egui-ui/SKILL.md +++ b/.claude/skills/egui-ui/SKILL.md @@ -56,7 +56,7 @@ D32): read a screen's component and its SCSS before changing it, and its capture forever. Work the core goes on with after an answer is started through `Backend::background`, so that it is waited for too. No `run_steps(n)`, no `with_max_steps`: a bench with a spinner runs with reduced motion. -- **The whole window**: `Harness::new_eframe` / `build_eframe` over `DevNotesApp`, through the gate +- **The whole window**: `Harness::new_eframe` / `build_eframe` over `App`, through the gate like a person (`app.rs` tests). - **Captures, not snapshots** (D24): `app::captures` renders the window's states in both themes into `DEVNOTES_CAPTURES` for a look by eye beside the reference's captures; CI uploads them. Nothing diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index d7165fb52..fb6e4a2ba 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -149,11 +149,11 @@ fn run(locations: Locations, instance: Instance) -> eframe::Result { METADATA.name, options(restored), #[cfg(not(feature = "e2e"))] - Box::new(move |cc| Ok(Box::new(ui::DevNotesApp::new(cc, startup())?))), + Box::new(move |cc| Ok(Box::new(ui::App::new(cc, startup())?))), #[cfg(feature = "e2e")] Box::new(move |cc| { unpainted::attach(&cc.egui_ctx); - let app = ui::DevNotesApp::new(cc, startup())?; + let app = ui::App::new(cc, startup())?; pointer::attach(&cc.egui_ctx); Ok(Box::new(sight::Watched::new(app))) }), diff --git a/crates/app/src/sight.rs b/crates/app/src/sight.rs index c7cd9dae7..54f178779 100644 --- a/crates/app/src/sight.rs +++ b/crates/app/src/sight.rs @@ -10,7 +10,7 @@ use egui::{Context, Sense, Ui, Vec2, ViewportCommand, ViewportId, WidgetInfo}; /// minimised, eframe runs `logic` alone, outside any pass, and no plugin hook sees what it asks, /// the window brought back included. The commands are read after `logic` and again after `ui`. pub(crate) struct Watched { - app: ui::DevNotesApp, + app: ui::App, hidden: bool, put_away: u32, /// The root's commands of this pass already read: `ui` adds to the list `logic` began. @@ -18,7 +18,7 @@ pub(crate) struct Watched { } impl Watched { - pub(crate) fn new(app: ui::DevNotesApp) -> Self { + pub(crate) fn new(app: ui::App) -> Self { Watched { app, hidden: false, put_away: 0, read: 0 } } diff --git a/crates/ui/src/app.rs b/crates/ui/src/app.rs index 7cdb67ef4..7faca46ff 100644 --- a/crates/ui/src/app.rs +++ b/crates/ui/src/app.rs @@ -74,7 +74,7 @@ impl Default for Desktop { } } -pub struct DevNotesApp { +pub struct App { backend: Backend, state: AppState, inputs: Receiver, @@ -87,7 +87,7 @@ pub struct DevNotesApp { was_minimized: bool, } -impl DevNotesApp { +impl App { /// Where the core is born, once the waker can reach the window (D20). The library stays /// closed: the first frame is the gate. pub fn new(cc: &eframe::CreationContext<'_>, startup: Startup) -> std::io::Result { @@ -181,7 +181,7 @@ fn in_front(ctx: &egui::Context) -> bool { }) } -impl DevNotesApp { +impl App { /// Read before the window is brought back: afterwards it is always in front. fn asked_from_outside(&mut self, action: GlobalAction, ctx: &egui::Context) { let action = @@ -290,7 +290,7 @@ impl DevNotesApp { } } -impl eframe::App for DevNotesApp { +impl eframe::App for App { /// Runs while the window is hidden too: eframe draws nothing then, so the window is shown /// from here, once it exists at its restored geometry. fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { @@ -500,8 +500,8 @@ mod tests { use super::*; use crate::inputs; - pub(super) fn settle(harness: &mut Harness<'_, DevNotesApp>) { - crate::testing::settle(harness, DevNotesApp::backend); + pub(super) fn settle(harness: &mut Harness<'_, App>) { + crate::testing::settle(harness, App::backend); } pub(super) fn startup(directory: &std::path::Path) -> Startup { @@ -546,19 +546,17 @@ mod tests { } } - pub(super) fn with_a_tray( - directory: &std::path::Path, - ) -> (Harness<'static, DevNotesApp>, FakeTray, Inbox) { + pub(super) fn with_a_tray(directory: &std::path::Path) -> (Harness<'static, App>, FakeTray, Inbox) { let fake = FakeTray::default(); let (inbox, waker, receiver) = inputs::channel(); let posted = inbox.clone(); let mut startup = startup_with(directory, (inbox, waker, receiver)); startup.desktop.tray = Box::new(fake.clone()); - let harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + let harness = Harness::new_eframe(|cc| App::new(cc, startup).unwrap()); (harness, fake, posted) } - pub(super) fn commands(harness: &Harness<'_, DevNotesApp>) -> Vec { + pub(super) fn commands(harness: &Harness<'_, App>) -> Vec { harness .output() .viewport_output @@ -636,7 +634,7 @@ mod tests { assert_eq!(harness.state().backend().engine().indexed(), 0); } - fn visible_requests(harness: &Harness<'_, DevNotesApp>) -> usize { + fn visible_requests(harness: &Harness<'_, App>) -> usize { harness .output() .viewport_output @@ -649,7 +647,7 @@ mod tests { #[test] fn the_window_is_shown_once_its_first_frame_is_ready() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); // The harness runs its first frames while it is built: the request is behind us. assert!(harness.state().shown); @@ -665,7 +663,7 @@ mod tests { let (inbox, waker, receiver) = inputs::channel(); let posted = inbox.clone(); let mut harness = Harness::new_eframe(|cc| { - DevNotesApp::new(cc, startup_with(directory.path(), (inbox, waker, receiver))).unwrap() + App::new(cc, startup_with(directory.path(), (inbox, waker, receiver))).unwrap() }); posted.post(Input::Instance(Message::Reveal)); @@ -693,7 +691,7 @@ mod tests { let directory = tempfile::tempdir().unwrap(); let copies = left_in_the_plain_copies(directory.path()); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); settle(&mut harness); assert!(!copies.exists(), "before anything is unlocked"); @@ -716,7 +714,7 @@ mod tests { #[test] fn the_engine_starts_on_a_profile_with_no_library_yet() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); harness.step(); let state = engine::db::run_here(harness.state().backend().engine(), engine::vault::vault_state); @@ -727,7 +725,7 @@ mod tests { #[test] fn a_maximised_window_keeps_the_size_it_had_before() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); let placed = egui::ViewportInfo { outer_rect: Some(egui::Rect::from_min_size(egui::pos2(10.0, 20.0), egui::vec2(820.0, 640.0))), inner_rect: Some(egui::Rect::from_min_size(egui::pos2(10.0, 50.0), egui::vec2(800.0, 600.0))), @@ -744,18 +742,18 @@ mod tests { assert!((geometry.x - 10.0).abs() < f32::EPSILON); } - pub(super) fn present(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> bool { + pub(super) fn present(harness: &Harness<'_, App>, author_id: &str) -> bool { use egui_kittest::kittest::Queryable; harness.query_by(|node| node.author_id() == Some(author_id)).is_some() } - pub(super) fn click(harness: &mut Harness<'_, DevNotesApp>, author_id: &str) { + pub(super) fn click(harness: &mut Harness<'_, App>, author_id: &str) { use egui_kittest::kittest::Queryable; harness.get_by(|node| node.author_id() == Some(author_id)).click(); settle(harness); } - pub(super) fn type_into(harness: &mut Harness<'_, DevNotesApp>, author_id: &str, words: &str) { + pub(super) fn type_into(harness: &mut Harness<'_, App>, author_id: &str, words: &str) { use egui_kittest::kittest::Queryable; click(harness, author_id); harness.get_by(|node| node.author_id() == Some(author_id)).type_text(words); @@ -763,7 +761,7 @@ mod tests { } /// Through the gate, as a first launch does it. - fn top_of(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> f64 { + fn top_of(harness: &Harness<'_, App>, author_id: &str) -> f64 { use egui_kittest::kittest::{NodeT, Queryable}; harness .get_by(|node| node.author_id() == Some(author_id)) @@ -797,7 +795,7 @@ mod tests { assert!(!present(&harness, "status-toast")); } - fn toasts(harness: &Harness<'_, DevNotesApp>) -> Vec { + fn toasts(harness: &Harness<'_, App>) -> Vec { use egui_kittest::kittest::Queryable; harness .query_all_by(|node| node.author_id() == Some("status-toast")) @@ -865,7 +863,7 @@ mod tests { assert_eq!(count(&harness, "error-banner"), 2, "until dismissed"); } - fn top_of_first(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> f64 { + fn top_of_first(harness: &Harness<'_, App>, author_id: &str) -> f64 { use egui_kittest::kittest::{NodeT, Queryable}; let nodes = harness.query_all_by(|node| node.author_id() == Some(author_id)); nodes @@ -893,11 +891,11 @@ mod tests { assert!(!bar.intersects(toast), "{bar:?} {toast:?}"); } - pub(super) fn open_library(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { + pub(super) fn open_library(directory: &std::path::Path) -> Harness<'static, App> { let startup = startup(directory); let mut harness = Harness::builder() .with_size(egui::vec2(1100.0, 720.0)) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); // The window finds the arrows in the system's fonts, which a bench has not. harness .ctx @@ -914,19 +912,19 @@ mod tests { #[test] fn the_areas_are_offered_only_once_the_library_is_open() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); settle(&mut harness); assert!(present(&harness, "theme-toggle")); assert!(!present(&harness, "area-switch")); } - pub(super) fn count(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> usize { + pub(super) fn count(harness: &Harness<'_, App>, author_id: &str) -> usize { use egui_kittest::kittest::Queryable; harness.query_all_by(|node| node.author_id() == Some(author_id)).count() } - fn seeded_mark(harness: &Harness<'_, DevNotesApp>) -> Option { + fn seeded_mark(harness: &Harness<'_, App>) -> Option { let directory = engine::db::run_here( harness.state().backend().engine(), engine::libraries::open_library_directory, @@ -995,7 +993,7 @@ mod tests { #[test] fn the_file_menu_is_offered_with_the_library_and_quits_on_the_second_click() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); settle(&mut harness); assert!(!present(&harness, "file-menu")); @@ -1007,7 +1005,7 @@ mod tests { } /// The colour `words` were painted in by the last frame. - fn ink_of(harness: &Harness<'_, DevNotesApp>, words: &str) -> Option { + fn ink_of(harness: &Harness<'_, App>, words: &str) -> Option { harness.output().shapes.iter().find_map(|clipped| match &clipped.shape { egui::Shape::Text(text) if text.galley.text() == words => { Some(text.galley.job.sections[0].format.color) @@ -1068,7 +1066,7 @@ mod tests { #[test] fn the_about_menu_stays_at_the_gate() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); settle(&mut harness); assert!(!present(&harness, "file-menu")); @@ -1111,7 +1109,7 @@ mod tests { #[test] fn the_toggle_switches_to_the_other_theme() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); settle(&mut harness); let before = harness.ctx.theme(); @@ -1123,7 +1121,7 @@ mod tests { #[test] fn a_banner_stays_until_it_is_dismissed() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); let state = &mut harness.state_mut().state; state.errors.report( i18n::keys::errors::ATTACHMENTS_LOAD_FAILED, diff --git a/crates/ui/src/app/area_switch_tests.rs b/crates/ui/src/app/area_switch_tests.rs index 1178aeb90..364a6ec17 100644 --- a/crates/ui/src/app/area_switch_tests.rs +++ b/crates/ui/src/app/area_switch_tests.rs @@ -4,11 +4,11 @@ use egui_kittest::kittest::Queryable; use super::tests::{click, open_library}; -fn switches(harness: &egui_kittest::Harness<'_, super::DevNotesApp>) -> usize { +fn switches(harness: &egui_kittest::Harness<'_, super::App>) -> usize { harness.query_all_by(|node| node.author_id() == Some("area-switch")).count() } -fn top(harness: &egui_kittest::Harness<'_, super::DevNotesApp>) -> f32 { +fn top(harness: &egui_kittest::Harness<'_, super::App>) -> f32 { harness .get_by(|node| node.author_id() == Some("area-option-notes")) .rect() @@ -42,7 +42,7 @@ fn each_area_is_reached_from_the_switch_of_its_rail() { } /// Where the three buttons are drawn, the area `area` on screen. -fn places(harness: &mut egui_kittest::Harness<'_, super::DevNotesApp>, area: &str) -> Vec { +fn places(harness: &mut egui_kittest::Harness<'_, super::App>, area: &str) -> Vec { click(harness, area); ["area-option-notes", "area-option-tools", "area-option-http"] .map(|author_id| harness.get_by(|node| node.author_id() == Some(author_id)).rect()) @@ -67,7 +67,7 @@ fn the_switch_is_at_one_place_and_one_size_on_every_area() { /// The two halves of a split button, and the one rounded outline it is drawn in. fn halves( - harness: &mut egui_kittest::Harness<'_, super::DevNotesApp>, + harness: &mut egui_kittest::Harness<'_, super::App>, area: &str, ids: [&str; 2], ) -> [egui::Rect; 2] { diff --git a/crates/ui/src/app/captures.rs b/crates/ui/src/app/captures.rs index 3911d8308..ad46e2c7a 100644 --- a/crates/ui/src/app/captures.rs +++ b/crates/ui/src/app/captures.rs @@ -7,7 +7,7 @@ use std::path::Path; use egui_kittest::Harness; use egui_kittest::kittest::Queryable; -use super::DevNotesApp; +use super::App; use super::tests::startup; use crate::services::time::fake::FakeClock; use crate::testing::PASSPHRASE; @@ -15,18 +15,18 @@ use engine::http::model::{HttpMethod, RequestKind}; const SIZE: egui::Vec2 = egui::vec2(1100.0, 720.0); -fn launch(profile: &Path) -> Harness<'static, DevNotesApp> { +fn launch(profile: &Path) -> Harness<'static, App> { launch_at(profile, SIZE) } -fn launch_at(profile: &Path, size: egui::Vec2) -> Harness<'static, DevNotesApp> { +fn launch_at(profile: &Path, size: egui::Vec2) -> Harness<'static, App> { // Loaded before the first frame, as the window has them a moment after: the captures show // the colours. text::highlight::warm(); let startup = startup(profile); let mut harness = Harness::builder() .with_size(size) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); harness.state_mut().state.clock = Box::new(FakeClock::at("2026-11-03T09:30:00Z")); // The window finds the arrows in the system's fonts, which a bench has not. harness @@ -36,38 +36,38 @@ fn launch_at(profile: &Path, size: egui::Vec2) -> Harness<'static, DevNotesApp> harness } -fn settle(harness: &mut Harness<'_, DevNotesApp>) { +fn settle(harness: &mut Harness<'_, App>) { super::tests::settle(harness); } -fn click(harness: &mut Harness<'_, DevNotesApp>, author_id: &str) { +fn click(harness: &mut Harness<'_, App>, author_id: &str) { harness.get_by(|node| node.author_id() == Some(author_id)).click(); settle(harness); } -fn type_into(harness: &mut Harness<'_, DevNotesApp>, author_id: &str, words: &str) { +fn type_into(harness: &mut Harness<'_, App>, author_id: &str, words: &str) { click(harness, author_id); harness.get_by(|node| node.author_id() == Some(author_id)).type_text(words); settle(harness); } /// The band of filters open: « Manage » is at the foot of the tags' menu. -fn manage_tags(harness: &mut Harness<'_, DevNotesApp>) { +fn manage_tags(harness: &mut Harness<'_, App>) { click(harness, "facet-menu-tag"); click(harness, "tag-manage"); } /// Draws the window as it stands, then again in the other theme, and gives the first one back. -fn capture(harness: &mut Harness<'_, DevNotesApp>, name: &str) { +fn capture(harness: &mut Harness<'_, App>, name: &str) { shoot(harness, name, true); } /// As `capture`, the pointer still pressed where it is: what a drag shows on its way. -fn capture_holding(harness: &mut Harness<'_, DevNotesApp>, name: &str) { +fn capture_holding(harness: &mut Harness<'_, App>, name: &str) { shoot(harness, name, false); } -fn shoot(harness: &mut Harness<'_, DevNotesApp>, name: &str, pointer_gone: bool) { +fn shoot(harness: &mut Harness<'_, App>, name: &str, pointer_gone: bool) { let directory = std::env::var_os("DEVNOTES_CAPTURES"); for _ in 0..2 { let theme = match harness.ctx.theme() { @@ -257,7 +257,7 @@ fn the_update_prompt() { } /// A library holding `API Paiements`, the HTTP area shown. -fn http_area(profile: &Path) -> Harness<'static, DevNotesApp> { +fn http_area(profile: &Path) -> Harness<'static, App> { let mut harness = launch(profile); type_into(&mut harness, "vault-passphrase", PASSPHRASE); type_into(&mut harness, "vault-confirmation", PASSPHRASE); @@ -918,7 +918,7 @@ fn the_board_of_the_samples() { /// A press at `from`, then the pointer moved by `by` in steps and held there: where it is. fn drag_to( - harness: &mut Harness<'_, DevNotesApp>, + harness: &mut Harness<'_, App>, from: egui::Pos2, button: egui::PointerButton, by: egui::Vec2, @@ -936,7 +936,7 @@ fn drag_to( from + by } -fn release(harness: &mut Harness<'_, DevNotesApp>, at: egui::Pos2, button: egui::PointerButton) { +fn release(harness: &mut Harness<'_, App>, at: egui::Pos2, button: egui::PointerButton) { harness.event(egui::Event::PointerButton { pos: at, button, @@ -947,7 +947,7 @@ fn release(harness: &mut Harness<'_, DevNotesApp>, at: egui::Pos2, button: egui: } /// The window as it stands, the pointer still held: a gesture under way, in one theme. -fn holding(harness: &mut Harness<'_, DevNotesApp>, name: &str) { +fn holding(harness: &mut Harness<'_, App>, name: &str) { let image = harness.render().expect("a software adapter draws the window"); if let Some(directory) = std::env::var_os("DEVNOTES_CAPTURES") { std::fs::create_dir_all(&directory).unwrap(); @@ -956,7 +956,7 @@ fn holding(harness: &mut Harness<'_, DevNotesApp>, name: &str) { } /// The Dessin of `kinds`, as it opens and with a shape selected. -fn drawing_editor(harness: &mut Harness<'_, DevNotesApp>) { +fn drawing_editor(harness: &mut Harness<'_, App>) { harness .get_by(|node| { node.author_id() == Some("note-card-open") && node.label().as_deref() == Some("Sketch") @@ -1237,7 +1237,7 @@ const WIDE_SCENE: &str = r#"{"version":1,"scene":{"objects":[ ]}}"#; /// The window, a drawing of that scene open in it. -fn with_a_drawing(profile: &std::path::Path, scene: &str) -> Harness<'static, DevNotesApp> { +fn with_a_drawing(profile: &std::path::Path, scene: &str) -> Harness<'static, App> { let mut harness = launch_at(profile, egui::vec2(1440.0, 900.0)); type_into(&mut harness, "vault-passphrase", PASSPHRASE); type_into(&mut harness, "vault-confirmation", PASSPHRASE); @@ -1582,7 +1582,7 @@ fn an_http_tab_dragged_along_the_strip() { .click(); settle(&mut harness); } - let tab = |harness: &Harness<'_, DevNotesApp>, name: &str| { + let tab = |harness: &Harness<'_, App>, name: &str| { harness .get_by(|node| { node.author_id() == Some("http-tab-open") @@ -1648,7 +1648,7 @@ fn a_folder_dropped_onto_another_space() { .unwrap(); harness.state_mut().state.revision.bump(); settle(&mut harness); - let at = |harness: &Harness<'_, DevNotesApp>, author_id: &str, name: &str| { + let at = |harness: &Harness<'_, App>, author_id: &str, name: &str| { harness .get_by(|node| node.author_id() == Some(author_id) && node.label().as_deref() == Some(name)) .rect() @@ -1686,12 +1686,11 @@ fn a_drawing_in_a_note() { type_into(&mut harness, "vault-confirmation", PASSPHRASE); click(&mut harness, "vault-submit"); settle(&mut harness); - let id = |harness: &Harness<'_, DevNotesApp>, title| { - crate::testing::note(&harness.state().backend, title).id.clone() - }; + let id = + |harness: &Harness<'_, App>, title| crate::testing::note(&harness.state().backend, title).id.clone(); let scene = id(&harness, "Architecture"); let note = id(&harness, "Bienvenue dans DevNotes"); - let rewrite = |harness: &mut Harness<'_, DevNotesApp>, id: &str, kind, content: String| { + let rewrite = |harness: &mut Harness<'_, App>, id: &str, kind, content: String| { let patch = NotePatch { kind: Some(kind), content: Some(content), ..NotePatch::default() }; let engine = harness.state().backend.engine().clone(); let id = id.to_owned(); @@ -1894,7 +1893,7 @@ fn deleting_a_space_and_a_folder() { crate::notes::bench::space(backend, "Archives"); harness.state_mut().state.revision.bump(); settle(&mut harness); - let options = |harness: &mut Harness<'static, DevNotesApp>, author_id: &str, name: &str| { + let options = |harness: &mut Harness<'static, App>, author_id: &str, name: &str| { harness .get_by(|node| { node.author_id() == Some(author_id) && node.label().is_some_and(|label| label.ends_with(name)) diff --git a/crates/ui/src/app/docs_tests.rs b/crates/ui/src/app/docs_tests.rs index 2409097b8..db54aa878 100644 --- a/crates/ui/src/app/docs_tests.rs +++ b/crates/ui/src/app/docs_tests.rs @@ -7,12 +7,12 @@ use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; use i18n::Language; -use super::DevNotesApp; +use super::App; use super::about_link_tests::Opened; use super::tests::{click, count, open_library, present, settle}; use crate::api::help; -fn open(directory: &std::path::Path, language: Language) -> Harness<'static, DevNotesApp> { +fn open(directory: &std::path::Path, language: Language) -> Harness<'static, App> { let mut harness = open_library(directory); harness.state_mut().state.language = language; click(&mut harness, "about-open"); @@ -21,27 +21,27 @@ fn open(directory: &std::path::Path, language: Language) -> Harness<'static, Dev harness } -fn title(harness: &Harness<'_, DevNotesApp>) -> String { +fn title(harness: &Harness<'_, App>) -> String { let node = harness.get_by(|node| node.author_id() == Some("docs-title")); node.accesskit_node().label().unwrap_or_default() } -fn search(harness: &mut Harness<'_, DevNotesApp>, words: &str) { +fn search(harness: &mut Harness<'_, App>, words: &str) { click(harness, "docs-search"); harness.get_by(|node| node.author_id() == Some("docs-search")).type_text(words); settle(harness); } /// Scrolled to, then clicked: what is out of sight is under the window's edge, or past it. -fn reach(harness: &mut Harness<'_, DevNotesApp>, author_id: &str) { +fn reach(harness: &mut Harness<'_, App>, author_id: &str) { harness.get_by(|node| node.author_id() == Some(author_id)).scroll_to_me(); settle(harness); click(harness, author_id); } /// The first of several nodes of one address. -fn click_first(harness: &mut Harness<'_, DevNotesApp>, author_id: &str) { - let first = |harness: &Harness<'_, DevNotesApp>, scroll: bool| { +fn click_first(harness: &mut Harness<'_, App>, author_id: &str) { + let first = |harness: &Harness<'_, App>, scroll: bool| { let node = harness .get_all_by(|node| node.author_id() == Some(author_id)) .next() @@ -118,7 +118,7 @@ fn a_section_of_the_page_is_reached_from_the_list() { let directory = tempfile::tempdir().unwrap(); let mut harness = open(directory.path(), Language::Fr); reach(&mut harness, "docs-page-safety"); - let place = |harness: &Harness<'_, DevNotesApp>| { + let place = |harness: &Harness<'_, App>| { harness .get_all_by(|node| node.author_id() == Some("docs-section")) .find(|node| node.accesskit_node().label().as_deref() == Some("La corbeille et Ctrl Z")) diff --git a/crates/ui/src/app/gate_update_tests.rs b/crates/ui/src/app/gate_update_tests.rs index 69d8ce8c1..d21e07bee 100644 --- a/crates/ui/src/app/gate_update_tests.rs +++ b/crates/ui/src/app/gate_update_tests.rs @@ -7,21 +7,21 @@ use std::sync::Arc; use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; -use super::DevNotesApp; +use super::App; use super::tests::{click, open_library, present, settle, startup}; use crate::services::updates::UpdateState; use crate::services::updates::fake::FakeUpdater; /// A library made, then the window launched again over it: the unlock card, the launch's /// check answered by `fake` while it is shown. -fn at_the_gate(directory: &Path, fake: Arc) -> Harness<'static, DevNotesApp> { +fn at_the_gate(directory: &Path, fake: Arc) -> Harness<'static, App> { let first = open_library(directory); crate::testing::close_library(first.state().backend()); drop(first); let startup = startup(directory); let mut harness = Harness::builder() .with_size(egui::vec2(1100.0, 720.0)) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); harness .ctx .set_missing_glyph_policy(egui::epaint::text::MissingGlyphPolicy::Tofu); @@ -33,7 +33,7 @@ fn at_the_gate(directory: &Path, fake: Arc) -> Harness<'static, Dev harness } -fn focused(harness: &Harness<'_, DevNotesApp>) -> Option { +fn focused(harness: &Harness<'_, App>) -> Option { let node = harness.query_by(|node| node.is_focused() && node.author_id().is_some())?; node.accesskit_node().author_id().map(str::to_owned) } diff --git a/crates/ui/src/app/global_key_tests.rs b/crates/ui/src/app/global_key_tests.rs index d053e4b06..a821756fa 100644 --- a/crates/ui/src/app/global_key_tests.rs +++ b/crates/ui/src/app/global_key_tests.rs @@ -6,7 +6,7 @@ use egui_kittest::Harness; use engine::notes::kind::NoteKind; use platform::shortcuts::Global; -use super::DevNotesApp; +use super::App; use super::tests::{click, commands, open_library, present, settle}; use crate::state::Area; @@ -22,18 +22,18 @@ impl platform::clipboard::Clipboard for Copied { } } -fn press(harness: &mut Harness<'_, DevNotesApp>, key: Global) { +fn press(harness: &mut Harness<'_, App>, key: Global) { let ctx = harness.ctx.clone(); harness.state_mut().asked_by_a_key(key, &ctx); settle(harness); } -fn capture(harness: &mut Harness<'_, DevNotesApp>, copied: &'static str) { +fn capture(harness: &mut Harness<'_, App>, copied: &'static str) { harness.state_mut().state.clipboard = Arc::new(Copied(copied)); press(harness, Global::Capture); } -fn opened_kind(harness: &Harness<'_, DevNotesApp>) -> Option { +fn opened_kind(harness: &Harness<'_, App>) -> Option { let opened = harness.state().state().editor.opened()?; Some(opened.note()?.note.kind) } @@ -99,7 +99,7 @@ fn an_empty_clipboard_captures_nothing() { fn before_a_library_is_open_nothing_is_captured() { let directory = tempfile::tempdir().unwrap(); let mut harness = - Harness::new_eframe(|cc| DevNotesApp::new(cc, super::tests::startup(directory.path())).unwrap()); + Harness::new_eframe(|cc| App::new(cc, super::tests::startup(directory.path())).unwrap()); capture(&mut harness, "A sentence."); diff --git a/crates/ui/src/app/library_panel_tests.rs b/crates/ui/src/app/library_panel_tests.rs index 4b5217e4b..ba766810d 100644 --- a/crates/ui/src/app/library_panel_tests.rs +++ b/crates/ui/src/app/library_panel_tests.rs @@ -3,15 +3,15 @@ use egui_kittest::Harness; -use super::DevNotesApp; +use super::App; use super::tests::{click, count, open_library, present, settle, type_into}; -fn libraries_panel(harness: &mut Harness<'_, DevNotesApp>) { +fn libraries_panel(harness: &mut Harness<'_, App>) { click(harness, "file-menu"); click(harness, "file-libraries"); } -fn first_launch_gate(harness: &mut Harness<'_, DevNotesApp>) { +fn first_launch_gate(harness: &mut Harness<'_, App>) { type_into(harness, "vault-passphrase", crate::testing::PASSPHRASE); type_into(harness, "vault-confirmation", crate::testing::PASSPHRASE); click(harness, "vault-submit"); @@ -19,7 +19,7 @@ fn first_launch_gate(harness: &mut Harness<'_, DevNotesApp>) { } /// A second library, made from the panel and passed through the gate. -fn with_two_libraries(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn with_two_libraries(directory: &std::path::Path) -> Harness<'static, App> { let mut harness = open_library(directory); libraries_panel(&mut harness); type_into(&mut harness, "library-new-name", "Boulot"); diff --git a/crates/ui/src/app/modal_tests.rs b/crates/ui/src/app/modal_tests.rs index cec84c68d..73f6bafaa 100644 --- a/crates/ui/src/app/modal_tests.rs +++ b/crates/ui/src/app/modal_tests.rs @@ -6,11 +6,11 @@ use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; use engine::http::model::{HttpMethod, RequestKind}; -use super::DevNotesApp; +use super::App; use super::tests::{click, open_library, present, settle}; /// A request open in the HTTP area, its URL changed and not saved. -fn an_unsaved_request(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn an_unsaved_request(directory: &std::path::Path) -> Harness<'static, App> { let mut harness = open_library(directory); let backend = harness.state().backend(); let api = crate::http::tests::collection(backend, "API"); @@ -34,7 +34,7 @@ fn an_unsaved_request(directory: &std::path::Path) -> Harness<'static, DevNotesA harness } -fn unsaved(harness: &Harness<'_, DevNotesApp>) -> bool { +fn unsaved(harness: &Harness<'_, App>) -> bool { harness .state() .state @@ -57,7 +57,7 @@ fn ctrl_s_under_the_cookie_jar_saves_nothing_underneath() { assert!(unsaved(&harness), "the request under the jar was saved"); } -fn focused(harness: &Harness<'_, DevNotesApp>) -> Option { +fn focused(harness: &Harness<'_, App>) -> Option { harness .query_all_by(|node| node.is_focused() && node.author_id().is_some()) .find_map(|node| node.accesskit_node().author_id().map(str::to_owned)) diff --git a/crates/ui/src/app/palette_copy_tests.rs b/crates/ui/src/app/palette_copy_tests.rs index a82239cac..52561e2c4 100644 --- a/crates/ui/src/app/palette_copy_tests.rs +++ b/crates/ui/src/app/palette_copy_tests.rs @@ -4,7 +4,7 @@ use std::sync::{Arc, Mutex}; use egui_kittest::Harness; -use super::DevNotesApp; +use super::App; use super::tests::{commands, open_library, settle}; use crate::state::out_of_sight; @@ -18,7 +18,7 @@ impl platform::notify::Notifier for Toasts { } } -fn copied_from_the_palette(harness: &mut Harness<'_, DevNotesApp>, from_elsewhere: bool) -> Arc { +fn copied_from_the_palette(harness: &mut Harness<'_, App>, from_elsewhere: bool) -> Arc { let toasts = Arc::new(Toasts::default()); let ctx = harness.ctx.clone(); let app = harness.state_mut(); diff --git a/crates/ui/src/app/perf.rs b/crates/ui/src/app/perf.rs index 86b00b815..32222a6f8 100644 --- a/crates/ui/src/app/perf.rs +++ b/crates/ui/src/app/perf.rs @@ -16,14 +16,14 @@ use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; use engine::db::run_here; -use super::DevNotesApp; +use super::App; use super::tests::startup; use crate::action::Action; use crate::gate::IndexFill; use crate::state::Area; use crate::testing::PASSPHRASE; -type Window = Harness<'static, DevNotesApp>; +type Window = Harness<'static, App>; /// The reference screen, 1 920 × 1 080, less the window's frame. const SIZE: (f32, f32) = (1904.0, 1041.0); @@ -127,7 +127,7 @@ fn launch(profile: &Path) -> Window { .with_size(vec2(SIZE.0, SIZE.1)) .with_step_dt(FRAME) .with_max_steps(100_000) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); window .ctx .set_missing_glyph_policy(egui::epaint::text::MissingGlyphPolicy::Tofu); diff --git a/crates/ui/src/app/preferences_tests.rs b/crates/ui/src/app/preferences_tests.rs index 55062dfc6..58a3a1f6f 100644 --- a/crates/ui/src/app/preferences_tests.rs +++ b/crates/ui/src/app/preferences_tests.rs @@ -5,42 +5,42 @@ use egui::{Event, Key, Modifiers}; use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; -use super::DevNotesApp; +use super::App; use super::tests::{click as click_at, count, open_library, present, settle, type_into}; use crate::services::settings::Settings; use crate::testing::PASSPHRASE; const NEXT: &str = "another horse battery staple"; -fn preferences(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn preferences(directory: &std::path::Path) -> Harness<'static, App> { let mut harness = open_library(directory); open(&mut harness); harness } -fn open(harness: &mut Harness<'_, DevNotesApp>) { +fn open(harness: &mut Harness<'_, App>) { click(harness, "file-menu"); click(harness, "file-preferences"); } -fn page(directory: &std::path::Path, id: &str) -> Harness<'static, DevNotesApp> { +fn page(directory: &std::path::Path, id: &str) -> Harness<'static, App> { let mut harness = preferences(directory); click(&mut harness, &format!("settings-page-{id}")); harness } /// Brought in view first: a click below the page is one on what is behind it. -fn click(harness: &mut Harness<'_, DevNotesApp>, author_id: &str) { +fn click(harness: &mut Harness<'_, App>, author_id: &str) { harness.get_by(|node| node.author_id() == Some(author_id)).scroll_to_me(); settle(harness); click_at(harness, author_id); } -fn settings<'a>(harness: &'a Harness<'_, DevNotesApp>) -> &'a Settings { +fn settings<'a>(harness: &'a Harness<'_, App>) -> &'a Settings { &harness.state().state().settings } -fn said(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> String { +fn said(harness: &Harness<'_, App>, author_id: &str) -> String { let node = harness.get_by(|node| node.author_id() == Some(author_id)); let node = node.accesskit_node(); node.value().or_else(|| node.label()).unwrap_or_default() @@ -135,13 +135,13 @@ fn a_version_skipped_can_be_told_again() { // The keys -fn listening(directory: &std::path::Path, action: &str) -> Harness<'static, DevNotesApp> { +fn listening(directory: &std::path::Path, action: &str) -> Harness<'static, App> { let mut harness = page(directory, "shortcuts"); click(&mut harness, &format!("shortcut-field-{action}")); harness } -fn press(harness: &mut Harness<'_, DevNotesApp>, modifiers: Modifiers, key: Key) { +fn press(harness: &mut Harness<'_, App>, modifiers: Modifiers, key: Key) { harness.event(Event::Key { key, physical_key: Some(key), pressed: true, repeat: false, modifiers }); settle(harness); } @@ -203,13 +203,13 @@ fn two_actions_on_one_key_are_said() { // The passphrase -fn change(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn change(directory: &std::path::Path) -> Harness<'static, App> { let mut harness = page(directory, "security"); click(&mut harness, "setting-change-passphrase"); harness } -fn fields(harness: &mut Harness<'_, DevNotesApp>, current: &str, next: &str, confirmation: &str) { +fn fields(harness: &mut Harness<'_, App>, current: &str, next: &str, confirmation: &str) { for (id, words) in [ ("change-passphrase-current", current), ("change-passphrase-next", next), @@ -290,14 +290,14 @@ fn a_variable_added_is_proposed_once_applied() { } /// The library left and opened again: its launch copy is taken then, and listed on its page. -fn copies(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn copies(directory: &std::path::Path) -> Harness<'static, App> { let first = open_library(directory); crate::testing::close_library(first.state().backend()); drop(first); let startup = super::tests::startup(directory); let mut harness = Harness::builder() .with_size(egui::vec2(1_100.0, 720.0)) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); harness .ctx .set_missing_glyph_policy(egui::epaint::text::MissingGlyphPolicy::Tofu); diff --git a/crates/ui/src/app/prompt_tests.rs b/crates/ui/src/app/prompt_tests.rs index cb5ef5a63..3a3301572 100644 --- a/crates/ui/src/app/prompt_tests.rs +++ b/crates/ui/src/app/prompt_tests.rs @@ -5,23 +5,23 @@ use std::sync::Arc; use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; -use super::DevNotesApp; +use super::App; use super::tests::{click, open_library, present, settle, type_into}; const PHRASE: &str = "an export passphrase"; -fn export(harness: &mut Harness<'_, DevNotesApp>) { +fn export(harness: &mut Harness<'_, App>) { click(harness, "file-menu"); click(harness, "file-option-exportAll"); settle(harness); } -fn can_submit(harness: &Harness<'_, DevNotesApp>) -> bool { +fn can_submit(harness: &Harness<'_, App>) -> bool { let submit = harness.get_by(|node| node.author_id() == Some("passphrase-prompt-submit")); !submit.accesskit_node().is_disabled() } -fn asking(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn asking(directory: &std::path::Path) -> Harness<'static, App> { let mut harness = open_library(directory); let file = directory.join("library.devnotes"); harness.state_mut().state.dialog = Arc::new(platform::dialog::Fixed(file)); diff --git a/crates/ui/src/app/rail_toggle_tests.rs b/crates/ui/src/app/rail_toggle_tests.rs index 978cb84b9..ca8fc918f 100644 --- a/crates/ui/src/app/rail_toggle_tests.rs +++ b/crates/ui/src/app/rail_toggle_tests.rs @@ -5,16 +5,16 @@ use egui_kittest::Harness; use egui_kittest::kittest::Queryable; use engine::http::model::{HttpMethod, RequestKind}; -use super::DevNotesApp; +use super::App; use super::tests::{click, open_library, settle}; /// The toggle's box, found by its address, in the window's points. -fn toggle(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> egui::Rect { +fn toggle(harness: &Harness<'_, App>, author_id: &str) -> egui::Rect { harness.get_by(|node| node.author_id() == Some(author_id)).rect() } /// Every place the toggle is drawn, at the density chosen: where it stood, page by page. -fn places(harness: &mut Harness<'static, DevNotesApp>) -> Vec<(&'static str, egui::Rect)> { +fn places(harness: &mut Harness<'static, App>) -> Vec<(&'static str, egui::Rect)> { let mut seen = Vec::new(); click(harness, "area-option-notes"); seen.push(("notes", toggle(harness, "library-rail-toggle"))); diff --git a/crates/ui/src/app/screens.rs b/crates/ui/src/app/screens.rs index cd64b95a2..362c2e522 100644 --- a/crates/ui/src/app/screens.rs +++ b/crates/ui/src/app/screens.rs @@ -16,7 +16,7 @@ use engine::notes::model::{NoteDraft, NoteLifecycle, NotePatch}; use engine::notes::priority::Priority; use engine::spaces::model::SpaceDraft; -use super::DevNotesApp; +use super::App; use super::tests::startup; use crate::action::{Action, AppAction}; use crate::services::preferences::Preferences; @@ -24,7 +24,7 @@ use crate::state::Area; use crate::testing::PASSPHRASE; use crate::theme::Appearance; -type Window = Harness<'static, DevNotesApp>; +type Window = Harness<'static, App>; /// What the reference's 1 100 × 720 window left to its page. const DEFAULT_SIZE: (f32, f32) = (1084.0, 681.0); @@ -63,7 +63,7 @@ fn launch(profile: &Path, size: (f32, f32), compact: bool) -> Window { startup.preferences = preferences(compact); let mut window = Harness::builder() .with_size(egui::vec2(size.0, size.1)) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); // The window finds what the embedded fonts lack in the system's, which a bench has not. window .ctx diff --git a/crates/ui/src/app/titlebar_tests.rs b/crates/ui/src/app/titlebar_tests.rs index 471a3e7d1..063359931 100644 --- a/crates/ui/src/app/titlebar_tests.rs +++ b/crates/ui/src/app/titlebar_tests.rs @@ -6,14 +6,14 @@ use egui::{Pos2, ResizeDirection, ViewportCommand as Command, ViewportId, pos2}; use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; -use super::DevNotesApp; +use super::App; use super::tests::{click, commands, open_library, present, settle, startup}; const SIZE: egui::Vec2 = egui::vec2(1100.0, 720.0); /// On the bar, away from its menus and its toggle: under the name. const EMPTY: Pos2 = pos2(700.0, 19.0); -fn window(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { +fn window(directory: &std::path::Path) -> Harness<'static, App> { let mut startup = startup(directory); // Its controls are named in the language on screen, the machine's otherwise. startup.preferences.set("locale", "en"); @@ -21,16 +21,16 @@ fn window(directory: &std::path::Path) -> Harness<'static, DevNotesApp> { let mut harness = Harness::builder() .with_size(SIZE) .with_step_dt(1.0 / 60.0) - .build_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + .build_eframe(|cc| App::new(cc, startup).unwrap()); settle(&mut harness); harness } -fn rect_of(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> egui::Rect { +fn rect_of(harness: &Harness<'_, App>, author_id: &str) -> egui::Rect { harness.get_by(|node| node.author_id() == Some(author_id)).rect() } -fn label_of(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> String { +fn label_of(harness: &Harness<'_, App>, author_id: &str) -> String { harness .get_by(|node| node.author_id() == Some(author_id)) .accesskit_node() @@ -38,7 +38,7 @@ fn label_of(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> String { .unwrap_or_default() } -fn press(harness: &mut Harness<'_, DevNotesApp>, at: Pos2, pressed: bool) { +fn press(harness: &mut Harness<'_, App>, at: Pos2, pressed: bool) { harness.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, @@ -48,7 +48,7 @@ fn press(harness: &mut Harness<'_, DevNotesApp>, at: Pos2, pressed: bool) { } /// What the pointer does in one frame, and what that frame asked of the window. -fn pointer(harness: &mut Harness<'_, DevNotesApp>, at: Pos2, presses: &[bool]) -> Vec { +fn pointer(harness: &mut Harness<'_, App>, at: Pos2, presses: &[bool]) -> Vec { harness.event(egui::Event::PointerMoved(at)); for pressed in presses { press(harness, at, *pressed); @@ -57,13 +57,13 @@ fn pointer(harness: &mut Harness<'_, DevNotesApp>, at: Pos2, presses: &[bool]) - commands(harness) } -fn click_at(harness: &mut Harness<'_, DevNotesApp>, author_id: &str) -> Vec { +fn click_at(harness: &mut Harness<'_, App>, author_id: &str) -> Vec { let at = rect_of(harness, author_id).center(); pointer(harness, at, &[]); pointer(harness, at, &[true, false]) } -fn maximized(harness: &mut Harness<'_, DevNotesApp>) { +fn maximized(harness: &mut Harness<'_, App>) { harness.input_mut().viewports.entry(ViewportId::ROOT).or_default().maximized = Some(true); settle(harness); } diff --git a/crates/ui/src/app/update_prompt_tests.rs b/crates/ui/src/app/update_prompt_tests.rs index 114a5fd4a..dc420c707 100644 --- a/crates/ui/src/app/update_prompt_tests.rs +++ b/crates/ui/src/app/update_prompt_tests.rs @@ -5,13 +5,13 @@ use std::sync::Arc; use egui_kittest::Harness; use egui_kittest::kittest::{NodeT, Queryable}; -use super::DevNotesApp; +use super::App; use super::tests::{click, open_library, present, settle}; use crate::services::settings::Settings; use crate::services::updates::UpdateState; use crate::services::updates::fake::FakeUpdater; -fn offered(directory: &std::path::Path, fake: Arc) -> Harness<'static, DevNotesApp> { +fn offered(directory: &std::path::Path, fake: Arc) -> Harness<'static, App> { let mut harness = open_library(directory); harness.state_mut().state.updates = UpdateState::with(fake); click(&mut harness, "about-open"); @@ -118,7 +118,7 @@ fn an_unsaved_request_is_asked_about_before_the_install() { } /// The launch's check, silent, over the library open: then the menu. -fn launched(directory: &std::path::Path, fake: Arc) -> Harness<'static, DevNotesApp> { +fn launched(directory: &std::path::Path, fake: Arc) -> Harness<'static, App> { let mut harness = open_library(directory); harness.state_mut().state.updates = UpdateState::with(fake); let app = harness.state_mut(); @@ -127,7 +127,7 @@ fn launched(directory: &std::path::Path, fake: Arc) -> Harness<'sta harness } -fn rect(harness: &Harness<'_, DevNotesApp>, author_id: &str) -> egui::Rect { +fn rect(harness: &Harness<'_, App>, author_id: &str) -> egui::Rect { harness.get_by(|node| node.author_id() == Some(author_id)).rect() } diff --git a/crates/ui/src/app/window_tests.rs b/crates/ui/src/app/window_tests.rs index d443ef49e..ba0188610 100644 --- a/crates/ui/src/app/window_tests.rs +++ b/crates/ui/src/app/window_tests.rs @@ -4,18 +4,18 @@ use egui::{ViewportCommand as Command, ViewportEvent, ViewportId, ViewportInfo}; use egui_kittest::Harness; use platform::tray; -use super::DevNotesApp; +use super::App; use super::tests::{commands, startup, startup_with, with_a_tray}; use crate::action::{Action, GlobalAction}; use crate::inputs::Input; use crate::state::out_of_sight; -fn press_the_close_button(harness: &mut Harness<'_, DevNotesApp>) { +fn press_the_close_button(harness: &mut Harness<'_, App>) { viewport(harness).events.push(ViewportEvent::Close); harness.step(); } -fn viewport<'a>(harness: &'a mut Harness<'_, DevNotesApp>) -> &'a mut ViewportInfo { +fn viewport<'a>(harness: &'a mut Harness<'_, App>) -> &'a mut ViewportInfo { harness.input_mut().viewports.entry(ViewportId::ROOT).or_default() } @@ -50,7 +50,7 @@ fn with_the_preference_off_the_close_button_ends_the_application() { #[test] fn without_a_tray_the_close_button_hides_the_window_all_the_same() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); press_the_close_button(&mut harness); @@ -60,7 +60,7 @@ fn without_a_tray_the_close_button_hides_the_window_all_the_same() { #[test] fn without_a_tray_and_with_the_preference_off_the_close_button_ends_the_application() { let directory = tempfile::tempdir().unwrap(); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup(directory.path())).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup(directory.path())).unwrap()); harness.state_mut().state.settings.close_to_tray = false; press_the_close_button(&mut harness); @@ -76,7 +76,7 @@ fn a_second_launch_s_palette_brings_the_hidden_window_back() { let (inbox, waker, receiver) = crate::inputs::channel(); let posted = inbox.clone(); let startup = startup_with(directory.path(), (inbox, waker, receiver)); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup).unwrap()); press_the_close_button(&mut harness); posted.post(Input::Instance(platform::instance::Message::Action("palette".to_owned()))); @@ -91,7 +91,7 @@ fn without_a_tray_a_second_launch_brings_the_hidden_window_back() { let (inbox, waker, receiver) = crate::inputs::channel(); let posted = inbox.clone(); let startup = startup_with(directory.path(), (inbox, waker, receiver)); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup).unwrap()); press_the_close_button(&mut harness); posted.post(Input::Instance(platform::instance::Message::Reveal)); @@ -177,7 +177,7 @@ fn closed_maximised_it_asks_to_be_maximised_once_shown() { let mut startup = startup(directory.path()); startup.geometry = Some(platform::window::Geometry { x: 0.0, y: 0.0, width: 800.0, height: 600.0, maximized: true }); - let mut harness = Harness::new_eframe(|cc| DevNotesApp::new(cc, startup).unwrap()); + let mut harness = Harness::new_eframe(|cc| App::new(cc, startup).unwrap()); // The first frame again: the harness draws it while it is built, its commands behind us. harness.state_mut().shown = false; harness.step(); diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index e300f9911..e33ff5dbc 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -24,7 +24,7 @@ mod titlebar; mod tools; mod widgets; -pub use app::{Desktop, DevNotesApp, Startup}; +pub use app::{App, Desktop, Startup}; pub use inputs::{Inbox, Input, channel}; pub use services::errors::ErrorNotifier; pub use services::global_keys::described as global_keys; diff --git a/docs/architecture/backend.md b/docs/architecture/backend.md index 89165e362..eecd698c3 100644 --- a/docs/architecture/backend.md +++ b/docs/architecture/backend.md @@ -96,7 +96,7 @@ as the screen is ported. Three pieces replace the reference's `resource()`, `lin ## A frame, its actions and its keys -`DevNotesApp` does the same thing every frame, in this order: `logic` drains the +`App` does the same thing every frame, in this order: `logic` drains the inputs (engine events, a second launch's `reveal` or `action `), adopts the answers that arrived and asks the `QueryCell`s again; `ui` draws, then reads the keys the widgets left, then applies the actions. **Drawing never changes the state**: it reads a screen's state, may change diff --git a/docs/architecture/libraries.md b/docs/architecture/libraries.md index 81f914918..813ac2820 100644 --- a/docs/architecture/libraries.md +++ b/docs/architecture/libraries.md @@ -104,7 +104,7 @@ open, but all of them. What is done about it: - an index entry wipes its texts when it is dropped (`zeroize`), and so do the folder names and global values the index replaces or drops; - the index is emptied when another library is opened, when a copy is restored, and when the - application exits (`Engine::wipe_index`, queued by `DevNotesApp::on_exit` behind the last write); + application exits (`Engine::wipe_index`, queued by `App::on_exit` behind the last write); - nothing of it is logged, nor sent in an event (`IndexProgress` carries two counts). What is not: the copies a view makes are ordinary `String`s, dropped unwiped, as before the @@ -473,7 +473,7 @@ and decrypted is time every other command would spend waiting. document reads it from disk, so DevNotes writes a decrypted copy under `app_data_dir()/open/` and opens that — one click, as before. The copy is `/` (`Attachment::opened_copy`): the viewer shows the name the user knows, and two of one name do not meet. Those copies are swept on the way out -(`DevNotesApp::on_exit`) and again at every launch, which is what covers one another application +(`App::on_exit`) and again at every launch, which is what covers one another application still held, and a crash. ⚠️ The profile and **not** the OS temporary directory: that one is shared with every account on the machine, where the copy would be readable by all of them and a directory somebody else created first would be theirs rather than ours. diff --git a/docs/architecture/testing.md b/docs/architecture/testing.md index bdea0b478..eeabbd50a 100644 --- a/docs/architecture/testing.md +++ b/docs/architecture/testing.md @@ -308,7 +308,7 @@ answered is then on screen. A window that still repaints at that point repaints test fails. `testing::locked()` closes a library before a second core opens its profile, as a process that ended leaves it. The widget bench runs with reduced motion, so its spinner rests. -`app::captures` drives the whole window (`DevNotesApp`) through the gate's states, the title +`app::captures` drives the whole window (`App`) through the gate's states, the title bar and the banners, and renders each in both themes on a software adapter — WARP on Windows, lavapipe on Linux — into `DEVNOTES_CAPTURES` when it is set. `test-rust` sets it and uploads the PNGs as `captures-`, to be looked at beside the reference's captures. Nothing compares From 4cba7633e077dc594bc89930d1cca8fac880a4f5 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 20:10:45 +0000 Subject: [PATCH 3/3] App name: tests, comments and descriptions read the values or say none MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixtures that need the application's name read the values: the database file, the preference keys, the welcome note's title, « About » and « Quitter », the documentation's addresses, the e2e binary, journey 11's files under the configured extension, the logging test's crate. Drawing addresses are built from `DRAWING_SOURCE`. Fixtures that only needed a word take a neutral one (`example.org`, `*.archive`, `seed`, `Notebook`, `notes`, `app`); the tools' samples read the values, so the screens, the README's tools tour and the site's scene stay as they are. Comments, crate descriptions and journey steps say « the application », or ``/`` where they spell a key, an address or a command. `DevNotes` leaves `doc-valid-idents`: a doc comment typing it no longer passes clippy. Part of #1896 (step 9) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BbVs5tCyTr9AasGra3Zzg3 --- CLAUDE.md | 2 +- Cargo.lock | 1 + clippy.toml | 2 +- crates/app/examples/icons.rs | 4 +- crates/app/src/logging.rs | 2 +- crates/app/src/main.rs | 3 +- crates/app/tests/script_host.rs | 2 +- crates/engine/benches/commands.rs | 4 +- crates/engine/benches/corpus.rs | 2 +- crates/engine/benches/reference.rs | 4 +- crates/engine/sandbox/package-lock.json | 4 +- crates/engine/sandbox/package.json | 2 +- crates/engine/src/docs.rs | 2 +- crates/engine/src/docs/model.rs | 6 +-- crates/engine/src/folders/board.rs | 2 +- crates/engine/src/http/scripts/engine.rs | 10 ++--- crates/engine/src/notes/language.rs | 4 +- crates/engine/src/tools/diff.rs | 8 ++-- crates/engine/src/tools/identity.rs | 32 +++++++------- crates/engine/src/tools/qr.rs | 14 +++---- crates/engine/src/transfer/bundle.rs | 2 +- crates/engine/src/transfer/file.rs | 8 ++-- crates/engine/src/transfer/model.rs | 6 +-- crates/engine/tests/commands/backups.rs | 2 +- crates/engine/tests/commands/concurrency.rs | 2 +- crates/engine/tests/commands/http_scripts.rs | 2 +- crates/engine/tests/commands/http_send.rs | 2 +- crates/engine/tests/commands/profile.rs | 11 ++--- crates/engine/tests/commands/transfer.rs | 12 +++--- crates/engine/tests/commands/websocket.rs | 2 +- crates/engine/tests/corpus/cmake.txt | 2 +- crates/engine/tests/corpus/cs.txt | 2 +- crates/engine/tests/corpus/json.txt | 2 +- crates/engine/tests/corpus/tf.txt | 2 +- crates/engine/tests/corpus/toml.txt | 2 +- crates/engine/tests/corpus/txt-weak-cmake.txt | 2 +- crates/engine/tests/formats.rs | 2 +- crates/engine/tests/transfer.rs | 2 +- crates/i18n/src/lib.rs | 2 +- crates/platform/Cargo.toml | 2 +- crates/platform/src/dialog.rs | 6 +-- crates/platform/src/instance.rs | 2 +- crates/platform/src/lib.rs | 8 ++-- crates/platform/src/shortcuts.rs | 8 ++-- crates/platform/src/shortcuts/notation.rs | 5 +-- crates/platform/src/shortcuts/system/gnome.rs | 6 +-- .../platform/src/shortcuts/system/portal.rs | 2 +- crates/richtext/src/picture.rs | 42 ++++++++++--------- crates/richtext/src/write.rs | 4 +- crates/ui/Cargo.toml | 2 +- crates/ui/clippy.toml | 2 +- crates/ui/src/app/captures.rs | 7 ++-- crates/ui/src/app/docs_tests.rs | 5 ++- crates/ui/src/app/palette_copy_tests.rs | 2 +- crates/ui/src/app/prompt_tests.rs | 6 +-- crates/ui/src/app/window_tests.rs | 2 +- crates/ui/src/gate/tests.rs | 2 +- crates/ui/src/lib.rs | 2 +- .../src/notes/overlays/editor/rich/tests.rs | 21 ++++++---- crates/ui/src/notes/parity_tests.rs | 6 ++- crates/ui/src/notes/prettier.rs | 2 +- crates/ui/src/services/docs_quotes.rs | 2 +- crates/ui/src/services/settings.rs | 2 +- crates/ui/src/state/folders.rs | 2 +- crates/ui/src/state/mod.rs | 4 +- crates/ui/src/state/spaces.rs | 2 +- crates/ui/src/state/transfer.rs | 12 +++--- crates/ui/src/titlebar/about_menu/docs/mod.rs | 2 +- .../ui/src/tools/catalogue/diff/structured.rs | 10 +++-- crates/ui/src/tools/catalogue/diff/text.rs | 15 ++++--- crates/ui/src/tools/catalogue/identity.rs | 2 +- crates/ui/src/widgets/rich.rs | 2 +- crates/ui/src/widgets/rich/tests.rs | 37 +++++++++------- e2e/Cargo.toml | 3 +- e2e/clippy.toml | 2 +- e2e/examples/footprint.rs | 2 +- e2e/src/driver.rs | 8 ++-- e2e/src/lib.rs | 4 +- e2e/src/sdk/disk.rs | 13 +++--- e2e/src/sdk/files.rs | 2 +- e2e/src/sdk/help.rs | 4 +- e2e/src/sdk/http.rs | 11 ++--- e2e/src/sdk/mod.rs | 39 +++++++++-------- e2e/src/sdk/notes.rs | 5 ++- e2e/src/sdk/prefs.rs | 2 +- e2e/src/sdk/window.rs | 8 ++-- e2e/tests/01_first_day.rs | 6 +-- e2e/tests/02_snippet_to_paste.rs | 2 +- e2e/tests/04_other_kinds.rs | 4 +- e2e/tests/07_reaching_from_anywhere.rs | 27 ++++++------ e2e/tests/11_libraries_and_transfer.rs | 40 ++++++++++-------- e2e/tests/13_making_it_mine.rs | 9 ++-- e2e/tests/14_nothing_readable_on_the_disk.rs | 12 +++--- 93 files changed, 325 insertions(+), 291 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 61016ad1d..615d694fa 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -57,7 +57,7 @@ Principles: - **Folders** nest inside one space, every rule in `folders::model::Lineage`; deleting hands notes and sub-folders to the parent; board geometry is separate from `Note`/`Folder`. Pinning is the only space order. → "Folders inside a space", "A folder travels; its coordinates do not", "Managing spaces from the switcher". - **Tools**: a pure Rust function each, called on the `compute` queue; `result` is an output, never an input; secrets are plain values. → "The tools: one contract…". - ⚠️ **The identity tool's lists are compiled in**: `crates/engine/resources/identity/` is `include_str!`-ed by `tools/identity/data.rs` (the standalone executable is one file) and each list is held whole by a test, not checked at run time. ⚠️ The names are **one list** (`names.txt`): never sort people's names by origin or by country — not in data, file names, order, code or tests. A new country is a file of places there, named in `data.rs`. → "The identity tool is that design…". -- ⚠️ **Request scripts run in the app relaunched as a script host** (`--devnotes-script-host`, read in `main` before any window): QuickJS, one host per request, a phase at a time; `pm.sendRequest` is sent by the parent. What `require` finds is bundled by `crates/engine/sandbox/build.mjs` into the committed `sandbox/dist/`. → "Request scripts, in a process of their own". +- ⚠️ **Request scripts run in the app relaunched as a script host** (`--script-host`, read in `main` before any window): QuickJS, one host per request, a phase at a time; `pm.sendRequest` is sent by the parent. What `require` finds is bundled by `crates/engine/sandbox/build.mjs` into the committed `sandbox/dist/`. → "Request scripts, in a process of their own". - **JSON explorer/visualiser**: inputs only; Rust owns the model (`explore_json`, nesting capped at 256, node/row caps). → "Exploring a JSON snippet", "The JSON visualiser's model". - `closed_enum!` declares enums once. **Imports degrade rather than fail**, in one transaction; an added variant does not bump `FORMAT_VERSION`. → "Import, export and copying out". - ⚠️ **Every name of the application is `brand`'s** (D36): six values of the root `Cargo.toml`'s `[workspace.metadata]`; never type the name, the slug, the identifier, the extension or the site. Other metadata is read from `Cargo.toml` at compile time; the changelog is baked in (`include_str!`). → "The application's names". diff --git a/Cargo.lock b/Cargo.lock index b8a0e02ef..8fb389d4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1719,6 +1719,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" name = "e2e" version = "1.3.0" dependencies = [ + "brand", "egui", "egui_inspection", "platform", diff --git a/clippy.toml b/clippy.toml index d511096ab..95817cbe2 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,3 +1,3 @@ # `clippy::doc_markdown` reads these product names as identifiers and asks for backticks. # `".."` extends the default list rather than replacing it. -doc-valid-idents = ["SQLite", "DevNotes", "TextMate", "QuickJS", "ProseMirror", "TipTap", ".."] +doc-valid-idents = ["SQLite", "TextMate", "QuickJS", "ProseMirror", "TipTap", ".."] diff --git a/crates/app/examples/icons.rs b/crates/app/examples/icons.rs index 814204797..a648a6313 100644 --- a/crates/app/examples/icons.rs +++ b/crates/app/examples/icons.rs @@ -1,4 +1,4 @@ -//! Regenerates `crates/app/icons/` from `devnotes.svg`: `cargo run -p app --example icons`. +//! Regenerates `crates/app/icons/` from `.svg`: `cargo run -p app --example icons`. //! //! ⚠️ 16, 24 and 32 px of the Windows `.ico` come from the hand-hinted drawings in //! `icons/source/`, whose lines sit on whole pixels. Scaled from the master they blur, and 24 px @@ -15,7 +15,7 @@ const PNGS: [(&str, u32); 3] = [("32x32.png", 32), ("128x128.png", 128), ("icon. fn main() { let icons = Path::new(env!("CARGO_MANIFEST_DIR")).join("icons"); - let master = icons.join("devnotes.svg"); + let master = icons.join(format!("{}.svg", brand::SLUG)); for (name, size) in PNGS { let source = if HINTED.contains(&size) { hinted(&icons, size) } else { master.clone() }; write(&icons.join(name), &render(&source, size)); diff --git a/crates/app/src/logging.rs b/crates/app/src/logging.rs index 90f0a18a2..cc3bd2a40 100644 --- a/crates/app/src/logging.rs +++ b/crates/app/src/logging.rs @@ -475,7 +475,7 @@ mod tests { &filed_from(&file, "lines before"), &[ "— the 3 lines before —", - "devnotes::logging: Logging at", + concat!(env!("CARGO_CRATE_NAME"), "::logging: Logging at"), "ui::action: #1 Notes::OpenNote", "ui::backend: db #1 notes::get 2 ms ok", "] ui::services::errors: the first warning", diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index fb6e4a2ba..fad4469b3 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -1,5 +1,4 @@ -//! The `devnotes` binary: a request-script host when relaunched as one, the application -//! otherwise. +//! The binary: a request-script host when relaunched as one, the application otherwise. // Prevents an additional console window on Windows in release. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] diff --git a/crates/app/tests/script_host.rs b/crates/app/tests/script_host.rs index e3dfe1b12..736e61334 100644 --- a/crates/app/tests/script_host.rs +++ b/crates/app/tests/script_host.rs @@ -1,4 +1,4 @@ -//! The `devnotes` binary started again as a script host, as the application starts it. +//! The binary started again as a script host, as the application starts it. use std::path::Path; use std::time::Duration; diff --git a/crates/engine/benches/commands.rs b/crates/engine/benches/commands.rs index 034290ad4..ff6a81b47 100644 --- a/crates/engine/benches/commands.rs +++ b/crates/engine/benches/commands.rs @@ -221,7 +221,7 @@ fn disk(c: &mut Criterion) { // The bundle is ~100 MB, so these two want their own sample size. group.sample_size(10); - let path = std::env::temp_dir().join("devnotes-bench-export.devnotes"); + let path = std::env::temp_dir().join("bench-export.archive"); let target = path.to_string_lossy().to_string(); // The corpus seeds no attachment, so the archive carries the bundle alone. What the // directory is does not matter; that it exists does. @@ -282,7 +282,7 @@ fn attachment(c: &mut Criterion) { }); }); - let profile = std::env::temp_dir().join(format!("devnotes-bench-profile-{}", uuid::Uuid::new_v4())); + let profile = std::env::temp_dir().join(format!("bench-profile-{}", uuid::Uuid::new_v4())); std::fs::create_dir_all(&profile).expect("a writable temporary directory"); libraries::registry::open_directory_in(&profile).expect("a registry"); diff --git a/crates/engine/benches/corpus.rs b/crates/engine/benches/corpus.rs index 1e760976b..addb52faf 100644 --- a/crates/engine/benches/corpus.rs +++ b/crates/engine/benches/corpus.rs @@ -125,7 +125,7 @@ pub(crate) fn build() -> Corpus { /// The size is a parameter for `corpus_size` alone: every other group takes [`NOTES`], so /// its numbers stay comparable across runs. pub(crate) fn build_of(notes: usize) -> Corpus { - let directory = std::env::temp_dir().join(format!("devnotes-bench-{}", uuid::Uuid::new_v4())); + let directory = std::env::temp_dir().join(format!("bench-{}", uuid::Uuid::new_v4())); std::fs::create_dir_all(&directory).expect("a writable temporary directory"); // The corpus is sealed like a real library, so the benchmarks measure what the diff --git a/crates/engine/benches/reference.rs b/crates/engine/benches/reference.rs index a7a631829..becb45667 100644 --- a/crates/engine/benches/reference.rs +++ b/crates/engine/benches/reference.rs @@ -182,10 +182,10 @@ fn uuid(n: usize) -> String { } pub(crate) fn build(size: Size) -> Reference { - let directory = std::env::temp_dir().join(format!("devnotes-reference-{}", uuid::Uuid::new_v4())); + let directory = std::env::temp_dir().join(format!("reference-{}", uuid::Uuid::new_v4())); std::fs::create_dir_all(&directory).unwrap(); let vault = engine::vault::file::create(&directory, "a passphrase", Cost::FOR_TESTS).unwrap(); - let mut library = db::open(&directory.join("devnotes.sqlite3"), vault).unwrap(); + let mut library = db::open(&directory.join(format!("{}.sqlite3", brand::SLUG)), vault).unwrap(); let (space_ids, note_ids) = seed(&mut library, size); std::fs::create_dir_all(directory.join("attachments")).unwrap(); diff --git a/crates/engine/sandbox/package-lock.json b/crates/engine/sandbox/package-lock.json index 4d05905e0..eb0806535 100644 --- a/crates/engine/sandbox/package-lock.json +++ b/crates/engine/sandbox/package-lock.json @@ -1,10 +1,10 @@ { - "name": "devnotes-script-libraries", + "name": "script-libraries", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "devnotes-script-libraries", + "name": "script-libraries", "license": "GPL-3.0-only", "devDependencies": { "ajv": "8.20.0", diff --git a/crates/engine/sandbox/package.json b/crates/engine/sandbox/package.json index 6a20aa5bb..50857fd18 100644 --- a/crates/engine/sandbox/package.json +++ b/crates/engine/sandbox/package.json @@ -1,5 +1,5 @@ { - "name": "devnotes-script-libraries", + "name": "script-libraries", "private": true, "description": "What a request script can require, bundled once into dist/ and compiled into the application.", "license": "GPL-3.0-only", diff --git a/crates/engine/src/docs.rs b/crates/engine/src/docs.rs index 1a0340186..5e02e628b 100644 --- a/crates/engine/src/docs.rs +++ b/crates/engine/src/docs.rs @@ -1,4 +1,4 @@ -//! The documentation, compiled in: the Markdown of `docs/content`, which devnotes.fr shows too. +//! The documentation, compiled in: the Markdown of `docs/content`, which the site shows too. pub mod model; pub mod search; diff --git a/crates/engine/src/docs/model.rs b/crates/engine/src/docs/model.rs index 2ceda14e4..0b924ecfa 100644 --- a/crates/engine/src/docs/model.rs +++ b/crates/engine/src/docs/model.rs @@ -501,8 +501,8 @@ mod tests { }; assert_eq!(to("[a](#ici)"), Target::Page { id: "page".to_owned(), section: Some("ici".to_owned()) }); assert_eq!( - to("[a](https://devnotes.fr/telecharger)"), - Target::Address("https://devnotes.fr/telecharger".to_owned()) + to("[a](https://example.org/telecharger)"), + Target::Address("https://example.org/telecharger".to_owned()) ); assert!(refused("[a](../autre.txt)").contains("leads nowhere")); } @@ -603,7 +603,7 @@ mod tests { Block::Paragraph(mut runs) => runs.remove(0), other => panic!("{other:?}"), }; - for address in ["https://devnotes.fr", "http://localhost:8080"] { + for address in ["https://example.org", "http://localhost:8080"] { assert!( matches!(to(address), Inline::Link { to: Target::Address(found), .. } if found == address) ); diff --git a/crates/engine/src/folders/board.rs b/crates/engine/src/folders/board.rs index 2863b59a6..9b83fcaea 100644 --- a/crates/engine/src/folders/board.rs +++ b/crates/engine/src/folders/board.rs @@ -45,7 +45,7 @@ pub const SCROLLBAR: i32 = 18; closed_enum! { /// How many lines a card shows of its note: the library's choice - /// (`devnotes.notes.previewLines`), since the board's loose cards are stored there in pixels. + /// (`.notes.previewLines`), since the board's loose cards are stored there in pixels. pub enum PreviewLines { Three = "3", #[default] diff --git a/crates/engine/src/http/scripts/engine.rs b/crates/engine/src/http/scripts/engine.rs index f4af8cb01..d1e4e77ba 100644 --- a/crates/engine/src/http/scripts/engine.rs +++ b/crates/engine/src/http/scripts/engine.rs @@ -1114,14 +1114,14 @@ mod tests { ("expect({ a: 1 }).toEqual({ a: 2 })", false), ("expect([1]).toStrictEqual([1])", true), ("expect([1]).toStrictEqual([2])", false), - ("expect('DevNotes').toContain('Notes')", true), + ("expect('MyNotes').toContain('Notes')", true), ("expect([1, 2]).toContain(2)", true), ("expect([{ a: 1 }]).toContain({ a: 1 })", false), ("expect(null).toContain(1)", false), ("expect([{ a: 1 }]).toContainEqual({ a: 1 })", true), ("expect([{ a: 1 }]).toContainEqual({ a: 2 })", false), - ("expect('DevNotes').toMatch(/notes/i)", true), - ("expect('DevNotes').toMatch('notes')", false), + ("expect('MyNotes').toMatch(/notes/i)", true), + ("expect('MyNotes').toMatch('notes')", false), ("expect({ a: 1, b: { c: 2, d: 3 } }).toMatchObject({ b: { c: 2 } })", true), ("expect({ a: [1, 2] }).toMatchObject({ a: [1] })", false), ("expect({ a: 1 }).toMatchObject({ b: undefined })", false), @@ -1446,8 +1446,8 @@ mod tests { ("require('csv-parse/lib/sync')('a,b\\n1,2', { columns: true })", r#"[{"a":"1","b":"2"}]"#), ("require('csv-parse/sync').parse('a,b\\n1,2')", r#"[["a","b"],["1","2"]]"#), ( - "[Buffer.from('DevNotes').toString('base64'), require('node:buffer').Buffer === Buffer]", - r#"["RGV2Tm90ZXM=",true]"#, + "[Buffer.from('Notebook').toString('base64'), require('node:buffer').Buffer === Buffer]", + r#"["Tm90ZWJvb2s=",true]"#, ), ( "(() => { const events = new (require('events'))(); let heard = 0; events.on('x', (n) => { heard = n; }); events.emit('x', 3); return heard; })()", diff --git a/crates/engine/src/notes/language.rs b/crates/engine/src/notes/language.rs index 629436e58..5e4d61502 100644 --- a/crates/engine/src/notes/language.rs +++ b/crates/engine/src/notes/language.rs @@ -1319,7 +1319,7 @@ mod tests { (" u32 { super::generate::fnv1a(seed) } @@ -636,12 +636,12 @@ s:Ba #[test] fn the_same_seed_gives_the_same_person_and_another_gives_another() { - assert_eq!(drawn("devnotes"), drawn("devnotes")); - assert_ne!(drawn("devnotes"), drawn("devnotes2")); + assert_eq!(drawn("seed"), drawn("seed")); + assert_ne!(drawn("seed"), drawn("seed2")); // All year: only the year of « today » is read. assert_eq!( - generate(&asked("devnotes"), NaiveDate::from_ymd_opt(2026, 1, 1).unwrap()).person, - generate(&asked("devnotes"), NaiveDate::from_ymd_opt(2026, 12, 31).unwrap()).person + generate(&asked("seed"), NaiveDate::from_ymd_opt(2026, 1, 1).unwrap()).person, + generate(&asked("seed"), NaiveDate::from_ymd_opt(2026, 12, 31).unwrap()).person ); } @@ -1219,7 +1219,7 @@ s:Ba /// What « Copier en JSON » writes: stable names, and the very person of the card. #[test] fn the_json_names_its_fields_as_the_note_documents_them() { - let answer = generate(&asked("devnotes"), today()); + let answer = generate(&asked("seed"), today()); let json: serde_json::Value = serde_json::from_str(&answer.json).unwrap(); for field in [ @@ -1246,7 +1246,7 @@ s:Ba assert_eq!(json["company"]["identifiers"][2]["kind"], "vat"); // A country without an IBAN writes none, and what it has instead. - let american = generate(&asked_in(Country::Us, "devnotes"), today()); + let american = generate(&asked_in(Country::Us, "seed"), today()); let json: serde_json::Value = serde_json::from_str(&american.json).unwrap(); assert!(json["bank"]["iban"].is_null()); assert_eq!(json["bank"]["local"][0]["kind"], "routingNumber"); @@ -1255,10 +1255,10 @@ s:Ba #[test] fn an_export_holds_as_many_people_as_asked_the_first_being_the_card_s() { - let (json, count) = exported(&asked("devnotes"), &[], 5, PeopleFormat::Json, today()); + let (json, count) = exported(&asked("seed"), &[], 5, PeopleFormat::Json, today()); let people: Vec = serde_json::from_str(&json).unwrap(); assert_eq!((people.len(), count), (5, 5)); - assert_eq!(people[0]["surname"], drawn("devnotes").surname); + assert_eq!(people[0]["surname"], drawn("seed").surname); assert_ne!(people[0], people[1]); assert!(people.iter().all(|person| person["country"] == "FR")); @@ -1272,7 +1272,7 @@ s:Ba #[test] fn an_export_of_several_countries_gives_each_its_turn() { let (json, _) = exported( - &asked("devnotes"), + &asked("seed"), &[Country::It, Country::Fr, Country::Us], 7, PeopleFormat::Json, @@ -1282,14 +1282,14 @@ s:Ba let countries: Vec<&str> = people.iter().map(|person| person["country"].as_str().unwrap()).collect(); assert_eq!(countries, ["FR", "IT", "US", "FR", "IT", "US", "FR"]); - assert_eq!(people[0]["surname"], drawn("devnotes").surname); + assert_eq!(people[0]["surname"], drawn("seed").surname); assert_eq!(people[1]["identifiers"][0]["kind"], "codiceFiscale"); assert!(people[2]["bank"]["iban"].is_null()); } #[test] fn a_csv_has_a_header_a_row_a_person_and_quotes_what_holds_a_comma() { - let (csv, _) = exported(&asked("devnotes"), &[Country::Gb], 4, PeopleFormat::Csv, today()); + let (csv, _) = exported(&asked("seed"), &[Country::Gb], 4, PeopleFormat::Csv, today()); let rows: Vec<&str> = csv.trim_end().split("\r\n").collect(); assert_eq!(rows.len(), 5); @@ -1314,7 +1314,7 @@ s:Ba format: PeopleFormat::Csv, separator: CsvSeparator::Semicolon, }; - let (csv, _) = super::exported(&asked("devnotes"), &batch, today(), data::library()); + let (csv, _) = super::exported(&asked("seed"), &batch, today(), data::library()); let rows: Vec<&str> = csv.trim_end().split("\r\n").collect(); assert!(rows[0].starts_with("\u{feff}country;sex;surname;givenNames")); @@ -1331,13 +1331,13 @@ s:Ba |format| PeopleBatch { countries: Vec::new(), count: 2, format, separator: CsvSeparator::Comma }; assert_eq!( - export(&asked("devnotes"), &batch(PeopleFormat::Csv), &path.to_string_lossy(), today(),), + export(&asked("seed"), &batch(PeopleFormat::Csv), &path.to_string_lossy(), today(),), PeopleExport::Written { people: 2 } ); assert_eq!(std::fs::read_to_string(&path).unwrap().lines().count(), 3); assert_eq!( export( - &asked("devnotes"), + &asked("seed"), &batch(PeopleFormat::Json), &folder.path().join("absent").join("people.json").to_string_lossy(), today(), @@ -1349,7 +1349,7 @@ s:Ba /// The service draws from the lists compiled in: the same person as from the library. #[test] fn the_lists_compiled_in_draw_the_same_person_for_a_seed() { - let request = asked("devnotes"); + let request = asked("seed"); assert_eq!(super::generate(&request, today()), generate(&request, today())); } diff --git a/crates/engine/src/tools/qr.rs b/crates/engine/src/tools/qr.rs index 9691a701a..4ad14679a 100644 --- a/crates/engine/src/tools/qr.rs +++ b/crates/engine/src/tools/qr.rs @@ -573,7 +573,7 @@ mod tests { ] .join("\r\n") ); - assert!(contact("", "", "", "DevNotes").unwrap().contains("N:;;;;\r\nFN:DevNotes")); + assert!(contact("", "", "", "Notebook").unwrap().contains("N:;;;;\r\nFN:Notebook")); } #[test] @@ -597,7 +597,7 @@ mod tests { #[test] fn the_path_covers_every_dark_module_inside_the_margin() { - let drawn = drawn(&request(text("DevNotes"), QrCorrection::Low)).unwrap(); + let drawn = drawn(&request(text("Notebook"), QrCorrection::Low)).unwrap(); let path = drawn.path(); let covered: usize = path @@ -612,7 +612,7 @@ mod tests { #[test] fn the_svg_file_is_the_preview_on_white() { - let drawn = drawn(&request(text("DevNotes"), QrCorrection::Low)).unwrap(); + let drawn = drawn(&request(text("Notebook"), QrCorrection::Low)).unwrap(); let file = svg(&drawn); assert!(file.contains(r#"viewBox="0 0 29 29" width="232" height="232""#)); @@ -622,7 +622,7 @@ mod tests { #[test] fn the_png_is_ten_pixels_a_module_with_its_margin_white() { - let drawn = drawn(&request(text("DevNotes"), QrCorrection::Low)).unwrap(); + let drawn = drawn(&request(text("Notebook"), QrCorrection::Low)).unwrap(); let bytes = png(&drawn).unwrap(); let decoder = png::Decoder::new(std::io::Cursor::new(bytes)); @@ -639,7 +639,7 @@ mod tests { #[test] fn a_margin_is_capped_and_zero_is_allowed() { let side = |margin| { - let request = QrRequest { margin, ..request(text("DevNotes"), QrCorrection::Low) }; + let request = QrRequest { margin, ..request(text("Notebook"), QrCorrection::Low) }; match describe(&request) { QrAnswer::Code { side, .. } => side, other => panic!("a code, not {other:?}"), @@ -653,7 +653,7 @@ mod tests { fn saving_writes_the_chosen_format_and_says_its_size() { let folder = tempfile::tempdir().unwrap(); let path = folder.path().join("qr.svg").to_string_lossy().into_owned(); - let code = request(text("DevNotes"), QrCorrection::Low); + let code = request(text("Notebook"), QrCorrection::Low); let saved = save(&code, QrFormat::Svg, &path); @@ -665,7 +665,7 @@ mod tests { #[test] fn the_clipboard_gets_opaque_rgba_at_the_png_scale() { - let (pixels, rgba) = rgba(&request(text("DevNotes"), QrCorrection::Low)).unwrap(); + let (pixels, rgba) = rgba(&request(text("Notebook"), QrCorrection::Low)).unwrap(); assert_eq!(pixels, 290); assert_eq!(rgba.len(), 290 * 290 * 4); diff --git a/crates/engine/src/transfer/bundle.rs b/crates/engine/src/transfer/bundle.rs index 844ed47be..978c9b098 100644 --- a/crates/engine/src/transfer/bundle.rs +++ b/crates/engine/src/transfer/bundle.rs @@ -316,7 +316,7 @@ mod tests { attachments: vec![hostile], }; - let path = profile.join("crafted.devnotes").to_string_lossy().to_string(); + let path = profile.join("crafted.archive").to_string_lossy().to_string(); file::write(&path, &bundle, &sending_files, &vault, None).unwrap(); let mut receiving = open_in_memory().unwrap(); diff --git a/crates/engine/src/transfer/file.rs b/crates/engine/src/transfer/file.rs index 74ace6a60..4840a5872 100644 --- a/crates/engine/src/transfer/file.rs +++ b/crates/engine/src/transfer/file.rs @@ -361,7 +361,7 @@ mod tests { let folder = tempfile::tempdir().unwrap(); let attachments = folder.path().join("attachments"); std::fs::create_dir_all(&attachments).unwrap(); - let export = folder.path().join("notes.devnotes").to_string_lossy().to_string(); + let export = folder.path().join("notes.archive").to_string_lossy().to_string(); Scratch { _folder: folder, attachments, export } } @@ -496,7 +496,7 @@ mod tests { /// ⚠️ A rename across volumes is not atomic: the staging file shares its target's folder. #[test] fn the_staging_file_sits_next_to_its_target() { - let target = std::env::temp_dir().join("documents").join("library.devnotes"); + let target = std::env::temp_dir().join("documents").join("library.archive"); let staged = staging_path(&target.to_string_lossy()); @@ -519,13 +519,13 @@ mod tests { .map(|entry| entry.unwrap().file_name().to_string_lossy().to_string()) .collect(); beside.sort(); - assert_eq!(beside, ["attachments", "notes.devnotes"]); + assert_eq!(beside, ["attachments", "notes.archive"]); } #[test] fn an_export_that_cannot_be_written_leaves_nothing_behind() { let scratch = scratch(); - let nowhere = Path::new(&scratch.export).with_file_name("missing").join("notes.devnotes"); + let nowhere = Path::new(&scratch.export).with_file_name("missing").join("notes.archive"); let refused = write(&nowhere.to_string_lossy(), &bundle(Vec::new()), &scratch.attachments, &library(), None); diff --git a/crates/engine/src/transfer/model.rs b/crates/engine/src/transfer/model.rs index 3acc0b315..f45b94a82 100644 --- a/crates/engine/src/transfer/model.rs +++ b/crates/engine/src/transfer/model.rs @@ -121,7 +121,7 @@ pub fn read_bundle(json: &str) -> Result { } /// `Note` deserialises `language`, `kind` and `priority` as closed enums, so one value from -/// a newer DevNotes would fail the whole import. This degrades it instead, as the database read +/// a newer version would fail the whole import. This degrades it instead, as the database read /// does (`NoteRow::open`); only the bridge stays strict. fn degrade_unknown_values(bundle: &mut serde_json::Value) -> BTreeSet { let mut degraded = BTreeSet::new(); @@ -307,7 +307,7 @@ mod tests { } } - /// One note from a newer DevNotes must not fail the whole file: its value comes down to the + /// One note from a newer version must not fail the whole file: its value comes down to the /// default, and the note is named so the loss is said. #[test] fn a_value_this_build_does_not_know_comes_down_to_the_default_and_is_counted() { @@ -352,7 +352,7 @@ mod tests { #[test] fn an_export_or_an_import_needs_a_file() { assert_eq!(validate_path(" ").unwrap_err().field, "path"); - assert!(validate_path("notes.devnotes").is_ok()); + assert!(validate_path("notes.archive").is_ok()); } #[test] diff --git a/crates/engine/tests/commands/backups.rs b/crates/engine/tests/commands/backups.rs index 6c612b709..f308dc414 100644 --- a/crates/engine/tests/commands/backups.rs +++ b/crates/engine/tests/commands/backups.rs @@ -83,7 +83,7 @@ fn the_launch_copy_holds_what_the_launch_purges_from_the_trash() { let directory = session.call(open_library_directory).unwrap(); let copy = directory.join("backups").join(newest_copy(&session)); let vault = engine::vault::file::unlock(©, PHRASE).unwrap(); - let mut copied = engine::db::open(©.join("devnotes.sqlite3"), vault).unwrap(); + let mut copied = engine::db::open(©.join(format!("{}.sqlite3", brand::SLUG)), vault).unwrap(); assert_eq!(trashed_ids(&mut copied).unwrap(), [note]); } diff --git a/crates/engine/tests/commands/concurrency.rs b/crates/engine/tests/commands/concurrency.rs index d43e1e453..a85b469cd 100644 --- a/crates/engine/tests/commands/concurrency.rs +++ b/crates/engine/tests/commands/concurrency.rs @@ -184,7 +184,7 @@ fn a_large_export_holds_back_no_other_command() { let path = source.to_string_lossy().to_string(); session.wait(|e| attach_file(e, note, path)).unwrap(); } - let path = scratch.path().join("all.devnotes").to_string_lossy().to_string(); + let path = scratch.path().join("all.archive").to_string_lossy().to_string(); let exporting = session diff --git a/crates/engine/tests/commands/http_scripts.rs b/crates/engine/tests/commands/http_scripts.rs index 2f37e670e..3d8e06779 100644 --- a/crates/engine/tests/commands/http_scripts.rs +++ b/crates/engine/tests/commands/http_scripts.rs @@ -250,7 +250,7 @@ fn the_console_says_what_left_what_came_back_and_for_which_send() { fn a_failed_send_is_said_in_the_console_by_its_code() { let session = hosted(); - send(&session, request("http://devnotes.invalid/")).unwrap_err(); + send(&session, request("http://example.invalid/")).unwrap_err(); let said = console(&session); assert!(matches!( diff --git a/crates/engine/tests/commands/http_send.rs b/crates/engine/tests/commands/http_send.rs index 26e0c3a5a..aac7c1f00 100644 --- a/crates/engine/tests/commands/http_send.rs +++ b/crates/engine/tests/commands/http_send.rs @@ -835,7 +835,7 @@ fn a_send_that_fails_says_why_by_a_code() { let plain = format!("https://127.0.0.1:{}/", plain_over_tls()); for (url, expected) in [ ("ftp://example.com", ErrorCode::HttpInvalidUrl), - ("http://devnotes.invalid/", ErrorCode::HttpUnresolved), + ("http://example.invalid/", ErrorCode::HttpUnresolved), (&closed, ErrorCode::HttpRefused), (&plain, ErrorCode::HttpTls), ] { diff --git a/crates/engine/tests/commands/profile.rs b/crates/engine/tests/commands/profile.rs index 668739e1c..bf1e98ca7 100644 --- a/crates/engine/tests/commands/profile.rs +++ b/crates/engine/tests/commands/profile.rs @@ -80,13 +80,8 @@ fn the_open_library_s_folder_is_where_its_database_is() { fn the_identity_tool_draws_a_person_in_every_country_with_no_folder_to_read() { let session = Session::open(); for country in Country::ALL { - let request = IdentityRequest { - country, - sex: None, - age_min: 18, - age_max: 80, - seed: Some("devnotes".to_string()), - }; + let request = + IdentityRequest { country, sex: None, age_min: 18, age_max: 80, seed: Some("seed".to_string()) }; let answer = session.call(|_| generate_identity(&request)); @@ -105,7 +100,7 @@ fn a_qr_code_is_drawn_as_square_rgba_for_the_shell_to_copy() { margin: 2, }; - let drawn = engine::tools::qr::rgba(&request("devnotes")); + let drawn = engine::tools::qr::rgba(&request("hello")); let nothing = engine::tools::qr::rgba(&request("")); let (side, rgba) = drawn.unwrap(); diff --git a/crates/engine/tests/commands/transfer.rs b/crates/engine/tests/commands/transfer.rs index 885ce1b84..c657e4c06 100644 --- a/crates/engine/tests/commands/transfer.rs +++ b/crates/engine/tests/commands/transfer.rs @@ -46,7 +46,7 @@ fn titles(session: &Session) -> Vec { fn nothing_answers_before_a_library_is_open() { let scratch = tempfile::tempdir().unwrap(); let session = Session::locked(); - let export = path_in(&scratch, "notes.devnotes"); + let export = path_in(&scratch, "notes.archive"); std::fs::write(&export, b"{}").unwrap(); let codes = [ @@ -63,7 +63,7 @@ fn nothing_answers_before_a_library_is_open() { fn an_export_without_a_file_or_with_a_short_phrase_is_refused_as_input() { let session = Session::locked(); let scratch = tempfile::tempdir().unwrap(); - let export = path_in(&scratch, "notes.devnotes"); + let export = path_in(&scratch, "notes.archive"); let answers = [ code(session.wait(|e| export_notes(e, " ".to_string(), ExportScope::Library, None))), @@ -80,7 +80,7 @@ fn an_export_without_a_file_or_with_a_short_phrase_is_refused_as_input() { fn an_export_of_nothing_writes_no_file() { let scratch = tempfile::tempdir().unwrap(); let session = Session::on_disk(&scratch.path().join("library")); - let export = path_in(&scratch, "notes.devnotes"); + let export = path_in(&scratch, "notes.archive"); let report = session .wait(|e| export_notes(e, export.clone(), ExportScope::Library, Some(PHRASE.to_string()))) @@ -101,7 +101,7 @@ fn a_protected_export_imports_into_another_library_with_its_phrase() { let work = sender.space("Work"); note(&sender, &work, "Deploy"); note(&sender, &work, "Rollback"); - let export = path_in(&scratch, "notes.devnotes"); + let export = path_in(&scratch, "notes.archive"); assert_eq!(sender.call(|e| count_export(e, &ExportScope::Library)).unwrap(), 2); let sent = sender @@ -131,7 +131,7 @@ fn an_unprotected_export_imports_without_a_phrase() { let work = sender.space("Work"); let kept = note(&sender, &work, "Kept"); note(&sender, &work, "Left"); - let export = path_in(&scratch, "notes.devnotes"); + let export = path_in(&scratch, "notes.archive"); let chosen = ExportScope::Notes { ids: vec![kept] }; let sent = sender.wait(|e| export_notes(e, export.clone(), chosen, None)).unwrap(); @@ -149,7 +149,7 @@ fn a_file_that_is_no_export_is_answered_by_its_code() { let session = Session::on_disk(&scratch.path().join("library")); let garbage = path_in(&scratch, "garbage.json"); std::fs::write(&garbage, b"not an export").unwrap(); - let missing = path_in(&scratch, "missing.devnotes"); + let missing = path_in(&scratch, "missing.archive"); assert_eq!(code(session.wait(|e| import_notes(e, garbage, None))), ErrorCode::ImportFormat); assert_eq!(code(session.wait(|e| import_notes(e, missing, None))), ErrorCode::FileAccess); diff --git a/crates/engine/tests/commands/websocket.rs b/crates/engine/tests/commands/websocket.rs index cad2f22c9..600627c98 100644 --- a/crates/engine/tests/commands/websocket.rs +++ b/crates/engine/tests/commands/websocket.rs @@ -267,7 +267,7 @@ fn a_scheme_that_is_not_a_socket_s_is_refused_with_its_twin() { fn a_host_that_does_not_resolve_is_named_as_such() { let session = Session::open(); - let answer = session.wait(|e| connect_websocket(e, request("wss://devnotes.invalid/"))); + let answer = session.wait(|e| connect_websocket(e, request("wss://example.invalid/"))); assert_eq!(code(answer), ErrorCode::HttpUnresolved); } diff --git a/crates/engine/tests/corpus/cmake.txt b/crates/engine/tests/corpus/cmake.txt index 1cd4c68e1..365a991a5 100644 --- a/crates/engine/tests/corpus/cmake.txt +++ b/crates/engine/tests/corpus/cmake.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.20) -project(devnotes CXX) +project(notes CXX) set(CMAKE_CXX_STANDARD 20) add_executable(app main.cpp) diff --git a/crates/engine/tests/corpus/cs.txt b/crates/engine/tests/corpus/cs.txt index 32779b8cd..119513295 100644 --- a/crates/engine/tests/corpus/cs.txt +++ b/crates/engine/tests/corpus/cs.txt @@ -1,6 +1,6 @@ using System; -namespace DevNotes +namespace Notes { class Program { diff --git a/crates/engine/tests/corpus/json.txt b/crates/engine/tests/corpus/json.txt index 49f93911d..6d5fe004c 100644 --- a/crates/engine/tests/corpus/json.txt +++ b/crates/engine/tests/corpus/json.txt @@ -1,5 +1,5 @@ { - "name": "devnotes", + "name": "notes", "version": "0.3.3", "private": true, "scripts": { "build": "ng build" } diff --git a/crates/engine/tests/corpus/tf.txt b/crates/engine/tests/corpus/tf.txt index 846eafbe5..9a0150bcb 100644 --- a/crates/engine/tests/corpus/tf.txt +++ b/crates/engine/tests/corpus/tf.txt @@ -3,7 +3,7 @@ provider "aws" { } resource "aws_s3_bucket" "assets" { - bucket = "devnotes-assets" + bucket = "notes-assets" tags = { Environment = var.environment } diff --git a/crates/engine/tests/corpus/toml.txt b/crates/engine/tests/corpus/toml.txt index ca741dda0..1df5fcc4e 100644 --- a/crates/engine/tests/corpus/toml.txt +++ b/crates/engine/tests/corpus/toml.txt @@ -1,5 +1,5 @@ [package] -name = "devnotes" +name = "notes" version = "0.3.3" edition = "2024" diff --git a/crates/engine/tests/corpus/txt-weak-cmake.txt b/crates/engine/tests/corpus/txt-weak-cmake.txt index adea6bb4b..383f2e0ae 100644 --- a/crates/engine/tests/corpus/txt-weak-cmake.txt +++ b/crates/engine/tests/corpus/txt-weak-cmake.txt @@ -1 +1 @@ -set(NAME devnotes) +set(NAME notes) diff --git a/crates/engine/tests/formats.rs b/crates/engine/tests/formats.rs index 686ceaad3..f4103a3dd 100644 --- a/crates/engine/tests/formats.rs +++ b/crates/engine/tests/formats.rs @@ -112,7 +112,7 @@ fn an_attachment_serializes_with_camel_case_keys() { #[test] fn an_export_bundle_reads_back_the_notes_it_wrote() { - // The file is a contract between two versions of DevNotes. + // The file is a contract between two versions of the application. let bundle = Bundle { version: transfer::model::FORMAT_VERSION, exported_at: at(NOW), diff --git a/crates/engine/tests/transfer.rs b/crates/engine/tests/transfer.rs index 75590f9b6..d74f01650 100644 --- a/crates/engine/tests/transfer.rs +++ b/crates/engine/tests/transfer.rs @@ -406,7 +406,7 @@ fn shipment(passphrase: Option<&str>, file_present: bool) -> Shipment { sealed::write_sealed(vault, &source_files.join(record.stored_name()), b"pixels").unwrap(); } let bundle = of(&mut source, &ExportScope::Library).unwrap(); - let export = scratch.path().join("notes.devnotes").to_string_lossy().to_string(); + let export = scratch.path().join("notes.archive").to_string_lossy().to_string(); file::write(&export, &bundle, &source_files, &source.shared_vault(), passphrase).unwrap(); let (destination, attachments) = library_at("destination"); let read = file::read(&export, passphrase).unwrap(); diff --git a/crates/i18n/src/lib.rs b/crates/i18n/src/lib.rs index 4d2aff8cc..65bc35bff 100644 --- a/crates/i18n/src/lib.rs +++ b/crates/i18n/src/lib.rs @@ -325,7 +325,7 @@ mod tests { #[test] fn the_application_is_named_by_its_manifest_and_never_in_a_translation() { - assert_eq!(interpolate("Bienvenue dans {{app}}", &[]), "Bienvenue dans DevNotes"); + assert_eq!(interpolate("Bienvenue dans {{app}}", &[]), format!("Bienvenue dans {APP}")); for language in Language::ALL { let spelled: Vec<&String> = language .catalogue() diff --git a/crates/platform/Cargo.toml b/crates/platform/Cargo.toml index 8fc93c14c..1844f0bd5 100644 --- a/crates/platform/Cargo.toml +++ b/crates/platform/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "platform" -description = "What DevNotes asks of the operating system: paths, window geometry, one instance per profile" +description = "What the application asks of the operating system: paths, window geometry, one instance per profile" version.workspace = true edition.workspace = true rust-version.workspace = true diff --git a/crates/platform/src/dialog.rs b/crates/platform/src/dialog.rs index 70206f863..16b53b98d 100644 --- a/crates/platform/src/dialog.rs +++ b/crates/platform/src/dialog.rs @@ -94,10 +94,10 @@ mod tests { #[test] fn a_fixed_dialog_answers_its_path_to_both_questions() { - let dialog = Fixed(PathBuf::from("export.devnotes")); + let dialog = Fixed(PathBuf::from("export.archive")); - assert_eq!(dialog.open(), Some(PathBuf::from("export.devnotes"))); - assert_eq!(dialog.save("notes.devnotes"), Some(PathBuf::from("export.devnotes"))); + assert_eq!(dialog.open(), Some(PathBuf::from("export.archive"))); + assert_eq!(dialog.save("notes.archive"), Some(PathBuf::from("export.archive"))); } #[test] diff --git a/crates/platform/src/instance.rs b/crates/platform/src/instance.rs index 836146709..d97b1b67d 100644 --- a/crates/platform/src/instance.rs +++ b/crates/platform/src/instance.rs @@ -13,7 +13,7 @@ use sha2::{Digest, Sha256}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Message { Reveal, - /// A global action by its name: `devnotes --action palette`, what a shortcut of the + /// A global action by its name: ` --action palette`, what a shortcut of the /// desktop's runs, or a scenario in place of a key. Action(String), } diff --git a/crates/platform/src/lib.rs b/crates/platform/src/lib.rs index 556a2789d..220f440e9 100644 --- a/crates/platform/src/lib.rs +++ b/crates/platform/src/lib.rs @@ -1,8 +1,8 @@ -//! What DevNotes asks of the operating system, behind safe APIs (D7): where its files are, where -//! its window was, whether another launch already holds the profile, whether the system asks +//! What the application asks of the operating system, behind safe APIs (D7): where its files are, +//! where its window was, whether another launch already holds the profile, whether the system asks //! for less motion, which file a dialog chose, the icon of the notification area, the keys taken -//! from the whole machine, the session's autostart, toasts, links and updates. Neither egui nor -//! the core is named here. +//! from the whole machine, the session's autostart, toasts, links and updates. Neither egui nor the +//! core is named here. pub mod autostart; pub mod clipboard; diff --git a/crates/platform/src/shortcuts.rs b/crates/platform/src/shortcuts.rs index 792eda695..f935d484b 100644 --- a/crates/platform/src/shortcuts.rs +++ b/crates/platform/src/shortcuts.rs @@ -29,7 +29,7 @@ pub enum Global { } impl Global { - /// Its name for `devnotes --action`, which a second launch hands over. + /// Its name for ` --action`, which a second launch hands over. pub fn name(self) -> &'static str { match self { Self::Palette => "palette", @@ -53,7 +53,7 @@ pub enum Holder { Application, /// A Wayland desktop, through its global-shortcuts portal, which asked the person first. Portal, - /// GNOME's own settings, where a custom shortcut runs `devnotes --action `. + /// GNOME's own settings, where a custom shortcut runs ` --action `. DesktopSettings, /// Nobody: a Wayland desktop offering neither, where the person binds the command. Nobody, @@ -187,9 +187,9 @@ mod tests { #[test] fn a_path_is_one_word_for_a_shell() { for (path, word) in [ - ("/usr/bin/devnotes", "/usr/bin/devnotes"), + ("/usr/bin/app", "/usr/bin/app"), ("/a-b_c.d+e:f=g@h%i,j", "/a-b_c.d+e:f=g@h%i,j"), - ("/home/a b/DevNotes", "'/home/a b/DevNotes'"), + ("/home/a b/App", "'/home/a b/App'"), ("/home/Dev'Notes", r"'/home/Dev'\''Notes'"), ("/home/$a", "'/home/$a'"), ("/home/é", "'/home/é'"), diff --git a/crates/platform/src/shortcuts/notation.rs b/crates/platform/src/shortcuts/notation.rs index c9e011432..f29b140ca 100644 --- a/crates/platform/src/shortcuts/notation.rs +++ b/crates/platform/src/shortcuts/notation.rs @@ -181,9 +181,6 @@ mod tests { #[test] fn a_printed_list_reads_back() { assert!(gvariant_list("@as []\n").is_empty()); - assert_eq!( - gvariant_list("['/a/custom0/', '/a/devnotes-palette/']\n"), - ["/a/custom0/", "/a/devnotes-palette/"] - ); + assert_eq!(gvariant_list("['/a/custom0/', '/a/app-palette/']\n"), ["/a/custom0/", "/a/app-palette/"]); } } diff --git a/crates/platform/src/shortcuts/system/gnome.rs b/crates/platform/src/shortcuts/system/gnome.rs index d05dea1d0..d1f03b651 100644 --- a/crates/platform/src/shortcuts/system/gnome.rs +++ b/crates/platform/src/shortcuts/system/gnome.rs @@ -1,7 +1,7 @@ //! GNOME without the portal (before 48, Ubuntu 24.04's 46): a custom shortcut of its own settings -//! for each key, running `devnotes --action `, which a second launch hands over. Written -//! with `gsettings`, as the person's Keyboard settings would; they stay there if DevNotes is -//! uninstalled, which no package's removal could reach. +//! for each key, running ` --action `, which a second launch hands over. Written +//! with `gsettings`, as the person's Keyboard settings would; they stay there if the application +//! is uninstalled, which no package's removal could reach. use std::io; use std::process::Command; diff --git a/crates/platform/src/shortcuts/system/portal.rs b/crates/platform/src/shortcuts/system/portal.rs index 6ac67890e..68d4c4d1b 100644 --- a/crates/platform/src/shortcuts/system/portal.rs +++ b/crates/platform/src/shortcuts/system/portal.rs @@ -47,7 +47,7 @@ pub(super) fn open(on_pressed: Listener) -> zbus::Result { Ok(Session { connection, handle: None, requests: 0 }) } -/// Names us `devnotes` (the menu entry's name) before any other call on this connection, so the +/// Names us by the slug (the menu entry's name) before any other call on this connection, so the /// desktop remembers what the person accepted across launches, from a terminal too. Only recent /// portals have it; the others find the name in the launch's systemd scope, or not at all. fn register(connection: &Connection) { diff --git a/crates/richtext/src/picture.rs b/crates/richtext/src/picture.rs index aedfadf90..464dc8354 100644 --- a/crates/richtext/src/picture.rs +++ b/crates/richtext/src/picture.rs @@ -1,5 +1,5 @@ //! The drawing a Note embeds: an image whose source is the drawing's id, and the part of the -//! text's width it takes, `devnotes:drawing/?w=50`. Without one it is at its own size. +//! text's width it takes, `:drawing/?w=50`. Without one it is at its own size. use crate::edit; use crate::model::{Block, Document, Position, Selection}; @@ -128,37 +128,39 @@ mod tests { use super::*; use crate::{read as read_note, write}; - const SIZED: &str = "avant\n\n![schéma](devnotes:drawing/a1?w=50)\n\naprès"; + fn sized() -> String { + format!("avant\n\n![schéma]({DRAWING_SOURCE}a1?w=50)\n\naprès") + } #[test] fn the_width_is_read_and_written_back() { - let document = read_note(SIZED); + let document = read_note(&sized()); assert_eq!(width(&document, &[1]), Some(50)); assert!(matches!( &document.blocks[1], - Block::Image { src, .. } if src == "devnotes:drawing/a1" + Block::Image { src, .. } if *src == format!("{DRAWING_SOURCE}a1") )); - assert_eq!(write(&document), SIZED); + assert_eq!(write(&document), sized()); } #[test] fn every_width_from_the_narrowest_to_the_widest_is_read() { for (written, width_read) in [(9, None), (10, Some(10)), (100, Some(100)), (101, None)] { - let document = read_note(&format!("![a](devnotes:drawing/a1?w={written})")); + let document = read_note(&format!("![a]({DRAWING_SOURCE}a1?w={written})")); assert_eq!(width(&document, &[0]), width_read, "{written}"); } } #[test] fn a_drawing_takes_a_width_and_gives_it_back() { - let mut document = read_note(SIZED); + let mut document = read_note(&sized()); assert!(set_width(&mut document, &[1], Some(75))); assert!(!set_width(&mut document, &[1], Some(75)), "as it was"); - assert!(write(&document).contains("devnotes:drawing/a1?w=75)")); + assert!(write(&document).contains(&format!("{DRAWING_SOURCE}a1?w=75)"))); assert!(set_width(&mut document, &[1], None)); - assert!(write(&document).contains("devnotes:drawing/a1)")); + assert!(write(&document).contains(&format!("{DRAWING_SOURCE}a1)"))); } #[test] @@ -175,7 +177,7 @@ mod tests { #[test] fn what_is_not_a_width_is_left_as_written() { for query in ["w=5", "w=101", "w=large", "x=50", "w=50&x=1", "w="] { - let written = format!("![a](devnotes:drawing/a1?{query})"); + let written = format!("![a]({DRAWING_SOURCE}a1?{query})"); let document = read_note(&written); assert_eq!(width(&document, &[0]), None, "{query}"); assert_eq!(write(&document), written); @@ -185,13 +187,13 @@ mod tests { #[test] fn a_drawing_is_found_whatever_its_query() { for (src, id) in [ - ("devnotes:drawing/a1", Some("a1")), - ("devnotes:drawing/a1?w=large", Some("a1")), - ("devnotes:drawing/a1?x=1?w=2", Some("a1")), - ("https://a.fr/a.png", None), - ("", None), + (format!("{DRAWING_SOURCE}a1"), Some("a1")), + (format!("{DRAWING_SOURCE}a1?w=large"), Some("a1")), + (format!("{DRAWING_SOURCE}a1?x=1?w=2"), Some("a1")), + ("https://a.fr/a.png".to_owned(), None), + (String::new(), None), ] { - assert_eq!(drawing_id(src), id, "{src}"); + assert_eq!(drawing_id(&src), id, "{src}"); } } @@ -230,7 +232,7 @@ mod tests { #[test] fn the_caret_meets_the_image_then_the_text_past_it() { - let document = read_note(SIZED); + let document = read_note(&sized()); assert_eq!(beside(&document, &[0], true), Some(Beside::Image(vec![1]))); assert_eq!(beside(&document, &[2], false), Some(Beside::Image(vec![1]))); @@ -240,7 +242,7 @@ mod tests { #[test] fn past_the_ends_there_is_nothing_to_meet() { - let document = read_note(SIZED); + let document = read_note(&sized()); assert_eq!(beside(&document, &[0], false), None); assert_eq!(beside(&document, &[2], true), None); @@ -256,7 +258,7 @@ mod tests { #[test] fn an_image_removed_leaves_the_caret_in_the_text_before_it() { - let mut document = read_note(SIZED); + let mut document = read_note(&sized()); let selection = remove(&mut document, &[1]); assert_eq!(write(&document), "avant\n\naprès"); @@ -279,7 +281,7 @@ mod tests { #[test] fn an_image_removed_alone_leaves_a_paragraph_to_type_in() { - let mut document = read_note("![a](devnotes:drawing/a1)"); + let mut document = read_note(&format!("![a]({DRAWING_SOURCE}a1)")); remove(&mut document, &[0]); assert_eq!(document.blocks, [Block::Paragraph(Vec::new())]); diff --git a/crates/richtext/src/write.rs b/crates/richtext/src/write.rs index d9260ea71..42da8f03f 100644 --- a/crates/richtext/src/write.rs +++ b/crates/richtext/src/write.rs @@ -341,8 +341,8 @@ mod tests { #[test] fn an_image_in_a_paragraph_stands_on_its_own() { - let written = round("avant ![x](devnotes:drawing/1)"); - assert!(written.ends_with("\n\n![x](devnotes:drawing/1)"), "{written}"); + let written = round("avant ![x](app:drawing/1)"); + assert!(written.ends_with("\n\n![x](app:drawing/1)"), "{written}"); } #[test] diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index 37bf26fdf..9fd75de5e 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ui" -description = "The egui interface of DevNotes" +description = "The egui interface of the application" version.workspace = true edition.workspace = true rust-version.workspace = true diff --git a/crates/ui/clippy.toml b/crates/ui/clippy.toml index c677936c5..472347c26 100644 --- a/crates/ui/clippy.toml +++ b/crates/ui/clippy.toml @@ -1,5 +1,5 @@ # Replaces the root's rather than adding to it: its line is repeated. -doc-valid-idents = ["SQLite", "DevNotes", "TextMate", "QuickJS", "ProseMirror", "TipTap", ".."] +doc-valid-idents = ["SQLite", "TextMate", "QuickJS", "ProseMirror", "TipTap", ".."] # Every custom widget goes through `widgets::interact`, which names it, addresses it and gives # it its focus ring: a control made with `Ui::interact` would have none of the three. diff --git a/crates/ui/src/app/captures.rs b/crates/ui/src/app/captures.rs index ad46e2c7a..c4bdebc43 100644 --- a/crates/ui/src/app/captures.rs +++ b/crates/ui/src/app/captures.rs @@ -183,7 +183,7 @@ fn the_title_bar_and_the_banners_over_an_open_library() { click(&mut harness, "file-quit"); capture(&mut harness, "file-menu-quit-asks"); harness.state_mut().state.dialog = - std::sync::Arc::new(platform::dialog::Fixed(profile.path().join("library.devnotes"))); + std::sync::Arc::new(platform::dialog::Fixed(profile.path().join("library.archive"))); click(&mut harness, "file-option-exportAll"); settle(&mut harness); capture(&mut harness, "passphrase-prompt"); @@ -1689,7 +1689,7 @@ fn a_drawing_in_a_note() { let id = |harness: &Harness<'_, App>, title| crate::testing::note(&harness.state().backend, title).id.clone(); let scene = id(&harness, "Architecture"); - let note = id(&harness, "Bienvenue dans DevNotes"); + let note = id(&harness, &format!("Bienvenue dans {}", brand::NAME)); let rewrite = |harness: &mut Harness<'_, App>, id: &str, kind, content: String| { let patch = NotePatch { kind: Some(kind), content: Some(content), ..NotePatch::default() }; let engine = harness.state().backend.engine().clone(); @@ -1707,7 +1707,8 @@ fn a_drawing_in_a_note() { settle(&mut harness); click(&mut harness, "editor-close"); let words = "Le service lit la file, puis écrit dans le stockage."; - let content = format!("{words}\n\n![Architecture](devnotes:drawing/{scene})\n\n{words}"); + let content = + format!("{words}\n\n![Architecture]({}{scene})\n\n{words}", richtext::picture::DRAWING_SOURCE); rewrite(&mut harness, ¬e, NoteKind::Note, content); harness.state_mut().state.editor.open(note); settle(&mut harness); diff --git a/crates/ui/src/app/docs_tests.rs b/crates/ui/src/app/docs_tests.rs index db54aa878..c8e5bc627 100644 --- a/crates/ui/src/app/docs_tests.rs +++ b/crates/ui/src/app/docs_tests.rs @@ -145,7 +145,10 @@ fn an_address_elsewhere_opens_the_browser() { assert_eq!( *opened.0.lock().unwrap(), - [PathBuf::from("https://devnotes.fr/en/docs"), PathBuf::from("https://devnotes.fr/en/download"),] + [ + PathBuf::from(concat!(brand::site!(), "/en/docs")), + PathBuf::from(concat!(brand::site!(), "/en/download")) + ] ); } diff --git a/crates/ui/src/app/palette_copy_tests.rs b/crates/ui/src/app/palette_copy_tests.rs index 52561e2c4..0f7a5a45f 100644 --- a/crates/ui/src/app/palette_copy_tests.rs +++ b/crates/ui/src/app/palette_copy_tests.rs @@ -47,7 +47,7 @@ fn over_another_application_the_window_goes_and_a_toast_says_it() { } #[test] -fn with_devnotes_in_front_it_only_closes_and_says_so_in_the_window() { +fn with_the_application_in_front_it_only_closes_and_says_so_in_the_window() { let directory = tempfile::tempdir().unwrap(); let mut harness = open_library(directory.path()); diff --git a/crates/ui/src/app/prompt_tests.rs b/crates/ui/src/app/prompt_tests.rs index 3a3301572..8e69f2560 100644 --- a/crates/ui/src/app/prompt_tests.rs +++ b/crates/ui/src/app/prompt_tests.rs @@ -23,7 +23,7 @@ fn can_submit(harness: &Harness<'_, App>) -> bool { fn asking(directory: &std::path::Path) -> Harness<'static, App> { let mut harness = open_library(directory); - let file = directory.join("library.devnotes"); + let file = directory.join("library.archive"); harness.state_mut().state.dialog = Arc::new(platform::dialog::Fixed(file)); export(&mut harness); type_into(&mut harness, "passphrase-prompt-field", PHRASE); @@ -77,7 +77,7 @@ fn escape_cancels_the_prompt_and_writes_nothing() { settle(&mut harness); assert!(!present(&harness, "passphrase-prompt")); - assert!(!directory.path().join("library.devnotes").exists()); + assert!(!directory.path().join("library.archive").exists()); } #[test] @@ -89,5 +89,5 @@ fn an_export_is_written_under_the_phrase_and_said() { let said = harness.state().state.status.latest().unwrap().1.key; assert!(said.path().starts_with("file.exportedProtected"), "{}", said.path()); - assert!(directory.path().join("library.devnotes").exists()); + assert!(directory.path().join("library.archive").exists()); } diff --git a/crates/ui/src/app/window_tests.rs b/crates/ui/src/app/window_tests.rs index ba0188610..1da553186 100644 --- a/crates/ui/src/app/window_tests.rs +++ b/crates/ui/src/app/window_tests.rs @@ -68,7 +68,7 @@ fn without_a_tray_and_with_the_preference_off_the_close_button_ends_the_applicat assert!(!commands(&harness).contains(&Command::CancelClose)); } -/// `devnotes --action palette` is what a desktop's own shortcut runs: as the key, it shows the +/// ` --action palette` is what a desktop's own shortcut runs: as the key, it shows the /// window with the palette, never a palette in a window out of sight. #[test] fn a_second_launch_s_palette_brings_the_hidden_window_back() { diff --git a/crates/ui/src/gate/tests.rs b/crates/ui/src/gate/tests.rs index 9a39502b3..3a94a7471 100644 --- a/crates/ui/src/gate/tests.rs +++ b/crates/ui/src/gate/tests.rs @@ -199,7 +199,7 @@ fn a_library_whose_key_is_missing_is_set_aside() { #[test] fn a_damaged_library_is_set_aside_and_its_phrase_opens_a_new_one() { let profile = testing::locked(); - let file = file_named(profile.path(), "devnotes.sqlite3"); + let file = file_named(profile.path(), &format!("{}.sqlite3", brand::SLUG)); let mut bytes = std::fs::read(&file).unwrap(); for byte in bytes.iter_mut().skip(100) { *byte = 0x5a; diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index e33ff5dbc..8b6de47d5 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -1,4 +1,4 @@ -//! The egui interface of DevNotes: the application frame, its state and its screens. It +//! The egui interface: the application's frame, its state and its screens. It //! calls the core directly, in the same process. // The modules are private, so that rustc reports what nothing in the crate uses any more. diff --git a/crates/ui/src/notes/overlays/editor/rich/tests.rs b/crates/ui/src/notes/overlays/editor/rich/tests.rs index 27ff7bb42..0e3831dc7 100644 --- a/crates/ui/src/notes/overlays/editor/rich/tests.rs +++ b/crates/ui/src/notes/overlays/editor/rich/tests.rs @@ -201,7 +201,7 @@ fn a_link_is_written_from_its_form_and_undo_and_redo_step_through_it() { harness.step(); harness .get_by(|node| node.author_id() == Some("rich-link-address")) - .type_text("https://devnotes.fr"); + .type_text("https://example.org"); settle(&mut harness); click_id(&mut harness, "rich-link-apply"); assert_eq!(surface_text(&harness), "Voir le site"); @@ -210,7 +210,7 @@ fn a_link_is_written_from_its_form_and_undo_and_redo_step_through_it() { assert_eq!(surface_text(&harness), "Voir "); press(&mut harness, Modifiers::COMMAND, Key::Y); click_id(&mut harness, "editor-close"); - assert_eq!(stored(&harness, &id), "Voir [le site](https://devnotes.fr)"); + assert_eq!(stored(&harness, &id), "Voir [le site](https://example.org)"); } #[test] @@ -298,10 +298,10 @@ fn a_page_pasted_keeps_its_bold_and_its_link() { paste( &mut harness, "Voir zqcopie et là", - Some("

Voir zqcopie et là

"), + Some("

Voir zqcopie et là

"), ); click_id(&mut harness, "editor-close"); - assert_eq!(stored(&harness, &id), "Voir **zqcopie** et [là](https://devnotes.fr)"); + assert_eq!(stored(&harness, &id), "Voir **zqcopie** et [là](https://example.org)"); } #[test] @@ -374,7 +374,8 @@ fn png_uri(side: u32) -> String { format!("data:image/png;base64,{}", base64::engine::general_purpose::STANDARD.encode(bytes)) } -/// A Note of `content`, `{}` its drawing's id, open once the drawing's picture is read. +/// A Note of `content`, `{source}` a drawing's address and `{}` its id, open once the drawing's +/// picture is read. fn embedding(content: &str) -> (Harness<'static>, String) { let (backend, profile) = testing::unlocked(); let seed = testing::note(&backend, "seed"); @@ -397,7 +398,9 @@ fn embedding(content: &str) -> (Harness<'static>, String) { }) .unwrap(); let space = seed.space_id.clone(); - let content = content.replace("{}", &drawing); + let content = content + .replace("{source}", richtext::picture::DRAWING_SOURCE) + .replace("{}", &drawing); let id = engine::db::run_here(backend.engine(), move |engine| { let draft = engine::notes::model::NoteDraft { kind: NoteKind::Note, @@ -437,13 +440,13 @@ fn said(harness: &Harness<'_>) -> Vec { #[test] fn an_embedded_drawing_shows_its_picture_and_a_lost_one_says_so() { - let (mut harness, _) = embedding("![le schéma](devnotes:drawing/{})\n\n![perdu](devnotes:drawing/nope)"); + let (mut harness, _) = embedding("![le schéma]({source}{})\n\n![perdu]({source}nope)"); crate::notes::bench::until(&mut harness, "both read", |harness| { said(harness) == ["le schéma", "Drawing not found"] }); } -const EMBEDDING: &str = "avant\n\n![le schéma](devnotes:drawing/{})\n\naprès"; +const EMBEDDING: &str = "avant\n\n![le schéma]({source}{})\n\naprès"; fn drawn(harness: &Harness<'_>) -> egui::Rect { harness @@ -462,7 +465,7 @@ fn reference(harness: &mut Harness<'_>, id: &str) -> String { click_id(harness, "editor-close"); settle(harness); let content = stored(harness, id); - let (_, reference) = content.split_once("devnotes:drawing/").unwrap(); + let (_, reference) = content.split_once(richtext::picture::DRAWING_SOURCE).unwrap(); reference.split_once(')').unwrap().0.to_owned() } diff --git a/crates/ui/src/notes/parity_tests.rs b/crates/ui/src/notes/parity_tests.rs index 5f85e5ea7..9bf761162 100644 --- a/crates/ui/src/notes/parity_tests.rs +++ b/crates/ui/src/notes/parity_tests.rs @@ -330,7 +330,11 @@ fn a_drawing_is_inserted_from_the_toolbar_of_a_note() { let stored = engine::db::run_here(backend.engine(), move |engine| engine::notes::get_note(engine, &written)) .unwrap(); - assert!(stored.content.contains(&format!("devnotes:drawing/{scene}"))); + assert!( + stored + .content + .contains(&format!("{}{scene}", richtext::picture::DRAWING_SOURCE)) + ); } #[test] diff --git a/crates/ui/src/notes/prettier.rs b/crates/ui/src/notes/prettier.rs index 81f6c2d7a..6752eab76 100644 --- a/crates/ui/src/notes/prettier.rs +++ b/crates/ui/src/notes/prettier.rs @@ -1,4 +1,4 @@ -//! The library's Prettier settings (`devnotes.notes.prettier`), as the reference stored them, and +//! The library's Prettier settings (`.notes.prettier`), as the reference stored them, and //! the options they make: every snippet of a library formats alike. use serde_json::{Value, json}; diff --git a/crates/ui/src/services/docs_quotes.rs b/crates/ui/src/services/docs_quotes.rs index 564bcb155..2166fc651 100644 --- a/crates/ui/src/services/docs_quotes.rs +++ b/crates/ui/src/services/docs_quotes.rs @@ -82,7 +82,7 @@ fn fits(text: &str, label: &str) -> bool { #[test] fn a_label_fits_its_text_and_what_its_placeholder_holds() { assert!(fits("Tableau", "Tableau")); - assert!(fits("Quitter {{app}}", "Quitter DevNotes")); + assert!(fits("Quitter {{app}}", &format!("Quitter {}", brand::NAME))); assert!(fits("+ Créer une note « {{query}} »", "+ Créer une note « … »")); assert!(!fits("Tableau", "Le tableau")); assert!(!fits("Quitter {{app}}", "Quitter")); diff --git a/crates/ui/src/services/settings.rs b/crates/ui/src/services/settings.rs index b87c5972d..1231a9d63 100644 --- a/crates/ui/src/services/settings.rs +++ b/crates/ui/src/services/settings.rs @@ -1,5 +1,5 @@ //! The application's settings, read from its preferences under their reference keys -//! (`devnotes.`), and the draft the preferences panel edits. A setting joins this +//! (`.`), and the draft the preferences panel edits. A setting joins this //! struct with the screen that reads it; the file keeps the others untouched. use engine::notes::kind::NoteKind; diff --git a/crates/ui/src/state/folders.rs b/crates/ui/src/state/folders.rs index 8c5737062..8a04da5ee 100644 --- a/crates/ui/src/state/folders.rs +++ b/crates/ui/src/state/folders.rs @@ -16,7 +16,7 @@ use crate::services::errors::ErrorNotifier; use crate::services::preferences::Preferences; use crate::services::status::StatusNotifier; -/// The library's, like everything under `devnotes.notes.`: an id means nothing elsewhere. +/// The library's, like everything under `.notes.`: an id means nothing elsewhere. pub const ACTIVE_FOLDER_KEY: &str = "notes.activeFolder"; enum Write { diff --git a/crates/ui/src/state/mod.rs b/crates/ui/src/state/mod.rs index 2a67b2b78..b6354d525 100644 --- a/crates/ui/src/state/mod.rs +++ b/crates/ui/src/state/mod.rs @@ -137,7 +137,7 @@ pub struct AppState { pub language: i18n::Language, /// The application's whole file, the keys this version does not know included. pub preferences: Preferences, - /// The open library's file (`devnotes.notes.*`), read again each time one opens. + /// The open library's file (`.notes.*`), read again each time one opens. pub library_preferences: Preferences, library_preferences_read: Option>, /// The first launch's samples, being written; nothing reads notes meanwhile. @@ -204,7 +204,7 @@ pub struct AppState { pub presentation: presentation::PresentationState, /// The open library's, read with its preferences. pub prettier: crate::notes::prettier::PrettierSettings, - /// How many lines a card shows, the library's (`devnotes.notes.previewLines`). + /// How many lines a card shows, the library's (`.notes.previewLines`). pub preview_lines: PreviewLines, pub errors: ErrorNotifier, pub clock: Box, diff --git a/crates/ui/src/state/spaces.rs b/crates/ui/src/state/spaces.rs index f0ea20147..07dd6d5bc 100644 --- a/crates/ui/src/state/spaces.rs +++ b/crates/ui/src/state/spaces.rs @@ -13,7 +13,7 @@ use crate::services::errors::ErrorNotifier; use crate::services::preferences::Preferences; use crate::services::status::StatusNotifier; -/// The library's, like everything under `devnotes.notes.`: an id means nothing elsewhere. +/// The library's, like everything under `.notes.`: an id means nothing elsewhere. pub const ACTIVE_SPACE_KEY: &str = "notes.activeSpace"; enum Write { diff --git a/crates/ui/src/state/transfer.rs b/crates/ui/src/state/transfer.rs index 132cc68c0..b6c306b72 100644 --- a/crates/ui/src/state/transfer.rs +++ b/crates/ui/src/state/transfer.rs @@ -556,11 +556,11 @@ mod tests { fn an_export_that_left_attachments_out_says_how_many() { let report = ExportReport { notes: 2, attachments_unreadable: 1, ..ExportReport::nothing(false) }; - let said = exported(&report, &ExportScope::Library, "/tmp/notes.devnotes"); + let said = exported(&report, &ExportScope::Library, "/tmp/notes.archive"); assert_eq!( said.text(i18n::Language::En), - "2 notes exported to notes.devnotes. ⚠️ 1 attachment could not be read and was left out." + "2 notes exported to notes.archive. ⚠️ 1 attachment could not be read and was left out." ); } @@ -585,7 +585,7 @@ mod tests { for (set, _) in &rungs[at..] { set(&mut report); } - let said = imported(&report, "/tmp/notes.devnotes"); + let said = imported(&report, "/tmp/notes.archive"); assert_eq!(said.key, rungs[at].1); for language in i18n::Language::ALL { assert!(!said.text(language).contains("{{"), "{at}"); @@ -602,9 +602,9 @@ mod tests { (false, 0, keys::file::EXPORTED), ] { let report = ExportReport { notes: 2, attachments, ..ExportReport::nothing(protected) }; - let said = exported(&report, &ExportScope::Library, "a/b/notes.devnotes"); + let said = exported(&report, &ExportScope::Library, "a/b/notes.archive"); assert_eq!(said.key, key); - assert!(said.text(i18n::Language::En).contains("notes.devnotes")); + assert!(said.text(i18n::Language::En).contains("notes.archive")); assert!(!said.text(i18n::Language::En).contains("a/b")); } } @@ -645,7 +645,7 @@ mod tests { fn an_export_that_cannot_be_written_is_said() { let mut bench = Bench::new(); testing::note(&bench.backend, "Worth exporting"); - bench.dialog = Arc::new(Fixed(bench.file.join("no-such-folder").join("a.devnotes"))); + bench.dialog = Arc::new(Fixed(bench.file.join("no-such-folder").join("a.archive"))); std::fs::write(&bench.file, "a file, not a folder").unwrap(); bench.export(); diff --git a/crates/ui/src/titlebar/about_menu/docs/mod.rs b/crates/ui/src/titlebar/about_menu/docs/mod.rs index b228072e0..04b86d78d 100644 --- a/crates/ui/src/titlebar/about_menu/docs/mod.rs +++ b/crates/ui/src/titlebar/about_menu/docs/mod.rs @@ -1,4 +1,4 @@ -//! The documentation, read offline: the pages devnotes.fr shows. Their list and a search on the +//! The documentation, read offline: the pages the site shows. Their list and a search on the //! left, the page on the right; a link elsewhere opens the browser. mod page; diff --git a/crates/ui/src/tools/catalogue/diff/structured.rs b/crates/ui/src/tools/catalogue/diff/structured.rs index 25d66a3ca..28b8fff50 100644 --- a/crates/ui/src/tools/catalogue/diff/structured.rs +++ b/crates/ui/src/tools/catalogue/diff/structured.rs @@ -20,8 +20,9 @@ use crate::widgets::{ self, Button, ChoiceMenu, Segmented, address, hovered, interact, towards, virtual_list, }; -const SAMPLE_A: &str = "# DevNotes, as released -name: devnotes +/// The application's own settings, `{name}` and `{slug}` filled in from its names. +const SAMPLE_A: &str = "# {name}, as released +name: {slug} version: 0.9.1 features: - notes @@ -31,7 +32,7 @@ window: height: 800 "; const SAMPLE_B: &str = "{ - \"name\": \"devnotes\", + \"name\": \"{slug}\", \"version\": \"0.9.2\", \"features\": [\"notes\", \"tools\"], \"window\": { \"width\": 1280, \"height\": 800 } @@ -115,7 +116,8 @@ impl StructuredDiff { /// Both sides, and each read by its shape again: a format left chosen would misread them. pub(super) fn fill_sample(&mut self, sides: &mut Sides) { - *sides = Sides { a: SAMPLE_A.to_owned(), b: SAMPLE_B.to_owned(), ..Sides::default() }; + let filled = |sample: &str| sample.replace("{name}", brand::NAME).replace("{slug}", brand::SLUG); + *sides = Sides { a: filled(SAMPLE_A), b: filled(SAMPLE_B), ..Sides::default() }; self.format_a = None; self.format_b = None; } diff --git a/crates/ui/src/tools/catalogue/diff/text.rs b/crates/ui/src/tools/catalogue/diff/text.rs index f18d20f1c..658f24f7b 100644 --- a/crates/ui/src/tools/catalogue/diff/text.rs +++ b/crates/ui/src/tools/catalogue/diff/text.rs @@ -17,24 +17,27 @@ use crate::tools::ui::{check, hint, label, note_import_into, paragraph, text_are use crate::tools::{Drawn, ToolResult}; use crate::widgets::{Button, Segmented, address, virtual_list}; +/// The site's own server, `{host}` and `{slug}` filled in from the application's names. const SAMPLE_A: &str = "server { listen 80; - server_name devnotes.fr; - root /var/www/devnotes; + server_name {host}; + root /var/www/{slug}; gzip off; } "; const SAMPLE_B: &str = "server { listen 443 ssl; - server_name devnotes.fr www.devnotes.fr; - root /var/www/devnotes; + server_name {host} www.{host}; + root /var/www/{slug}; gzip on; - ssl_certificate /etc/ssl/devnotes.pem; + ssl_certificate /etc/ssl/{slug}.pem; } "; pub(super) fn fill_sample(sides: &mut Sides) { - *sides = Sides { a: SAMPLE_A.to_owned(), b: SAMPLE_B.to_owned(), ..Sides::default() }; + let host = brand::SITE.trim_start_matches("https://"); + let filled = |sample: &str| sample.replace("{host}", host).replace("{slug}", brand::SLUG); + *sides = Sides { a: filled(SAMPLE_A), b: filled(SAMPLE_B), ..Sides::default() }; } #[expect(clippy::struct_excessive_bools, reason = "each is its own option")] diff --git a/crates/ui/src/tools/catalogue/identity.rs b/crates/ui/src/tools/catalogue/identity.rs index 6854606d8..3a15345fe 100644 --- a/crates/ui/src/tools/catalogue/identity.rs +++ b/crates/ui/src/tools/catalogue/identity.rs @@ -32,7 +32,7 @@ use crate::widgets::{self, Button, Chip, ChoiceMenu, IconButton, Segmented, Text const AGES_AT_FIRST: (u32, u32) = (18, 80); const PEOPLE_AT_FIRST: u32 = 10; /// The seed a sample draws from: the same person for whoever opens the tool. -const SAMPLE_SEED: &str = "devnotes"; +const SAMPLE_SEED: &str = brand::SLUG; const MONOGRAM: f32 = 104.0; const FACT_GAP: f32 = gap::INSET; diff --git a/crates/ui/src/widgets/rich.rs b/crates/ui/src/widgets/rich.rs index b6b5cabf3..99acdbb77 100644 --- a/crates/ui/src/widgets/rich.rs +++ b/crates/ui/src/widgets/rich.rs @@ -741,7 +741,7 @@ fn placeholder(ui: &mut Ui, words: &str, frame: &Frame<'_>) -> Drawn { Drawn { response, whole: None } } -/// A drawing embedded by `devnotes:drawing/`, its picture read by id where it is shown; any +/// A drawing embedded by `:drawing/`, its picture read by id where it is shown; any /// other image as it was written: a Note never fetches an address. fn image(ui: &mut Ui, alt: &str, (src, width): (&str, Option), frame: &mut Frame<'_>) -> Drawn { let id = drawing_id(src); diff --git a/crates/ui/src/widgets/rich/tests.rs b/crates/ui/src/widgets/rich/tests.rs index 21b1d3e3c..9ea4287b6 100644 --- a/crates/ui/src/widgets/rich/tests.rs +++ b/crates/ui/src/widgets/rich/tests.rs @@ -1,8 +1,10 @@ use egui_kittest::kittest::{NodeT, Queryable}; +use richtext::picture::DRAWING_SOURCE; + use super::*; -fn shown(markdown: &'static str) -> egui_kittest::Harness<'static, Option> { +fn shown(markdown: &str) -> egui_kittest::Harness<'static, Option> { let document = richtext::read(markdown); let mut harness = crate::testing::harness().with_size(vec2(700.0, 900.0)).build_ui_state( move |ui, link: &mut Option| { @@ -226,7 +228,7 @@ fn a_web_address_is_one_whatever_its_case() { // Read -fn painted(markdown: &'static str) -> Vec { +fn painted(markdown: &str) -> Vec { crate::testing::painted(&shown(markdown)) } @@ -262,7 +264,7 @@ fn a_block_of_code_names_its_language_in_its_corner() { #[test] fn another_image_than_a_drawing_is_written_as_it_was() { assert!(painted("![alt](https://a.fr/b.png)").contains(&"![alt](https://a.fr/b.png)".to_owned())); - let drawing = painted("![Le plan](devnotes:drawing/abc)"); + let drawing = painted(&format!("![Le plan]({DRAWING_SOURCE}abc)")); assert!(drawing.contains(&"Le plan".to_owned()), "{drawing:?}"); } @@ -357,7 +359,7 @@ fn read_a_task_s_box_does_not_take_the_click() { #[test] fn an_image_clicked_is_picked_and_each_is_answered_where_it_is() { - let mut harness = edited("a\n\n![x](devnotes:drawing/one)\n\n![y](devnotes:drawing/two)"); + let mut harness = edited(&format!("a\n\n![x]({DRAWING_SOURCE}one)\n\n![y]({DRAWING_SOURCE}two)")); let paths: Vec> = harness.state().images.iter().map(|image| image.path.clone()).collect(); assert_eq!(paths, [vec![1], vec![2]]); @@ -368,8 +370,13 @@ fn an_image_clicked_is_picked_and_each_is_answered_where_it_is() { // A drawing embedded +/// The drawing `id` in a Note, by the address the application writes. +fn embedded(id: &str) -> String { + format!("![a]({DRAWING_SOURCE}{id})") +} + /// The drawing as its `pictures` say it, in a room 400 px wide. -fn embedding(markdown: &'static str, size: [usize; 2]) -> egui_kittest::Harness<'static, Vec> { +fn embedding(markdown: &str, size: [usize; 2]) -> egui_kittest::Harness<'static, Vec> { let document = richtext::read(markdown); let mut harness = crate::testing::harness().with_size(vec2(800.0, 900.0)).build_ui_state( move |ui, wanted: &mut Vec| { @@ -401,18 +408,18 @@ fn embeds(harness: &egui_kittest::Harness<'_, State>) -> Vec { #[test] fn a_picture_never_asked_for_is_wanted_and_one_coming_is_not() { for (markdown, wanted) in [ - ("![a](devnotes:drawing/new)", vec!["new".to_owned()]), - ("![a](devnotes:drawing/waiting)", Vec::new()), - ("![a](devnotes:drawing/shown)", Vec::new()), - ("![a](https://a.fr/b.png)", Vec::new()), + (embedded("new"), vec!["new".to_owned()]), + (embedded("waiting"), Vec::new()), + (embedded("shown"), Vec::new()), + ("![a](https://a.fr/b.png)".to_owned(), Vec::new()), ] { - assert_eq!(*embedding(markdown, [100, 50]).state(), wanted, "{markdown}"); + assert_eq!(*embedding(&markdown, [100, 50]).state(), wanted, "{markdown}"); } } #[test] fn a_drawing_gone_is_said() { - let words = crate::testing::painted(&embedding("![a](devnotes:drawing/gone)", [100, 50])); + let words = crate::testing::painted(&embedding(&embedded("gone"), [100, 50])); assert!(words.contains(&"Dessin introuvable".to_owned()), "{words:?}"); } @@ -421,11 +428,11 @@ fn a_drawing_gone_is_said() { #[test] fn a_drawing_is_drawn_at_its_width_and_keeps_its_shape() { for (markdown, natural, drawn) in [ - ("![a](devnotes:drawing/shown)", [100, 50], vec2(100.0, 50.0)), - ("![a](devnotes:drawing/shown)", [800, 400], vec2(400.0, 200.0)), - ("![a](devnotes:drawing/shown?w=50)", [100, 50], vec2(200.0, 100.0)), + (embedded("shown"), [100, 50], vec2(100.0, 50.0)), + (embedded("shown"), [800, 400], vec2(400.0, 200.0)), + (embedded("shown?w=50"), [100, 50], vec2(200.0, 100.0)), ] { - let harness = embedding(markdown, natural); + let harness = embedding(&markdown, natural); let rects = embeds(&harness); assert_eq!(rects.len(), 1, "{markdown}"); assert!((rects[0].size() - drawn).length() < 1.0, "{markdown}: {:?}", rects[0].size()); diff --git a/e2e/Cargo.toml b/e2e/Cargo.toml index bab67083b..590628c07 100644 --- a/e2e/Cargo.toml +++ b/e2e/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "e2e" -description = "The end-to-end driver: the e2e flavour of devnotes, launched and driven from outside" +description = "The end-to-end driver: the e2e flavour of the application, launched and driven from outside" version.workspace = true edition.workspace = true rust-version.workspace = true @@ -10,6 +10,7 @@ license.workspace = true publish = false [dependencies] +brand.workspace = true egui.workspace = true egui_inspection.workspace = true platform.workspace = true diff --git a/e2e/clippy.toml b/e2e/clippy.toml index 13cd0ac48..7a0193903 100644 --- a/e2e/clippy.toml +++ b/e2e/clippy.toml @@ -1,5 +1,5 @@ # Replaces the root's rather than adding to it: its line is repeated. -doc-valid-idents = ["SQLite", "DevNotes", "TextMate", ".."] +doc-valid-idents = ["SQLite", "TextMate", ".."] # A journey waits on a condition (an `expect_…` of the SDK), never on a duration. disallowed-methods = [ diff --git a/e2e/examples/footprint.rs b/e2e/examples/footprint.rs index 352f3d6a0..810c9b31c 100644 --- a/e2e/examples/footprint.rs +++ b/e2e/examples/footprint.rs @@ -4,7 +4,7 @@ //! //! ``` //! CARGO_PROFILE_DEV_OPT_LEVEL=3 CARGO_PROFILE_DEV_DEBUG=0 cargo build -p app --features e2e --target-dir target/perf -//! DEVNOTES_E2E_BIN=target/perf/debug/devnotes DEVNOTES_E2E_GPU=1 DEVNOTES_E2E_PAINT_ALL=1 \ +//! DEVNOTES_E2E_BIN=target/perf/debug/ DEVNOTES_E2E_GPU=1 DEVNOTES_E2E_PAINT_ALL=1 \ //! cargo run -p e2e --example footprint -- [new] //! ``` //! diff --git a/e2e/src/driver.rs b/e2e/src/driver.rs index 507a0b7ca..367580f9c 100644 --- a/e2e/src/driver.rs +++ b/e2e/src/driver.rs @@ -1,6 +1,6 @@ -//! The driver under the SDK: launches the `e2e` flavour of `devnotes` and speaks egui's inspection -//! protocol to it. It knows of the application only what its `AccessKit` tree shows, and finds a -//! control by its `author_id`. +//! The driver under the SDK: launches the `e2e` flavour of the application and speaks egui's +//! inspection protocol to it. It knows of the application only what its `AccessKit` tree shows, and +//! finds a control by its `author_id`. use std::ffi::OsString; use std::net::{Ipv4Addr, TcpListener, TcpStream}; @@ -21,7 +21,7 @@ fn binary() -> PathBuf { return PathBuf::from(path); } let workspace = Path::new(env!("CARGO_MANIFEST_DIR")).join(".."); - let binary = workspace.join(format!("target/e2e/debug/devnotes{}", std::env::consts::EXE_SUFFIX)); + let binary = workspace.join(format!("target/e2e/debug/{}{}", brand::SLUG, std::env::consts::EXE_SUFFIX)); assert!( binary.exists(), "no e2e flavour at {}: cargo build -p app --features e2e --target-dir target/e2e", diff --git a/e2e/src/lib.rs b/e2e/src/lib.rs index abf0096a4..6e8e722c9 100644 --- a/e2e/src/lib.rs +++ b/e2e/src/lib.rs @@ -1,5 +1,5 @@ -//! The end-to-end suite's SDK: what a person does with DevNotes' window, and what they see on it. -//! A journey (`e2e/tests/`) launches an [`App`], acts through its areas (`app.notes()`, +//! The end-to-end suite's SDK: what a person does with the application's window, and what they see +//! on it. A journey (`e2e/tests/`) launches an [`App`], acts through its areas (`app.notes()`, //! `app.editor()`…) and expects what the screen shows; how an act is carried out on the window //! stays in here. `CONTRIBUTING.md` says how to run and mend them. //! diff --git a/e2e/src/sdk/disk.rs b/e2e/src/sdk/disk.rs index e3161b430..ff6425482 100644 --- a/e2e/src/sdk/disk.rs +++ b/e2e/src/sdk/disk.rs @@ -4,16 +4,17 @@ use std::path::{Path, PathBuf}; use super::App; use crate::current_step; -/// What DevNotes leaves on the disk: its profile, read from outside, as anyone holding the machine -/// would read it. +/// What the application leaves on the disk: its profile, read from outside, as anyone holding the +/// machine would read it. pub struct Disk<'a>(pub(super) &'a mut App); /// The library's database, which a scan that read nothing would never meet. -const DATABASE: &str = "devnotes.sqlite3"; +const DATABASE: &str = concat!(brand::slug!(), ".sqlite3"); impl Disk<'_> { /// No file of the profile says any of these words, in what it holds or in its name. Read while - /// DevNotes is closed or at its gate, when every file can be read: one that cannot fails. + /// The application is closed or at its gate, when every file can be read: one that cannot + /// fails. pub fn expect_nowhere(&mut self, words: &[&str], says: &str) { let profile = self.0.profile().to_owned(); let step = current_step(); @@ -30,8 +31,8 @@ impl Disk<'_> { } } - /// A file of the profile says this word, once DevNotes has written it. What SQLite holds while - /// DevNotes runs is not read. + /// A file of the profile says this word, once the application has written it. What SQLite holds + /// while The application runs is not read. pub fn expect_somewhere(&mut self, word: &str, says: &str) { let profile = self.0.profile().to_owned(); self.0.until(says, |_| { diff --git a/e2e/src/sdk/files.rs b/e2e/src/sdk/files.rs index 4099d6388..f36c2a28c 100644 --- a/e2e/src/sdk/files.rs +++ b/e2e/src/sdk/files.rs @@ -65,7 +65,7 @@ impl Files<'_> { pub(super) fn damage_library(profile: &Path) { let libraries = std::fs::read_dir(profile.join("libraries")).expect("the profile has a library"); let library = libraries.flatten().next().expect("the profile has a library"); - let database = library.path().join("devnotes.sqlite3"); + let database = library.path().join(format!("{}.sqlite3", brand::SLUG)); let mut bytes = std::fs::read(&database).expect("the database is read"); bytes[100..].fill(0x5a); std::fs::write(&database, bytes).expect("the damaged database is written"); diff --git a/e2e/src/sdk/help.rs b/e2e/src/sdk/help.rs index d90b3894b..02c3a57b2 100644 --- a/e2e/src/sdk/help.rs +++ b/e2e/src/sdk/help.rs @@ -34,9 +34,9 @@ impl Help<'_> { self.choose("about-whats-new", "« What's new »"); } - /// *About → About DevNotes*. + /// *About → About* and the application's name. pub fn open_about(&mut self) { - self.choose("about-about", "« About DevNotes »"); + self.choose("about-about", concat!("« About ", brand::display_name!(), " »")); } /// *About → Check for updates*, or the version already found. diff --git a/e2e/src/sdk/http.rs b/e2e/src/sdk/http.rs index f25f1b5ed..c16616f27 100644 --- a/e2e/src/sdk/http.rs +++ b/e2e/src/sdk/http.rs @@ -4,7 +4,7 @@ use egui::{Key, Modifiers, Pos2}; use super::{App, Screen, Shortcut}; use crate::driver::{Tree, said, within}; -/// The HTTP area: its rail, its tabs, its cookies, and what it asks before DevNotes quits. +/// The HTTP area: its rail, its tabs, its cookies, and what it asks before the application quits. pub struct Http<'a>(pub(super) &'a mut App); impl Http<'_> { @@ -171,10 +171,11 @@ impl Http<'_> { self.0.until("the cookies close", |tree| !tree.has("http-cookies-dialog")); } - /// Quits: DevNotes asks what becomes of the requests left with changes. + /// Quits: the application asks what becomes of the requests left with changes. pub fn ask_to_quit(&mut self) { self.0.driver.hand_over(Some("quit")); - self.0.expect_eq(Screen::changes_asked, 1, "DevNotes asks about the changes"); + self.0 + .expect_eq(Screen::changes_asked, 1, "the application asks about the changes"); } /// Stays, the changes as they are. @@ -183,7 +184,7 @@ impl Http<'_> { self.0.until("the question goes", |tree| !tree.has("http-leave-dialog")); } - /// Saves every change, and DevNotes ends. + /// Saves every change, and the application ends. pub fn save_and_quit(&mut self) { self.0.click("http-leave-save", "the button that saves"); self.0.ended(); @@ -279,7 +280,7 @@ impl Screen { self.0.texts("http-cookie") } - /// How many requests with changes DevNotes asks about before it goes on; 0 when it asks + /// How many requests with changes the application asks about before it goes on; 0 when it asks /// nothing. pub fn changes_asked(&self) -> usize { if !self.0.has("http-leave-dialog") { diff --git a/e2e/src/sdk/mod.rs b/e2e/src/sdk/mod.rs index 6f4d459d2..aee8cd2e4 100644 --- a/e2e/src/sdk/mod.rs +++ b/e2e/src/sdk/mod.rs @@ -94,7 +94,7 @@ use tempfile::TempDir; use crate::driver::Driver; use crate::{PASSPHRASE, current_step, server}; -/// DevNotes as a person has it in front of them, on a profile of the journey's own. +/// The application as a person has it in front of them, on a profile of the journey's own. pub struct App { driver: Driver, /// The profile, the person's files and the terminal's lines: gone once the application is. @@ -111,8 +111,8 @@ pub struct App { session: Option, } -/// What a person asks of DevNotes from anywhere, by a key of the whole machine. A second launch -/// stands for the key, which no driver presses. +/// What a person asks of the application from anywhere, by a key of the whole machine. A second +/// launch stands for the key, which no driver presses. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Global { Palette, @@ -121,12 +121,12 @@ pub enum Global { } impl App { - /// DevNotes launched for the first time: nothing on the disk, the gate on the screen. + /// The application launched for the first time: nothing on the disk, the gate on the screen. pub fn first_launch(journey: &'static str) -> Self { Self::launch(journey, Vec::new()) } - /// DevNotes with its library made and open on its sample notes: where a journey starts. + /// The application with its library made and open on its sample notes: where a journey starts. pub fn open(journey: &'static str) -> Self { Self::launch(journey, Vec::new()).with_a_library() } @@ -151,7 +151,8 @@ impl App { Self::open(journey) } - /// DevNotes launched on a profile that outlives it, for a measure: the gate on the screen. + /// The application launched on a profile that outlives it, for a measure: the gate on the + /// screen. pub fn launch_on(profile: &Path) -> Self { Self::start("measure", room(), profile.to_owned(), Vec::new()) } @@ -383,7 +384,7 @@ impl App { Files(self) } - /// What DevNotes leaves on the disk, read from outside. + /// What the application leaves on the disk, read from outside. pub fn disk(&mut self) -> Disk<'_> { Disk(self) } @@ -411,7 +412,7 @@ impl App { self.driver.settle(); } - /// DevNotes ends by itself, everything written; started again, its library is unlocked. + /// The application ends by itself, everything written; started again, its library is unlocked. pub fn start_after_the_end(&mut self) { self.driver.ended(); self.start_again(); @@ -433,7 +434,8 @@ impl App { self.driver.apply(vec![Event::Copy]); } - /// Quits and starts DevNotes again, as a person closing it and coming back: the gate asks. + /// Quits and starts the application again, as a person closing it and coming back: the gate + /// asks. pub fn relaunch(&mut self) { self.driver.hand_over(Some("quit")); self.driver.ended(); @@ -452,7 +454,7 @@ impl App { self.expect(|s| !s.banner(), "the banner goes"); } - /// Quits, reads the disk while DevNotes is closed, and starts it again: the gate asks. + /// Quits, reads the disk while the application is closed, and starts it again: the gate asks. pub fn while_closed(&mut self, read: impl FnOnce(&mut Disk<'_>)) { self.driver.hand_over(Some("quit")); self.driver.ended(); @@ -460,14 +462,15 @@ impl App { self.start_again(); } - /// DevNotes ends without a word, as in a crash, and is started again: the gate asks. + /// The application ends without a word, as in a crash, and is started again: the gate asks. pub fn crash_and_launch_again(&mut self) { self.driver.kill(); self.start_again(); self.until("the gate lists its libraries", |tree| tree.has("vault-library")); } - /// Quits, has the library's database damaged while DevNotes is closed, and starts it again. + /// Quits, has the library's database damaged while the application is closed, and starts it + /// again. pub fn relaunch_damaged(&mut self) { self.driver.hand_over(Some("quit")); self.driver.ended(); @@ -475,14 +478,14 @@ impl App { self.driver.start_again(); } - /// *File → Quit*, clicked again as it asks, and DevNotes ends. + /// *File → Quit*, clicked again as it asks, and the application ends. pub fn quit_from_the_menu(mut self) { self.click("file-menu", "the « File » menu"); self.click_twice("file-quit", "« Quit »"); self.ended(); } - /// Quits DevNotes, once the journey is over. + /// Quits the application, once the journey is over. pub fn quit(mut self) { self.driver.hand_over(Some("quit")); self.driver.ended(); @@ -498,8 +501,8 @@ impl App { self.driver.process() } - /// DevNotes was launched without a line in the terminal. Said of Linux alone, where it is - /// launched from one often enough for its lines to be read as faults. + /// The application was launched without a line in the terminal. Said of Linux alone, where it + /// is launched from one often enough for its lines to be read as faults. pub fn expect_silent_terminal(&mut self, says: &str) { let wrote = std::fs::read_to_string(terminal(self.room.path())).unwrap_or_default(); // Mesa's pair about DRI3 is Xvfb's, which has none: no desktop's X server lacks it. @@ -516,13 +519,13 @@ impl App { } } - /// DevNotes started a second time while it runs: the window comes back on the screen. + /// The application started a second time while it runs: the window comes back on the screen. fn launch_again(&mut self) { self.driver.hand_over(None); self.driver.settle(); } - /// Waits for DevNotes to end by itself, everything written. + /// Waits for the application to end by itself, everything written. fn ended(&mut self) { self.driver.ended(); } diff --git a/e2e/src/sdk/notes.rs b/e2e/src/sdk/notes.rs index c860fb22c..79501d4f5 100644 --- a/e2e/src/sdk/notes.rs +++ b/e2e/src/sdk/notes.rs @@ -21,7 +21,10 @@ impl Sample { /// Its title, in English and in French. fn titles(self) -> [&'static str; 2] { match self { - Self::Welcome => ["Welcome to DevNotes", "Bienvenue dans DevNotes"], + Self::Welcome => [ + concat!("Welcome to ", brand::display_name!()), + concat!("Bienvenue dans ", brand::display_name!()), + ], Self::PsqlConnection => ["psql connection", "Connexion psql"], Self::ApiResponse => ["API response — open it as a graph", "Réponse d’API — à ouvrir en graphe"], Self::ReleaseDay => ["Release day", "Mise en production"], diff --git a/e2e/src/sdk/prefs.rs b/e2e/src/sdk/prefs.rs index 4aca855a1..3195a2fed 100644 --- a/e2e/src/sdk/prefs.rs +++ b/e2e/src/sdk/prefs.rs @@ -197,7 +197,7 @@ impl Prefs<'_> { /// The file on the disk holds this value for a setting, named as the file names it. pub fn expect_stored(&mut self, setting: &str, value: &str, says: &str) { let file = self.0.profile().join("preferences.json"); - let key = format!("devnotes.{setting}"); + let key = format!("{}.{setting}", brand::SLUG); self.0 .until(says, |_| stored(&file).get(&key).and_then(Value::as_str) == Some(value)); } diff --git a/e2e/src/sdk/window.rs b/e2e/src/sdk/window.rs index eb633038f..37e2614f8 100644 --- a/e2e/src/sdk/window.rs +++ b/e2e/src/sdk/window.rs @@ -62,19 +62,19 @@ impl Window<'_> { self.0.driver.settle_out_of_sight(); } - /// Closes the window as its close button does, DevNotes staying in the tray. + /// Closes the window as its close button does, the application staying in the tray. pub fn close_to_tray(&mut self) { self.0.put_away = self.times_put_away(); self.0.driver.hand_over(Some("close")); self.0.driver.settle_out_of_sight(); } - /// Starts DevNotes a second time while it runs. + /// Starts the application a second time while it runs. pub fn start_again(&mut self) { self.0.launch_again(); } - /// Closes the window, DevNotes ending with it: by its control, or as macOS' own does. + /// Closes the window, the application ending with it: by its control, or as macOS' own does. pub fn close_for_good(&mut self) { if cfg!(target_os = "macos") { self.0.driver.hand_over(Some("close")); @@ -146,7 +146,7 @@ impl Screen { self.0.text("window-maximize") } - /// Whether the window has controls of DevNotes' own; the system draws them otherwise. + /// Whether the window has controls of the application's own; the system draws them otherwise. pub fn own_window_controls(&self) -> bool { self.0.has("window-maximize") || self.0.has("window-close") } diff --git a/e2e/tests/01_first_day.rs b/e2e/tests/01_first_day.rs index 2083fb632..6e454cb4b 100644 --- a/e2e/tests/01_first_day.rs +++ b/e2e/tests/01_first_day.rs @@ -1,5 +1,5 @@ -//! Journey 1, « First day »: a machine where DevNotes never ran. The gate makes the library, a real -//! relaunch opens it, and the samples are walked as their own list proposes. +//! Journey 1, « First day »: a machine where the application never ran. The gate makes the library, +//! a real relaunch opens it, and the samples are walked as their own list proposes. use e2e::{App, JsonView, PASSPHRASE, Sample, Shortcut, step}; @@ -49,7 +49,7 @@ fn making_the_library(app: &mut App) { } fn coming_back(app: &mut App) { - step("quit and started again, DevNotes asks for the phrase, once", || { + step("quit and started again, the application asks for the phrase, once", || { app.relaunch(); app.expect(|s| s.gate().asks_the_phrase(), "the phrase is asked once"); }); diff --git a/e2e/tests/02_snippet_to_paste.rs b/e2e/tests/02_snippet_to_paste.rs index c30d18b41..55e03ad07 100644 --- a/e2e/tests/02_snippet_to_paste.rs +++ b/e2e/tests/02_snippet_to_paste.rs @@ -257,7 +257,7 @@ fn keeping_the_draft(app: &mut App) { app.notes().expect_card("Jump by mosh", "the card wears its new title"); }); - step("a title being typed is kept when DevNotes quits", || { + step("a title being typed is kept when the application quits", || { app.notes().open("Jump by mosh"); app.editor().retype_title(JUMP); app.relaunch_and_unlock(); diff --git a/e2e/tests/04_other_kinds.rs b/e2e/tests/04_other_kinds.rs index da6ddd22d..a082e004d 100644 --- a/e2e/tests/04_other_kinds.rs +++ b/e2e/tests/04_other_kinds.rs @@ -44,7 +44,7 @@ fn a_note(app: &mut App) { ] { app.rich().write_line(tool, text); } - app.rich().write_link("the site", "https://devnotes.fr"); + app.rich().write_link("the site", "https://example.org"); app.capture("note"); }); @@ -62,7 +62,7 @@ fn a_note(app: &mut App) { "- first point", "1. first step", "- [ ] first task", - "[the site](https://devnotes.fr)", + "[the site](https://example.org)", ] { app.clipboard().expect_saying(markdown, "the Markdown holds what was written"); } diff --git a/e2e/tests/07_reaching_from_anywhere.rs b/e2e/tests/07_reaching_from_anywhere.rs index 28b695a31..f41976ede 100644 --- a/e2e/tests/07_reaching_from_anywhere.rs +++ b/e2e/tests/07_reaching_from_anywhere.rs @@ -1,6 +1,6 @@ -//! Journey 7, « Reaching DevNotes from anywhere »: a second launch, the palette, the clipboard, the -//! keys of the whole machine and the tray, with the window in sight, put away or minimised — the -//! same on every system. +//! Journey 7, « Reaching the application from anywhere »: a second launch, the palette, the +//! clipboard, the keys of the whole machine and the tray, with the window in sight, put away or +//! minimised — the same on every system. use e2e::{App, Area, Global, Sample, Screen, Switch, TrayEntry, step}; @@ -156,12 +156,15 @@ fn from_the_machine(app: &mut App) { } fn put_away(app: &mut App) { - step("closed with « Close to tray » on, DevNotes stays, and a second launch brings it back", || { - app.window().close_to_tray(); - app.window().start_again(); - app.window().expect_back("the window went away once, and is back"); - app.notes().expect_card(SNIPPET, "the library is still open"); - }); + step( + "closed with « Close to tray » on, the application stays, and a second launch brings it back", + || { + app.window().close_to_tray(); + app.window().start_again(); + app.window().expect_back("the window went away once, and is back"); + app.notes().expect_card(SNIPPET, "the library is still open"); + }, + ); step("the keys of the machine answer with the window put away", || { app.window().close_to_tray(); @@ -183,7 +186,7 @@ fn put_away(app: &mut App) { if !OWN_BUTTONS { step("macOS has its own « minimise »: closing minimised, and the keys answered", || { - app.expect(|s| !s.own_window_controls(), "DevNotes draws none of its own"); + app.expect(|s| !s.own_window_controls(), "the application draws none of its own"); }); return; } @@ -227,7 +230,7 @@ fn the_tray(app: &mut App) { app.rich().expect_text(WORDS, "a note holds the clipboard"); }); - step("« Open DevNotes » brings the window back as it was", || { + step("the tray's « Open » brings the window back as it was", || { app.window().close_to_tray(); app.tray().choose(TrayEntry::Open); app.window().expect_back("the window is back"); @@ -237,7 +240,7 @@ fn the_tray(app: &mut App) { } fn without_the_tray(mut app: App) { - step("« Quit » ends DevNotes, its window out of sight", || { + step("« Quit » ends the application, its window out of sight", || { app.window().close_to_tray(); app.tray().choose(TrayEntry::Quit); app.start_after_the_end(); diff --git a/e2e/tests/11_libraries_and_transfer.rs b/e2e/tests/11_libraries_and_transfer.rs index d0b104431..159f9ac90 100644 --- a/e2e/tests/11_libraries_and_transfer.rs +++ b/e2e/tests/11_libraries_and_transfer.rs @@ -12,6 +12,12 @@ const SPACE: &str = "Travel"; const FOLDER: &str = "Perf"; const FILED: &str = "Slow query"; const LOOSE: &str = "Nightly dump"; +/// The files notes leave by, under the extension the export proposes. +const SEALED_FILE: &str = concat!("sealed.", brand::file_extension!()); +const EVERYTHING_FILE: &str = concat!("everything.", brand::file_extension!()); +const SPACE_FILE: &str = concat!("space.", brand::file_extension!()); +const SELECTION_FILE: &str = concat!("selection.", brand::file_extension!()); +const NONE_FILE: &str = concat!("none.", brand::file_extension!()); #[test] fn libraries_and_transfer() { @@ -118,28 +124,26 @@ fn leaving(app: &mut App) { step("everything is exported, under a phrase and in the clear", || { app.transfer().expect_selection_waiting("a selection's entries wait for one"); - app.files().answer("sealed.devnotes"); + app.files().answer(SEALED_FILE); app.transfer().export_sealed(Export::Everything, FILE_PHRASE); - app.transfer().expect_reported("sealed.devnotes", "the report names the file"); + app.transfer().expect_reported(SEALED_FILE, "the report names the file"); app.files() - .expect("sealed.devnotes", |bytes| !holds(bytes, FILED), "nothing is read in it"); - app.files().answer("everything.devnotes"); + .expect(SEALED_FILE, |bytes| !holds(bytes, FILED), "nothing is read in it"); + app.files().answer(EVERYTHING_FILE); app.transfer().export(Export::Everything); - app.transfer() - .expect_reported("everything.devnotes", "the report names the file"); + app.transfer().expect_reported(EVERYTHING_FILE, "the report names the file"); app.files() - .expect("everything.devnotes", |bytes| bytes.starts_with(b"PK"), "it is an archive"); + .expect(EVERYTHING_FILE, |bytes| bytes.starts_with(b"PK"), "it is an archive"); }); step("a space is exported under a phrase, and a selection in the clear", || { - app.files().answer("space.devnotes"); + app.files().answer(SPACE_FILE); app.transfer().export_sealed(Export::Space, FILE_PHRASE); - app.transfer().expect_reported("space.devnotes", "the report names the file"); + app.transfer().expect_reported(SPACE_FILE, "the report names the file"); app.selection().tick(LOOSE); - app.files().answer("selection.devnotes"); + app.files().answer(SELECTION_FILE); app.transfer().export(Export::Selection); - app.transfer() - .expect_reported("selection.devnotes", "the report names the file"); + app.transfer().expect_reported(SELECTION_FILE, "the report names the file"); }); step("*Copy selection as Markdown* copies the note with all that says it", || { @@ -152,16 +156,16 @@ fn leaving(app: &mut App) { }); step("an export given up, or of nothing, asks nothing more and leaves no file", || { - app.files().answer("none.devnotes"); + app.files().answer(NONE_FILE); app.transfer().ask(Export::Everything); app.transfer().give_up(); - app.files().expect_none("none.devnotes", "nothing was written"); + app.files().expect_none(NONE_FILE, "nothing was written"); app.rail().new_space("Empty"); app.transfer().ask(Export::Space); app.transfer() .expect_reported("this space has no notes", "an empty space is said to be"); app.expect_still(|s| !s.file_phrase_asked(), "no phrase is asked"); - app.files().expect_none("none.devnotes", "nothing was written"); + app.files().expect_none(NONE_FILE, "nothing was written"); }); } @@ -170,7 +174,7 @@ fn coming_in(app: &mut App) { app.libraries().open(); app.libraries().switch_to(SECOND); app.gate().unlock(SECOND_PHRASE); - app.files().answer("space.devnotes"); + app.files().answer(SPACE_FILE); app.transfer().import(); app.transfer().try_phrase("not the file's phrase"); app.expect(|s| !s.file_phrase_problem().is_empty(), "another phrase is refused"); @@ -204,7 +208,7 @@ fn coming_in(app: &mut App) { }); step("everything comes in, spaces merged by name", || { - app.files().answer("everything.devnotes"); + app.files().answer(EVERYTHING_FILE); app.transfer().import(); app.transfer().expect_reported( "6 notes imported", @@ -215,7 +219,7 @@ fn coming_in(app: &mut App) { 1, "the space is the same one", ); - app.files().answer("selection.devnotes"); + app.files().answer(SELECTION_FILE); app.transfer().import(); app.transfer() .expect_reported("Nothing to import", "the selection was here already"); diff --git a/e2e/tests/13_making_it_mine.rs b/e2e/tests/13_making_it_mine.rs index df6be1a23..409c22da2 100644 --- a/e2e/tests/13_making_it_mine.rs +++ b/e2e/tests/13_making_it_mine.rs @@ -18,7 +18,7 @@ fn making_it_mine() { the_window(&mut app); what_the_about_menu_says(&mut app); - step("*File → Quit* asks for a second click, and ends DevNotes", || { + step("*File → Quit* asks for a second click, and ends the application", || { app.quit_from_the_menu(); }); } @@ -255,11 +255,12 @@ fn the_areas(app: &mut App) { }); } -/// macOS keeps its own three buttons: the steps that press DevNotes' own say what it shows instead. +/// macOS keeps its own three buttons: the steps that press the application's own say what it shows +/// instead. fn the_window(app: &mut App) { if cfg!(target_os = "macos") { step("the window wears the system's own buttons", || { - app.expect(|s| !s.own_window_controls(), "DevNotes draws none of its own"); + app.expect(|s| !s.own_window_controls(), "the application draws none of its own"); }); return; } @@ -291,7 +292,7 @@ fn the_window(app: &mut App) { app.window().expect_back("the window went out of sight and is back"); }); - step("closed, with « Close to tray » off, it ends DevNotes", || { + step("closed, with « Close to tray » off, it ends the application", || { app.prefs().change(|prefs| prefs.flip(Switch::CloseToTray)); app.window().close_for_good(); app.start_after_the_end(); diff --git a/e2e/tests/14_nothing_readable_on_the_disk.rs b/e2e/tests/14_nothing_readable_on_the_disk.rs index 75f44e80b..d514fa2bb 100644 --- a/e2e/tests/14_nothing_readable_on_the_disk.rs +++ b/e2e/tests/14_nothing_readable_on_the_disk.rs @@ -1,7 +1,7 @@ -//! Journey 14, « Nothing readable on the disk »: something of every kind DevNotes seals is written, -//! and the whole profile is read from outside, as anyone holding the machine would read it — the -//! database and its copies, the logs, the preferences. An attachment opened is the one plain copy, -//! and it goes with DevNotes, even after a crash. +//! Journey 14, « Nothing readable on the disk »: something of every kind the application seals is +//! written, and the whole profile is read from outside, as anyone holding the machine would read it +//! — the database and its copies, the logs, the preferences. An attachment opened is the one plain +//! copy, and it goes with the application, even after a crash. use e2e::{App, Area, Body, Method, PASSPHRASE, Screen, Shortcut, Spot, step}; @@ -129,12 +129,12 @@ fn everything_sealed(app: &mut App, api: &str) { } fn an_attachment_opened(app: &mut App) { - step("an attachment opened is a plain copy while DevNotes runs, gone once it is closed", || { + step("an attachment opened is a plain copy while the application runs, gone once it is closed", || { app.notes().open(SNIPPET); app.attachments().open(0); app.disk().expect_somewhere(BYTES, "the plain copy is under the profile"); app.editor().close(); - app.while_closed(|disk| disk.expect_nowhere(©, "the copy went with DevNotes")); + app.while_closed(|disk| disk.expect_nowhere(©, "the copy went with the application")); app.gate().unlock(PASSPHRASE); }); }