mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 23:38:06 +08:00
Fix tests
This commit is contained in:
@@ -93,9 +93,12 @@ where
|
||||
|
||||
drop(cache_guard);
|
||||
|
||||
let fut = self.node.eval(input);
|
||||
let cache = self.cache.clone();
|
||||
|
||||
Box::pin(async move {
|
||||
let value = self.node.eval(input).await;
|
||||
*self.cache.lock().unwrap() = Some((hash, Arc::new(value.clone())));
|
||||
let value = fut.await;
|
||||
*cache.lock().unwrap() = Some((hash, Arc::new(value.clone())));
|
||||
value
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use crate::instances::{InstanceRef, Instances};
|
||||
use crate::raster_types::{CPU, RasterDataTable};
|
||||
use crate::vector::VectorDataTable;
|
||||
use crate::{ Context, Ctx, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, WithIndex};
|
||||
use crate::{Context, Ctx, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, WithIndex};
|
||||
use glam::DVec2;
|
||||
|
||||
#[node_macro::node(name("Instance on Points"), category("Instancing"), path(graphene_core::vector))]
|
||||
async fn instance_on_points<T: Into<GraphicElement> + Default + Send + Clone + 'static>(
|
||||
ctx: impl Ctx + WithIndex,
|
||||
ctx: impl Ctx + WithIndex + Sync,
|
||||
points: VectorDataTable,
|
||||
#[implementations(
|
||||
Context -> GraphicGroupTable,
|
||||
|
||||
@@ -397,7 +397,6 @@ impl Display for TaggedValue {
|
||||
|
||||
pub struct UpcastNode {
|
||||
value: MemoHash<TaggedValue>,
|
||||
inspected: Cell<bool>,
|
||||
}
|
||||
impl<'input> Node<'input, DAny<'input>> for UpcastNode {
|
||||
type Output = FutureAny<'input>;
|
||||
@@ -407,13 +406,12 @@ impl<'input> Node<'input, DAny<'input>> for UpcastNode {
|
||||
}
|
||||
|
||||
fn introspect(&self) -> graphene_core::memo::MonitorIntrospectResult {
|
||||
let inspected = self.inspected.replace(true);
|
||||
graphene_core::memo::MonitorIntrospectResult::Evaluated((Arc::new(self.value.clone().into_inner()) as Arc<dyn std::any::Any + Send + Sync>, !inspected))
|
||||
graphene_core::memo::MonitorIntrospectResult::Evaluated((Arc::new(self.value.clone().into_inner()) as Arc<dyn std::any::Any + Send + Sync>, true))
|
||||
}
|
||||
}
|
||||
impl UpcastNode {
|
||||
pub fn new(value: MemoHash<TaggedValue>) -> Self {
|
||||
Self { value, inspected: Cell::new(false) }
|
||||
Self { value }
|
||||
}
|
||||
}
|
||||
#[derive(Default, Debug, Clone, Copy)]
|
||||
|
||||
@@ -7,7 +7,6 @@ use graph_craft::proto::{ProtoNetwork, ProtoNode};
|
||||
use graph_craft::util::load_network;
|
||||
use graph_craft::wasm_application_io::{EditorPreferences, WasmApplicationIoValue};
|
||||
use graphene_core::text::FontCache;
|
||||
use graphene_std::any::EditorContext;
|
||||
use graphene_std::application_io::{ApplicationIo, ApplicationIoValue, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig};
|
||||
use graphene_std::wasm_application_io::WasmApplicationIo;
|
||||
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||
@@ -180,7 +179,7 @@ fn compile_graph(document_string: String, application_io: Arc<WasmApplicationIo>
|
||||
let mut network = load_network(&document_string);
|
||||
fix_nodes(&mut network);
|
||||
|
||||
let substitutions: std::collections::HashMap<String, DocumentNode> = preprocessor::generate_node_substitutions();
|
||||
let substitutions = preprocessor::generate_node_substitutions();
|
||||
preprocessor::expand_network(&mut network, &substitutions);
|
||||
|
||||
let mut wrapped_network = wrap_network_in_scope(network, Arc::new(FontCache::default()), EditorMetadata::default(), application_io);
|
||||
|
||||
@@ -3,7 +3,6 @@ pub use graph_craft::proto::{Any, NodeContainer, TypeErasedBox, TypeErasedNode};
|
||||
use graph_craft::proto::{DynFuture, FutureAny, SharedNodeContainer};
|
||||
use graphene_core::Context;
|
||||
use graphene_core::ContextDependencies;
|
||||
use graphene_core::EditorContext;
|
||||
use graphene_core::NodeIO;
|
||||
use graphene_core::OwnedContextImpl;
|
||||
use graphene_core::WasmNotSend;
|
||||
|
||||
@@ -15,7 +15,7 @@ fn update_executor<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
|
||||
c.bench_function(name, |b| {
|
||||
b.iter_batched(
|
||||
|| (executor.clone(), proto_network.clone()),
|
||||
|(mut executor, network)| futures::executor::block_on(executor.update(black_box(network, None))),
|
||||
|(mut executor, network)| futures::executor::block_on(executor.update(black_box(network), None)),
|
||||
criterion::BatchSize::SmallInput,
|
||||
)
|
||||
});
|
||||
@@ -33,7 +33,7 @@ fn run_once<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
|
||||
let proto_network = network.compile().unwrap().0;
|
||||
|
||||
let executor = futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap();
|
||||
let context = graphene_std::any::EditorContext::default();
|
||||
let context = graphene_std::EditorContext::default();
|
||||
|
||||
c.bench_function(name, |b| b.iter(|| futures::executor::block_on((&executor).evaluate_from_node(context.clone(), None))));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ fn update_executor(c: &mut Criterion) {
|
||||
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
|
||||
(executor, proto_network)
|
||||
},
|
||||
|(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network, None))),
|
||||
|(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network), None)),
|
||||
criterion::BatchSize::SmallInput,
|
||||
)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user