Add/update GUI test for impl indent fix

This commit is contained in:
Guillaume Gomez 2025-04-24 12:31:58 +02:00
parent 7a895bd87a
commit a29072a67a
4 changed files with 44 additions and 2 deletions

View file

@ -11,7 +11,7 @@ assert-property: (".top-doc .docblock table", {"scrollWidth": "1572"})
// Checking it works on other doc blocks as well...
// Logically, the ".docblock" and the "<p>" should have the same scroll width (if we exclude the margin).
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": 816})
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": 835})
assert-property: ("#implementations-list > details .docblock > p", {"scrollWidth": 835})
// However, since there is overflow in the <table>, its scroll width is bigger.
assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1572"})

View file

@ -0,0 +1,16 @@
// Checks the impl block docs have the correct indent.
go-to: "file://" + |DOC_PATH| + "/test_docs/impls_indent/struct.Context.html"
// First we ensure that the impl items are indent (more on the right of the screen) than the
// impl itself.
store-position: ("#impl-Context", {"x": impl_x})
store-position: ("#impl-Context > .item-info", {"x": impl_item_x})
assert: |impl_x| < |impl_item_x|
// And we ensure that all impl items have the same indent.
assert-position: ("#impl-Context > .docblock", {"x": |impl_item_x|})
assert-position: ("#impl-Context + .docblock", {"x": |impl_item_x|})
// Same with the collapsible impl block.
assert-position: ("#impl-Context-1 > .docblock", {"x": |impl_item_x|})
assert-position: (".implementors-toggle > summary + .docblock", {"x": |impl_item_x|})

View file

@ -21,7 +21,7 @@ compare-elements-property: (
)
assert-property: (
"#impl-SimpleTrait-for-LongItemInfo2 .item-info",
{"scrollWidth": "916"},
{"scrollWidth": "935"},
)
// Just to be sure we're comparing the correct "item-info":
assert-text: (

View file

@ -740,3 +740,29 @@ pub mod SidebarSort {
impl Sort for Cell<u8> {}
impl<'a> Sort for &'a str {}
}
pub mod impls_indent {
pub struct Context;
/// Working with objects.
///
/// # Safety
///
/// Functions that take indices of locals do not check bounds on these indices;
/// the caller must ensure that the indices are less than the number of locals
/// in the current stack frame.
impl Context {
}
/// Working with objects.
///
/// # Safety
///
/// Functions that take indices of locals do not check bounds on these indices;
/// the caller must ensure that the indices are less than the number of locals
/// in the current stack frame.
impl Context {
/// bla
pub fn bar() {}
}
}