mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 10:13:09 -06:00
WIP red-app-r4-2: edits before the fixer was stopped (its job scope was capped at 4 GB); not built
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1eb1f03857
commit
414f2a3909
@@ -101,7 +101,7 @@ impl<'a> EngineTool<'a> {
|
||||
|
||||
fn end_twist_on_input(&mut self, cx: &ToolContext<'_>) {
|
||||
let turned_this_frame = self.app.twist_frame == Some(self.ctx.cumulative_frame_nr());
|
||||
if !turned_this_frame && cx.space().and_then(|space| space.wheel()).is_some_and(|wheel| wheel.rotation == 0.0) {
|
||||
if !turned_this_frame && cx.space().and_then(|space| space.wheel()).is_none_or(|wheel| wheel.rotation == 0.0) {
|
||||
self.end_twist();
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,6 @@ impl CanvasTool for EngineTool<'_> {
|
||||
if self.blocked() || self.app.anim_preview_active() || !cx.pointer_moved() {
|
||||
return;
|
||||
}
|
||||
self.end_twist();
|
||||
self.pointer(pointer, cx, PointerKind::Move);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,12 +149,11 @@ pub(crate) fn body(app: &mut SlideApp, ui: &mut Ui, cx: &mut BodyCx<'_>) {
|
||||
// The board drains commands once. Only the command targeted at this pane changes its selection scope;
|
||||
// app commands fall through to the same run path the editor root uses.
|
||||
while let Some((command, fired)) = cx.take_command::<EditCommands>() {
|
||||
let params = if command == EditCommands::SelectAll && fired.target.is_some() && fired.target == cx.command_chain().innermost("pane") {
|
||||
json!({"scope": "slides"})
|
||||
if command == EditCommands::SelectAll && fired.target.is_some() && fired.target == cx.command_chain().innermost("pane") {
|
||||
let _ = app.run("edit.selectAll", json!({"scope": "slides"}));
|
||||
} else {
|
||||
fired.command.params
|
||||
};
|
||||
let _ = app.run(&fired.command.id, params);
|
||||
app.fire(ui.ctx(), &fired);
|
||||
}
|
||||
}
|
||||
for event in out.events {
|
||||
match event {
|
||||
|
||||
@@ -93,6 +93,18 @@ fn web_export_all_slides_gives_one_file_per_slide() {
|
||||
assert_eq!(one[0].0, "Deck.png");
|
||||
}
|
||||
|
||||
/// The files a browser host downloaded: each Save the app asked for whose bytes arrived. A browser save is
|
||||
/// a download, not a `Files::write`, so `ScriptedFiles::written` does not list it.
|
||||
fn downloaded(files: &ScriptedFiles) -> Vec<std::path::PathBuf> {
|
||||
files
|
||||
.requests()
|
||||
.into_iter()
|
||||
.filter(|request| request.kind == craft::host::PickKind::Save)
|
||||
.filter_map(|request| request.file_name.map(std::path::PathBuf::from))
|
||||
.filter(|path| files.file(path).is_some())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// A PNG may omit the background; JPEG remains opaque.
|
||||
#[test]
|
||||
fn web_png_export_can_leave_the_background_transparent() {
|
||||
@@ -100,10 +112,10 @@ fn web_png_export_can_leave_the_background_transparent() {
|
||||
let mut h = files_harness(Session::with_new(), files.clone());
|
||||
let mut alpha = Vec::new();
|
||||
for (format, extra) in [("png", json!({})), ("png", json!({"transparentBackground": true})), ("jpeg", json!({"transparentBackground": true}))] {
|
||||
let before = files.written().len();
|
||||
let before = downloaded(&files).len();
|
||||
assert!(h.state_mut().export_as(format, extra));
|
||||
h.run_steps(2);
|
||||
let written = files.written();
|
||||
let written = downloaded(&files);
|
||||
assert!(written.len() > before);
|
||||
let bytes = files.file(written.last().unwrap()).unwrap();
|
||||
alpha.push(deckcraft_render::decode_image(&bytes).unwrap().get_pixel(2, 2).0[3]);
|
||||
@@ -119,17 +131,17 @@ fn every_listed_save_type_exports() {
|
||||
let mut h = files_harness(Session::with_new(), files.clone());
|
||||
h.state_mut().session.execute("slide.new", &json!({})).unwrap();
|
||||
for (id, _, _) in crate::backstage::SAVE_TYPES {
|
||||
let before = files.written().len();
|
||||
let before = downloaded(&files).len();
|
||||
assert!(h.state_mut().export_as(id, json!({})), "{id} exports");
|
||||
h.run_steps(2);
|
||||
let written = files.written();
|
||||
let written = downloaded(&files);
|
||||
assert!(written.len() > before, "{id} produces a file");
|
||||
for path in &written[before..] {
|
||||
assert!(!files.file(path).unwrap().is_empty(), "{id}: {path:?}");
|
||||
}
|
||||
}
|
||||
let title = h.state().session.active().unwrap().title();
|
||||
let names = files.written();
|
||||
let names = downloaded(&files);
|
||||
for name in [format!("{title}1.jpg"), format!("{title}2.jpg"), format!("{title}1.png"), format!("{title}2.png")] {
|
||||
assert!(names.iter().any(|p| p.file_name().is_some_and(|n| n == name.as_str())), "{name}: {names:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user