mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 02:35:37 +01:00
Color Wheel: Copy Color As tests run their frame through ui_context and part_frame
This commit is contained in:
1 parent
ac256df28e
commit
f78d37cc6e
1 file changed
+3
-4
@@ -32,11 +32,10 @@ fn app(opacity: f64) -> VectorcraftApp {
|
||||
|
||||
/// Run Copy Color As › `notation` in one frame: its answer and the texts it put on the clipboard.
|
||||
fn copy(app: &mut VectorcraftApp, notation: &str) -> (Result<Value, String>, Vec<String>) {
|
||||
let ctx = egui::Context::default();
|
||||
app.ui_ctx = Some(ctx.clone());
|
||||
let ctx = crate::testing::ui_context();
|
||||
let mut answer = None;
|
||||
let mut out = ctx.run_ui(Default::default(), |_| answer = run(app, &format!("ui.colorWheel.copy.{notation}"), &json!({})));
|
||||
out.textures_delta.clear();
|
||||
let out =
|
||||
crate::testing::part_frame(app, &ctx, Default::default(), |app, _| answer = run(app, &format!("ui.colorWheel.copy.{notation}"), &json!({})));
|
||||
let copied =
|
||||
out.platform_output.commands.iter().filter_map(|c| if let egui::OutputCommand::CopyText(t) = c { Some(t.clone()) } else { None }).collect();
|
||||
(answer.expect("a Copy Color As item"), copied)
|
||||
|
||||
Reference in new issue
Block a user