Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions eden/scm/lib/renderdag/src/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,35 @@ mod tests {
);
}

#[test]
fn basic_disconnected() {
assert_eq!(
render(&test_fixtures::BASIC_DISCONNECTED),
r#"
o C
|
o B

o A"#
);
}

#[test]
fn basic_disconnected_min_row_height_1() {
let mut renderer = GraphRowRenderer::new()
.output()
.with_min_row_height(1)
.build_ascii();
assert_eq!(
render_string(&test_fixtures::BASIC_DISCONNECTED, &mut renderer),
r#"
o C
|
o B
o A"#
);
}

#[test]
fn branches_and_merges() {
assert_eq!(
Expand Down
15 changes: 15 additions & 0 deletions eden/scm/lib/renderdag/src/ascii_large.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,21 @@ mod tests {
);
}

#[test]
fn basic_disconnected() {
assert_eq!(
render(&test_fixtures::BASIC_DISCONNECTED),
r#"
o C
|
|
o B


o A"#
);
}

#[test]
fn branches_and_merges() {
assert_eq!(
Expand Down
29 changes: 29 additions & 0 deletions eden/scm/lib/renderdag/src/box_drawing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,35 @@ mod tests {
);
}

#[test]
fn basic_disconnected() {
assert_eq!(
render(&test_fixtures::BASIC_DISCONNECTED),
r#"
o C
o B

o A"#
);
}

#[test]
fn basic_disconnected_min_row_height_1() {
let mut renderer = GraphRowRenderer::new()
.output()
.with_min_row_height(1)
.build_box_drawing();
assert_eq!(
render_string(&test_fixtures::BASIC_DISCONNECTED, &mut renderer),
r#"
o C
o B
o A"#
);
}

#[test]
fn branches_and_merges() {
assert_eq!(
Expand Down
3 changes: 3 additions & 0 deletions eden/scm/lib/renderdag/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ where
} else if i == column {
link_line[i] |= LinkLine::CHILD
| p.to_link_line(LinkLine::VERT_PARENT, LinkLine::VERT_ANCESTOR);
if p.id().is_some() {
need_link_line = true;
}
} else {
link_line[i] |=
p.to_link_line(LinkLine::LEFT_FORK_PARENT, LinkLine::LEFT_FORK_ANCESTOR);
Expand Down
12 changes: 12 additions & 0 deletions eden/scm/lib/renderdag/src/test_fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ pub(crate) const BASIC: TestFixture = TestFixture {
missing: &[],
};

// A-B is a connected pair; C is an isolated node that ends up in the same
// column after A's column is freed. Used to verify that the renderer
// visually distinguishes connected from unconnected adjacent nodes.
pub(crate) const BASIC_DISCONNECTED: TestFixture = TestFixture {
dag: "A B-C",
messages: &[],
heads: &["A", "C"],
reserve: &[],
ancestors: &[],
missing: &[],
};

pub(crate) const BRANCHES_AND_MERGES: TestFixture = TestFixture {
dag: r#"
T /---------------N--O---\ T
Expand Down