mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 02:08:12 +08:00
Fix test compilation and allow the ci to run (#1456)
* Fix test compilation * Don't fail if .wasm-pack dir does not exist
This commit is contained in:
@@ -28,7 +28,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
- name: 🗑 Clear wasm-bindgen cache
|
||||||
run: rm -r ~/.cache/.wasm-pack
|
run: rm -r ~/.cache/.wasm-pack || true
|
||||||
|
|
||||||
- name: 🟢 Set up Node
|
- name: 🟢 Set up Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ mod test {
|
|||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
use crate::test_utils::EditorTestUtils;
|
use crate::test_utils::EditorTestUtils;
|
||||||
|
|
||||||
|
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||||
use document_legacy::LayerId;
|
use document_legacy::LayerId;
|
||||||
use document_legacy::Operation;
|
use document_legacy::Operation;
|
||||||
use graphene_core::raster::color::Color;
|
use graphene_core::raster::color::Color;
|
||||||
|
|||||||
+1
-1
@@ -2519,7 +2519,7 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, hash: u64) -> NodeNetwork
|
|||||||
.to_document_node(vec![input_type.unwrap()], DocumentNodeMetadata::default());
|
.to_document_node(vec![input_type.unwrap()], DocumentNodeMetadata::default());
|
||||||
if let DocumentNodeImplementation::Network(g) = &mut begin_scope.implementation {
|
if let DocumentNodeImplementation::Network(g) = &mut begin_scope.implementation {
|
||||||
if let Some(node) = g.nodes.get_mut(&0) {
|
if let Some(node) = g.nodes.get_mut(&0) {
|
||||||
node.hash = hash;
|
node.world_state_hash = hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ pub struct DocumentNode {
|
|||||||
pub skip_deduplication: bool,
|
pub skip_deduplication: bool,
|
||||||
/// Used as a hash of the graph input where applicable. This ensures that protonodes that depend on the graph's input are always regenerated.
|
/// Used as a hash of the graph input where applicable. This ensures that protonodes that depend on the graph's input are always regenerated.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub hash: u64,
|
pub world_state_hash: u64,
|
||||||
/// The path to this node as of when [`NodeNetwork::generate_node_paths`] was called.
|
/// The path to this node as of when [`NodeNetwork::generate_node_paths`] was called.
|
||||||
/// For example if this node was ID 6 inside a node with ID 4 and with a [`DocumentNodeImplementation::Network`], the path would be [4, 6].
|
/// For example if this node was ID 6 inside a node with ID 4 and with a [`DocumentNodeImplementation::Network`], the path would be [4, 6].
|
||||||
pub path: Option<Vec<NodeId>>,
|
pub path: Option<Vec<NodeId>>,
|
||||||
@@ -164,7 +164,7 @@ impl Default for DocumentNode {
|
|||||||
implementation: Default::default(),
|
implementation: Default::default(),
|
||||||
metadata: Default::default(),
|
metadata: Default::default(),
|
||||||
skip_deduplication: Default::default(),
|
skip_deduplication: Default::default(),
|
||||||
hash: Default::default(),
|
world_state_hash: Default::default(),
|
||||||
path: Default::default(),
|
path: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ impl DocumentNode {
|
|||||||
construction_args: args,
|
construction_args: args,
|
||||||
document_node_path: self.path.unwrap_or_default(),
|
document_node_path: self.path.unwrap_or_default(),
|
||||||
skip_deduplication: self.skip_deduplication,
|
skip_deduplication: self.skip_deduplication,
|
||||||
hash: self.hash,
|
world_state_hash: self.world_state_hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1248,8 +1248,7 @@ mod test {
|
|||||||
identifier: "graphene_core::structural::ConsNode".into(),
|
identifier: "graphene_core::structural::ConsNode".into(),
|
||||||
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
|
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![(0, false)]),
|
construction_args: ConstructionArgs::Nodes(vec![(0, false)]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
};
|
};
|
||||||
assert_eq!(proto_node, reference);
|
assert_eq!(proto_node, reference);
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1266,7 @@ mod test {
|
|||||||
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
|
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
|
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
|
||||||
document_node_path: vec![1, 0],
|
document_node_path: vec![1, 0],
|
||||||
skip_deduplication: false,
|
..Default::default()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -1277,7 +1276,7 @@ mod test {
|
|||||||
input: ProtoNodeInput::Node(10, false),
|
input: ProtoNodeInput::Node(10, false),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![]),
|
construction_args: ConstructionArgs::Nodes(vec![]),
|
||||||
document_node_path: vec![1, 1],
|
document_node_path: vec![1, 1],
|
||||||
skip_deduplication: false,
|
..Default::default()
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(14, ProtoNode::value(ConstructionArgs::Value(TaggedValue::U32(2)), vec![1, 4])),
|
(14, ProtoNode::value(ConstructionArgs::Value(TaggedValue::U32(2)), vec![1, 4])),
|
||||||
|
|||||||
@@ -207,7 +207,21 @@ pub struct ProtoNode {
|
|||||||
pub identifier: NodeIdentifier,
|
pub identifier: NodeIdentifier,
|
||||||
pub document_node_path: Vec<NodeId>,
|
pub document_node_path: Vec<NodeId>,
|
||||||
pub skip_deduplication: bool,
|
pub skip_deduplication: bool,
|
||||||
pub hash: u64,
|
/// Represents a global state on which the node depends. This is a hack, TODO: figure out a proper solution
|
||||||
|
pub world_state_hash: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for ProtoNode {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
identifier: NodeIdentifier::new("graphene_core::ops::IdNode"),
|
||||||
|
construction_args: ConstructionArgs::Value(value::TaggedValue::U32(0)),
|
||||||
|
input: ProtoNodeInput::None,
|
||||||
|
document_node_path: vec![],
|
||||||
|
skip_deduplication: false,
|
||||||
|
world_state_hash: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A ProtoNodeInput represents the primary input of a node in a ProtoNetwork.
|
/// A ProtoNodeInput represents the primary input of a node in a ProtoNetwork.
|
||||||
@@ -253,7 +267,7 @@ impl ProtoNode {
|
|||||||
if self.skip_deduplication {
|
if self.skip_deduplication {
|
||||||
self.document_node_path.hash(&mut hasher);
|
self.document_node_path.hash(&mut hasher);
|
||||||
}
|
}
|
||||||
self.hash.hash(&mut hasher);
|
self.world_state_hash.hash(&mut hasher);
|
||||||
std::mem::discriminant(&self.input).hash(&mut hasher);
|
std::mem::discriminant(&self.input).hash(&mut hasher);
|
||||||
match self.input {
|
match self.input {
|
||||||
ProtoNodeInput::None => (),
|
ProtoNodeInput::None => (),
|
||||||
@@ -273,7 +287,7 @@ impl ProtoNode {
|
|||||||
input: ProtoNodeInput::None,
|
input: ProtoNodeInput::None,
|
||||||
document_node_path: path,
|
document_node_path: path,
|
||||||
skip_deduplication: false,
|
skip_deduplication: false,
|
||||||
hash: 0,
|
world_state_hash: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,7 +400,7 @@ impl ProtoNetwork {
|
|||||||
input,
|
input,
|
||||||
document_node_path: path,
|
document_node_path: path,
|
||||||
skip_deduplication: false,
|
skip_deduplication: false,
|
||||||
hash: 0,
|
world_state_hash: 0,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -778,12 +792,12 @@ mod test {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
ids,
|
ids,
|
||||||
vec![
|
vec![
|
||||||
2785293541695324513,
|
17957338642374791135,
|
||||||
12994980551665119079,
|
1303972037140595827,
|
||||||
17926586814106640907,
|
15485192931817078264,
|
||||||
2523412932923113119,
|
9739645351331265115,
|
||||||
12965978620570332342,
|
4165308598738454684,
|
||||||
16191561097939296982
|
5557529806312473178
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -799,8 +813,7 @@ mod test {
|
|||||||
identifier: "id".into(),
|
identifier: "id".into(),
|
||||||
input: ProtoNodeInput::Node(11, false),
|
input: ProtoNodeInput::Node(11, false),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![]),
|
construction_args: ConstructionArgs::Nodes(vec![]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -809,8 +822,7 @@ mod test {
|
|||||||
identifier: "id".into(),
|
identifier: "id".into(),
|
||||||
input: ProtoNodeInput::Node(11, false),
|
input: ProtoNodeInput::Node(11, false),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![]),
|
construction_args: ConstructionArgs::Nodes(vec![]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -819,8 +831,7 @@ mod test {
|
|||||||
identifier: "cons".into(),
|
identifier: "cons".into(),
|
||||||
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
|
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
|
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -829,8 +840,7 @@ mod test {
|
|||||||
identifier: "add".into(),
|
identifier: "add".into(),
|
||||||
input: ProtoNodeInput::Node(10, false),
|
input: ProtoNodeInput::Node(10, false),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![]),
|
construction_args: ConstructionArgs::Nodes(vec![]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -839,8 +849,7 @@ mod test {
|
|||||||
identifier: "value".into(),
|
identifier: "value".into(),
|
||||||
input: ProtoNodeInput::None,
|
input: ProtoNodeInput::None,
|
||||||
construction_args: ConstructionArgs::Value(value::TaggedValue::U32(2)),
|
construction_args: ConstructionArgs::Value(value::TaggedValue::U32(2)),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -860,8 +869,7 @@ mod test {
|
|||||||
identifier: "id".into(),
|
identifier: "id".into(),
|
||||||
input: ProtoNodeInput::Node(2, false),
|
input: ProtoNodeInput::Node(2, false),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![]),
|
construction_args: ConstructionArgs::Nodes(vec![]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -870,8 +878,7 @@ mod test {
|
|||||||
identifier: "id".into(),
|
identifier: "id".into(),
|
||||||
input: ProtoNodeInput::Node(1, false),
|
input: ProtoNodeInput::Node(1, false),
|
||||||
construction_args: ConstructionArgs::Nodes(vec![]),
|
construction_args: ConstructionArgs::Nodes(vec![]),
|
||||||
document_node_path: vec![],
|
..Default::default()
|
||||||
skip_deduplication: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user