Commit graph

374 commits

Author SHA1 Message Date
Guillaume Gomez
dbfbf2df54 Remove rustdoc GUI flaky test
(cherry picked from commit 607ac4bb84)
2026-02-06 08:38:33 -08:00
Jonathan Brouwer
322be0cdee Remove the 4 failing tests from rustdoc-gui
(cherry picked from commit bce8c00e2f)
2026-02-06 08:34:18 -08:00
Guillaume Gomez
4bacdf7b8b Reduce rustdoc GUI flakyness, take 2 2026-01-14 22:47:53 +01:00
Guillaume Gomez
62849e6441 Reduce flakyness for tests/rustdoc-gui/notable-trait.goml 2026-01-13 10:22:34 +01:00
Guillaume Gomez
fe307c5452
Rollup merge of #150816 - method-anchor, r=camelid
Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
2026-01-09 12:00:01 +01:00
Guillaume Gomez
945e7c78d2 Use functions more in rustdoc GUI tests 2026-01-08 21:49:29 +01:00
Guillaume Gomez
16fbf6a27b Add check for trait impl method anchor 2026-01-08 21:47:12 +01:00
Guillaume Gomez
bfb117ac74 Clean up tests/rustdoc-gui/anchors.goml test code 2026-01-08 21:47:12 +01:00
Guillaume Gomez
c502d7fce0 Fix trait method anchor disappearing before user can click on it 2026-01-08 21:47:12 +01:00
Guillaume Gomez
665781513e Fix changes coming from browser-ui-test version update 2026-01-02 20:21:44 +01:00
Jonathan Brouwer
71c248a2e1
Rollup merge of #150396 - GuillaumeGomez:fix-line-numbers-hidden, r=lolbinarycat
[rustdoc] If line number setting is disabled, do not make line numbers take space

While working on https://github.com/rust-lang/rust/pull/150395, I realized that when enabled then disabled the "show line numbers" setting, instead of looking like initially:

<img width="904" height="148" alt="Screenshot From 2025-12-26 16-51-44" src="https://github.com/user-attachments/assets/a24df2f2-61be-4db5-b60f-519b35425fd2" />

The "space" taken by line numbers was still there:

<img width="904" height="148" alt="Screenshot From 2025-12-26 16-51-41" src="https://github.com/user-attachments/assets/b44af75d-52a4-4401-98e4-602b16bf6b9b" />

This PR fixes it.

First commit cleans up the `utils.goml` file a bit, I think I'll do more cleanup because switching the settings without reloading the page should make GUI tests a bit faster.

r? `@yotamofek`
2025-12-30 02:07:07 +01:00
Guillaume Gomez
c054e52bc9 Add GUI test for copying code when line numbers are displayed in code examples 2025-12-26 20:24:50 +01:00
Guillaume Gomez
99836fc6d4 Add GUI regression test for disabled line numbers 2025-12-26 20:13:27 +01:00
Guillaume Gomez
3d92872170 Clean up utils.goml file 2025-12-26 17:20:55 +01:00
Guillaume Gomez
13091ddc93 Make implementors list visible only when filled 2025-12-10 16:18:22 +01:00
Guillaume Gomez
985178dacf Add GUI test to ensure that negative impls are correctly sorted 2025-12-10 16:18:22 +01:00
Guillaume Gomez
a21affabf8 Fix invalid link generation for type alias methods 2025-11-24 17:01:32 +01:00
Michael Howell
c9293bfdae rustdoc-search: add test case for throbber 2025-10-07 12:59:58 -07:00
bors
dd091003ac Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, r=GuillaumeGomez,notriddle
If a trait item appears in rustdoc search, hide the corrosponding impl items

fixes rust-lang/rust#138251

cc `@notriddle`
2025-10-03 08:43:43 +00:00
binarycat
2dd00d3391 fix rustdoc tests broke by trait item filtering 2025-10-02 15:28:00 -05:00
Guillaume Gomez
6cccea8731 Remove doc_auto_cfg feature as well 2025-09-27 11:30:57 +02:00
Matthias Krüger
1285b164e1
Rollup merge of #147047 - notriddle:toolbar-index, r=GuillaumeGomez
rustdoc: put the toolbar on the all item index
2025-09-26 06:36:33 +02:00
Michael Howell
51ae86dec9 rustdoc-search: add test case for all/index.html search 2025-09-25 15:45:11 -07:00
León Orell Valerian Liehr
85c193a4ed
rustdoc: hide #[repr(...)] if it isn't part of the public ABI 2025-09-25 11:49:27 +02:00
Guillaume Gomez
b6f8824315 Ensure that --html-after-content option is used to check scrape_examples_ice rustdoc GUI test 2025-09-05 15:13:08 +02:00
Janis
f67e29e5a8
squash fix render_call_locations panic when default span points at file outside of local_sources
add test against crashing with --html-after-content file

correctly add --html-after-content to env not args

formatting fix for rustdoc-call-locations-after-content/rmake.rs

Use local crate source file as default span in `render_call_locations`

- avoids unwrapping the first file added to the source map as a local file in
`href_from_span`

move test to tests/rustdoc-gui, rename to scrape_examples_ice

test link is correct

use rustdocflags, rename path in example, track lock file

factor out duplicate function calls

use compile-flags to make sure the after.html file is actually included in the rustdoc call

fix goml go-to path

increment assert-count in sidebar-source-code.goml

adjust crate-search width in search-result-display.goml

renamed Bar in scrape_examples_ice test

make crate name shorter ..
2025-09-02 01:38:23 +02:00
Guillaume Gomez
75cbd05d19 Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
bors
809200ec95 Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycat
Add support for macro expansion in rustdoc source code pages

This is what it looks like:

![Screenshot From 2025-02-18 18-08-51](https://github.com/user-attachments/assets/ce2b3806-6218-47df-94bf-e9e9ed40cd41)

![image](https://github.com/user-attachments/assets/891042db-8632-4dba-9343-e28570c058fe)

You can test it [here](https://rustdoc.crud.net/imperio/macro-expansion/src/lib/lib.rs.html). In this case, I also enabled the `--generate-link-to-definition` to show that both options work well together.

Note: <del>There is a bug currently in firefox where the line numbers are not displayed correctly if they're inside the "macro expansion" span: https://bugzilla.mozilla.org/show_bug.cgi?id=1949948<del> Found a workaround around this bug.

r? `@notriddle`
2025-08-24 19:46:17 +00:00
Guillaume Gomez
f5fddc776c Improve code and add test with macro coming from another file from the same crate 2025-08-23 10:57:14 +02:00
Guillaume Gomez
b968ef8d19 Make macro expansion feature buttons accessible 2025-08-23 00:57:29 +02:00
Guillaume Gomez
f8b8cc4cce Do macro expansion at AST level rather than HIR 2025-08-23 00:57:29 +02:00
Guillaume Gomez
e6f9e2e623 Add GUI test for --generate-macro-expansion option 2025-08-23 00:57:28 +02:00
Michael Howell
53b775d9c6 rustdoc-search: GUI tests check for // in URL
When this fails, you get output that looks like:

    /home/user/rust/tests/rustdoc-gui/search-result-impl-disambiguation.goml search-result-impl-disambiguation... FAILED
    [ERROR] `tests/rustdoc-gui/utils.goml` around line 49
        from `tests/rustdoc-gui/search-result-impl-disambiguation.goml` line 25: JS errors occurred: Event: Event

Making the error message more informative requires patching browser-ui-test.
2025-08-21 09:24:54 -07:00
Michael Howell
8511e40e72 rustdoc-search: search backend with partitioned suffix tree 2025-08-15 10:26:03 -07:00
Guillaume Gomez
22607491bb Add GUI regression test for tooltips i icons 2025-08-04 19:17:08 +02:00
Guillaume Gomez
b4f404b581 Fix wrong font being used for tooltips i icons 2025-08-04 19:17:08 +02:00
Guillaume Gomez
7c3bddaa74 Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
binarycat
00c104225f rustdoc: make srcIndex no longer a global variable
this is one-time initialization data, it can just
be a function parameter.

we also move the json parsing into createSrcSidebar
to save a few bytes.
2025-06-16 20:22:24 -05:00
Jacob Pratt
045ac21c6f
Rollup merge of #139831 - lolbinarycat:rustdoc-mobile-sidebar, r=GuillaumeGomez
rustdoc: on mobile, make the sidebar full width and linewrap

this is because the mobile sidebar cannot be resized, unlike on desktop.
2025-05-25 04:00:55 +02:00
binarycat
bcca611b35 rustdoc-gui test: apply suggestions from code review 2025-05-23 17:43:19 -05:00
binarycat
1eba1b56e3 rustdoc: rip out all the gui tests for <100% width mobile sidebar
stuff like "clicking the settings menu closes the mobile sidebar"
is now impossible for users to observe, since the mobile sidebar
will always cover the settings menu due to being full-width,
which is good because that behavior is also now impossible for
our testing framework to observe.
2025-05-22 16:44:29 -05:00
Matthias Krüger
981bbf4197
Rollup merge of #140868 - SpecificProtagonist:rustdoc-trait-impl-code-link, r=notriddle
rustdoc: Fix links with inline code in trait impl docs

Fixes #140857
2025-05-22 07:19:01 +02:00
SpecificProtagonist
4516a5b96b
better checks 2025-05-11 08:02:19 +02:00
SpecificProtagonist
b8d55544c5
remove superfluous import 2025-05-11 07:58:18 +02:00
SpecificProtagonist
bd23ee2382
gui test different link 2025-05-10 19:48:13 +02:00
SpecificProtagonist
31ae60d30d
gui test 2025-05-10 19:36:28 +02:00
Michael Howell
3fa98a1507 rustdoc: add a handle that makes sidebar resizing more obvious
This change is based on some discussion on [lolbinarycat's idea],
but with a more "traditional" design. Specifically, this is the
closest thing I could find to a consensus across many systems I
looked at for inspiration:

- In Jira, resizable sidebars have a stack of four dots.
- In The GIMP, resizable sidebars have a stack of three dots.
- In [old Windows], "panes" are defined to have the same border
  style as a window, which has a raised appearance.
- In [NeXT], a drag point usually had an innie, whether the line in a
  slider or the circle in a scroller; I can also hide and show the
  favorites bar in Workspace by dragging on a circular "grip spot"
- In [old Mac], drag handles for things usually had a "grip track"
  of parallel lines.
- [OSX] kept that, but the "Source List" part of the Finder still had
  the circle grip for a time the same way Workspace did

[lolbinarycat's idea]: https://github.com/rust-lang/rust/pull/139420
[old Windows]: https://archive.org/details/windowsinterface00micr/page/n9/mode/2up
[old Mac]: https://archive.org/details/apple-hig/1996_Human_Interface_Guidelines_for_Mac_OS_8_%28WWDC_Release%29/page/16/mode/2up
[NeXT]: https://archive.org/details/apple-hig/1993%20NeXTSTEP%20User%20Interface%20Guidelines%20-%20Release%203/page/145/mode/2up
[OSX]: https://dn721903.ca.archive.org/0/items/apple-hig/MacOSX_HIG_2005_09_08.pdf#page=267
2025-05-09 12:38:00 -07:00
Guillaume Gomez
a92ba60d0f
Rollup merge of #140135 - GuillaumeGomez:sidebars-image, r=rustdoc
Unify sidebar buttons to use the same image

Part of https://github.com/rust-lang/rust/issues/139832.

The source sidebar looks like this with the new image:

![image](https://github.com/user-attachments/assets/df4fee52-fb71-4794-91b7-3afc6d2aab70)

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-images/src/foo/foo.rs.html).

r? `@notriddle`
2025-05-06 14:50:45 +02:00
Guillaume Gomez
a29072a67a Add/update GUI test for impl indent fix 2025-04-24 12:33:29 +02:00
Guillaume Gomez
f7d8558003 Add rustdoc-gui test to ensure sidebars share the same image 2025-04-23 21:34:50 +02:00