Complete Modern desktop widgets and file libraries (by Codex)

This commit is contained in:
Codex committed 2026-10-26 00:08:50 +01:00
1 parent db89d889f7
commit 31bcf93205
43 files changed
+3134 -484

No files matched your search

+12 -2
View File
@@ -113,7 +113,7 @@ int main(int argc, char **argv) try {
std::ostringstream css;
for (const auto *name : {"theme.rcss", "ticket.rcss", "sports.rcss",
"calendar.rcss", "reports.rcss", "report_details.rcss",
"report_pickers.rcss", "indoor.rcss", "planning.rcss", "almanac.rcss", "finance.rcss", "bank.rcss", "contracts.rcss", "amount.rcss", "environment.rcss", "advertising.rcss", "toto.rcss", "lineup.rcss", "transfer.rcss", "career_reports.rcss", "rankings.rcss", "stadium.rcss", "statistics.rcss", "news.rcss", "settings.rcss"}) {
"report_pickers.rcss", "indoor.rcss", "planning.rcss", "almanac.rcss", "finance.rcss", "bank.rcss", "contracts.rcss", "amount.rcss", "environment.rcss", "advertising.rcss", "toto.rcss", "lineup.rcss", "transfer.rcss", "career_reports.rcss", "rankings.rcss", "stadium.rcss", "statistics.rcss", "news.rcss", "settings.rcss", "widgets.rcss", "files.rcss"}) {
std::ifstream input(root / name);
require(bool(input), "Production stylesheet missing");
css << input.rdbuf() << '\n';
@@ -188,6 +188,14 @@ int main(int argc, char **argv) try {
"<option>3840 × 2160</option></select></div>"
"<div class='settings-jump-label'><select id='settings-jump-test' class='settings-select'>"
"<option selected>Spielablauf und Wettbewerbe</option><option>Ergebnisse</option></select></div></div>";
content += "<div class='desktop-card desk-card' style='left:40dp;top:1500dp;width:472dp;height:472dp;'>"
"<div id='month-box' class='desk-calendar-month'><span id='month-label'>Juli 2032</span></div></div>"
"<button class='desk-warning' style='left:700dp;top:1500dp;width:180dp;height:176dp;'><span class='status-lamp'></span>"
"<span id='warning-label' class='warning-caption'>Kontostand</span></button>"
"<div class='desk-card' style='position:absolute;left:1100dp;top:1500dp;width:968dp;height:472dp;'>"
"<div class='desk-fixture'><div><span id='fixture-label'>Synthetic Club</span></div></div></div>";
content += "<div id='gallery-scroll-test' class='modern-widget-gallery' style='left:2700dp;top:1500dp;width:900dp;height:200dp;max-height:200dp;'>"
"<div style='position:relative;height:1000dp;'><article class='widget-gallery-item' style='top:600dp;'></article></div></div>";
auto *doc = context->LoadDocumentFromMemory(
"<rml><head><style>" + css.str() + "</style></head><body class='" +
theme + "'>" + content + "</body></rml>");
@@ -202,8 +210,9 @@ int main(int argc, char **argv) try {
context->Update();
context->Render();
}
require(doc->GetElementById("gallery-scroll-test")->GetScrollHeight() > doc->GetElementById("gallery-scroll-test")->GetClientHeight()*2,"Gallery content does not contribute to scroll extent");
require(!center_selects(*doc), "Control centering does not settle");
for (const auto *id : {"stats-scale-label", "stats-legend-label", "stats-player-label", "stats-world-label", "stats-from-label", "stats-winner-label", "news-brand-test", "settings-row-label", "settings-row-help"}) {
for (const auto *id : {"stats-scale-label", "stats-legend-label", "stats-player-label", "stats-world-label", "stats-from-label", "stats-winner-label", "news-brand-test", "settings-row-label", "settings-row-help", "month-label", "warning-label", "fixture-label"}) {
auto *label = doc->GetElementById(id);
require(label && label->GetBox().GetSize(Rml::BoxArea::Content).x > 0 && visible_text_lines(*label) > 0,
"A production statistics/news label has collapsed or lost its font face");
@@ -213,6 +222,7 @@ int main(int argc, char **argv) try {
require(button, "Button missing");
centered_text(*button, *button);
}
centered_text(*doc->GetElementById("month-label"), *doc->GetElementById("month-box"));
auto *list = doc->GetElementById("list");
centered_text(*list, *list, false);
auto *rich = doc->GetElementById("rich");
+159
View File
@@ -0,0 +1,159 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "modern/ui/demo_widgets.hpp"
#include "modern/ui/desktop.hpp"
#include "modern/ui/model.hpp"
#include <chrono>
#include <iostream>
#include <set>
#include <stdexcept>
using namespace bmh::modern_ui;
namespace {
void require(bool yes, const char *why) {
if (!yes)
throw std::runtime_error(why);
}
struct Fixture {
fs::path root;
std::shared_ptr<const Catalog> world;
Fixture() {
root = fs::temp_directory_path() /
("openbmh-desktop-ui-" +
std::to_string(
std::chrono::steady_clock::now().time_since_epoch().count()));
fs::create_directories(root / "world");
const auto write = [&](const std::string &name, const Json &data) {
bmh::editor::write_atomic(root / name, data.dump());
};
write("manifest.json", {{"format", "openbmh-world"},
{"kind", "world"},
{"format_version", "1.1"},
{"id", "world:synthetic-desktop"},
{"start_date", "2032-07-01"},
{"requires", {"editor:world-v1"}},
{"x-editor", {{"profile", "editor-world-v1"}}}});
write("world/nations.json",
{{"items", {{{"id", "nation:de"}, {"name", "Synthetic nation"}}}}});
write("world/competitions.json", {{"items",
{{{"id", "competition:desktop-test"},
{"type", "league"},
{"nation", "nation:de"},
{"name", "Synthetic league"}}}}});
Json clubs = Json::array();
for (int i = 0; i < 2; ++i)
clubs.push_back({{"id", "club:desktop-" + std::to_string(i)},
{"name", "Synthetic Club " + std::to_string(i)},
{"nation", "nation:de"},
{"competition", "competition:desktop-test"}});
write("world/clubs.json", {{"items", clubs}});
write("world/players.json", {{"items", Json::array()}});
world = Catalog::open(root);
}
~Fixture() {
std::error_code ec;
fs::remove_all(root, ec);
}
};
void test(Fixture &f) {
DemoSource source(f.world);
const auto initial = source.snapshot();
auto layout = default_desktop();
require(valid_desktop(layout) && widget_definitions().size() == 17 &&
widget_catalogue().size() == 17,
"Widget catalogue incomplete");
int visible = 0;
for (const auto &[id, o] : layout.at("objects").items()) {
require(o.at("pinned") == true, "Standard must be fixed");
if (o.at("widget") == true && o.at("visible") == true)
++visible;
}
require(visible == 8 && desktop_routes().size() == 32,
"Default desktop counts wrong");
for (const auto &d : widget_catalogue()) {
bool found = false;
for (const auto &def : widget_definitions())
if (def.id == d.at("id").get<std::string>()) {
found = true;
require(def.sizes.size() == d.at("spans").size(),
"Widget size metadata mismatch");
}
require(found, "Unknown catalogue widget");
}
const auto projected = demo_desktop_widgets(*f.world, initial.state);
require(projected.at("warnings").size() == 10 &&
projected.at("own_curve").size() == 12 &&
projected.at("form").size() == 6,
"Widget projection incomplete");
require(source.snapshot().state == initial.state && !source.dirty(),
"Read-only widget data changed source");
auto altered = initial.state;
altered["cash"] = 0;
altered["finance"]["stocks"][0] = 1;
altered["contracts"]["players"] = Json::object();
auto warnings = demo_desktop_widgets(*f.world, altered).at("warnings");
require(warnings[0].at("attention") == true &&
warnings[1].at("attention") == true,
"Warnings do not reflect shared state");
const auto original = layout;
require(!resize_desktop_widget(layout, "account", 4, 1) && layout == original,
"Pinned widget resized");
require(!add_desktop_widget(layout, "calendar", 2, 2) && layout == original,
"Visible widget added twice");
require(!add_desktop_widget(layout, "fans", 8, 8) && layout == original,
"Unsupported size accepted");
require(set_desktop_grid(layout, false), "Free placement failed");
require(add_desktop_widget(layout, "fans", 2, 1) &&
!layout.at("objects").at("fans").at("pinned").get<bool>(),
"Optional widget not added movable");
require(layout.at("objects").at("fans").at("visible") == true,
"Added widget hidden");
require(arrange_desktop(layout) && layout.at("grid") == false,
"Arrange must preserve free/grid choice");
const auto before = layout;
require(set_desktop_grid(layout, true) && valid_desktop(layout),
"Snap mode failed");
for (const auto &[id, o] : original.at("objects").items())
if (o.at("visible") == true)
require(layout.at("objects").at(id) == o, "Snap moved a pinned object");
auto bad = layout;
bad["objects"]["fans"]["z"] = -1;
require(!valid_desktop(bad), "Invalid z order accepted");
auto changed = initial.state.at("settings");
changed["cells"][0] = 1 - changed["cells"][0].get<int>();
require(source.apply({initial.revision, "settings", changed}).ok,
"Cannot dirty source fixture");
const auto revision = source.snapshot().revision;
require(!source.mark_saved(revision - 1) && source.dirty(),
"Stale save acknowledgment cleared dirty state");
require(source.mark_saved(revision) && !source.dirty() &&
source.snapshot().revision == revision,
"Save acknowledgment changed revision");
const auto saved = f.root / "desktop.ui.json";
source.save(saved, layout);
auto data = Json::parse(bmh::editor::read_file(saved));
const auto restored = source.load_data(data);
require(restored == layout && !source.dirty(),
"In-memory load differs from file load");
const auto good = source.snapshot();
data["desktop"]["objects"]["calendar"]["x"] = -1;
bool rejected = false;
try {
source.load_data(data);
} catch (const std::exception &) {
rejected = true;
}
require(rejected && source.snapshot().state == good.state &&
source.snapshot().revision == good.revision,
"Failed in-memory load was not atomic");
}
} // namespace
int main() {
try {
Fixture f;
test(f);
std::cout << "modern desktop UI tests passed\n";
return 0;
} catch (const std::exception &e) {
std::cerr << e.what() << '\n';
return 1;
}
}
+217
View File
@@ -0,0 +1,217 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "modern/ui/demo_files.hpp"
#include "modern/ui/desktop.hpp"
#include "modern/ui/ui_preferences.hpp"
#include "editor/images.hpp"
#include "content/digest.hpp"
#include <algorithm>
#include <chrono>
#include <iostream>
#include <stdexcept>
using namespace bmh::modern_ui;
namespace {
void require(bool value, const char *message) {
if (!value) throw std::runtime_error(message);
}
template<class F> void rejected(F operation, const char *message) {
bool failed = false;
try { operation(); } catch (const std::exception &) { failed = true; }
require(failed, message);
}
struct Fixture {
fs::path root;
std::shared_ptr<const Catalog> world;
Fixture() {
root = fs::temp_directory_path() / ("openbmh-files-ui-" + std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
fs::create_directories(root / "world");
const auto write = [&](const std::string &name, const Json &value) {
bmh::editor::write_atomic(root / name, value.dump());
};
write("manifest.json", {{"format", "openbmh-world"}, {"kind", "world"}, {"format_version", "1.1"},
{"id", "world:synthetic-files"}, {"start_date", "2032-07-01"}, {"requires", {"editor:world-v1"}}, {"x-editor", {{"profile", "editor-world-v1"}}}});
write("world/nations.json", {{"items", {{{"id", "nation:de"}, {"name", "Synthetic nation"}}}}});
write("world/competitions.json", {{"items", {{{"id", "competition:files"}, {"type", "league"}, {"nation", "nation:de"}, {"name", "Synthetic league"}}}}});
Json clubs = Json::array();
for (int i = 0; i < 2; ++i) clubs.push_back({{"id", "club:files-" + std::to_string(i)}, {"name", "Synthetic Club " + std::to_string(i)}, {"nation", "nation:de"}, {"competition", "competition:files"}});
write("world/clubs.json", {{"items", clubs}});
write("world/players.json", {{"items", Json::array()}});
world = Catalog::open(root);
}
~Fixture() { std::error_code error; fs::remove_all(root, error); }
};
void names() {
require(DemoFiles::clean_name(" Saison 1 ") == "Saison 1", "Name trimming failed");
require(DemoFiles::name_key("Öffnung") == DemoFiles::name_key("o\xcc\x88" "FFNUNG"), "German composed/decomposed case conflict missed");
require(DemoFiles::name_key("Straße") == DemoFiles::name_key("STRASSE"), "Sharp-s casefold conflict missed");
require(DemoFiles::name_key("Café") == DemoFiles::name_key("CAFE\xcc\x81"), "Latin keyboard normalization missed");
require(DemoFiles::name_key("ABC", true) == "abc", "View compatibility normalization missed");
require(DemoFiles::name_key("ABC") != "abc", "Career names incorrectly use compatibility normalization");
require(DemoFiles::clean_name(std::string(64, 'x')).size() == 64, "64 character name rejected");
rejected([] { DemoFiles::clean_name(std::string(65, 'x')); }, "Long name accepted");
rejected([] { DemoFiles::clean_name("line\nbreak"); }, "Control character accepted");
rejected([] { DemoFiles::clean_name("\xc0\xaf"); }, "Invalid UTF8 accepted");
rejected([] { DemoFiles::clean_name(" \t\n"); }, "Empty name accepted");
}
void files() {
Fixture fixture;
const auto directory = fixture.root / "isolated-userdata";
DemoSource active(fixture.world);
auto payload = active.snapshot().state;
payload["desktop"] = default_desktop();
const auto png = bmh::editor::images::encode_png({2, 2, {255,0,0,255, 0,255,0,255, 0,0,255,255, 255,255,255,255}});
DemoFiles saves(directory, DemoFileKind::career, fixture.world);
require(saves.list().empty() && !fs::exists(directory), "Browsing created mutable storage");
const auto changed = active.apply({active.snapshot().revision, "ticket", 17});
require(changed.ok && active.dirty(), "Synthetic active edit failed");
const auto active_before = active.snapshot();
const auto first = saves.put("Öffnung", payload, png);
require(active.dirty() && active.snapshot().state == active_before.state && active.snapshot().revision == active_before.revision,
"Provider save altered active source or marked it clean before publication hook");
require(!active.mark_saved(active_before.revision + 1) && active.dirty(), "Stale save acknowledgement marked active career clean");
require(active.mark_saved(active_before.revision) && !active.dirty(), "Valid publication acknowledgement did not mark source clean");
const auto raw_before = bmh::editor::read_file(saves.directory() / bmh::editor::path(first.id));
const auto read = saves.read(first.id, first.token);
require(read.data == payload && read.preview_png == png && read.bytes == raw_before.size(), "Payload/preview/metadata roundtrip differs");
require(fs::exists(saves.preview_file(read)), "Derived preview cache missing");
rejected([&] { saves.put("o\xcc\x88" "FFNUNG", payload, png); }, "Case-insensitive duplicate save accepted");
auto invalid = payload; invalid["ticket"] = 999;
rejected([&] { saves.put("Bad", invalid, png); }, "Invalid career was published");
rejected([&] { saves.put(first.name, invalid, png, first.id, first.token); }, "Invalid overwrite was published");
rejected([&] { saves.put("Bad image", payload, "not PNG"); }, "Invalid preview was published");
rejected([&] { saves.read("../escape.json"); }, "Traversal selection accepted");
require(bmh::editor::read_file(saves.directory() / bmh::editor::path(first.id)) == raw_before, "Rejected mutation damaged existing save");
const auto renamed = saves.rename(first.id, first.token, "Neue Saison");
require(renamed.id == first.id && renamed.preview_png == png && renamed.data == payload && renamed.created == first.created,
"Rename lost payload, preview, identity or timestamp");
rejected([&] { saves.remove(first.id, first.token); }, "Stale deletion accepted");
rejected([&] { saves.put("Replace", payload, png, first.id, first.token); }, "Stale overwrite accepted");
require(saves.read(renamed.id, renamed.token).name == "Neue Saison", "Stale action changed selected record");
const auto exported = fixture.root / "export.json";
saves.export_file(renamed.id, renamed.token, exported);
const auto export_before = bmh::editor::read_file(exported);
rejected([&] { saves.export_file(renamed.id, renamed.token, exported); }, "Export silently overwrote an existing file");
require(bmh::editor::read_file(exported) == export_before, "Failed export damaged destination");
const auto imported = saves.import_file(exported);
require(imported.id != renamed.id && imported.name != renamed.name && imported.data == payload && imported.preview_png == png,
"Import replaced original or lost preview");
const auto selected_path = saves.directory() / bmh::editor::path(renamed.id);
const auto other_path = saves.directory() / bmh::editor::path(imported.id);
const auto selected_bytes = bmh::editor::read_file(selected_path);
const auto other_bytes = bmh::editor::read_file(other_path);
const auto original_names = std::make_pair(renamed.name, imported.name);
const auto unchanged_slots = [&] {
require(bmh::editor::read_file(selected_path) == selected_bytes && bmh::editor::read_file(other_path) == other_bytes,
"Rejected managed export changed either slot's bytes");
const auto selected_record = saves.read(renamed.id, renamed.token);
const auto other_record = saves.read(imported.id, imported.token);
require(selected_record.id == renamed.id && other_record.id == imported.id &&
std::make_pair(selected_record.name, other_record.name) == original_names,
"Rejected managed export changed slot IDs or names");
};
rejected([&] { saves.export_file(renamed.id, renamed.token, other_path, true); }, "Export overwrote another managed slot");
unchanged_slots();
rejected([&] { saves.export_file(renamed.id, renamed.token, selected_path, true); }, "Export overwrote its own managed slot");
unchanged_slots();
rejected([&] { saves.export_file(renamed.id, renamed.token, saves.directory() / ".." / "saves" / bmh::editor::path(imported.id), true); }, "Dot-dot alias bypassed managed export guard");
unchanged_slots();
rejected([&] { saves.export_file(renamed.id, renamed.token, saves.directory() / "new-export.json", true); }, "Export created an untracked managed slot");
require(!fs::exists(saves.directory() / "new-export.json"), "Rejected managed export left a new record");
fs::create_directories(directory / "layouts");
rejected([&] { saves.export_file(renamed.id, renamed.token, directory / "layouts" / "new-export.json", true); }, "Career export entered managed layouts");
std::error_code alias_error;
const auto alias = fixture.root / "export-save-alias";
fs::create_directory_symlink(saves.directory(), alias, alias_error);
if (!alias_error) {
rejected([&] { saves.export_file(renamed.id, renamed.token, alias / bmh::editor::path(imported.id), true); }, "Directory symlink bypassed managed export guard");
unchanged_slots(); fs::remove(alias);
}
alias_error.clear();
const auto file_alias = fixture.root / "export-slot-alias.json";
fs::create_symlink(other_path, file_alias, alias_error);
if (!alias_error) {
rejected([&] { saves.export_file(renamed.id, renamed.token, file_alias, true); }, "File symlink bypassed managed export guard");
unchanged_slots(); fs::remove(file_alias);
}
// Operating-system base-path aliases (not managed subdirectories) are valid.
const auto base_alias=fixture.root/"base-folder-alias";
std::error_code base_alias_error;
fs::create_directory_symlink(directory,base_alias,base_alias_error);
if(!base_alias_error){DemoFiles aliased(base_alias,DemoFileKind::career,fixture.world);require(aliased.read(renamed.id,renamed.token).data==payload,"Base directory alias failed");fs::remove(base_alias);}
saves.export_file(renamed.id, renamed.token, exported, true);
require(bmh::editor::read_file(exported) == export_before, "Confirmed external export no longer works");
auto damaged = Json::parse(export_before); damaged["data"]["cash"] = 123;
bmh::editor::write_atomic(fixture.root / "damaged.json", damaged.dump());
const auto before_count = saves.list().size();
rejected([&] { saves.import_file(fixture.root / "damaged.json"); }, "Hash-mismatched import accepted");
damaged = Json::parse(export_before); damaged["world_revision"] = "other source revision";
bmh::editor::write_atomic(fixture.root / "damaged.json", damaged.dump());
rejected([&] { saves.import_file(fixture.root / "damaged.json"); }, "Foreign source revision accepted");
require(saves.list().size() == before_count, "Rejected import changed local records");
const auto legacy_path = saves.directory() / "Legacy.json";
bmh::editor::write_atomic(legacy_path, payload.dump());
bmh::editor::write_atomic(saves.directory() / "Legacy.png", png);
const auto legacy_raw = bmh::editor::read_file(legacy_path);
const auto legacy = saves.read("Legacy.json");
require(legacy.legacy && legacy.data == payload && legacy.preview_png == png && bmh::editor::read_file(legacy_path) == legacy_raw,
"Legacy browsing rewrote source or separated screenshot");
std::error_code symlink_error;
fs::create_symlink(saves.directory() / bmh::editor::path(renamed.id), saves.directory() / "unsafe.json", symlink_error);
if (!symlink_error) {
rejected([&] { saves.read("unsafe.json"); }, "Symlink source accepted");
fs::remove(saves.directory() / "unsafe.json");
require(saves.read(renamed.id, renamed.token).data == payload, "Symlink rejection damaged target");
}
fs::create_directory(fixture.root / "export-is-directory.json");
rejected([&] { saves.export_file(renamed.id, renamed.token, fixture.root / "export-is-directory.json", true); }, "Export replaced a directory");
require(saves.read(renamed.id, renamed.token).data == payload, "Failed export IO changed source");
fs::create_directory(directory / ".files-transaction");
rejected([&] { saves.rename(renamed.id, renamed.token, "Busy"); }, "Concurrent transaction lock ignored");
fs::remove(directory / ".files-transaction");
require(saves.read(renamed.id, renamed.token).name == renamed.name, "Failed busy transaction changed original");
const auto loaded_before = active.snapshot();
rejected([&] { active.load_data(invalid); }, "Invalid load_data accepted");
require(active.snapshot().revision == loaded_before.revision && active.snapshot().state == loaded_before.state,
"Failed load partially published career");
auto layout = active.load_data(read.data);
require(layout == default_desktop() && !active.dirty() && active.snapshot().state.at("ticket") == payload.at("ticket"),
"Validated load did not publish selected saved state cleanly");
auto info = payload; info["date"] = "2033-02-12"; info["game_info"] = {{"matchday", 19}};
const auto meta = DemoFiles::career_metadata(info);
require(meta["season"] == "2032/33" && meta["date"] == "2033-02-12" && meta["matchday"] == "19. Spieltag",
"Metadata uses current career instead of selected document");
DemoFiles views(directory, DemoFileKind::desktop, fixture.world);
const Json view = {{"layout", default_desktop()}, {"theme", "silver"}};
const auto preferences_file = directory / "ui-preferences.json";
auto preferences = default_ui_preferences(); preferences["sound"]["volume"] = 31;
save_ui_preferences(preferences_file, preferences);
const auto preferences_before = bmh::editor::read_file(preferences_file);
rejected([&] { views.put("Standard", view, png); }, "Immutable standard view overwritten");
rejected([&] { views.put("STANDARD", view, png); }, "Compatibility spelling overwrote standard view");
rejected([&] { views.put("No preview", view); }, "Layout committed without atomic preview");
const auto plan = views.put("Plan / Süd", view, png);
require(plan.id.find('/') == plan.id.npos && plan.data == view, "Logical name escaped storage directory or theme was lost");
auto invalid_view = view; invalid_view["layout"]["objects"]["calendar"]["x"] = -100;
rejected([&] { views.put(plan.name, invalid_view, png, plan.id, plan.token); }, "Invalid layout overwrite accepted");
const auto new_name = views.rename(plan.id, plan.token, "Wochenende");
require(new_name.preview_png == png && new_name.data == view, "View rename separated layout and screenshot");
rejected([&] { views.export_file(new_name.id, new_name.token, selected_path, true); }, "View export overwrote a managed career slot");
unchanged_slots();
require(views.read(new_name.id, new_name.token).name == new_name.name, "Rejected cross-kind export changed source view");
require(bmh::editor::read_file(preferences_file) == preferences_before && load_ui_preferences(preferences_file) == preferences,
"View provider modified global UI preferences");
views.remove(new_name.id, new_name.token);
require(views.list().empty(), "Confirmed view deletion left visible half record");
for (int i = 0; i < 12; ++i) saves.put("Growing slot " + std::to_string(i), payload);
require(saves.list().size() > 10, "Save provider has an artificial ten-slot limit");
bmh::editor::write_atomic(saves.directory() / "broken.json", "{broken");
const auto broken = saves.list();
require(std::any_of(broken.begin(), broken.end(), [](const auto &r) { return r.id == "broken.json" && !r.valid(); }),
"Malformed local file silently disappeared from browser");
saves.remove(imported.id, imported.token);
require(saves.read(renamed.id, renamed.token).data == payload, "Deleting another slot damaged original");
}
} // namespace
int main() {
try { names(); files(); std::cout << "PASS synthetic UI files: atomic payload/PNG, stale guards, Unicode names, selected metadata, import/export, isolated preferences and rollback\n"; return 0; }
catch (const std::exception &e) { std::cerr << e.what() << '\n'; return 1; }
}