Skip to content

Commit a29072a

Browse files
Add/update GUI test for impl indent fix
1 parent 7a895bd commit a29072a

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

tests/rustdoc-gui/docblock-table-overflow.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ assert-property: (".top-doc .docblock table", {"scrollWidth": "1572"})
1111
// Checking it works on other doc blocks as well...
1212

1313
// Logically, the ".docblock" and the "<p>" should have the same scroll width (if we exclude the margin).
14-
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": 816})
14+
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": 835})
1515
assert-property: ("#implementations-list > details .docblock > p", {"scrollWidth": 835})
1616
// However, since there is overflow in the <table>, its scroll width is bigger.
1717
assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1572"})
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Checks the impl block docs have the correct indent.
2+
go-to: "file://" + |DOC_PATH| + "/test_docs/impls_indent/struct.Context.html"
3+
4+
// First we ensure that the impl items are indent (more on the right of the screen) than the
5+
// impl itself.
6+
store-position: ("#impl-Context", {"x": impl_x})
7+
store-position: ("#impl-Context > .item-info", {"x": impl_item_x})
8+
assert: |impl_x| < |impl_item_x|
9+
10+
// And we ensure that all impl items have the same indent.
11+
assert-position: ("#impl-Context > .docblock", {"x": |impl_item_x|})
12+
assert-position: ("#impl-Context + .docblock", {"x": |impl_item_x|})
13+
14+
// Same with the collapsible impl block.
15+
assert-position: ("#impl-Context-1 > .docblock", {"x": |impl_item_x|})
16+
assert-position: (".implementors-toggle > summary + .docblock", {"x": |impl_item_x|})

tests/rustdoc-gui/item-info-overflow.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ compare-elements-property: (
2121
)
2222
assert-property: (
2323
"#impl-SimpleTrait-for-LongItemInfo2 .item-info",
24-
{"scrollWidth": "916"},
24+
{"scrollWidth": "935"},
2525
)
2626
// Just to be sure we're comparing the correct "item-info":
2727
assert-text: (

tests/rustdoc-gui/src/test_docs/lib.rs

+26
Original file line numberDiff line numberDiff line change
@@ -740,3 +740,29 @@ pub mod SidebarSort {
740740
impl Sort for Cell<u8> {}
741741
impl<'a> Sort for &'a str {}
742742
}
743+
744+
pub mod impls_indent {
745+
pub struct Context;
746+
747+
/// Working with objects.
748+
///
749+
/// # Safety
750+
///
751+
/// Functions that take indices of locals do not check bounds on these indices;
752+
/// the caller must ensure that the indices are less than the number of locals
753+
/// in the current stack frame.
754+
impl Context {
755+
}
756+
757+
/// Working with objects.
758+
///
759+
/// # Safety
760+
///
761+
/// Functions that take indices of locals do not check bounds on these indices;
762+
/// the caller must ensure that the indices are less than the number of locals
763+
/// in the current stack frame.
764+
impl Context {
765+
/// bla
766+
pub fn bar() {}
767+
}
768+
}

0 commit comments

Comments
 (0)