mirror of https://github.com/hannobraun/Fornjot
Refactor test not to rely on `Shape::update`
This commit is contained in:
parent
c08da0d683
commit
d1d1f6d561
|
@ -232,28 +232,29 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn coherence_edge() {
|
fn coherence_edge() {
|
||||||
let mut shape = Shape::new();
|
let mut tmp = Shape::new();
|
||||||
Edge::builder(&mut shape)
|
|
||||||
.build_line_segment_from_points([[0., 0., 0.], [1., 0., 0.]])
|
let a = Point::from([0., 0., 0.]);
|
||||||
.get();
|
let b = Point::from([1., 0., 0.]);
|
||||||
|
|
||||||
|
let curve = {
|
||||||
|
let curve = tmp.insert(Curve::line_from_points([a, b]));
|
||||||
|
LocalForm::canonical_only(curve)
|
||||||
|
};
|
||||||
|
|
||||||
|
let a = tmp.insert(Vertex { point: a });
|
||||||
|
let b = tmp.insert(Vertex { point: b });
|
||||||
|
|
||||||
let deviation = Scalar::from_f64(0.25);
|
let deviation = Scalar::from_f64(0.25);
|
||||||
|
|
||||||
shape.update().update_all(|edge: &mut Edge<3>| {
|
let a = LocalForm::new(Point::from([Scalar::ZERO + deviation]), a);
|
||||||
let original = edge.clone();
|
let b = LocalForm::new(Point::from([Scalar::ONE]), b);
|
||||||
*edge = Edge {
|
let vertices = VerticesOfEdge::from_vertices([a, b]);
|
||||||
vertices: original.vertices.map(|vertex| {
|
|
||||||
LocalForm::new(
|
let edge = Edge { curve, vertices };
|
||||||
*vertex.local() + [deviation],
|
|
||||||
vertex.canonical(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
..original
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let result = validate(
|
let result = validate(
|
||||||
shape.clone(),
|
edge.clone(),
|
||||||
&ValidationConfig {
|
&ValidationConfig {
|
||||||
identical_max_distance: deviation * 2.,
|
identical_max_distance: deviation * 2.,
|
||||||
..ValidationConfig::default()
|
..ValidationConfig::default()
|
||||||
|
@ -262,7 +263,7 @@ mod tests {
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
|
|
||||||
let result = validate(
|
let result = validate(
|
||||||
shape,
|
edge,
|
||||||
&ValidationConfig {
|
&ValidationConfig {
|
||||||
identical_max_distance: deviation / 2.,
|
identical_max_distance: deviation / 2.,
|
||||||
..ValidationConfig::default()
|
..ValidationConfig::default()
|
||||||
|
|
Loading…
Reference in New Issue