Skip to content

Commit 04ff7b7

Browse files
committed
Fix tests
1 parent da22edb commit 04ff7b7

File tree

8 files changed

+23
-25
lines changed

8 files changed

+23
-25
lines changed

editor/src/test_utils.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::test_utils::test_prelude::LayerNodeIdentifier;
1212
use glam::DVec2;
1313
use graph_craft::document::DocumentNode;
1414
use graphene_std::InputAccessor;
15-
use graphene_std::any::EditorContext;
1615
use graphene_std::raster::color::Color;
1716

1817
/// A set of utility functions to make the writing of editor test more declarative
@@ -22,20 +21,20 @@ pub struct EditorTestUtils {
2221
}
2322

2423
impl EditorTestUtils {
25-
pub fn create() -> Self {
26-
let _ = env_logger::builder().is_test(true).try_init();
27-
set_uuid_seed(0);
24+
// pub fn create() -> Self {
25+
// let _ = env_logger::builder().is_test(true).try_init();
26+
// set_uuid_seed(0);
2827

29-
let (mut editor, runtime) = Editor::new_local_executor();
28+
// let (mut editor, runtime) = Editor::new_local_executor();
3029

31-
// We have to set this directly instead of using `GlobalsMessage::SetPlatform` because race conditions with multiple tests can cause that message handler to set it more than once, which is a failure.
32-
// It isn't sufficient to guard the message dispatch here with a check if the once_cell is empty, because that isn't atomic and the time between checking and handling the dispatch can let multiple through.
33-
let _ = GLOBAL_PLATFORM.set(Platform::Windows).is_ok();
30+
// // We have to set this directly instead of using `GlobalsMessage::SetPlatform` because race conditions with multiple tests can cause that message handler to set it more than once, which is a failure.
31+
// // It isn't sufficient to guard the message dispatch here with a check if the once_cell is empty, because that isn't atomic and the time between checking and handling the dispatch can let multiple through.
32+
// let _ = GLOBAL_PLATFORM.set(Platform::Windows).is_ok();
3433

35-
editor.handle_message(PortfolioMessage::Init);
34+
// editor.handle_message(PortfolioMessage::Init);
3635

37-
Self { editor, runtime }
38-
}
36+
// Self { editor, runtime }
37+
// }
3938

4039
// pub fn eval_graph<'a>(&'a mut self) -> impl std::future::Future<Output = Result<Instrumented, String>> + 'a {
4140
// // An inner function is required since async functions in traits are a bit weird

node-graph/gcore/src/memo.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ where
9393

9494
drop(cache_guard);
9595

96+
let fut = self.node.eval(input);
97+
let cache = self.cache.clone();
98+
9699
Box::pin(async move {
97-
let value = self.node.eval(input).await;
98-
*self.cache.lock().unwrap() = Some((hash, Arc::new(value.clone())));
100+
let value = fut.await;
101+
*cache.lock().unwrap() = Some((hash, Arc::new(value.clone())));
99102
value
100103
})
101104
}

node-graph/gcore/src/vector/algorithms/instance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use crate::instances::{InstanceRef, Instances};
22
use crate::raster_types::{CPU, RasterDataTable};
33
use crate::vector::VectorDataTable;
4-
use crate::{ Context, Ctx, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, WithIndex};
4+
use crate::{Context, Ctx, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, WithIndex};
55
use glam::DVec2;
66

77
#[node_macro::node(name("Instance on Points"), category("Instancing"), path(graphene_core::vector))]
88
async fn instance_on_points<T: Into<GraphicElement> + Default + Send + Clone + 'static>(
9-
ctx: impl Ctx + WithIndex,
9+
ctx: impl Ctx + WithIndex + Sync,
1010
points: VectorDataTable,
1111
#[implementations(
1212
Context -> GraphicGroupTable,

node-graph/graph-craft/src/document/value.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ impl Display for TaggedValue {
397397

398398
pub struct UpcastNode {
399399
value: MemoHash<TaggedValue>,
400-
inspected: Cell<bool>,
401400
}
402401
impl<'input> Node<'input, DAny<'input>> for UpcastNode {
403402
type Output = FutureAny<'input>;
@@ -407,13 +406,12 @@ impl<'input> Node<'input, DAny<'input>> for UpcastNode {
407406
}
408407

409408
fn introspect(&self) -> graphene_core::memo::MonitorIntrospectResult {
410-
let inspected = self.inspected.replace(true);
411-
graphene_core::memo::MonitorIntrospectResult::Evaluated((Arc::new(self.value.clone().into_inner()) as Arc<dyn std::any::Any + Send + Sync>, !inspected))
409+
graphene_core::memo::MonitorIntrospectResult::Evaluated((Arc::new(self.value.clone().into_inner()) as Arc<dyn std::any::Any + Send + Sync>, true))
412410
}
413411
}
414412
impl UpcastNode {
415413
pub fn new(value: MemoHash<TaggedValue>) -> Self {
416-
Self { value, inspected: Cell::new(false) }
414+
Self { value }
417415
}
418416
}
419417
#[derive(Default, Debug, Clone, Copy)]

node-graph/graphene-cli/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use graph_craft::proto::{ProtoNetwork, ProtoNode};
77
use graph_craft::util::load_network;
88
use graph_craft::wasm_application_io::{EditorPreferences, WasmApplicationIoValue};
99
use graphene_core::text::FontCache;
10-
use graphene_std::any::EditorContext;
1110
use graphene_std::application_io::{ApplicationIo, ApplicationIoValue, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig};
1211
use graphene_std::wasm_application_io::WasmApplicationIo;
1312
use interpreted_executor::dynamic_executor::DynamicExecutor;
@@ -180,7 +179,7 @@ fn compile_graph(document_string: String, application_io: Arc<WasmApplicationIo>
180179
let mut network = load_network(&document_string);
181180
fix_nodes(&mut network);
182181

183-
let substitutions: std::collections::HashMap<String, DocumentNode> = preprocessor::generate_node_substitutions();
182+
let substitutions = preprocessor::generate_node_substitutions();
184183
preprocessor::expand_network(&mut network, &substitutions);
185184

186185
let mut wrapped_network = wrap_network_in_scope(network, Arc::new(FontCache::default()), EditorMetadata::default(), application_io);

node-graph/gstd/src/any.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pub use graph_craft::proto::{Any, NodeContainer, TypeErasedBox, TypeErasedNode};
33
use graph_craft::proto::{DynFuture, FutureAny, SharedNodeContainer};
44
use graphene_core::Context;
55
use graphene_core::ContextDependencies;
6-
use graphene_core::EditorContext;
76
use graphene_core::NodeIO;
87
use graphene_core::OwnedContextImpl;
98
use graphene_core::WasmNotSend;

node-graph/interpreted-executor/benches/run_demo_art_criterion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn update_executor<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
1515
c.bench_function(name, |b| {
1616
b.iter_batched(
1717
|| (executor.clone(), proto_network.clone()),
18-
|(mut executor, network)| futures::executor::block_on(executor.update(black_box(network, None))),
18+
|(mut executor, network)| futures::executor::block_on(executor.update(black_box(network), None)),
1919
criterion::BatchSize::SmallInput,
2020
)
2121
});
@@ -33,7 +33,7 @@ fn run_once<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
3333
let proto_network = network.compile().unwrap().0;
3434

3535
let executor = futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap();
36-
let context = graphene_std::any::EditorContext::default();
36+
let context = graphene_std::EditorContext::default();
3737

3838
c.bench_function(name, |b| b.iter(|| futures::executor::block_on((&executor).evaluate_from_node(context.clone(), None))));
3939
}

node-graph/interpreted-executor/benches/update_executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn update_executor(c: &mut Criterion) {
1616
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
1717
(executor, proto_network)
1818
},
19-
|(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network, None))),
19+
|(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network), None)),
2020
criterion::BatchSize::SmallInput,
2121
)
2222
});

0 commit comments

Comments
 (0)