From f8dddb2a55ffac76325d58f1834dd4512dba0b7c Mon Sep 17 00:00:00 2001 From: FredApps Date: Thu, 19 Nov 2026 09:23:28 +0100 Subject: [PATCH] Split UI test kit from story suite --- crates/automation/Cargo.toml | 3 +- crates/automation/src/lib.rs | 1 + crates/automation/src/ui/actions/mod.rs | 2 +- crates/automation/src/ui/agents/mod.rs | 2 +- crates/browse/Cargo.toml | 3 +- crates/browse/src/ui/bin/mod.rs | 2 +- crates/browse/src/ui/compare/mod.rs | 2 +- crates/browse/src/ui/freebin/mod.rs | 2 +- crates/browse/src/ui/mod.rs | 1 + crates/browse/src/ui/places/mod.rs | 2 +- crates/browse/src/ui/relink/mod.rs | 2 +- crates/color-ui/Cargo.toml | 3 +- crates/color-ui/src/ui/area.rs | 2 +- crates/color-ui/src/ui/choice.rs | 2 +- crates/color-ui/src/ui/compare.rs | 2 +- crates/color-ui/src/ui/disc.rs | 2 +- crates/color-ui/src/ui/droppers.rs | 2 +- crates/color-ui/src/ui/eyedropper.rs | 2 +- crates/color-ui/src/ui/gradient/editor.rs | 2 +- crates/color-ui/src/ui/harmony.rs | 2 +- crates/color-ui/src/ui/hud.rs | 2 +- crates/color-ui/src/ui/info.rs | 2 +- crates/color-ui/src/ui/lut_picker.rs | 2 +- crates/color-ui/src/ui/paint_chip.rs | 2 +- crates/color-ui/src/ui/pair.rs | 2 +- crates/color-ui/src/ui/palette.rs | 2 +- crates/color-ui/src/ui/panel.rs | 2 +- crates/color-ui/src/ui/picker/mod.rs | 2 +- crates/color-ui/src/ui/popover.rs | 2 +- crates/color-ui/src/ui/profile_prompts.rs | 2 +- crates/color-ui/src/ui/ramp.rs | 2 +- crates/color-ui/src/ui/readout.rs | 2 +- crates/color-ui/src/ui/samplers.rs | 2 +- crates/color-ui/src/ui/screen_picker.rs | 2 +- crates/color-ui/src/ui/strip.rs | 2 +- crates/color-ui/src/ui/swatches.rs | 2 +- crates/color-ui/src/ui/testing.rs | 1 + crates/color-ui/src/ui/warning.rs | 2 +- crates/color-ui/src/ui/wheel.rs | 2 +- crates/craft/Cargo.toml | 1 + crates/dialogs/Cargo.toml | 3 +- crates/dialogs/src/lib.rs | 1 + crates/dialogs/src/ui/mod.rs | 2 +- crates/draw/Cargo.toml | 3 +- crates/draw/src/lib.rs | 1 + crates/draw/src/ui/add_beside/mod.rs | 2 +- crates/draw/src/ui/artboard/mod.rs | 2 +- crates/draw/src/ui/brush_presets/mod.rs | 2 +- crates/draw/src/ui/brush_settings/mod.rs | 2 +- crates/draw/src/ui/connector/mod.rs | 2 +- crates/draw/src/ui/corner/mod.rs | 2 +- crates/draw/src/ui/crop/bar.rs | 2 +- crates/draw/src/ui/crop/perspective_bar.rs | 2 +- crates/draw/src/ui/crop/perspective_crop.rs | 2 +- crates/draw/src/ui/crop/tool.rs | 2 +- crates/draw/src/ui/gradient/fill_editor.rs | 2 +- .../src/ui/gradient/gradient_overlay/mod.rs | 2 +- crates/draw/src/ui/gradient/map/mod.rs | 2 +- crates/draw/src/ui/gradient/palette/mod.rs | 2 +- crates/draw/src/ui/gradient/swatch.rs | 2 +- crates/draw/src/ui/measure/mod.rs | 2 +- crates/draw/src/ui/paint_bar.rs | 2 +- crates/draw/src/ui/paths/mod.rs | 2 +- crates/draw/src/ui/pattern/mod.rs | 2 +- crates/draw/src/ui/pen/bezier/mod.rs | 2 +- crates/draw/src/ui/pen/mod.rs | 2 +- crates/draw/src/ui/picture_fill/mod.rs | 2 +- crates/draw/src/ui/shape/mod.rs | 2 +- crates/draw/src/ui/shape_presets.rs | 2 +- crates/draw/src/ui/slice/mod.rs | 2 +- crates/draw/src/ui/stroke/mod.rs | 2 +- crates/draw/src/ui/symmetry/mod.rs | 2 +- crates/draw/src/ui/transform/session_bar.rs | 2 +- .../draw/src/ui/transform/session_overlay.rs | 2 +- crates/draw/src/ui/transform/transform_box.rs | 2 +- .../draw/src/ui/transform/transform_fields.rs | 2 +- crates/feature-root/Cargo.toml | 34 ++++++++-------- crates/font-manager/Cargo.toml | 5 ++- crates/font-manager/src/axes/sliders.rs | 2 +- crates/font-manager/src/glyphs.rs | 2 +- crates/font-manager/src/lib.rs | 1 + crates/font-manager/src/missing.rs | 2 +- crates/font-manager/src/panel/app.rs | 2 +- crates/font-manager/src/panel/browse.rs | 2 +- crates/font-manager/src/panel/details.rs | 2 +- crates/font-manager/src/panel/sources.rs | 2 +- crates/font-manager/src/panel/specimen.rs | 2 +- crates/font-manager/src/picker.rs | 2 +- crates/imaging/Cargo.toml | 3 +- crates/imaging/src/lib.rs | 1 + crates/imaging/src/ui/adjust/basic.rs | 2 +- crates/imaging/src/ui/adjust/curves_panel.rs | 2 +- .../imaging/src/ui/adjust/hue_saturation.rs | 2 +- crates/imaging/src/ui/adjust/levels_editor.rs | 2 +- crates/imaging/src/ui/adjust/levels_panel.rs | 2 +- crates/imaging/src/ui/adjust/mixers.rs | 2 +- crates/imaging/src/ui/adjust/panel.rs | 2 +- crates/imaging/src/ui/adjust/session.rs | 2 +- crates/imaging/src/ui/adjust/sliders.rs | 2 +- crates/imaging/src/ui/adjust/tone.rs | 2 +- crates/imaging/src/ui/blur_pins/mod.rs | 2 +- crates/imaging/src/ui/channels/mod.rs | 2 +- crates/imaging/src/ui/color_range/mod.rs | 2 +- crates/imaging/src/ui/curve/mod.rs | 2 +- crates/imaging/src/ui/fill/mod.rs | 2 +- crates/imaging/src/ui/filter_gallery/mod.rs | 2 +- crates/imaging/src/ui/histogram/mod.rs | 2 +- .../src/ui/layer_style/blend_if/mod.rs | 2 +- .../imaging/src/ui/layer_style/contour/mod.rs | 2 +- crates/imaging/src/ui/layer_style/mod.rs | 2 +- crates/imaging/src/ui/liquify/mod.rs | 2 +- crates/imaging/src/ui/mask_view/mod.rs | 2 +- crates/imaging/src/ui/raw_develop/mod.rs | 2 +- crates/imaging/src/ui/scopes/mod.rs | 2 +- crates/imaging/src/ui/select/mod.rs | 2 +- crates/imaging/src/ui/select_mask/mod.rs | 2 +- crates/imaging/src/ui/selection/mod.rs | 2 +- .../imaging/src/ui/transform_preview/mod.rs | 2 +- crates/imaging/src/ui/vanishing_point/mod.rs | 2 +- crates/imaging/src/ui/warp/cylinder.rs | 2 +- crates/imaging/src/ui/warp/mod.rs | 2 +- crates/imaging/src/ui/warp/perspective/mod.rs | 2 +- crates/imaging/src/ui/warp/pin/mod.rs | 2 +- crates/imaging/src/ui/wide_angle/mod.rs | 2 +- crates/layers/Cargo.toml | 5 ++- crates/layers/src/lib.rs | 2 + crates/layers/src/ui/comps/mod.rs | 2 +- crates/layers/src/ui/filter/mod.rs | 2 +- crates/layers/src/ui/options/mod.rs | 2 +- crates/layers/src/ui/panel/mod.rs | 2 +- crates/layers/src/ui/rows/mod.rs | 2 +- crates/menu/Cargo.toml | 3 +- crates/menu/src/bar.rs | 2 +- crates/menu/src/lib.rs | 1 + crates/menu/src/shortcuts/mod.rs | 2 +- crates/menu/src/shortcuts/recorder.rs | 2 +- crates/menu/src/shortcuts/view.rs | 2 +- crates/pages/Cargo.toml | 3 +- crates/pages/src/lib.rs | 1 + crates/pages/src/ui/column_bar.rs | 2 +- crates/pages/src/ui/grid.rs | 2 +- crates/pages/src/ui/header_footer.rs | 2 +- crates/pages/src/ui/list.rs | 2 +- crates/pages/src/ui/margins.rs | 2 +- crates/pages/src/ui/marks.rs | 2 +- crates/pages/src/ui/preview.rs | 2 +- crates/pages/src/ui/range.rs | 2 +- crates/pages/src/ui/reading.rs | 2 +- crates/pages/src/ui/setup.rs | 2 +- crates/pages/src/ui/table/mod.rs | 2 +- crates/pages/src/ui/text_selection.rs | 2 +- crates/pages/src/ui/thumbnails.rs | 2 +- crates/pages/src/ui/view.rs | 2 +- crates/print/Cargo.toml | 3 +- crates/print/src/lib.rs | 1 + crates/print/src/ui/mod.rs | 2 +- crates/review/Cargo.toml | 3 +- crates/review/src/lib.rs | 1 + crates/review/src/ui/annotate.rs | 2 +- crates/review/src/ui/avatar.rs | 2 +- crates/review/src/ui/chat.rs | 2 +- crates/review/src/ui/comments.rs | 2 +- crates/review/src/ui/join.rs | 2 +- crates/review/src/ui/presence.rs | 2 +- crates/review/src/ui/revisions.rs | 2 +- crates/review/src/ui/signature.rs | 2 +- crates/review/src/ui/thread.rs | 2 +- crates/review/src/ui/versions.rs | 2 +- crates/review/src/ui/vote.rs | 2 +- crates/table/Cargo.toml | 5 ++- crates/table/src/ui/chart.rs | 2 +- crates/table/src/ui/conditions.rs | 2 +- crates/table/src/ui/error_tag.rs | 2 +- crates/table/src/ui/fields.rs | 2 +- crates/table/src/ui/filter.rs | 2 +- crates/table/src/ui/grid.rs | 2 +- crates/table/src/ui/mod.rs | 1 + crates/table/src/ui/outline.rs | 2 +- crates/table/src/ui/slicer.rs | 2 +- crates/table/src/ui/stats.rs | 2 +- crates/text/Cargo.toml | 3 +- crates/text/src/lib.rs | 1 + crates/text/src/ui/character.rs | 2 +- crates/text/src/ui/character/style_options.rs | 2 +- crates/text/src/ui/columns.rs | 2 +- crates/text/src/ui/editor.rs | 2 +- crates/text/src/ui/find.rs | 2 +- crates/text/src/ui/hyperlink.rs | 2 +- crates/text/src/ui/notes.rs | 2 +- crates/text/src/ui/path_text.rs | 2 +- crates/text/src/ui/ruler.rs | 2 +- crates/text/src/ui/spelling.rs | 2 +- crates/text/src/ui/style_panel.rs | 2 +- crates/text/src/ui/tabs_dialog.rs | 2 +- crates/text/src/ui/type_bar.rs | 2 +- crates/theme-editor/Cargo.toml | 3 +- crates/theme-editor/src/lib.rs | 3 +- crates/theme-store/Cargo.toml | 3 +- crates/theme-store/src/ui/mod.rs | 3 +- crates/timeline/Cargo.toml | 3 +- crates/timeline/src/lib.rs | 1 + crates/timeline/src/ui/graph.rs | 2 +- crates/timeline/src/ui/keyframes.rs | 2 +- crates/timeline/src/ui/markers.rs | 2 +- crates/timeline/src/ui/overview.rs | 2 +- crates/timeline/src/ui/panel.rs | 2 +- crates/timeline/src/ui/preview.rs | 2 +- crates/timeline/src/ui/render_queue.rs | 2 +- crates/timeline/src/ui/ruler.rs | 2 +- crates/timeline/src/ui/stack.rs | 2 +- crates/timeline/src/ui/timecode.rs | 2 +- crates/timeline/src/ui/transport.rs | 2 +- crates/timeline/src/ui/view.rs | 2 +- crates/ui-canvas/Cargo.toml | 3 +- crates/ui-canvas/src/canvas/crop/mod.rs | 2 +- crates/ui-canvas/src/canvas/full_window.rs | 4 +- .../ui-canvas/src/canvas/full_window_parts.rs | 2 +- crates/ui-canvas/src/canvas/mod.rs | 2 +- crates/ui-canvas/src/canvas/navigate/mod.rs | 2 +- crates/ui-canvas/src/canvas/navigator/mod.rs | 2 +- .../ui-canvas/src/canvas/navigator_panel.rs | 2 +- crates/ui-canvas/src/canvas/pasteboard/mod.rs | 2 +- crates/ui-canvas/src/canvas/raster/mod.rs | 2 +- crates/ui-canvas/src/canvas/rulers/mod.rs | 2 +- crates/ui-canvas/src/canvas/scrollbars/mod.rs | 2 +- crates/ui-canvas/src/canvas/split/mod.rs | 2 +- .../src/canvas_controls/brush/mod.rs | 2 +- .../ui-canvas/src/canvas_controls/grid/mod.rs | 2 +- .../src/canvas_controls/guides/mod.rs | 2 +- .../src/canvas_controls/marquee/mod.rs | 2 +- .../src/canvas_controls/outline/mod.rs | 2 +- .../src/canvas_controls/pixel_grid/mod.rs | 2 +- .../src/canvas_controls/smart_guides/mod.rs | 2 +- .../ui-canvas/src/canvas_controls/task_bar.rs | 2 +- crates/ui-canvas/src/lib.rs | 3 +- crates/ui-contract/Cargo.toml | 10 ++--- crates/ui-contract/src/contract/body.rs | 2 +- crates/ui-contract/src/contract/mod.rs | 10 ++--- crates/ui-contract/src/contract/registry.rs | 18 ++++----- crates/ui-contract/src/runtime/egui/access.rs | 2 +- crates/ui-contract/src/runtime/egui/areas.rs | 6 +-- .../ui-contract/src/runtime/egui/fixture.rs | 9 +++++ .../ui-contract/src/runtime/egui/widgets.rs | 10 +++-- crates/ui-contract/src/runtime/keys.rs | 2 +- .../ui-contract/src/runtime/keys/intents.rs | 2 +- crates/ui-contract/src/runtime/overlay.rs | 2 +- crates/ui-contract/src/runtime/pointer.rs | 4 +- crates/ui-contract/src/testing/mod.rs | 16 +++++++- crates/ui-contract/src/testing/story.rs | 4 ++ crates/ui-gallery/Cargo.toml | 40 +++++++++---------- crates/ui-macros/src/component.rs | 8 ++-- crates/ui-macros/src/lib.rs | 6 +++ crates/ui-macros/src/tests.rs | 8 ++-- crates/ui-panels/Cargo.toml | 3 +- crates/ui-panels/src/dialog/mod.rs | 4 +- crates/ui-panels/src/dialog/prompt.rs | 2 +- crates/ui-panels/src/docking/dock_column.rs | 2 +- crates/ui-panels/src/docking/floating.rs | 2 +- crates/ui-panels/src/docking/iconic.rs | 4 +- crates/ui-panels/src/docking/mod.rs | 2 +- crates/ui-panels/src/docking/root.rs | 2 +- crates/ui-panels/src/lib.rs | 3 +- crates/ui-panels/src/rails/drawer.rs | 2 +- crates/ui-panels/src/rails/flyout.rs | 2 +- crates/ui-panels/src/rails/tool.rs | 4 +- crates/ui-panels/src/sections/footer.rs | 2 +- crates/ui-panels/src/sections/group_box.rs | 2 +- crates/ui-panels/src/sections/mod.rs | 2 +- crates/ui-panels/src/sections/panel.rs | 2 +- crates/ui-panels/src/sections/reorderable.rs | 2 +- crates/ui-panels/src/sections/section.rs | 2 +- crates/ui-panels/src/sections/stack.rs | 2 +- crates/ui-panels/src/sections/title_row.rs | 2 +- crates/ui-patterns/Cargo.toml | 3 +- crates/ui-patterns/src/lib.rs | 3 +- crates/ui-patterns/src/patterns/dock/area.rs | 2 +- crates/ui-patterns/src/patterns/dock/panes.rs | 2 +- .../ui-patterns/src/patterns/dock/switcher.rs | 2 +- .../src/patterns/dock/workspace_dialogs.rs | 2 +- .../src/patterns/form_dialogs/about.rs | 2 +- .../src/patterns/form_dialogs/dialog.rs | 2 +- .../src/patterns/form_dialogs/export.rs | 2 +- .../src/patterns/form_dialogs/file_list.rs | 2 +- .../src/patterns/form_dialogs/form.rs | 2 +- .../src/patterns/form_dialogs/guides.rs | 4 +- .../src/patterns/form_dialogs/list_manager.rs | 2 +- .../form_dialogs/navigator_options.rs | 2 +- .../src/patterns/form_dialogs/new_document.rs | 2 +- .../src/patterns/form_dialogs/password.rs | 2 +- .../src/patterns/form_dialogs/path_row.rs | 2 +- .../src/patterns/form_dialogs/pdf_export.rs | 2 +- .../src/patterns/form_dialogs/preview.rs | 2 +- .../src/patterns/form_dialogs/properties.rs | 2 +- .../src/patterns/form_dialogs/report.rs | 2 +- .../src/patterns/form_dialogs/rows.rs | 2 +- .../src/patterns/form_dialogs/save_for_web.rs | 2 +- .../src/patterns/form_dialogs/sizing.rs | 2 +- .../src/patterns/form_dialogs/watermark.rs | 2 +- .../src/patterns/panels/history.rs | 2 +- .../src/patterns/panels/inspector.rs | 2 +- .../src/patterns/panels/modifier_keys.rs | 2 +- .../src/patterns/panels/palette.rs | 2 +- .../ui-patterns/src/patterns/panels/tour.rs | 2 +- .../src/patterns/preferences/path_setting.rs | 2 +- .../src/patterns/preferences/window.rs | 2 +- .../src/patterns/presets/browser.rs | 2 +- .../src/patterns/presets/footer.rs | 2 +- .../src/patterns/presets/manager.rs | 2 +- .../ui-patterns/src/patterns/presets/named.rs | 2 +- .../src/patterns/presets/picker.rs | 2 +- crates/ui-shell/Cargo.toml | 3 +- crates/ui-shell/src/lib.rs | 3 +- crates/ui-shell/src/shell/app_shell.rs | 2 +- crates/ui-shell/src/shell/canvas_shell.rs | 2 +- crates/ui-shell/src/shell/caption_button.rs | 2 +- crates/ui-shell/src/shell/document_window.rs | 2 +- crates/ui-shell/src/shell/opening.rs | 2 +- .../ui-shell/src/shell/screen_mode_button.rs | 2 +- crates/ui-shell/src/shell/start.rs | 2 +- crates/ui-shell/src/shell/title_bar/bar.rs | 2 +- crates/ui-shell/src/shell/viewport_window.rs | 2 +- crates/ui-widgets/Cargo.toml | 3 +- crates/ui-widgets/src/bars/align.rs | 2 +- crates/ui-widgets/src/bars/breadcrumb.rs | 2 +- .../ui-widgets/src/bars/constraint_fields.rs | 2 +- crates/ui-widgets/src/bars/mod.rs | 2 +- crates/ui-widgets/src/bars/status_readout.rs | 2 +- crates/ui-widgets/src/buttons/mod.rs | 2 +- crates/ui-widgets/src/choice/check.rs | 2 +- crates/ui-widgets/src/choice/radio.rs | 2 +- crates/ui-widgets/src/choice/rating.rs | 2 +- crates/ui-widgets/src/choice/segmented.rs | 2 +- crates/ui-widgets/src/choice/swatch.rs | 2 +- crates/ui-widgets/src/choice/swatch_table.rs | 2 +- crates/ui-widgets/src/choice/switch.rs | 2 +- crates/ui-widgets/src/controls/mod.rs | 2 +- crates/ui-widgets/src/display/badge.rs | 2 +- crates/ui-widgets/src/display/divider.rs | 2 +- crates/ui-widgets/src/display/icon.rs | 2 +- .../ui-widgets/src/display/inspect_overlay.rs | 2 +- crates/ui-widgets/src/display/kbd.rs | 2 +- crates/ui-widgets/src/display/picture.rs | 2 +- crates/ui-widgets/src/display/progress.rs | 2 +- crates/ui-widgets/src/display/spinner.rs | 2 +- crates/ui-widgets/src/display/target_mark.rs | 2 +- crates/ui-widgets/src/display/text.rs | 2 +- crates/ui-widgets/src/form/mod.rs | 2 +- crates/ui-widgets/src/form/slider_field.rs | 2 +- crates/ui-widgets/src/graph/mod.rs | 2 +- .../ui-widgets/src/layout_components/mod.rs | 2 +- crates/ui-widgets/src/lib.rs | 4 +- crates/ui-widgets/src/list/mod.rs | 4 +- crates/ui-widgets/src/menu/bar.rs | 2 +- crates/ui-widgets/src/menu/mod.rs | 2 +- crates/ui-widgets/src/notices/mod.rs | 2 +- crates/ui-widgets/src/pickers/combo_box.rs | 2 +- crates/ui-widgets/src/pickers/date.rs | 2 +- crates/ui-widgets/src/pickers/face.rs | 2 +- crates/ui-widgets/src/pickers/icon_picker.rs | 2 +- .../ui-widgets/src/pickers/reference_point.rs | 2 +- crates/ui-widgets/src/pickers/select.rs | 2 +- crates/ui-widgets/src/pickers/tree_picker.rs | 2 +- crates/ui-widgets/src/pickers/unit_select.rs | 2 +- crates/ui-widgets/src/popover/anchored.rs | 2 +- crates/ui-widgets/src/popover/drop_veil.rs | 2 +- crates/ui-widgets/src/popover/popup_list.rs | 2 +- crates/ui-widgets/src/table/metadata.rs | 2 +- crates/ui-widgets/src/table/mod.rs | 2 +- crates/ui-widgets/src/tabs/document.rs | 2 +- crates/ui-widgets/src/tabs/strip.rs | 2 +- crates/ui-widgets/src/tabs/tab.rs | 2 +- crates/ui-widgets/src/text/alt_text.rs | 2 +- crates/ui-widgets/src/text/chips.rs | 2 +- crates/ui-widgets/src/text/hex.rs | 2 +- crates/ui-widgets/src/text/linked.rs | 2 +- crates/ui-widgets/src/text/number.rs | 2 +- crates/ui-widgets/src/text/selectable_text.rs | 2 +- crates/ui-widgets/src/text/text_field.rs | 2 +- crates/ui-widgets/src/text/zoom_field.rs | 2 +- crates/ui-widgets/src/tile_grid/grid.rs | 2 +- crates/ui-widgets/src/tile_grid/mod.rs | 2 +- .../ui-widgets/src/value_drag/angle_dial.rs | 2 +- .../ui-widgets/src/value_drag/point_picker.rs | 2 +- .../ui-widgets/src/value_drag/range_slider.rs | 2 +- crates/ui-widgets/src/value_drag/slider.rs | 2 +- crates/ui-widgets/src/value_drag/thumb_row.rs | 2 +- crates/ui/Cargo.toml | 3 +- crates/ui/src/lib.rs | 4 ++ crates/update/Cargo.toml | 3 +- crates/update/src/lib.rs | 1 + crates/update/src/stack_dialogs.rs | 2 +- docs/development.md | 4 +- tools/cl | 6 ++- 393 files changed, 538 insertions(+), 445 deletions(-) diff --git a/crates/automation/Cargo.toml b/crates/automation/Cargo.toml index f82a4c14fe..5a2b801d5d 100644 --- a/crates/automation/Cargo.toml +++ b/crates/automation/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The egui parts: the Actions panel, the control channel's server side (screenshots, synthetic # input) and `ui` stories. Without it the crate has no egui: `ControlOptions`, `ControlClient`, @@ -55,5 +56,5 @@ thiserror = { workspace = true } [dev-dependencies] tempfile = "3" -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } diff --git a/crates/automation/src/lib.rs b/crates/automation/src/lib.rs index 52e967eade..7757692dfc 100644 --- a/crates/automation/src/lib.rs +++ b/crates/automation/src/lib.rs @@ -57,6 +57,7 @@ pub use security::AutomationError; /// The trials this crate registers, for its integration binary. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/automation/src/ui/actions/mod.rs b/crates/automation/src/ui/actions/mod.rs index 2b9ed43044..390a60cec3 100644 --- a/crates/automation/src/ui/actions/mod.rs +++ b/crates/automation/src/ui/actions/mod.rs @@ -17,7 +17,7 @@ pub mod mock; mod panel; mod prompt; mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/automation/src/ui/agents/mod.rs b/crates/automation/src/ui/agents/mod.rs index 01b5a91159..39fd04c670 100644 --- a/crates/automation/src/ui/agents/mod.rs +++ b/crates/automation/src/ui/agents/mod.rs @@ -1,6 +1,6 @@ //! `AgentsPage`: the Agents page of Preferences, over the agent settings in the Preferences draft. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/browse/Cargo.toml b/crates/browse/Cargo.toml index b30cf10b31..177c2a836e 100644 --- a/crates/browse/Cargo.toml +++ b/crates/browse/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The browsing widgets (`craft_browse::ui`) and `FileThumbSource`. ui = ["dep:craft-behavior", "dep:craft-ui", "dep:egui", "dep:kurbo"] @@ -37,6 +38,6 @@ kurbo = { workspace = true, optional = true } serde = { workspace = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } tempfile = "3" diff --git a/crates/browse/src/ui/bin/mod.rs b/crates/browse/src/ui/bin/mod.rs index 2e775e2439..de3efdcbcc 100644 --- a/crates/browse/src/ui/bin/mod.rs +++ b/crates/browse/src/ui/bin/mod.rs @@ -23,7 +23,7 @@ mod free_view; mod icon; mod list; mod search; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::cell::RefCell; diff --git a/crates/browse/src/ui/compare/mod.rs b/crates/browse/src/ui/compare/mod.rs index 0d4d83f22b..2cad582942 100644 --- a/crates/browse/src/ui/compare/mod.rs +++ b/crates/browse/src/ui/compare/mod.rs @@ -14,7 +14,7 @@ mod arrange; mod caption; mod pill; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod style; mod tile; diff --git a/crates/browse/src/ui/freebin/mod.rs b/crates/browse/src/ui/freebin/mod.rs index 9f922f85ee..341116b98d 100644 --- a/crates/browse/src/ui/freebin/mod.rs +++ b/crates/browse/src/ui/freebin/mod.rs @@ -5,7 +5,7 @@ //! End, the marquee, the move gesture, rename, delete and the context menu. `FreeBin` adds the placement and turns the //! move gesture into the cards' new positions. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::cell::RefCell; diff --git a/crates/browse/src/ui/mod.rs b/crates/browse/src/ui/mod.rs index bb6c5d2cbc..910e7d8bc0 100644 --- a/crates/browse/src/ui/mod.rs +++ b/crates/browse/src/ui/mod.rs @@ -21,5 +21,6 @@ pub use relink::{LinkList, LinkListWords, RelinkDialog, RelinkWords, StatusBadge /// The stories and trials this crate registers for the integration binary. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/browse/src/ui/places/mod.rs b/crates/browse/src/ui/places/mod.rs index b129fd3515..f6ebde7d29 100644 --- a/crates/browse/src/ui/places/mod.rs +++ b/crates/browse/src/ui/places/mod.rs @@ -15,7 +15,7 @@ //! } //! ``` -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::path::{Path, PathBuf}; diff --git a/crates/browse/src/ui/relink/mod.rs b/crates/browse/src/ui/relink/mod.rs index 9973ea727b..1816678b91 100644 --- a/crates/browse/src/ui/relink/mod.rs +++ b/crates/browse/src/ui/relink/mod.rs @@ -18,7 +18,7 @@ mod badge; mod dialog; mod list; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use badge::StatusBadge; diff --git a/crates/color-ui/Cargo.toml b/crates/color-ui/Cargo.toml index f7f775023b..d6cbb1c107 100644 --- a/crates/color-ui/Cargo.toml +++ b/crates/color-ui/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The colour widgets (`craft_color_ui::ui`). ui = ["dep:craft-behavior", "dep:craft-keymap", "dep:craft-ui", "dep:egui", "dep:craft-settings", "dep:craft-window", "craft-platform/screen", "dep:serde_json"] @@ -39,7 +40,7 @@ serde = { workspace = true } serde_json = { workspace = true, optional = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] diff --git a/crates/color-ui/src/ui/area.rs b/crates/color-ui/src/ui/area.rs index 0f3fe324bc..d151bcf571 100644 --- a/crates/color-ui/src/ui/area.rs +++ b/crates/color-ui/src/ui/area.rs @@ -13,7 +13,7 @@ use craft_ui::style::{ComponentStyle, StyleCx}; use craft_ui::value_drag::{PointMark, PointPicker}; use egui::{Mesh, Pos2, Rect, Vec2, pos2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// Vertices along each side of the area's colour mesh (PhotoCraft's 32). diff --git a/crates/color-ui/src/ui/choice.rs b/crates/color-ui/src/ui/choice.rs index cc60252436..17ec7be7bf 100644 --- a/crates/color-ui/src/ui/choice.rs +++ b/crates/color-ui/src/ui/choice.rs @@ -1,7 +1,7 @@ //! `ColorChoice`: a choice among named colours with a custom colour, as Photoshop's pasteboard colour //! (Preferences, Interface), the Crop shield colour and the Note colour. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_theme::Srgba; diff --git a/crates/color-ui/src/ui/compare.rs b/crates/color-ui/src/ui/compare.rs index de84255b3c..9edb518b9c 100644 --- a/crates/color-ui/src/ui/compare.rs +++ b/crates/color-ui/src/ui/compare.rs @@ -12,7 +12,7 @@ use egui::{CornerRadius, Rect, Response, Vec2, pos2}; use super::picker::ColorPickerWords; use super::warning::{ColorWarning, ColorWarningChip}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a compare block: the size of the block and of each half, the edge round it and the gap between a diff --git a/crates/color-ui/src/ui/disc.rs b/crates/color-ui/src/ui/disc.rs index 1f3cc430cd..dab85370f6 100644 --- a/crates/color-ui/src/ui/disc.rs +++ b/crates/color-ui/src/ui/disc.rs @@ -16,7 +16,7 @@ use craft_ui::runtime::focus::{ActivateKeys, FocusShape, KeepKeys, KeyUse}; use craft_ui::style::{ComponentStyle, FocusLook, MarkerLook, StyleColor, StyleCx}; use egui::{Color32, Mesh, Pos2, Response, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The disc: a press on it grabs the nearest marker within reach. diff --git a/crates/color-ui/src/ui/droppers.rs b/crates/color-ui/src/ui/droppers.rs index 1e74fa220d..8d5c4fe67d 100644 --- a/crates/color-ui/src/ui/droppers.rs +++ b/crates/color-ui/src/ui/droppers.rs @@ -31,7 +31,7 @@ use craft_ui::runtime::env::Label; use craft_ui::runtime::requests::EyedropperRequest; use egui::{Pos2, Response, Ui, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The pipette icon's tip, in the icon's own 24-unit box. diff --git a/crates/color-ui/src/ui/eyedropper.rs b/crates/color-ui/src/ui/eyedropper.rs index a094917b45..5670cf4aa0 100644 --- a/crates/color-ui/src/ui/eyedropper.rs +++ b/crates/color-ui/src/ui/eyedropper.rs @@ -35,7 +35,7 @@ use craft_ui::runtime::env::{Env, Label}; use craft_ui::style::DataColor; use egui::{Color32, Pos2, Response, Ui, Vec2, vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/color-ui/src/ui/gradient/editor.rs b/crates/color-ui/src/ui/gradient/editor.rs index fc92f39787..7a83ebd9d3 100644 --- a/crates/color-ui/src/ui/gradient/editor.rs +++ b/crates/color-ui/src/ui/gradient/editor.rs @@ -17,7 +17,7 @@ use crate::gradient::{GradientStops, Sampler, StopRules}; mod bar; mod fields; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use bar::GradientBar; diff --git a/crates/color-ui/src/ui/harmony.rs b/crates/color-ui/src/ui/harmony.rs index 9fbe067036..807ba048da 100644 --- a/crates/color-ui/src/ui/harmony.rs +++ b/crates/color-ui/src/ui/harmony.rs @@ -19,7 +19,7 @@ use super::picker::{ChannelRow, ChannelRule}; use crate::harmony::{Guide, GuideOptions, Harmony, Variation}; use craft_ui::choice::{SwatchTable, SwatchTableOutput}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/color-ui/src/ui/hud.rs b/crates/color-ui/src/ui/hud.rs index 412c62ea01..f9b6ecc604 100644 --- a/crates/color-ui/src/ui/hud.rs +++ b/crates/color-ui/src/ui/hud.rs @@ -17,7 +17,7 @@ use craft_ui::runtime::pointer; use craft_ui::style::{ComponentStyle, StyleCx, UiTokens}; use egui::{Pos2, Rect, Response, Ui, Vec2, pos2, vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The model the HUD picks in: saturation and brightness across and down, hue in the strip. diff --git a/crates/color-ui/src/ui/info.rs b/crates/color-ui/src/ui/info.rs index 46238e585b..cb192b03b4 100644 --- a/crates/color-ui/src/ui/info.rs +++ b/crates/color-ui/src/ui/info.rs @@ -13,7 +13,7 @@ use egui::{Response, Ui}; use super::SamplerReadout; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// What a missing value shows. diff --git a/crates/color-ui/src/ui/lut_picker.rs b/crates/color-ui/src/ui/lut_picker.rs index 8c2609d36a..bb40074c70 100644 --- a/crates/color-ui/src/ui/lut_picker.rs +++ b/crates/color-ui/src/ui/lut_picker.rs @@ -19,7 +19,7 @@ use craft_ui::runtime::env::Label; use craft_ui::style::{ComponentStyle, StyleCx}; use egui::{Response, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/color-ui/src/ui/paint_chip.rs b/crates/color-ui/src/ui/paint_chip.rs index 098395b957..55c42cc6bc 100644 --- a/crates/color-ui/src/ui/paint_chip.rs +++ b/crates/color-ui/src/ui/paint_chip.rs @@ -34,7 +34,7 @@ use super::{PickedColor, ScreenPickGesture, SwatchKey, SwatchPalette, SwatchesWo use crate::palette::{SwatchColor, SwatchGroup}; mod paint_list; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use paint_list::{PaintLink, PaintLinkKind, PaintList, PaintListEvent, PaintListOptions, PaintListOutput, PaintRow}; diff --git a/crates/color-ui/src/ui/pair.rs b/crates/color-ui/src/ui/pair.rs index 3b1204c6db..454bebee90 100644 --- a/crates/color-ui/src/ui/pair.rs +++ b/crates/color-ui/src/ui/pair.rs @@ -18,7 +18,7 @@ use egui::{Color32, CornerRadius, Painter, Pos2, Rect, Response, Shape, Stroke, use super::popover::compact_picker; use super::{ColorPicker, PickedColor, ScreenPickGesture}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// One of the wells, `WELL.at(0)` the primary and `WELL.at(1)` the secondary. diff --git a/crates/color-ui/src/ui/palette.rs b/crates/color-ui/src/ui/palette.rs index c974505568..f8200fd8ca 100644 --- a/crates/color-ui/src/ui/palette.rs +++ b/crates/color-ui/src/ui/palette.rs @@ -10,7 +10,7 @@ use craft_ui::runtime::env::Label; use egui::{Response, Ui}; use std::sync::Arc; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// What a [`SwatchPalette`] reports. diff --git a/crates/color-ui/src/ui/panel.rs b/crates/color-ui/src/ui/panel.rs index acb53d2a1d..05d31faa30 100644 --- a/crates/color-ui/src/ui/panel.rs +++ b/crates/color-ui/src/ui/panel.rs @@ -29,7 +29,7 @@ use super::{ }; use crate::{CmykModel, GrayModel, not_web_safe}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/color-ui/src/ui/picker/mod.rs b/crates/color-ui/src/ui/picker/mod.rs index 3cb865a6a7..10e6b13f50 100644 --- a/crates/color-ui/src/ui/picker/mod.rs +++ b/crates/color-ui/src/ui/picker/mod.rs @@ -6,7 +6,7 @@ mod channel; mod compact; mod full; mod screen_pick; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod value; diff --git a/crates/color-ui/src/ui/popover.rs b/crates/color-ui/src/ui/popover.rs index d599b74556..e995bbd43c 100644 --- a/crates/color-ui/src/ui/popover.rs +++ b/crates/color-ui/src/ui/popover.rs @@ -11,7 +11,7 @@ use egui::{Response, Ui}; use super::{ColorPicker, ColorPickerLayout, ColorPickerOutput, PickedColor, ScreenPickGesture}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The setup closure of the picker in the popover. diff --git a/crates/color-ui/src/ui/profile_prompts.rs b/crates/color-ui/src/ui/profile_prompts.rs index 6ff093604c..32a4a97f4a 100644 --- a/crates/color-ui/src/ui/profile_prompts.rs +++ b/crates/color-ui/src/ui/profile_prompts.rs @@ -18,7 +18,7 @@ use serde_json::{Value, json}; use crate::display::MonitorProblem; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/color-ui/src/ui/ramp.rs b/crates/color-ui/src/ui/ramp.rs index 63bb1a38db..f074258eff 100644 --- a/crates/color-ui/src/ui/ramp.rs +++ b/crates/color-ui/src/ui/ramp.rs @@ -17,7 +17,7 @@ use egui::{Color32, CornerRadius, Mesh, Pos2, Rect, Response, Vec2, pos2}; use std::hash::{DefaultHasher, Hash, Hasher}; use std::sync::Arc; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The bar: a press picks the colour under the pointer. diff --git a/crates/color-ui/src/ui/readout.rs b/crates/color-ui/src/ui/readout.rs index 34887e2211..79baeb9c11 100644 --- a/crates/color-ui/src/ui/readout.rs +++ b/crates/color-ui/src/ui/readout.rs @@ -1,6 +1,6 @@ //! `ColorReadout`: a colour as a hex field and editable R, G and B fields (the readout of a Color panel). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{EditEvent, EditEvents, Mixed}; diff --git a/crates/color-ui/src/ui/samplers.rs b/crates/color-ui/src/ui/samplers.rs index a0edd1a072..23f8c13d36 100644 --- a/crates/color-ui/src/ui/samplers.rs +++ b/crates/color-ui/src/ui/samplers.rs @@ -34,7 +34,7 @@ use super::{InfoColor, SampleSize, SampleSizeSelect}; use craft_ui::style::{ComponentStyle, StyleColor, StyleCx}; use egui::{Pos2, Response, Ui, Vec2, vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/color-ui/src/ui/screen_picker.rs b/crates/color-ui/src/ui/screen_picker.rs index 1184d9fef4..89cbe238fa 100644 --- a/crates/color-ui/src/ui/screen_picker.rs +++ b/crates/color-ui/src/ui/screen_picker.rs @@ -33,7 +33,7 @@ use egui::{Color32, Context, Pos2, Rect, Ui, pos2, vec2}; use super::ScreenPickGesture; mod capture; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use capture::{CaptureView, CaptureWindow}; diff --git a/crates/color-ui/src/ui/strip.rs b/crates/color-ui/src/ui/strip.rs index 2ac3a38ce7..c26e62e91e 100644 --- a/crates/color-ui/src/ui/strip.rs +++ b/crates/color-ui/src/ui/strip.rs @@ -15,7 +15,7 @@ use craft_ui::runtime::focus::{ActivateKeys, KeepKeys, KeyUse}; use craft_ui::style::{ComponentStyle, DataColor, FocusLook, StyleColor, StyleCx}; use egui::{CornerRadius, Mesh, Pos2, Rect, Vec2, pos2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The strip itself: a press on it sets the value there. diff --git a/crates/color-ui/src/ui/swatches.rs b/crates/color-ui/src/ui/swatches.rs index 6293e937fb..b450b92c1a 100644 --- a/crates/color-ui/src/ui/swatches.rs +++ b/crates/color-ui/src/ui/swatches.rs @@ -6,7 +6,7 @@ mod library; mod menu; mod panel; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use library::{SwatchAt, SwatchEdit, SwatchKey, SwatchLibrary, SwatchesState, swatch_rows}; diff --git a/crates/color-ui/src/ui/testing.rs b/crates/color-ui/src/ui/testing.rs index 0c557eaa67..f84385a15e 100644 --- a/crates/color-ui/src/ui/testing.rs +++ b/crates/color-ui/src/ui/testing.rs @@ -1 +1,2 @@ +#[cfg(feature = "suite")] craft_ui::testing_registered!(); diff --git a/crates/color-ui/src/ui/warning.rs b/crates/color-ui/src/ui/warning.rs index 40949d67ed..b67de633cd 100644 --- a/crates/color-ui/src/ui/warning.rs +++ b/crates/color-ui/src/ui/warning.rs @@ -11,7 +11,7 @@ use craft_ui::runtime::env::Label; use craft_ui::style::{ComponentStyle, StyleCx}; use egui::{Rect, Response, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// A warning the host shows beside a colour's swatch, as the out-of-gamut and web-colour warnings of Photoshop's Color diff --git a/crates/color-ui/src/ui/wheel.rs b/crates/color-ui/src/ui/wheel.rs index b2c3b0ca12..615789773a 100644 --- a/crates/color-ui/src/ui/wheel.rs +++ b/crates/color-ui/src/ui/wheel.rs @@ -15,7 +15,7 @@ use craft_ui::style::{ComponentStyle, FocusLook, MarkerLook, StyleColor, StyleCx use egui::{Mesh, Pos2, Rect, Vec2, vec2}; use std::f32::consts::TAU; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The hue ring: a press on it sets the hue to the pointer's angle. diff --git a/crates/craft/Cargo.toml b/crates/craft/Cargo.toml index 708bbf2b62..be3b619595 100644 --- a/crates/craft/Cargo.toml +++ b/crates/craft/Cargo.toml @@ -215,6 +215,7 @@ craft-suite-account = { workspace = true, optional = true } craft-xfa = { workspace = true, optional = true } [features] +suite = ["screen-testing", "craft-ui/suite", "craft-automation?/suite", "craft-browse?/suite", "craft-color-ui?/suite", "craft-dialogs?/suite", "craft-draw?/suite", "craft-font-manager?/suite", "craft-imaging?/suite", "craft-layers?/suite", "craft-menu?/suite", "craft-pages?/suite", "craft-print?/suite", "craft-review?/suite", "craft-table?/suite", "craft-text?/suite", "craft-theme-editor?/suite", "craft-theme-store?/suite", "craft-timeline?/suite", "craft-update?/suite"] ui = [ "dep:craft-ui", "dep:egui", diff --git a/crates/dialogs/Cargo.toml b/crates/dialogs/Cargo.toml index 9a80873416..cbda38030c 100644 --- a/crates/dialogs/Cargo.toml +++ b/crates/dialogs/Cargo.toml @@ -45,6 +45,7 @@ log = "0.4" zbus = { version = "5", default-features = false, features = ["async-io", "blocking-api"] } [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # `craft_dialogs::ui`: `PathField` and the other egui parts of the file service. ui = ["dep:craft-behavior", "dep:craft-ui", "dep:egui"] @@ -52,7 +53,7 @@ ui = ["dep:craft-behavior", "dep:craft-ui", "dep:egui"] screen-testing = ["ui", "craft-ui/testing"] [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } [lints] workspace = true diff --git a/crates/dialogs/src/lib.rs b/crates/dialogs/src/lib.rs index 299d5accc7..7b3356385c 100644 --- a/crates/dialogs/src/lib.rs +++ b/crates/dialogs/src/lib.rs @@ -34,6 +34,7 @@ pub mod ui; /// The registrations of this crate's UI types, for its integration binary. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/dialogs/src/ui/mod.rs b/crates/dialogs/src/ui/mod.rs index 0d48dcf9b1..eda6b23dd4 100644 --- a/crates/dialogs/src/ui/mod.rs +++ b/crates/dialogs/src/ui/mod.rs @@ -1,7 +1,7 @@ //! The file service's UI part: [`PathField`], and the words of the service's native boxes. mod path_field; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use path_field::{PathField, PathFieldOutput, PathFieldWords}; diff --git a/crates/draw/Cargo.toml b/crates/draw/Cargo.toml index bcb5b6c7e6..9a8c91cb58 100644 --- a/crates/draw/Cargo.toml +++ b/crates/draw/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite", "craft-color-ui/suite"] default = [] # The tool widgets (`craft_draw::ui`). ui = ["dep:craft-behavior", "dep:craft-keymap", "dep:craft-ui", "dep:egui", "dep:craft-color-ui", "craft-color-ui/ui", "dep:craft-settings", "dep:serde_json"] @@ -38,5 +39,5 @@ serde = { version = "1", features = ["derive"] } serde_json = { workspace = true, optional = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } diff --git a/crates/draw/src/lib.rs b/crates/draw/src/lib.rs index a27622d1f5..4111d49bce 100644 --- a/crates/draw/src/lib.rs +++ b/crates/draw/src/lib.rs @@ -9,6 +9,7 @@ pub mod ui; #[cfg(feature = "screen-testing")] pub mod testing { //! The registrations of this crate's stories, for the `tests/it` harness. + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/draw/src/ui/add_beside/mod.rs b/crates/draw/src/ui/add_beside/mod.rs index fb1856c793..ecc1d90427 100644 --- a/crates/draw/src/ui/add_beside/mod.rs +++ b/crates/draw/src/ui/add_beside/mod.rs @@ -2,7 +2,7 @@ //! (Photoshop) or a connected object (FigJam) there. One canvas control for the Artboard tool and the connector //! tools: its buttons are parts in the canvas's arena, so a press on one reaches the control before the tool. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/draw/src/ui/artboard/mod.rs b/crates/draw/src/ui/artboard/mod.rs index edab421c12..acec3ed2d0 100644 --- a/crates/draw/src/ui/artboard/mod.rs +++ b/crates/draw/src/ui/artboard/mod.rs @@ -19,7 +19,7 @@ mod background; mod bar; mod overlay; mod properties; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod tool; mod words; diff --git a/crates/draw/src/ui/brush_presets/mod.rs b/crates/draw/src/ui/brush_presets/mod.rs index 617a57bfb2..6c263431b3 100644 --- a/crates/draw/src/ui/brush_presets/mod.rs +++ b/crates/draw/src/ui/brush_presets/mod.rs @@ -14,7 +14,7 @@ mod panel; mod picker; mod rows; mod settings; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/draw/src/ui/brush_settings/mod.rs b/crates/draw/src/ui/brush_settings/mod.rs index 2c2155da56..dce1efb64c 100644 --- a/crates/draw/src/ui/brush_settings/mod.rs +++ b/crates/draw/src/ui/brush_settings/mod.rs @@ -19,7 +19,7 @@ mod preview; mod rows; mod sections; mod size_field; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/draw/src/ui/connector/mod.rs b/crates/draw/src/ui/connector/mod.rs index 943bda0e31..29c4cc5eea 100644 --- a/crates/draw/src/ui/connector/mod.rs +++ b/crates/draw/src/ui/connector/mod.rs @@ -14,7 +14,7 @@ mod place; mod tool; mod words; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::EditEvent; diff --git a/crates/draw/src/ui/corner/mod.rs b/crates/draw/src/ui/corner/mod.rs index c4e163fed6..002a8a7804 100644 --- a/crates/draw/src/ui/corner/mod.rs +++ b/crates/draw/src/ui/corner/mod.rs @@ -6,7 +6,7 @@ //! arc the app's engine draws. mod geometry; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod style; mod widgets; diff --git a/crates/draw/src/ui/crop/bar.rs b/crates/draw/src/ui/crop/bar.rs index c9e2f4892a..5b2aaee265 100644 --- a/crates/draw/src/ui/crop/bar.rs +++ b/crates/draw/src/ui/crop/bar.rs @@ -21,7 +21,7 @@ use craft_ui::runtime::requests::ColorRequest; use craft_ui::text::NumberField; use egui::{Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The ratio, a ratio field, a preset or W × H × Resolution changed. diff --git a/crates/draw/src/ui/crop/perspective_bar.rs b/crates/draw/src/ui/crop/perspective_bar.rs index 3a7ffd72fb..72b437f4ae 100644 --- a/crates/draw/src/ui/crop/perspective_bar.rs +++ b/crates/draw/src/ui/crop/perspective_bar.rs @@ -11,7 +11,7 @@ use craft_ui::layout_components::Row; use craft_ui::runtime::env::Env; use egui::{Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The Perspective Crop options: W × H × Resolution, Front Image, Clear, a divider and Show Grid. diff --git a/crates/draw/src/ui/crop/perspective_crop.rs b/crates/draw/src/ui/crop/perspective_crop.rs index c4bae97367..000a02bdca 100644 --- a/crates/draw/src/ui/crop/perspective_crop.rs +++ b/crates/draw/src/ui/crop/perspective_crop.rs @@ -487,5 +487,5 @@ pub fn grid_lines(view: &CanvasView, q: &[Point; 4], step: f32) -> Vec<[Pos2; 2] out } -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/draw/src/ui/crop/tool.rs b/crates/draw/src/ui/crop/tool.rs index d5de11c8a7..b6484d7bc5 100644 --- a/crates/draw/src/ui/crop/tool.rs +++ b/crates/draw/src/ui/crop/tool.rs @@ -788,5 +788,5 @@ pub fn crop_to_form(words: &CropWords, frame: &CropBox) -> ParamDialog<'static> ParamDialog::command(CROP_TO_KEY, words.crop_to.clone(), params) } -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/draw/src/ui/gradient/fill_editor.rs b/crates/draw/src/ui/gradient/fill_editor.rs index 81f6f36f7c..b6b09c8188 100644 --- a/crates/draw/src/ui/gradient/fill_editor.rs +++ b/crates/draw/src/ui/gradient/fill_editor.rs @@ -222,5 +222,5 @@ impl<'a> GradientFillEditor<'a> { } } -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/draw/src/ui/gradient/gradient_overlay/mod.rs b/crates/draw/src/ui/gradient/gradient_overlay/mod.rs index d82d7625b3..00d8ff9cdb 100644 --- a/crates/draw/src/ui/gradient/gradient_overlay/mod.rs +++ b/crates/draw/src/ui/gradient/gradient_overlay/mod.rs @@ -5,7 +5,7 @@ mod keys; mod parts; mod pointer; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/draw/src/ui/gradient/map/mod.rs b/crates/draw/src/ui/gradient/map/mod.rs index 7866b8f492..c75a048bb0 100644 --- a/crates/draw/src/ui/gradient/map/mod.rs +++ b/crates/draw/src/ui/gradient/map/mod.rs @@ -4,7 +4,7 @@ //! It lives here rather than with the other adjustment editors in craft-imaging because it picks from the palette's //! [`GradientGroup`] presets, and a family crate depends on no other family crate but craft-color-ui. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{EditEvent, Mixed}; diff --git a/crates/draw/src/ui/gradient/palette/mod.rs b/crates/draw/src/ui/gradient/palette/mod.rs index cb1866ba6f..9d320e9d74 100644 --- a/crates/draw/src/ui/gradient/palette/mod.rs +++ b/crates/draw/src/ui/gradient/palette/mod.rs @@ -7,7 +7,7 @@ use craft_ui::patterns::presets::{CellShape, PresetBrowser, PresetEvent, PresetR use craft_ui::runtime::env::{Env, Label}; use egui::{Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_color_ui::ui::gradient::{GradientRamp, GradientStops, Sampler, StopRows, default_sampler}; diff --git a/crates/draw/src/ui/gradient/swatch.rs b/crates/draw/src/ui/gradient/swatch.rs index 16cf2f0b7f..e6698f38bf 100644 --- a/crates/draw/src/ui/gradient/swatch.rs +++ b/crates/draw/src/ui/gradient/swatch.rs @@ -10,7 +10,7 @@ use egui::{CornerRadius, Response, Vec2}; use craft_color_ui::ui::gradient::{GradientRamp, GradientStops, Sampler, StopRows, default_sampler}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a gradient swatch: the colour swatch's height, corners and ring. diff --git a/crates/draw/src/ui/measure/mod.rs b/crates/draw/src/ui/measure/mod.rs index 0344454207..e7a492e346 100644 --- a/crates/draw/src/ui/measure/mod.rs +++ b/crates/draw/src/ui/measure/mod.rs @@ -9,7 +9,7 @@ mod bar; mod distances; mod model; mod overlay; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod tool; mod words; diff --git a/crates/draw/src/ui/paint_bar.rs b/crates/draw/src/ui/paint_bar.rs index 74a61e601e..977519a025 100644 --- a/crates/draw/src/ui/paint_bar.rs +++ b/crates/draw/src/ui/paint_bar.rs @@ -20,7 +20,7 @@ use craft_ui::runtime::env::{Env, Label, UnitKind}; use craft_ui::text::{NumberField, RangeAlert}; use egui::{Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/draw/src/ui/paths/mod.rs b/crates/draw/src/ui/paths/mod.rs index d751cff179..96396f58b4 100644 --- a/crates/draw/src/ui/paths/mod.rs +++ b/crates/draw/src/ui/paths/mod.rs @@ -6,7 +6,7 @@ mod menu; mod model; mod panel; mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/draw/src/ui/pattern/mod.rs b/crates/draw/src/ui/pattern/mod.rs index b74f303af6..473e821e53 100644 --- a/crates/draw/src/ui/pattern/mod.rs +++ b/crates/draw/src/ui/pattern/mod.rs @@ -6,7 +6,7 @@ use craft_theme::Srgba; mod dialog; mod editor; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/draw/src/ui/pen/bezier/mod.rs b/crates/draw/src/ui/pen/bezier/mod.rs index d99b541df7..dd9c80570a 100644 --- a/crates/draw/src/ui/pen/bezier/mod.rs +++ b/crates/draw/src/ui/pen/bezier/mod.rs @@ -5,7 +5,7 @@ mod hit_test; mod mark; mod model; mod ops; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod style; mod tools; diff --git a/crates/draw/src/ui/pen/mod.rs b/crates/draw/src/ui/pen/mod.rs index 61395d61a6..0924c37834 100644 --- a/crates/draw/src/ui/pen/mod.rs +++ b/crates/draw/src/ui/pen/mod.rs @@ -9,7 +9,7 @@ pub(crate) mod bezier; mod curvature_mode; mod mode; mod options; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod tool; mod words; diff --git a/crates/draw/src/ui/picture_fill/mod.rs b/crates/draw/src/ui/picture_fill/mod.rs index 99f742b10e..a1445e5a4d 100644 --- a/crates/draw/src/ui/picture_fill/mod.rs +++ b/crates/draw/src/ui/picture_fill/mod.rs @@ -8,7 +8,7 @@ //! ``` mod editor; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/draw/src/ui/shape/mod.rs b/crates/draw/src/ui/shape/mod.rs index 0ccad43ade..7295249bdd 100644 --- a/crates/draw/src/ui/shape/mod.rs +++ b/crates/draw/src/ui/shape/mod.rs @@ -15,7 +15,7 @@ mod bar; mod gear; mod mode_select; mod panel; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod stroke_cells; mod words; diff --git a/crates/draw/src/ui/shape_presets.rs b/crates/draw/src/ui/shape_presets.rs index 579b431a7c..4595c453c0 100644 --- a/crates/draw/src/ui/shape_presets.rs +++ b/crates/draw/src/ui/shape_presets.rs @@ -11,7 +11,7 @@ use craft_ui::style::UiTokens; use egui::{Color32, Mesh, Painter, Pos2, Rect, Shape, Stroke, Ui, pos2}; use kurbo::{BezPath, PathEl}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The error bound, in points, when the glyph's curves are flattened. diff --git a/crates/draw/src/ui/slice/mod.rs b/crates/draw/src/ui/slice/mod.rs index 8ce3f4f59c..cc6202f645 100644 --- a/crates/draw/src/ui/slice/mod.rs +++ b/crates/draw/src/ui/slice/mod.rs @@ -38,7 +38,7 @@ use std::sync::Arc; mod bar; mod dialogs; mod overlay; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod tool; mod words; diff --git a/crates/draw/src/ui/stroke/mod.rs b/crates/draw/src/ui/stroke/mod.rs index 7eb02bec6d..a5bb3a2a64 100644 --- a/crates/draw/src/ui/stroke/mod.rs +++ b/crates/draw/src/ui/stroke/mod.rs @@ -8,7 +8,7 @@ mod button; mod editor; mod preview; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/draw/src/ui/symmetry/mod.rs b/crates/draw/src/ui/symmetry/mod.rs index a4676ddea3..96bf3515d0 100644 --- a/crates/draw/src/ui/symmetry/mod.rs +++ b/crates/draw/src/ui/symmetry/mod.rs @@ -9,7 +9,7 @@ mod handles; mod menu; mod model; mod overlay; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod transform; diff --git a/crates/draw/src/ui/transform/session_bar.rs b/crates/draw/src/ui/transform/session_bar.rs index d0d9a8247f..150dbd15b9 100644 --- a/crates/draw/src/ui/transform/session_bar.rs +++ b/crates/draw/src/ui/transform/session_bar.rs @@ -1,6 +1,6 @@ //! `TransformBar`: the options bar of an open Free Transform session. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use super::session::{TransformEdit, TransformPhase, TransformSession, TransformSettings, TransformWarp}; diff --git a/crates/draw/src/ui/transform/session_overlay.rs b/crates/draw/src/ui/transform/session_overlay.rs index c86781be77..685bc46d7b 100644 --- a/crates/draw/src/ui/transform/session_overlay.rs +++ b/crates/draw/src/ui/transform/session_overlay.rs @@ -1,7 +1,7 @@ //! `TransformOverlay`: the open session's box on the canvas, which shows a [`TransformBox`](super::TransformBox) //! and turns its reports into [`TransformEdit`]s, and `TransformTool`: the canvas tool of the open session. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::CancelReason; diff --git a/crates/draw/src/ui/transform/transform_box.rs b/crates/draw/src/ui/transform/transform_box.rs index cc92328706..cbb62d3333 100644 --- a/crates/draw/src/ui/transform/transform_box.rs +++ b/crates/draw/src/ui/transform/transform_box.rs @@ -2,7 +2,7 @@ //! corners, edges, reference point, inside and outside are parts in the canvas's arena; the value is the box in //! document units. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::geometry::quad::{self, BoxAllow, BoxDrag, BoxPart, BoxRules, BoxState, ScaleRule, TransformMode}; diff --git a/crates/draw/src/ui/transform/transform_fields.rs b/crates/draw/src/ui/transform/transform_fields.rs index 86c62b5ad2..9b620e2f0d 100644 --- a/crates/draw/src/ui/transform/transform_fields.rs +++ b/crates/draw/src/ui/transform/transform_fields.rs @@ -1,7 +1,7 @@ //! `TransformFields`: the X, Y, W, H, angle and skew fields of a transform box, as an options-bar strip or a panel's //! rows. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod units; diff --git a/crates/feature-root/Cargo.toml b/crates/feature-root/Cargo.toml index e21c56c8d6..3392e7ef42 100644 --- a/crates/feature-root/Cargo.toml +++ b/crates/feature-root/Cargo.toml @@ -31,22 +31,22 @@ workspace = true [dependencies] craft-ui-gallery = { path = "../ui-gallery", default-features = false } # The gallery's optional domain crates, with the gallery's features (`cl doctor` checks that the lists match). -craft-automation = { workspace = true, features = ["screen-testing"] } -craft-browse = { workspace = true, features = ["screen-testing"] } -craft-color-ui = { workspace = true, features = ["screen-testing"] } -craft-draw = { workspace = true, features = ["screen-testing"] } -craft-imaging = { workspace = true, features = ["screen-testing"] } -craft-layers = { workspace = true, features = ["screen-testing"] } -craft-menu = { workspace = true, features = ["screen-testing"] } -craft-pages = { workspace = true, features = ["screen-testing"] } -craft-print = { workspace = true, features = ["screen-testing"] } -craft-review = { workspace = true, features = ["screen-testing"] } -craft-table = { workspace = true, features = ["screen-testing"] } -craft-text = { workspace = true, features = ["screen-testing", "find"] } -craft-theme-store = { workspace = true, features = ["screen-testing"] } -craft-timeline = { workspace = true, features = ["screen-testing", "xml", "otio"] } +craft-automation = { workspace = true, features = ["suite"] } +craft-browse = { workspace = true, features = ["suite"] } +craft-color-ui = { workspace = true, features = ["suite"] } +craft-draw = { workspace = true, features = ["suite"] } +craft-imaging = { workspace = true, features = ["suite"] } +craft-layers = { workspace = true, features = ["suite"] } +craft-menu = { workspace = true, features = ["suite"] } +craft-pages = { workspace = true, features = ["suite"] } +craft-print = { workspace = true, features = ["suite"] } +craft-review = { workspace = true, features = ["suite"] } +craft-table = { workspace = true, features = ["suite"] } +craft-text = { workspace = true, features = ["suite", "find"] } +craft-theme-store = { workspace = true, features = ["suite"] } +craft-timeline = { workspace = true, features = ["suite", "xml", "otio"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -craft-dialogs = { workspace = true, features = ["screen-testing"] } -craft-font-manager = { workspace = true, features = ["screen-testing"] } -craft-update = { workspace = true, features = ["screen-testing"] } +craft-dialogs = { workspace = true, features = ["suite"] } +craft-font-manager = { workspace = true, features = ["suite"] } +craft-update = { workspace = true, features = ["suite"] } diff --git a/crates/font-manager/Cargo.toml b/crates/font-manager/Cargo.toml index c8f5148bc4..f3a18f1c62 100644 --- a/crates/font-manager/Cargo.toml +++ b/crates/font-manager/Cargo.toml @@ -12,6 +12,7 @@ repository.workspace = true test = false [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # `FontsPanel`: the whole interface as one egui panel (it builds for the web too), with the picker, the Glyphs panel, the axis sliders and the # Missing Fonts dialog. @@ -40,13 +41,13 @@ log = { version = "0.4", optional = true } skrifa = { version = "0.44", default-features = false, features = ["std"] } [dev-dependencies] -craft-font-manager = { path = ".", features = ["screen-testing"] } +craft-font-manager = { path = ".", features = ["suite"] } [[test]] name = "it" path = "tests/it/main.rs" harness = false -required-features = ["screen-testing"] +required-features = ["suite"] [lints] workspace = true diff --git a/crates/font-manager/src/axes/sliders.rs b/crates/font-manager/src/axes/sliders.rs index 0e09b95af3..51ed8904b3 100644 --- a/crates/font-manager/src/axes/sliders.rs +++ b/crates/font-manager/src/axes/sliders.rs @@ -1,6 +1,6 @@ //! The row of sliders that edits the axes of a face (Photoshop's Properties › Character axis sliders; FigCraft's axis panel). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/font-manager/src/glyphs.rs b/crates/font-manager/src/glyphs.rs index 0a20f136f1..a52059e890 100644 --- a/crates/font-manager/src/glyphs.rs +++ b/crates/font-manager/src/glyphs.rs @@ -2,7 +2,7 @@ //! Currency, ...), a grid of glyph cells drawn by the app's text engine, a zoom slider, and the recently used //! glyphs in a row at the top. Double-click or Enter inserts the glyph where the app can insert. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/font-manager/src/lib.rs b/crates/font-manager/src/lib.rs index ce2598faac..ccb334ac7c 100644 --- a/crates/font-manager/src/lib.rs +++ b/crates/font-manager/src/lib.rs @@ -40,5 +40,6 @@ pub use panel::{ /// The registered stories and trials of this crate. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/font-manager/src/missing.rs b/crates/font-manager/src/missing.rs index 14c73dd053..45af646b3b 100644 --- a/crates/font-manager/src/missing.rs +++ b/crates/font-manager/src/missing.rs @@ -2,7 +2,7 @@ //! are not installed, and the dialog that lists them with a replacement for each (Photoshop's //! "missing fonts" warning on open; VectorCraft's and FigCraft's Document Fonts lists). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::borrow::Cow; diff --git a/crates/font-manager/src/panel/app.rs b/crates/font-manager/src/panel/app.rs index dc92fc3af5..f1b099d915 100644 --- a/crates/font-manager/src/panel/app.rs +++ b/crates/font-manager/src/panel/app.rs @@ -1,7 +1,7 @@ //! The panel's model, what the host calls, and the view: the tabs and search across the top, the filters at the //! reading start, the family cards, the details sheet and the download consent. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::collections::HashMap; diff --git a/crates/font-manager/src/panel/browse.rs b/crates/font-manager/src/panel/browse.rs index d954b2c05a..5b31c135af 100644 --- a/crates/font-manager/src/panel/browse.rs +++ b/crates/font-manager/src/panel/browse.rs @@ -1,6 +1,6 @@ //! The tabs and search, the filters, the sample toolbar and the list of family cards. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod cards; diff --git a/crates/font-manager/src/panel/details.rs b/crates/font-manager/src/panel/details.rs index c471054489..36592c7e09 100644 --- a/crates/font-manager/src/panel/details.rs +++ b/crates/font-manager/src/panel/details.rs @@ -2,7 +2,7 @@ //! installing or removing it whole or a style at a time. mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/font-manager/src/panel/sources.rs b/crates/font-manager/src/panel/sources.rs index e46f24eebe..450b1cbe7d 100644 --- a/crates/font-manager/src/panel/sources.rs +++ b/crates/font-manager/src/panel/sources.rs @@ -2,7 +2,7 @@ //! added (never curated, and flagged when their file changed since it was added), adding one, //! and downloading them all again. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/font-manager/src/panel/specimen.rs b/crates/font-manager/src/panel/specimen.rs index 83e1181d98..85cfe0dbf8 100644 --- a/crates/font-manager/src/panel/specimen.rs +++ b/crates/font-manager/src/panel/specimen.rs @@ -12,7 +12,7 @@ use crate::Catalog; use crate::FaceInfo; use crate::panel::faces::{self, Owner, Shown}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The ink of a sample: the text colour for a face that drew, the muted one for the interface face standing in. diff --git a/crates/font-manager/src/picker.rs b/crates/font-manager/src/picker.rs index 3e4c413a0d..5a9f6c91ca 100644 --- a/crates/font-manager/src/picker.rs +++ b/crates/font-manager/src/picker.rs @@ -5,7 +5,7 @@ mod rank; mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/imaging/Cargo.toml b/crates/imaging/Cargo.toml index 5ae89a6196..92e2f5aaef 100644 --- a/crates/imaging/Cargo.toml +++ b/crates/imaging/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The editing widgets (`craft_imaging::ui`). ui = ["craft-color-ui/ui", "dep:serde_json", "dep:craft-behavior", "dep:craft-keymap", "dep:craft-ui", "dep:egui", "dep:kurbo"] @@ -37,7 +38,7 @@ serde = { workspace = true } serde_json = { workspace = true, optional = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] diff --git a/crates/imaging/src/lib.rs b/crates/imaging/src/lib.rs index 52bc4632b6..8e50164861 100644 --- a/crates/imaging/src/lib.rs +++ b/crates/imaging/src/lib.rs @@ -16,6 +16,7 @@ pub mod wide_angle; /// The registered stories and suite cases of the widgets, for `tests/it`. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/imaging/src/ui/adjust/basic.rs b/crates/imaging/src/ui/adjust/basic.rs index 543bb92238..a8143b3c59 100644 --- a/crates/imaging/src/ui/adjust/basic.rs +++ b/crates/imaging/src/ui/adjust/basic.rs @@ -3,7 +3,7 @@ mod brightness_contrast; mod color_balance; mod photo_filter; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod threshold; diff --git a/crates/imaging/src/ui/adjust/curves_panel.rs b/crates/imaging/src/ui/adjust/curves_panel.rs index f01d19b137..2e6ce2d83a 100644 --- a/crates/imaging/src/ui/adjust/curves_panel.rs +++ b/crates/imaging/src/ui/adjust/curves_panel.rs @@ -3,7 +3,7 @@ //! and the hint line; and the ⌘/Ctrl-click-on-the-image helper //! ([`CurvesPanel::add_point_from_sample`]). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/imaging/src/ui/adjust/hue_saturation.rs b/crates/imaging/src/ui/adjust/hue_saturation.rs index 82f81bc043..2ae72ba3df 100644 --- a/crates/imaging/src/ui/adjust/hue_saturation.rs +++ b/crates/imaging/src/ui/adjust/hue_saturation.rs @@ -1,7 +1,7 @@ //! [`HueSaturationEditor`]: Master and six colour ranges, Colorize, the two spectrum bars and the four range thumbs //! that wrap at 360°. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::Mixed; diff --git a/crates/imaging/src/ui/adjust/levels_editor.rs b/crates/imaging/src/ui/adjust/levels_editor.rs index 26c3762d33..10988ddf7a 100644 --- a/crates/imaging/src/ui/adjust/levels_editor.rs +++ b/crates/imaging/src/ui/adjust/levels_editor.rs @@ -1,7 +1,7 @@ //! [`LevelsEditor`]: a levels adjustment's histogram, input thumbs and fields, output bar, thumbs //! and fields, editing one channel's [`Levels`]. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::ops::RangeInclusive; diff --git a/crates/imaging/src/ui/adjust/levels_panel.rs b/crates/imaging/src/ui/adjust/levels_panel.rs index 62951796c4..e381f24b5c 100644 --- a/crates/imaging/src/ui/adjust/levels_panel.rs +++ b/crates/imaging/src/ui/adjust/levels_panel.rs @@ -1,7 +1,7 @@ //! [`LevelsPanel`]: the Levels adjustment around the [`LevelsEditor`]: the point pickers, the //! Channel select, Auto and the editor over the shown channel's histogram. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/imaging/src/ui/adjust/mixers.rs b/crates/imaging/src/ui/adjust/mixers.rs index 97bbef63b4..53cba62db8 100644 --- a/crates/imaging/src/ui/adjust/mixers.rs +++ b/crates/imaging/src/ui/adjust/mixers.rs @@ -3,7 +3,7 @@ mod black_white; mod channel_mixer; mod selective_color; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use black_white::{BlackWhite, BlackWhiteEditor, BlackWhiteOutput}; diff --git a/crates/imaging/src/ui/adjust/panel.rs b/crates/imaging/src/ui/adjust/panel.rs index cce9abba33..73b8687d54 100644 --- a/crates/imaging/src/ui/adjust/panel.rs +++ b/crates/imaging/src/ui/adjust/panel.rs @@ -1,6 +1,6 @@ //! [`AdjustmentsPanel`]: the grid of adjustment buttons a document panel offers for adding an adjustment layer. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{Metrics, NavShape, Roving, Sense}; diff --git a/crates/imaging/src/ui/adjust/session.rs b/crates/imaging/src/ui/adjust/session.rs index 039a312ddd..5d16649608 100644 --- a/crates/imaging/src/ui/adjust/session.rs +++ b/crates/imaging/src/ui/adjust/session.rs @@ -1,7 +1,7 @@ //! [`AdjustSession`]: the Properties panel's memory of the settings it found on an adjustment //! layer, so Reset returns to them once the user edited. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The settings an adjustment layer had when the Properties panel started showing it, and whether diff --git a/crates/imaging/src/ui/adjust/sliders.rs b/crates/imaging/src/ui/adjust/sliders.rs index 9ec8dcd6b2..ceb9a2357c 100644 --- a/crates/imaging/src/ui/adjust/sliders.rs +++ b/crates/imaging/src/ui/adjust/sliders.rs @@ -5,7 +5,7 @@ //! rows' edits are lifted onto the editor's value ([`Run`]), so one slider drag, one typed number or one reset is one //! gesture of the whole value. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::ops::RangeInclusive; diff --git a/crates/imaging/src/ui/adjust/tone.rs b/crates/imaging/src/ui/adjust/tone.rs index 711bdd0dcd..5ffd10e666 100644 --- a/crates/imaging/src/ui/adjust/tone.rs +++ b/crates/imaging/src/ui/adjust/tone.rs @@ -5,7 +5,7 @@ //! The library reports the sample; turning it into a Levels or Curves value needs the document's //! colour management and mode, so the app does that, as with the Eyedropper. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{CancelReason, Cursor, IconId, PaintedCursor}; diff --git a/crates/imaging/src/ui/blur_pins/mod.rs b/crates/imaging/src/ui/blur_pins/mod.rs index ff5c992598..df9271b5fb 100644 --- a/crates/imaging/src/ui/blur_pins/mod.rs +++ b/crates/imaging/src/ui/blur_pins/mod.rs @@ -20,7 +20,7 @@ mod grab; mod model; mod overlay; mod panel; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod style; mod words; diff --git a/crates/imaging/src/ui/channels/mod.rs b/crates/imaging/src/ui/channels/mod.rs index 12272b4c50..15ce167df5 100644 --- a/crates/imaging/src/ui/channels/mod.rs +++ b/crates/imaging/src/ui/channels/mod.rs @@ -7,7 +7,7 @@ mod menu; mod model; mod panel; mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; pub use footer::ChannelsFooterButton; diff --git a/crates/imaging/src/ui/color_range/mod.rs b/crates/imaging/src/ui/color_range/mod.rs index 4cae584108..05b693a7f0 100644 --- a/crates/imaging/src/ui/color_range/mod.rs +++ b/crates/imaging/src/ui/color_range/mod.rs @@ -13,7 +13,7 @@ mod dialog; mod hosted; mod labels; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod value; diff --git a/crates/imaging/src/ui/curve/mod.rs b/crates/imaging/src/ui/curve/mod.rs index 8ecb410ac2..b8cf171751 100644 --- a/crates/imaging/src/ui/curve/mod.rs +++ b/crates/imaging/src/ui/curve/mod.rs @@ -5,7 +5,7 @@ mod graph; mod model; mod preview; mod ramp; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/imaging/src/ui/fill/mod.rs b/crates/imaging/src/ui/fill/mod.rs index 7653eea8de..b11ab14851 100644 --- a/crates/imaging/src/ui/fill/mod.rs +++ b/crates/imaging/src/ui/fill/mod.rs @@ -29,7 +29,7 @@ mod overlay; mod panel; mod preview_pane; mod session; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod tool; mod words; diff --git a/crates/imaging/src/ui/filter_gallery/mod.rs b/crates/imaging/src/ui/filter_gallery/mod.rs index 1452e91eda..7a40b878d0 100644 --- a/crates/imaging/src/ui/filter_gallery/mod.rs +++ b/crates/imaging/src/ui/filter_gallery/mod.rs @@ -24,7 +24,7 @@ mod catalog; mod parameters; mod session; mod stack; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod tree; mod words; diff --git a/crates/imaging/src/ui/histogram/mod.rs b/crates/imaging/src/ui/histogram/mod.rs index ab2799cf67..e8b9d77730 100644 --- a/crates/imaging/src/ui/histogram/mod.rs +++ b/crates/imaging/src/ui/histogram/mod.rs @@ -8,7 +8,7 @@ mod data; pub mod paint; mod plot; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod words; diff --git a/crates/imaging/src/ui/layer_style/blend_if/mod.rs b/crates/imaging/src/ui/layer_style/blend_if/mod.rs index 21d6a8f8f1..5a99989014 100644 --- a/crates/imaging/src/ui/layer_style/blend_if/mod.rs +++ b/crates/imaging/src/ui/layer_style/blend_if/mod.rs @@ -1,6 +1,6 @@ //! `BlendIfBar`: one Blend If slider (This Layer or Underlying Layer) with its four handles, over `ThumbRow`. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{EditEvents, Mixed}; diff --git a/crates/imaging/src/ui/layer_style/contour/mod.rs b/crates/imaging/src/ui/layer_style/contour/mod.rs index c9f7914f55..f99b6cc035 100644 --- a/crates/imaging/src/ui/layer_style/contour/mod.rs +++ b/crates/imaging/src/ui/layer_style/contour/mod.rs @@ -2,7 +2,7 @@ //! the contour as a curve. mod editor; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/imaging/src/ui/layer_style/mod.rs b/crates/imaging/src/ui/layer_style/mod.rs index ecaa2ceea7..87d3b8f7dc 100644 --- a/crates/imaging/src/ui/layer_style/mod.rs +++ b/crates/imaging/src/ui/layer_style/mod.rs @@ -30,7 +30,7 @@ mod hosted; mod labels; mod list; mod page; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod styles; diff --git a/crates/imaging/src/ui/liquify/mod.rs b/crates/imaging/src/ui/liquify/mod.rs index b0346aebf5..8da163f54a 100644 --- a/crates/imaging/src/ui/liquify/mod.rs +++ b/crates/imaging/src/ui/liquify/mod.rs @@ -48,7 +48,7 @@ mod canvas; mod commands; mod panel; mod session; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod tools; mod words; diff --git a/crates/imaging/src/ui/mask_view/mod.rs b/crates/imaging/src/ui/mask_view/mod.rs index a4ad4e47f8..60dea75ba9 100644 --- a/crates/imaging/src/ui/mask_view/mod.rs +++ b/crates/imaging/src/ui/mask_view/mod.rs @@ -23,7 +23,7 @@ mod controls; mod keys; mod state; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; pub use controls::{MaskViewControls, MaskViewControlsOutput}; diff --git a/crates/imaging/src/ui/raw_develop/mod.rs b/crates/imaging/src/ui/raw_develop/mod.rs index 06f209fbd1..0011b018c7 100644 --- a/crates/imaging/src/ui/raw_develop/mod.rs +++ b/crates/imaging/src/ui/raw_develop/mod.rs @@ -19,7 +19,7 @@ mod mixer; mod preview; mod scopes; mod source; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/imaging/src/ui/scopes/mod.rs b/crates/imaging/src/ui/scopes/mod.rs index eff571c3e7..f22787f55a 100644 --- a/crates/imaging/src/ui/scopes/mod.rs +++ b/crates/imaging/src/ui/scopes/mod.rs @@ -28,7 +28,7 @@ mod clipping; mod menu; mod panel; mod plot; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod vectorscope; mod words; diff --git a/crates/imaging/src/ui/select/mod.rs b/crates/imaging/src/ui/select/mod.rs index 780ddceebc..ca49a38e44 100644 --- a/crates/imaging/src/ui/select/mod.rs +++ b/crates/imaging/src/ui/select/mod.rs @@ -55,7 +55,7 @@ mod lasso; mod magnetic; mod marquee; mod polygon; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; pub mod operations; diff --git a/crates/imaging/src/ui/select_mask/mod.rs b/crates/imaging/src/ui/select_mask/mod.rs index 4982a9b00e..a58118f9c4 100644 --- a/crates/imaging/src/ui/select_mask/mod.rs +++ b/crates/imaging/src/ui/select_mask/mod.rs @@ -43,7 +43,7 @@ mod commands; mod edits; mod panel; mod session; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod tools; mod words; diff --git a/crates/imaging/src/ui/selection/mod.rs b/crates/imaging/src/ui/selection/mod.rs index 96bab02a58..968b5d00ca 100644 --- a/crates/imaging/src/ui/selection/mod.rs +++ b/crates/imaging/src/ui/selection/mod.rs @@ -10,7 +10,7 @@ //! [`QuickMaskLook`]: crate::selection::QuickMaskLook mod overlay; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; pub use overlay::{OutlineSource, PointMap, SelectionOverlay, SelectionOverlayOutput, SelectionWords}; diff --git a/crates/imaging/src/ui/transform_preview/mod.rs b/crates/imaging/src/ui/transform_preview/mod.rs index d89c558774..3c2af1c321 100644 --- a/crates/imaging/src/ui/transform_preview/mod.rs +++ b/crates/imaging/src/ui/transform_preview/mod.rs @@ -20,7 +20,7 @@ //! ``` mod maps; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod styled; mod textures; diff --git a/crates/imaging/src/ui/vanishing_point/mod.rs b/crates/imaging/src/ui/vanishing_point/mod.rs index 507b004ba9..c7f0bc264a 100644 --- a/crates/imaging/src/ui/vanishing_point/mod.rs +++ b/crates/imaging/src/ui/vanishing_point/mod.rs @@ -27,7 +27,7 @@ mod draw; mod editor; mod new_plane; mod planes; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod style; mod words; diff --git a/crates/imaging/src/ui/warp/cylinder.rs b/crates/imaging/src/ui/warp/cylinder.rs index c5b29e4734..db96973c6a 100644 --- a/crates/imaging/src/ui/warp/cylinder.rs +++ b/crates/imaging/src/ui/warp/cylinder.rs @@ -21,7 +21,7 @@ use egui::{CornerRadius, Pos2, Rect, Response, Vec2}; use super::WarpMesh; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The bend of both arcs the Cylinder starts with, in units of the half axis: about a quarter of the width. diff --git a/crates/imaging/src/ui/warp/mod.rs b/crates/imaging/src/ui/warp/mod.rs index 32987fa8aa..c63d5630d3 100644 --- a/crates/imaging/src/ui/warp/mod.rs +++ b/crates/imaging/src/ui/warp/mod.rs @@ -12,7 +12,7 @@ mod mesh; mod model; pub mod perspective; pub mod pin; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use cylinder::{CylinderHandle, CylinderValues, CylinderWarp, CylinderWarpOutput, CylinderWarpStyle}; diff --git a/crates/imaging/src/ui/warp/perspective/mod.rs b/crates/imaging/src/ui/warp/perspective/mod.rs index 585877dcd4..6f9ada6b83 100644 --- a/crates/imaging/src/ui/warp/perspective/mod.rs +++ b/crates/imaging/src/ui/warp/perspective/mod.rs @@ -5,7 +5,7 @@ mod bar; mod overlay; mod session; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; pub use bar::{PerspectiveBar, PerspectiveBarOutput, PerspectiveBarWords}; diff --git a/crates/imaging/src/ui/warp/pin/mod.rs b/crates/imaging/src/ui/warp/pin/mod.rs index a0fc21393a..2cbd631d59 100644 --- a/crates/imaging/src/ui/warp/pin/mod.rs +++ b/crates/imaging/src/ui/warp/pin/mod.rs @@ -5,7 +5,7 @@ mod bar; mod overlay; mod session; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; pub use bar::{PinWarpBar, PinWarpBarOutput, PinWarpBarWords}; diff --git a/crates/imaging/src/ui/wide_angle/mod.rs b/crates/imaging/src/ui/wide_angle/mod.rs index 34df37299a..19ed8ced18 100644 --- a/crates/imaging/src/ui/wide_angle/mod.rs +++ b/crates/imaging/src/ui/wide_angle/mod.rs @@ -18,7 +18,7 @@ mod commands; mod lines; mod panel; mod session; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; mod tool; mod words; diff --git a/crates/layers/Cargo.toml b/crates/layers/Cargo.toml index f3d58a9d19..eede73357b 100644 --- a/crates/layers/Cargo.toml +++ b/crates/layers/Cargo.toml @@ -16,8 +16,9 @@ workspace = true # UI-only: egui and craft-ui are plain dependencies, so there is no `ui` feature. [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] -# The stories, `mock` and the integration tests (`tests/it`). +# The test kit and `mock` helpers. screen-testing = ["craft-ui/testing"] [dependencies] @@ -37,4 +38,4 @@ serde_json = { workspace = true } name = "it" path = "tests/it/main.rs" harness = false -required-features = ["screen-testing"] +required-features = ["suite"] diff --git a/crates/layers/src/lib.rs b/crates/layers/src/lib.rs index 1881cc1920..a283d79861 100644 --- a/crates/layers/src/lib.rs +++ b/crates/layers/src/lib.rs @@ -17,6 +17,8 @@ pub mod testing { use egui::accesskit::NodeId; use egui::{Context, Rect}; + #[cfg(feature = "suite")] + craft_ui::testing_registered!(); /// The rect of the thumbnail that shows `part` of the layer `info`, in the row whose node is `row`, as the row diff --git a/crates/layers/src/ui/comps/mod.rs b/crates/layers/src/ui/comps/mod.rs index 122a463a60..768bd8b6e5 100644 --- a/crates/layers/src/ui/comps/mod.rs +++ b/crates/layers/src/ui/comps/mod.rs @@ -3,7 +3,7 @@ mod body; mod events; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/layers/src/ui/filter/mod.rs b/crates/layers/src/ui/filter/mod.rs index 09566dff06..1851e2a471 100644 --- a/crates/layers/src/ui/filter/mod.rs +++ b/crates/layers/src/ui/filter/mod.rs @@ -5,7 +5,7 @@ //! plain code, so a host's control channel can read and set the criteria (PhotoCraft's //! `ui.set layerFilter {by, kinds, name, effect, mode, attribute, color, smart}`) without the panel. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{EditEvent, IconId, Mixed, SelectionChange}; diff --git a/crates/layers/src/ui/options/mod.rs b/crates/layers/src/ui/options/mod.rs index 9511e27520..852c60cf91 100644 --- a/crates/layers/src/ui/options/mod.rs +++ b/crates/layers/src/ui/options/mod.rs @@ -3,7 +3,7 @@ //! `LayersSettings` is the panel's persisted section (`.settings(&mut ..)` on the panel); //! `LayersOptions` is the value the dialog edits and returns, held by the settings. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_ui::choice::{Checkbox, Radio, RadioGroup}; diff --git a/crates/layers/src/ui/panel/mod.rs b/crates/layers/src/ui/panel/mod.rs index 1402b26617..3956f91a6d 100644 --- a/crates/layers/src/ui/panel/mod.rs +++ b/crates/layers/src/ui/panel/mod.rs @@ -11,7 +11,7 @@ mod events; mod footer; mod menu; mod row; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use drag::{LayersDrag, document_hash}; diff --git a/crates/layers/src/ui/rows/mod.rs b/crates/layers/src/ui/rows/mod.rs index 71d97e9e58..b1861f45f9 100644 --- a/crates/layers/src/ui/rows/mod.rs +++ b/crates/layers/src/ui/rows/mod.rs @@ -1,6 +1,6 @@ //! `BlendRows`: Blend mode, Opacity, Lock and Fill as one block. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{EditEvent, EditEvents, IconId}; diff --git a/crates/menu/Cargo.toml b/crates/menu/Cargo.toml index df82fa938b..017db5b2ad 100644 --- a/crates/menu/Cargo.toml +++ b/crates/menu/Cargo.toml @@ -25,6 +25,7 @@ serde = { workspace = true } serde_json = { workspace = true } [features] +suite = ["screen-testing", "craft-ui/suite"] screen-testing = ["craft-ui/testing"] [dev-dependencies] @@ -35,7 +36,7 @@ egui = { workspace = true } name = "it" path = "tests/it/main.rs" harness = false -required-features = ["screen-testing"] +required-features = ["suite"] # AppKit end to end: runs on the main thread, so no harness; on other platforms it does nothing. [[test]] diff --git a/crates/menu/src/bar.rs b/crates/menu/src/bar.rs index 3907b35de1..1a483d8f06 100644 --- a/crates/menu/src/bar.rs +++ b/crates/menu/src/bar.rs @@ -8,7 +8,7 @@ //! choice reaches the app as a fired command with [`craft_ui::runtime::commands::FireSource::Menu`]. //! `Builtin::Quit` and `Builtin::Minimize` act on the root window through the runtime. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_keymap::{CommandRef, Platform}; diff --git a/crates/menu/src/lib.rs b/crates/menu/src/lib.rs index 086baa59c6..923c92cf82 100644 --- a/crates/menu/src/lib.rs +++ b/crates/menu/src/lib.rs @@ -131,5 +131,6 @@ pub use theme::{THEME_COMMAND, ThemeChoice, ThemeLabels, ThemeMenu, ThemeRow}; #[cfg(feature = "screen-testing")] /// The stories and words this crate registers, for the story tests. pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/menu/src/shortcuts/mod.rs b/crates/menu/src/shortcuts/mod.rs index 6c08bb9d3b..d68bc0e210 100644 --- a/crates/menu/src/shortcuts/mod.rs +++ b/crates/menu/src/shortcuts/mod.rs @@ -110,7 +110,7 @@ mod review; mod rows; mod sets; mod state; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub mod summary; mod view; diff --git a/crates/menu/src/shortcuts/recorder.rs b/crates/menu/src/shortcuts/recorder.rs index affa21849c..f00a71a0c4 100644 --- a/crates/menu/src/shortcuts/recorder.rs +++ b/crates/menu/src/shortcuts/recorder.rs @@ -17,7 +17,7 @@ use craft_ui::runtime::focus::{self, FocusTarget, KeepKeys, KeyUse}; use craft_ui::style::{ComponentStyle, FocusLook, Ink, StyleCx, SurfaceKind, SurfaceLook, TextLook, TypeRole}; use egui::{Rect, Response, Ui, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The field claims bare Escape while recording, so it reaches the field as a chord (the keymap's recorder reads it as diff --git a/crates/menu/src/shortcuts/view.rs b/crates/menu/src/shortcuts/view.rs index cbb4858d71..66eb2fe12d 100644 --- a/crates/menu/src/shortcuts/view.rs +++ b/crates/menu/src/shortcuts/view.rs @@ -7,7 +7,7 @@ mod bars; mod detail; mod header; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod table; diff --git a/crates/pages/Cargo.toml b/crates/pages/Cargo.toml index 3bce55f00a..56e4703e07 100644 --- a/crates/pages/Cargo.toml +++ b/crates/pages/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The page widgets (`craft_pages::ui`), on craft-ui. ui = ["dep:craft-behavior", "dep:craft-ui", "dep:craft-theme", "dep:egui"] @@ -34,6 +35,6 @@ craft-theme = { workspace = true, optional = true } egui = { workspace = true, optional = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } craft-i18n = { workspace = true } diff --git a/crates/pages/src/lib.rs b/crates/pages/src/lib.rs index b369fa26f4..f9b94f6924 100644 --- a/crates/pages/src/lib.rs +++ b/crates/pages/src/lib.rs @@ -42,6 +42,7 @@ pub use setup::{MARGIN_PRESETS, MarginPreset, Margins, Orientation, PAPER_SIZES, /// The stories and trials this crate registers. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/pages/src/ui/column_bar.rs b/crates/pages/src/ui/column_bar.rs index 13fb5497a5..64b4ec37d3 100644 --- a/crates/pages/src/ui/column_bar.rs +++ b/crates/pages/src/ui/column_bar.rs @@ -2,7 +2,7 @@ //! column widths. A divider moves only the two columns it divides (`craft_behavior::divider`, `Give::Pair`); each keeps //! its least share, and the other columns keep theirs. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::divider::{Give, Segment, resize, travel}; diff --git a/crates/pages/src/ui/grid.rs b/crates/pages/src/ui/grid.rs index 063bee5935..c434aef539 100644 --- a/crates/pages/src/ui/grid.rs +++ b/crates/pages/src/ui/grid.rs @@ -2,7 +2,7 @@ //! boundaries (violet) and the baseline grid (light blue, from its zoom threshold) are hairlines drawn over the //! pages, under the selection. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use super::view::PlacedPage; diff --git a/crates/pages/src/ui/header_footer.rs b/crates/pages/src/ui/header_footer.rs index 52611db913..b079bd2e41 100644 --- a/crates/pages/src/ui/header_footer.rs +++ b/crates/pages/src/ui/header_footer.rs @@ -3,7 +3,7 @@ //! empty, a double click (or Enter on the focused section) starts editing it, and the app's editor takes the section's //! rectangle. What a section holds, its fields and the editor are the app's. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::kurbo::Point; diff --git a/crates/pages/src/ui/list.rs b/crates/pages/src/ui/list.rs index b6498c9833..5d192e127d 100644 --- a/crates/pages/src/ui/list.rs +++ b/crates/pages/src/ui/list.rs @@ -20,7 +20,7 @@ //! } //! ``` -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{ColumnKey, ColumnWidth, EditEvent, IconId, Mixed, Selection, SelectionChange, keyed}; diff --git a/crates/pages/src/ui/margins.rs b/crates/pages/src/ui/margins.rs index cc1f8a6f00..f204ac92f4 100644 --- a/crates/pages/src/ui/margins.rs +++ b/crates/pages/src/ui/margins.rs @@ -2,7 +2,7 @@ //! each ruler is the margin, the white the text area; the pointer over an edge shows a resize cursor and the margin's //! name, and a drag moves the margin as one edit gesture (one undo step). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::ops::RangeInclusive; diff --git a/crates/pages/src/ui/marks.rs b/crates/pages/src/ui/marks.rs index da2516dc0f..af7dc43b4a 100644 --- a/crates/pages/src/ui/marks.rs +++ b/crates/pages/src/ui/marks.rs @@ -3,7 +3,7 @@ //! ° no-break spaces, ¶ paragraph ends, # the end of a story. Extras: the overset mark (a red + in the out port) on a //! frame whose story does not fit, and frame outlines with their in and out ports. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::kurbo::{Point, Rect}; diff --git a/crates/pages/src/ui/preview.rs b/crates/pages/src/ui/preview.rs index 9c0736c42f..ae75489ee8 100644 --- a/crates/pages/src/ui/preview.rs +++ b/crates/pages/src/ui/preview.rs @@ -2,7 +2,7 @@ //! Files preview and VectorCraft's Place PDF page choice show it: the page as large as fits, "Page 3 of 12" under it, //! the arrow and Page keys to step from anywhere in the preview, Escape or Close to leave. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use super::view::PageSource; diff --git a/crates/pages/src/ui/range.rs b/crates/pages/src/ui/range.rs index 413656d2f3..7dc4dfd928 100644 --- a/crates/pages/src/ui/range.rs +++ b/crates/pages/src/ui/range.rs @@ -2,7 +2,7 @@ //! page choices, showing the pages back in the same format; and `PageRangeOptions`, the All pages / Pages from-to / Subset rows of //! Acrobat's Page Range Options. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{Codec, NotAValue, NumberCodec}; diff --git a/crates/pages/src/ui/reading.rs b/crates/pages/src/ui/reading.rs index 122fa690f0..6ca5231739 100644 --- a/crates/pages/src/ui/reading.rs +++ b/crates/pages/src/ui/reading.rs @@ -22,7 +22,7 @@ use egui::{CornerRadius, Pos2, Rect, Response, Ui, Vec2, pos2, vec2}; use super::view::PageSource; use crate::layout::SCREEN_POINTS_PER_POINT; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The page-turn parts: one over each gap between the columns and one over each side margin, indexed from the left. diff --git a/crates/pages/src/ui/setup.rs b/crates/pages/src/ui/setup.rs index 3eb897549f..e2b60b4e85 100644 --- a/crates/pages/src/ui/setup.rs +++ b/crates/pages/src/ui/setup.rs @@ -8,7 +8,7 @@ //! if let Some(choice) = PageLayoutMenus::new(&doc.page_setup()).unit(prefs.unit).margins(ui, &margins_button) { doc.apply(choice) } //! ``` -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::ops::RangeInclusive; diff --git a/crates/pages/src/ui/table/mod.rs b/crates/pages/src/ui/table/mod.rs index a69f17f028..04eab77590 100644 --- a/crates/pages/src/ui/table/mod.rs +++ b/crates/pages/src/ui/table/mod.rs @@ -6,7 +6,7 @@ pub mod edges; pub mod properties; pub mod selection; pub mod size_picker; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use edges::{BorderEdges, BorderPreset, EdgeKey, EdgePicker, EdgePickerStyle, EdgePickerWords}; diff --git a/crates/pages/src/ui/text_selection.rs b/crates/pages/src/ui/text_selection.rs index d8b60b1641..422891087a 100644 --- a/crates/pages/src/ui/text_selection.rs +++ b/crates/pages/src/ui/text_selection.rs @@ -17,7 +17,7 @@ use egui::{CornerRadius, Pos2, Response, Vec2, pos2}; use super::view::PlacedPage; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// A page's text as the selection reads it, glyph by glyph in reading order. Rectangles are page points (origin diff --git a/crates/pages/src/ui/thumbnails.rs b/crates/pages/src/ui/thumbnails.rs index 2f5e54fbe0..d45ce50152 100644 --- a/crates/pages/src/ui/thumbnails.rs +++ b/crates/pages/src/ui/thumbnails.rs @@ -20,7 +20,7 @@ //! } //! ``` -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use super::view::PageSource; diff --git a/crates/pages/src/ui/view.rs b/crates/pages/src/ui/view.rs index 478ecd3b9c..b9893ff3b7 100644 --- a/crates/pages/src/ui/view.rs +++ b/crates/pages/src/ui/view.rs @@ -19,7 +19,7 @@ //! ``` mod pictures; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use self::pictures::{PageMetrics, PagePictures}; diff --git a/crates/print/Cargo.toml b/crates/print/Cargo.toml index a3a14b1b8e..347de2d6b4 100644 --- a/crates/print/Cargo.toml +++ b/crates/print/Cargo.toml @@ -14,6 +14,7 @@ autotests = false harness = false [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The printer and job settings widgets (`craft_print::ui`). ui = ["dep:craft-behavior", "dep:craft-ui", "dep:egui", "dep:serde_json"] @@ -65,7 +66,7 @@ roxmltree = "0.21" miniz_oxide = "0.9" [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } tempfile = "3" roxmltree = "0.21" miniz_oxide = "0.9" diff --git a/crates/print/src/lib.rs b/crates/print/src/lib.rs index 356d3f7c92..05c6c287be 100644 --- a/crates/print/src/lib.rs +++ b/crates/print/src/lib.rs @@ -39,6 +39,7 @@ pub mod ui; /// The registrations of this crate's UI types, for its integration binary. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/print/src/ui/mod.rs b/crates/print/src/ui/mod.rs index 5ee97c0478..e3033f364d 100644 --- a/crates/print/src/ui/mod.rs +++ b/crates/print/src/ui/mod.rs @@ -3,7 +3,7 @@ mod dialog; mod panel; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use dialog::{HostedPrint, PrintAnswer, PrintDialog, PrintDialogOutput, PrintDialogWords, PrintFinish, PrintMarks, PrintSection, PrintSheet}; diff --git a/crates/review/Cargo.toml b/crates/review/Cargo.toml index ec5db4281a..08fb97f3db 100644 --- a/crates/review/Cargo.toml +++ b/crates/review/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The review widgets (`craft_review::ui`). ui = ["dep:craft-keymap", "dep:craft-ui", "dep:craft-host", "dep:craft-theme", "dep:egui", "dep:image"] @@ -36,6 +37,6 @@ kurbo = { workspace = true, features = ["serde"] } serde = { workspace = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } serde_json = { workspace = true } diff --git a/crates/review/src/lib.rs b/crates/review/src/lib.rs index c27a790fda..22379b1144 100644 --- a/crates/review/src/lib.rs +++ b/crates/review/src/lib.rs @@ -20,6 +20,7 @@ pub mod ui; /// The stories and word sets the integration tests register. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/review/src/ui/annotate.rs b/crates/review/src/ui/annotate.rs index 7472397a75..559fdb29fc 100644 --- a/crates/review/src/ui/annotate.rs +++ b/crates/review/src/ui/annotate.rs @@ -1,7 +1,7 @@ //! The annotation tool on the canvas, the overlay that draws annotations, and the toolbar. mod overlay; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod tool; mod toolbar; diff --git a/crates/review/src/ui/avatar.rs b/crates/review/src/ui/avatar.rs index 567ccce637..696b38fd54 100644 --- a/crates/review/src/ui/avatar.rs +++ b/crates/review/src/ui/avatar.rs @@ -9,7 +9,7 @@ use egui::{Color32, Rect, Response, Vec2}; use crate::collab::initials; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// Paints a round face filling `rect`: `fill` with the initials of `name` centred on it, in the ink that reads on `fill`. diff --git a/crates/review/src/ui/chat.rs b/crates/review/src/ui/chat.rs index 5afeb73139..ba07516afc 100644 --- a/crates/review/src/ui/chat.rs +++ b/crates/review/src/ui/chat.rs @@ -14,7 +14,7 @@ use egui::{Color32, CornerRadius, Pos2, Rect, Response, Ui, Vec2}; use crate::collab::CollabRequest; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/review/src/ui/comments.rs b/crates/review/src/ui/comments.rs index b6eabc76a6..6275509813 100644 --- a/crates/review/src/ui/comments.rs +++ b/crates/review/src/ui/comments.rs @@ -14,7 +14,7 @@ mod list; mod menus; mod row; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::collections::BTreeMap; diff --git a/crates/review/src/ui/join.rs b/crates/review/src/ui/join.rs index 78b8a61192..fdfacbcc0d 100644 --- a/crates/review/src/ui/join.rs +++ b/crates/review/src/ui/join.rs @@ -12,7 +12,7 @@ use egui::{Response, Ui}; use crate::collab::{CollabRequest, CollabTransport, JoinState}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/review/src/ui/presence.rs b/crates/review/src/ui/presence.rs index f229a24ad5..a20e7ec695 100644 --- a/crates/review/src/ui/presence.rs +++ b/crates/review/src/ui/presence.rs @@ -22,7 +22,7 @@ use super::avatar::Avatar; use super::chat::{BubbleLook, paint_chat_bubble}; use crate::collab::{CHAT_FADE_S, CHAT_HOLD_S, CollabRequest, CollabTransport, Participant, ParticipantId, chat_alpha}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// Most selection outlines drawn for one person. diff --git a/crates/review/src/ui/revisions.rs b/crates/review/src/ui/revisions.rs index 7d74a3662d..b7cba275cf 100644 --- a/crates/review/src/ui/revisions.rs +++ b/crates/review/src/ui/revisions.rs @@ -16,7 +16,7 @@ use egui::{CornerRadius, Response, Ui, Vec2}; use crate::revisions::{Revision, RevisionAction, RevisionKind}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The detail lines a card shows. diff --git a/crates/review/src/ui/signature.rs b/crates/review/src/ui/signature.rs index 217b6aad8a..7155eeff38 100644 --- a/crates/review/src/ui/signature.rs +++ b/crates/review/src/ui/signature.rs @@ -28,7 +28,7 @@ use egui::{ColorImage, Pos2, Rect, Vec2}; use crate::signature::{MAX_IMAGE_BYTES, MAX_IMAGE_SIDE, MAX_SIGNATURE_CHARS, SavedSignature, SignatureDraft, SignatureImage, SignatureTab}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The pad's width over its height. diff --git a/crates/review/src/ui/thread.rs b/crates/review/src/ui/thread.rs index 6687ef6532..25ae66c4d3 100644 --- a/crates/review/src/ui/thread.rs +++ b/crates/review/src/ui/thread.rs @@ -8,7 +8,7 @@ mod mention; mod pins; mod popover; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use mention::{insert_mention, mention_matches, mention_query}; diff --git a/crates/review/src/ui/versions.rs b/crates/review/src/ui/versions.rs index bcd7877d16..2844b6a4cc 100644 --- a/crates/review/src/ui/versions.rs +++ b/crates/review/src/ui/versions.rs @@ -29,7 +29,7 @@ use crate::versions::{Branch, BranchId, BranchState, HistoryRow, Version, Versio /// The most lines of a version's description a row shows. const DESCRIPTION_LINES: u8 = 3; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/review/src/ui/vote.rs b/crates/review/src/ui/vote.rs index 9937b547a2..ea137108fd 100644 --- a/crates/review/src/ui/vote.rs +++ b/crates/review/src/ui/vote.rs @@ -13,7 +13,7 @@ use egui::{Response, Ui}; use crate::collab::{CollabRequest, CollabTransport, VoteScope}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// Votes per person a new vote starts with. diff --git a/crates/table/Cargo.toml b/crates/table/Cargo.toml index c1573bdb94..ae18662897 100644 --- a/crates/table/Cargo.toml +++ b/crates/table/Cargo.toml @@ -15,6 +15,7 @@ test = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The table widgets (`craft_table::ui`). ui = ["dep:craft-ui", "dep:craft-behavior", "dep:craft-keymap", "dep:craft-theme", "dep:egui"] @@ -29,11 +30,11 @@ craft-ui = { workspace = true, optional = true } egui = { workspace = true, optional = true } [dev-dependencies] -craft-table = { path = ".", features = ["screen-testing"] } +craft-table = { path = ".", features = ["suite"] } egui = { workspace = true } [[test]] name = "it" path = "tests/it/main.rs" harness = false -required-features = ["screen-testing"] +required-features = ["suite"] diff --git a/crates/table/src/ui/chart.rs b/crates/table/src/ui/chart.rs index 74ec981715..23d04e0b47 100644 --- a/crates/table/src/ui/chart.rs +++ b/crates/table/src/ui/chart.rs @@ -5,7 +5,7 @@ use craft_ui::primitives::{DataStrokeWidth, Draw, PaintShape, TextRun}; use craft_ui::style::{DataColor, StyleColor}; use egui::{CornerRadius, Pos2, Rect, pos2, vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// A document line width never shrinks below this share of its width at 100 % zoom (a zoom floor, not a size). diff --git a/crates/table/src/ui/conditions.rs b/crates/table/src/ui/conditions.rs index 3825a0508c..5a4433ad69 100644 --- a/crates/table/src/ui/conditions.rs +++ b/crates/table/src/ui/conditions.rs @@ -18,7 +18,7 @@ use craft_ui::style::SurfaceKind; use craft_ui::text::{NumberField, TextField}; use egui::{Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/table/src/ui/error_tag.rs b/crates/table/src/ui/error_tag.rs index c91db70db5..9178f88871 100644 --- a/crates/table/src/ui/error_tag.rs +++ b/crates/table/src/ui/error_tag.rs @@ -16,7 +16,7 @@ use craft_ui::runtime::env::WordSet as _; use craft_ui::style::{ComponentStyle, FocusLook, IconLook, StyleCx, SurfaceLook}; use egui::{Rect, Response, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/table/src/ui/fields.rs b/crates/table/src/ui/fields.rs index a94e17f208..5bd4c1f1d0 100644 --- a/crates/table/src/ui/fields.rs +++ b/crates/table/src/ui/fields.rs @@ -21,7 +21,7 @@ use craft_ui::sections::Panel; use craft_ui::style::{SurfaceKind, TypeRole}; use egui::{Id, Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/table/src/ui/filter.rs b/crates/table/src/ui/filter.rs index 2bd5488cd0..4e15592d90 100644 --- a/crates/table/src/ui/filter.rs +++ b/crates/table/src/ui/filter.rs @@ -11,7 +11,7 @@ use craft_ui::primitives::IconSpec; use craft_ui::style::{ComponentStyle, FocusLook, IconLook, StyleCx, SurfaceLook}; use egui::{Rect, Response, Vec2, pos2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/table/src/ui/grid.rs b/crates/table/src/ui/grid.rs index 5fb00d4005..afb4fa0cc3 100644 --- a/crates/table/src/ui/grid.rs +++ b/crates/table/src/ui/grid.rs @@ -26,7 +26,7 @@ mod model; mod paint; mod reference; mod row; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use geometry::{GridLayout, HEADER_MIN_ZOOM, SheetGeometry, SheetMetrics}; diff --git a/crates/table/src/ui/mod.rs b/crates/table/src/ui/mod.rs index 2386a8e7a8..91660e5d46 100644 --- a/crates/table/src/ui/mod.rs +++ b/crates/table/src/ui/mod.rs @@ -30,6 +30,7 @@ pub mod stats; /// The registrations of the table widgets' stories and trials. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/table/src/ui/outline.rs b/crates/table/src/ui/outline.rs index 40ea459f5e..0ef2efa2bb 100644 --- a/crates/table/src/ui/outline.rs +++ b/crates/table/src/ui/outline.rs @@ -12,7 +12,7 @@ use egui::{CornerRadius, Pos2, Rect, Response, Vec2, pos2, vec2}; use super::grid::{CellAt, CellRange, SheetGeometry, column_letters}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/table/src/ui/slicer.rs b/crates/table/src/ui/slicer.rs index a3cf1863bb..bc05f83478 100644 --- a/crates/table/src/ui/slicer.rs +++ b/crates/table/src/ui/slicer.rs @@ -17,7 +17,7 @@ use craft_ui::sections::{HeaderStrength, TitleRow}; use craft_ui::style::{ComponentStyle, Flags, FocusLook, Stateful, StyleColor, StyleCx, SurfaceKind, SurfaceLook, TextLook, TypeRole, UiTokens}; use egui::{Rect, Response, Ui, Vec2, pos2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/table/src/ui/stats.rs b/crates/table/src/ui/stats.rs index 22ff65ea5c..182bc63323 100644 --- a/crates/table/src/ui/stats.rs +++ b/crates/table/src/ui/stats.rs @@ -15,7 +15,7 @@ use craft_ui::runtime::env::Label; use craft_ui::style::{ComponentStyle, FocusLook, StyleCx, TextLook}; use egui::{Rect, Response, Vec2}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 39be256830..f173f309ab 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -45,13 +45,14 @@ serde_json = { workspace = true, optional = true } [dev-dependencies] unicode-segmentation = "1.13" -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } [[example]] name = "hyphgen" required-features = ["generator"] [features] +suite = ["screen-testing", "craft-ui/suite"] positioned = ["dep:kurbo"] default = ["hyphen", "bidi", "segment"] # Hyphenation points; English (bundled dictionary and patterns) needs no further feature. diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index 8b1230a65f..d402923f4a 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -58,6 +58,7 @@ pub mod ui; /// The stories and trials of the crate's UI, registered in craft-ui's registry. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/text/src/ui/character.rs b/crates/text/src/ui/character.rs index 4d45ed78f2..c74e61afbc 100644 --- a/crates/text/src/ui/character.rs +++ b/crates/text/src/ui/character.rs @@ -32,7 +32,7 @@ use egui::{Response, Ui}; pub(crate) mod paragraph; mod paragraph_dialog; pub(crate) mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod style_options; diff --git a/crates/text/src/ui/character/style_options.rs b/crates/text/src/ui/character/style_options.rs index d0f100b660..4de90ff8de 100644 --- a/crates/text/src/ui/character/style_options.rs +++ b/crates/text/src/ui/character/style_options.rs @@ -30,7 +30,7 @@ use crate::ui::length::DocUnit; #[cfg(feature = "font-picker")] use super::FontPickerSource; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/text/src/ui/columns.rs b/crates/text/src/ui/columns.rs index 959d21c78a..9e20f79a70 100644 --- a/crates/text/src/ui/columns.rs +++ b/crates/text/src/ui/columns.rs @@ -23,7 +23,7 @@ use craft_ui::text::{NumberField, NumberOutput}; use egui::{Pos2, Rect, Ui, Vec2, pos2, vec2}; use std::cell::Cell; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The most columns PowerPoint takes; the diff --git a/crates/text/src/ui/editor.rs b/crates/text/src/ui/editor.rs index ddc86013a9..2a69077ed9 100644 --- a/crates/text/src/ui/editor.rs +++ b/crates/text/src/ui/editor.rs @@ -23,7 +23,7 @@ mod commands; mod edits; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::ops::Range; diff --git a/crates/text/src/ui/find.rs b/crates/text/src/ui/find.rs index 7e6754ef9e..b952d3ecb0 100644 --- a/crates/text/src/ui/find.rs +++ b/crates/text/src/ui/find.rs @@ -3,7 +3,7 @@ //! Replace and Go To tabs, Search Options, Replace and Replace All) and PowerPoint's simpler Find / Replace, on the //! dialog stack. Both search with [`crate::find`]; the document's text and the replacing are the app's. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod bar; diff --git a/crates/text/src/ui/hyperlink.rs b/crates/text/src/ui/hyperlink.rs index ee0705b047..05b840783c 100644 --- a/crates/text/src/ui/hyperlink.rs +++ b/crates/text/src/ui/hyperlink.rs @@ -19,7 +19,7 @@ use craft_ui::sections::{DialogRole, FooterButton}; use craft_ui::text::TextField; use egui::{Context, Response, Ui}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/text/src/ui/notes.rs b/crates/text/src/ui/notes.rs index c55c616e2a..34584de01f 100644 --- a/crates/text/src/ui/notes.rs +++ b/crates/text/src/ui/notes.rs @@ -5,7 +5,7 @@ //! //! The notes are the app's; [`NotesText`] is the shape the editor reads and writes. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod text; diff --git a/crates/text/src/ui/path_text.rs b/crates/text/src/ui/path_text.rs index c9473f093b..06c5f252bd 100644 --- a/crates/text/src/ui/path_text.rs +++ b/crates/text/src/ui/path_text.rs @@ -1,6 +1,6 @@ //! `PathTextMarkers`: the start, end and overflow marks of text laid on a path, a canvas control. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::kurbo::{Point, Vec2 as PathVec}; diff --git a/crates/text/src/ui/ruler.rs b/crates/text/src/ui/ruler.rs index fd2e4c1c84..d67e4178bb 100644 --- a/crates/text/src/ui/ruler.rs +++ b/crates/text/src/ui/ruler.rs @@ -28,7 +28,7 @@ mod geometry; mod items; mod paint; mod run; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use geometry::{Geometry, Shapes}; diff --git a/crates/text/src/ui/spelling.rs b/crates/text/src/ui/spelling.rs index 97951e67ff..8fdbb163ee 100644 --- a/crates/text/src/ui/spelling.rs +++ b/crates/text/src/ui/spelling.rs @@ -41,7 +41,7 @@ use egui::{Context, Response, Ui}; use serde::{Deserialize, Serialize}; use serde_json::{Value, json}; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/text/src/ui/style_panel.rs b/crates/text/src/ui/style_panel.rs index 53b87ee00b..8cbd44b443 100644 --- a/crates/text/src/ui/style_panel.rs +++ b/crates/text/src/ui/style_panel.rs @@ -19,7 +19,7 @@ use egui::{Response, Ui}; use std::cell::Cell; mod picker; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use picker::{NamedStyleRow, StylePreview, style_rows}; diff --git a/crates/text/src/ui/tabs_dialog.rs b/crates/text/src/ui/tabs_dialog.rs index 293cea5ece..315364933f 100644 --- a/crates/text/src/ui/tabs_dialog.rs +++ b/crates/text/src/ui/tabs_dialog.rs @@ -30,7 +30,7 @@ use egui::Ui; use std::borrow::Cow; use std::cell::RefCell; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; const POSITION: ColumnKey = ColumnKey::new("position"); diff --git a/crates/text/src/ui/type_bar.rs b/crates/text/src/ui/type_bar.rs index 10d3b62142..b53637718e 100644 --- a/crates/text/src/ui/type_bar.rs +++ b/crates/text/src/ui/type_bar.rs @@ -29,7 +29,7 @@ use crate::ui::type_options::{TextAntiAlias, TextOrientation, TypeOptionWords}; #[cfg(feature = "font-picker")] use crate::ui::character::FontPickerSource; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/theme-editor/Cargo.toml b/crates/theme-editor/Cargo.toml index 117c883be9..2df8725a8d 100644 --- a/crates/theme-editor/Cargo.toml +++ b/crates/theme-editor/Cargo.toml @@ -13,6 +13,7 @@ autotests = false harness = false [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The panels' stories. screen-testing = ["craft-ui/testing"] @@ -24,7 +25,7 @@ craft-ui = { workspace = true } egui = { workspace = true } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } [lints] workspace = true diff --git a/crates/theme-editor/src/lib.rs b/crates/theme-editor/src/lib.rs index 22bb4063d0..ff5bd4e041 100644 --- a/crates/theme-editor/src/lib.rs +++ b/crates/theme-editor/src/lib.rs @@ -10,7 +10,7 @@ mod detail; mod layer; mod problems; mod rows; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; mod subject; mod words; @@ -26,6 +26,7 @@ pub use words::summary; /// The stories this crate registers for the integration binary. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/theme-store/Cargo.toml b/crates/theme-store/Cargo.toml index d92130fcdc..7e46b9911b 100644 --- a/crates/theme-store/Cargo.toml +++ b/crates/theme-store/Cargo.toml @@ -14,6 +14,7 @@ autotests = false harness = false [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # `craft_theme_store::ui`: the Preferences appearance page and its theme chips. ui = ["dep:craft-behavior", "dep:craft-ui", "dep:egui"] @@ -33,7 +34,7 @@ craft-atomic = { workspace = true } dirs = "7" [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } tempfile = "3" [lints] diff --git a/crates/theme-store/src/ui/mod.rs b/crates/theme-store/src/ui/mod.rs index cd11f8476a..b2b89756ad 100644 --- a/crates/theme-store/src/ui/mod.rs +++ b/crates/theme-store/src/ui/mod.rs @@ -2,10 +2,11 @@ mod chip; mod page; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; #[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] craft_ui::testing_registered!(); pub use chip::{ThemeChip, ThemeChipOutput, ThemeChipStyle}; diff --git a/crates/timeline/Cargo.toml b/crates/timeline/Cargo.toml index a588eb43af..165a0c4990 100644 --- a/crates/timeline/Cargo.toml +++ b/crates/timeline/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] default = [] # The timeline widgets (`craft_timeline::ui`). ui = ["dep:craft-behavior", "dep:craft-keymap", "dep:craft-theme", "dep:craft-ui", "dep:egui"] @@ -40,7 +41,7 @@ serde_json = { workspace = true, optional = true } web-time = "1.1" [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } egui = { workspace = true } proptest = { workspace = true } serde_json = { workspace = true } diff --git a/crates/timeline/src/lib.rs b/crates/timeline/src/lib.rs index 38f91b7356..5f15caa644 100644 --- a/crates/timeline/src/lib.rs +++ b/crates/timeline/src/lib.rs @@ -86,6 +86,7 @@ mod timecode_tests; /// The stories and trials this crate registers. #[cfg(feature = "screen-testing")] pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/timeline/src/ui/graph.rs b/crates/timeline/src/ui/graph.rs index 0f90f62bf3..1ab5d846c4 100644 --- a/crates/timeline/src/ui/graph.rs +++ b/crates/timeline/src/ui/graph.rs @@ -1,7 +1,7 @@ //! `GraphEditor`: keyframed values (or their speed) as curves over time (N1.08), a leaf with a content painter for the //! plot and parts for the keys, the handles and the bottom bar. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::kurbo; diff --git a/crates/timeline/src/ui/keyframes.rs b/crates/timeline/src/ui/keyframes.rs index fb5aa620f1..a5da02a597 100644 --- a/crates/timeline/src/ui/keyframes.rs +++ b/crates/timeline/src/ui/keyframes.rs @@ -1,6 +1,6 @@ //! Keyframe lanes, the keyframe navigator and the animation toggle (N1.04). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/timeline/src/ui/markers.rs b/crates/timeline/src/ui/markers.rs index 897e1f542d..bad737ea8e 100644 --- a/crates/timeline/src/ui/markers.rs +++ b/crates/timeline/src/ui/markers.rs @@ -1,7 +1,7 @@ //! Markers on a ruler or a clip bar, and the Marker dialog (N1.12). mod dialog; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; pub use dialog::{MarkerDialog, MarkerDialogAction, MarkerDialogResult, MarkerDraft}; diff --git a/crates/timeline/src/ui/overview.rs b/crates/timeline/src/ui/overview.rs index 42c349c2f4..1a40d565f8 100644 --- a/crates/timeline/src/ui/overview.rs +++ b/crates/timeline/src/ui/overview.rs @@ -1,6 +1,6 @@ //! The whole timeline in miniature (N1.13). -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{Axis, Metrics, PointerButton, PressPhase, Sense}; diff --git a/crates/timeline/src/ui/panel.rs b/crates/timeline/src/ui/panel.rs index c9b1f656b3..059da322e5 100644 --- a/crates/timeline/src/ui/panel.rs +++ b/crates/timeline/src/ui/panel.rs @@ -872,7 +872,7 @@ pub struct TopStripStyle { metrics: Metrics, } -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; /// The model of the pattern's registration probe: no tracks. diff --git a/crates/timeline/src/ui/preview.rs b/crates/timeline/src/ui/preview.rs index 75486fe732..42029e1b76 100644 --- a/crates/timeline/src/ui/preview.rs +++ b/crates/timeline/src/ui/preview.rs @@ -1,6 +1,6 @@ //! A decoded frame fitted in a panel, with a status line. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{Axis, Metrics, Sense}; diff --git a/crates/timeline/src/ui/render_queue.rs b/crates/timeline/src/ui/render_queue.rs index 38694bad90..0e67d99f3c 100644 --- a/crates/timeline/src/ui/render_queue.rs +++ b/crates/timeline/src/ui/render_queue.rs @@ -1,6 +1,6 @@ //! The render (export) queue list. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use std::borrow::Cow; diff --git a/crates/timeline/src/ui/ruler.rs b/crates/timeline/src/ui/ruler.rs index a5b132deb4..0fc261e497 100644 --- a/crates/timeline/src/ui/ruler.rs +++ b/crates/timeline/src/ui/ruler.rs @@ -1,7 +1,7 @@ //! `TimelineRuler`: the time ruler across the top of a timeline (N1.01), a leaf that reads the `TimeAxis` of the //! `TimelineView` around it. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{Axis, CursorIcon, HitLevel, HitPriority, Metrics, NavMove, PartKey, PointerButton, PressPhase, RulerUnits, Sense, Ticks}; diff --git a/crates/timeline/src/ui/stack.rs b/crates/timeline/src/ui/stack.rs index 84346cb84e..6a466738af 100644 --- a/crates/timeline/src/ui/stack.rs +++ b/crates/timeline/src/ui/stack.rs @@ -817,5 +817,5 @@ pub(crate) fn set_event(before: T, after: T, label: &str) -> EditEvent { EditEvent::set(Mixed::Same(before), after, Arc::from(label), None) } -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/timeline/src/ui/timecode.rs b/crates/timeline/src/ui/timecode.rs index 096363dec2..18b2dfe552 100644 --- a/crates/timeline/src/ui/timecode.rs +++ b/crates/timeline/src/ui/timecode.rs @@ -1,7 +1,7 @@ //! The timecode field, its codec and the Timecode panel. mod readout; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::nav::LARGE_STEPS; diff --git a/crates/timeline/src/ui/transport.rs b/crates/timeline/src/ui/transport.rs index b8c8a457d9..3021732a25 100644 --- a/crates/timeline/src/ui/transport.rs +++ b/crates/timeline/src/ui/transport.rs @@ -1,6 +1,6 @@ //! A monitor's transport bar and the compact media controls. -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; use craft_behavior::{EditEvents, IconId}; diff --git a/crates/timeline/src/ui/view.rs b/crates/timeline/src/ui/view.rs index d3420d63d7..6787c3147e 100644 --- a/crates/timeline/src/ui/view.rs +++ b/crates/timeline/src/ui/view.rs @@ -632,5 +632,5 @@ impl Outcome for TimelineViewOutput { } } -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] pub(crate) mod stories; diff --git a/crates/ui-canvas/Cargo.toml b/crates/ui-canvas/Cargo.toml index fe58c30591..4353a3d3d2 100644 --- a/crates/ui-canvas/Cargo.toml +++ b/crates/ui-canvas/Cargo.toml @@ -15,6 +15,7 @@ test = false workspace = true [features] +suite = ["testing", "craft-ui-panels/suite"] default = [] # `craft_ui::testing` with the canvas test helpers (`ToolFixture`, `tool_story`, `canvas_story`). testing = ["craft-ui-panels/testing"] @@ -31,7 +32,7 @@ serde = { workspace = true } serde_json = { workspace = true } [dev-dependencies] -craft-ui-canvas = { path = ".", features = ["testing"] } +craft-ui-canvas = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-keymap = { workspace = true, features = ["egui"] } craft-ui-test-kit = { workspace = true } diff --git a/crates/ui-canvas/src/canvas/crop/mod.rs b/crates/ui-canvas/src/canvas/crop/mod.rs index f2a9256ac7..0177699e7f 100644 --- a/crates/ui-canvas/src/canvas/crop/mod.rs +++ b/crates/ui-canvas/src/canvas/crop/mod.rs @@ -5,7 +5,7 @@ mod gesture; mod paint; mod shield; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::words::CanvasWords; diff --git a/crates/ui-canvas/src/canvas/full_window.rs b/crates/ui-canvas/src/canvas/full_window.rs index 8634c82fcd..ca4ec57277 100644 --- a/crates/ui-canvas/src/canvas/full_window.rs +++ b/crates/ui-canvas/src/canvas/full_window.rs @@ -21,9 +21,9 @@ use egui::Ui; pub use hosted::{FullWindowWorkspace, HostedWorkspace, WorkspaceCx, WorkspacePass}; mod hosted; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod trials; /// The style of a full-window dialog: the surface comes from the container. diff --git a/crates/ui-canvas/src/canvas/full_window_parts.rs b/crates/ui-canvas/src/canvas/full_window_parts.rs index 93aa1264b3..de4ecfa5ae 100644 --- a/crates/ui-canvas/src/canvas/full_window_parts.rs +++ b/crates/ui-canvas/src/canvas/full_window_parts.rs @@ -4,7 +4,7 @@ mod canvas; mod side; mod status; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod title; mod view; diff --git a/crates/ui-canvas/src/canvas/mod.rs b/crates/ui-canvas/src/canvas/mod.rs index 2439b191d2..fd14825bce 100644 --- a/crates/ui-canvas/src/canvas/mod.rs +++ b/crates/ui-canvas/src/canvas/mod.rs @@ -15,7 +15,7 @@ pub(crate) mod full_window_parts; mod march; mod readout; mod space; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; #[cfg(feature = "testing")] pub(crate) mod testing; diff --git a/crates/ui-canvas/src/canvas/navigate/mod.rs b/crates/ui-canvas/src/canvas/navigate/mod.rs index 93b3a32637..def611c7f5 100644 --- a/crates/ui-canvas/src/canvas/navigate/mod.rs +++ b/crates/ui-canvas/src/canvas/navigate/mod.rs @@ -9,7 +9,7 @@ mod bar; mod keys; mod options; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod wheel; diff --git a/crates/ui-canvas/src/canvas/navigator/mod.rs b/crates/ui-canvas/src/canvas/navigator/mod.rs index 87d4d7c8ce..356c4aea56 100644 --- a/crates/ui-canvas/src/canvas/navigator/mod.rs +++ b/crates/ui-canvas/src/canvas/navigator/mod.rs @@ -12,7 +12,7 @@ mod menu; mod preview; mod proxy; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod zoom_row; diff --git a/crates/ui-canvas/src/canvas/navigator_panel.rs b/crates/ui-canvas/src/canvas/navigator_panel.rs index eea453822b..24ec2e0aa2 100644 --- a/crates/ui-canvas/src/canvas/navigator_panel.rs +++ b/crates/ui-canvas/src/canvas/navigator_panel.rs @@ -8,7 +8,7 @@ use craft_behavior::kurbo::Size; use craft_behavior::{CanvasView, EditEvents}; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// What the Navigator panel reports. diff --git a/crates/ui-canvas/src/canvas/pasteboard/mod.rs b/crates/ui-canvas/src/canvas/pasteboard/mod.rs index ecc5d9c906..7426f103c0 100644 --- a/crates/ui-canvas/src/canvas/pasteboard/mod.rs +++ b/crates/ui-canvas/src/canvas/pasteboard/mod.rs @@ -3,7 +3,7 @@ //! preferences; the default colour is the canvas surround. Artboards show their names above them, and a click on a //! name selects the artboard. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::space::canvas_space; diff --git a/crates/ui-canvas/src/canvas/raster/mod.rs b/crates/ui-canvas/src/canvas/raster/mod.rs index 8aa376bbdf..81b8e6e577 100644 --- a/crates/ui-canvas/src/canvas/raster/mod.rs +++ b/crates/ui-canvas/src/canvas/raster/mod.rs @@ -15,7 +15,7 @@ //! The display takes no pointer and no keys and declares no parts: a press on it reaches the canvas's tool. mod detail; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use detail::{DetailPlan, snap_to_texels}; diff --git a/crates/ui-canvas/src/canvas/rulers/mod.rs b/crates/ui-canvas/src/canvas/rulers/mod.rs index f30d57f3a5..0e02bdf016 100644 --- a/crates/ui-canvas/src/canvas/rulers/mod.rs +++ b/crates/ui-canvas/src/canvas/rulers/mod.rs @@ -2,7 +2,7 @@ //! control (20.6). The strips and the corner are parts at handle priority in the canvas's arena. A drag from a strip //! reports a guide being placed; a drag from the corner moves the zero point. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod ticks; diff --git a/crates/ui-canvas/src/canvas/scrollbars/mod.rs b/crates/ui-canvas/src/canvas/scrollbars/mod.rs index 021b78a5bb..677e6c0f68 100644 --- a/crates/ui-canvas/src/canvas/scrollbars/mod.rs +++ b/crates/ui-canvas/src/canvas/scrollbars/mod.rs @@ -9,7 +9,7 @@ //! The bars measure the view along the screen axes, so on a rotated view they show the extent of the unrotated //! document. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::words::CanvasWords; diff --git a/crates/ui-canvas/src/canvas/split/mod.rs b/crates/ui-canvas/src/canvas/split/mod.rs index 0f2804e87d..739496afad 100644 --- a/crates/ui-canvas/src/canvas/split/mod.rs +++ b/crates/ui-canvas/src/canvas/split/mod.rs @@ -7,7 +7,7 @@ //! the [`SplitAt`] the caller binds ([`SplitAt::placed`]). A linked pane follows the active view's zoom and position //! ([`SplitViews::follow`]). -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::words::SplitWords; diff --git a/crates/ui-canvas/src/canvas_controls/brush/mod.rs b/crates/ui-canvas/src/canvas_controls/brush/mod.rs index 25475f0c59..d030aab84c 100644 --- a/crates/ui-canvas/src/canvas_controls/brush/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/brush/mod.rs @@ -26,7 +26,7 @@ mod cursor; mod falloff; mod resize; mod source_marker; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod tip; mod trail; diff --git a/crates/ui-canvas/src/canvas_controls/grid/mod.rs b/crates/ui-canvas/src/canvas_controls/grid/mod.rs index c37b1929df..885f861b88 100644 --- a/crates/ui-canvas/src/canvas_controls/grid/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/grid/mod.rs @@ -2,7 +2,7 @@ //! the document grid of Preferences > Guides, Grid & Slices. Display only: it senses nothing, so the host's menu item //! carries the state. Show it before guides and frames. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(super) mod stories; use crate::canvas::{CanvasSpace, GuideLine, canvas_space}; diff --git a/crates/ui-canvas/src/canvas_controls/guides/mod.rs b/crates/ui-canvas/src/canvas_controls/guides/mod.rs index 36be120da3..e6ab7a77df 100644 --- a/crates/ui-canvas/src/canvas_controls/guides/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/guides/mod.rs @@ -3,7 +3,7 @@ mod place; pub mod reading; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use reading::GuideReading; diff --git a/crates/ui-canvas/src/canvas_controls/marquee/mod.rs b/crates/ui-canvas/src/canvas_controls/marquee/mod.rs index 410bfa5597..b96d07fb19 100644 --- a/crates/ui-canvas/src/canvas_controls/marquee/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/marquee/mod.rs @@ -2,7 +2,7 @@ //! selection band or an outline being drawn over the canvas, mapped from document geometry through the canvas's view. //! It takes no pointer and no key: the press, the drag and the modifier rules are the canvas tool's. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(super) mod stories; use super::words::CanvasControlWords; diff --git a/crates/ui-canvas/src/canvas_controls/outline/mod.rs b/crates/ui-canvas/src/canvas_controls/outline/mod.rs index 150ffeb5b8..e9f78090c4 100644 --- a/crates/ui-canvas/src/canvas_controls/outline/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/outline/mod.rs @@ -3,7 +3,7 @@ //! share one stroking function over `kit::outline` (halo and line) and `kit::dashed`. mod hover; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(super) mod stories; use crate::canvas::canvas_space; diff --git a/crates/ui-canvas/src/canvas_controls/pixel_grid/mod.rs b/crates/ui-canvas/src/canvas_controls/pixel_grid/mod.rs index 5901a85981..1cbc42d832 100644 --- a/crates/ui-canvas/src/canvas_controls/pixel_grid/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/pixel_grid/mod.rs @@ -7,7 +7,7 @@ //! display and keeps the merged line segments per revision and padded region in the control's memory, so panning //! within the padding costs nothing and the work is bounded by the viewport. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(super) mod stories; use crate::canvas::{PixelRect, RasterSource, canvas_space}; diff --git a/crates/ui-canvas/src/canvas_controls/smart_guides/mod.rs b/crates/ui-canvas/src/canvas_controls/smart_guides/mod.rs index 265c9b2b11..2ba6bd6e08 100644 --- a/crates/ui-canvas/src/canvas_controls/smart_guides/mod.rs +++ b/crates/ui-canvas/src/canvas_controls/smart_guides/mod.rs @@ -1,7 +1,7 @@ //! `SmartGuides`: the alignment lines and distances shown while something moves, a canvas control that only paints //! (20.6). It has no parts, so a press never lands on it. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::canvas::{CanvasRulers, canvas_space}; diff --git a/crates/ui-canvas/src/canvas_controls/task_bar.rs b/crates/ui-canvas/src/canvas_controls/task_bar.rs index 10bc17e55e..ad8c0b5c6d 100644 --- a/crates/ui-canvas/src/canvas_controls/task_bar.rs +++ b/crates/ui-canvas/src/canvas_controls/task_bar.rs @@ -1,6 +1,6 @@ //! `TaskBar`: the contextual task bar over a canvas, hung below its anchor until the user moves it. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::CanvasControlWords; diff --git a/crates/ui-canvas/src/lib.rs b/crates/ui-canvas/src/lib.rs index b1c40a7280..7b26db86c6 100644 --- a/crates/ui-canvas/src/lib.rs +++ b/crates/ui-canvas/src/lib.rs @@ -12,7 +12,7 @@ extern crate self as craft_ui; #[doc(hidden)] pub use craft_ui_panels::canvas_data; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[doc(hidden)] pub use craft_ui_panels::story_kit; #[cfg(feature = "testing")] @@ -51,5 +51,6 @@ pub mod testing { }; pub use craft_ui_panels::testing::*; + #[cfg(feature = "suite")] crate::testing_registered!(); } diff --git a/crates/ui-contract/Cargo.toml b/crates/ui-contract/Cargo.toml index 112697346a..4e364cf525 100644 --- a/crates/ui-contract/Cargo.toml +++ b/crates/ui-contract/Cargo.toml @@ -16,10 +16,10 @@ workspace = true [features] default = [] -# `craft_ui::testing`: the fixture and suite runner, with the snapshot renderer. One feature for all of the test kit, -# so every test build of every crate asks the runtime for the same thing and builds it once; a crate that depends on -# the runtime through another framework crate cannot name the runtime's features on the command line. -testing = ["dep:libtest-mimic", "snapshot", "craft-platform/testing"] +# `craft_ui::testing`: the fixture and helpers used by application tests. +# The suite runner, stories, registrations and snapshots are opt-in. +testing = ["craft-platform/testing"] +suite = ["testing", "dep:libtest-mimic", "snapshot"] # `craft_ui::testing::snapshot`: stories rendered to images offscreen (desktop only). snapshot = ["dep:egui_kittest", "dep:image"] # Draw colour glyphs (COLR, sbix, CBDT), e.g. colour emoji. @@ -89,7 +89,7 @@ flate2 = { version = "1", default-features = false, features = ["rust_backend"] epaint_default_fonts = { version = "0.37", features = ["monochrome_emoji_fonts"] } [dev-dependencies] -craft-ui-contract = { path = ".", features = ["testing"] } +craft-ui-contract = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-fonts-build = { workspace = true } craft-host = { workspace = true } diff --git a/crates/ui-contract/src/contract/body.rs b/crates/ui-contract/src/contract/body.rs index ab1d798f2c..c091946999 100644 --- a/crates/ui-contract/src/contract/body.rs +++ b/crates/ui-contract/src/contract/body.rs @@ -33,7 +33,7 @@ pub use regions::pad_of; #[doc(hidden)] pub use reorder::REORDER_BAND; pub use scroll::{STRIP_BACK, STRIP_FORWARD}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) use window::MOVE_BAND; use window::WindowMode; pub(crate) use window::keep_inside; diff --git a/crates/ui-contract/src/contract/mod.rs b/crates/ui-contract/src/contract/mod.rs index 6c4877339c..28b5bc6347 100644 --- a/crates/ui-contract/src/contract/mod.rs +++ b/crates/ui-contract/src/contract/mod.rs @@ -15,9 +15,9 @@ mod hosted; mod items; mod label; mod lazy; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod level; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod level_table; mod looks; mod mount; @@ -87,7 +87,7 @@ pub use label::colon_of; pub use label::{CellWidth, FieldLabelRole, FieldLayout, GlyphLabel, InsideLabel, LabelKind, LabelScheme, Scrub, SideLabel}; pub use lazy::Lazy; #[doc(hidden)] -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub use level::{Catalog, CatalogEntry, Level, StoryLayout, Surface, catalog, stale_table_rows, story_title}; pub use looks::Looks; pub use overlay::{Overlay, OverlayUi, Overlays, Popup, PopupHandle, SizeLimits, Trigger}; @@ -95,7 +95,7 @@ pub use pages::Pages; pub use paint_ui::PaintUi; pub use props::{Common, Props, Resolved, Tooltip, TooltipAt, TooltipSpec, TooltipWhen}; #[doc(hidden)] -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub use registry::registrations; #[doc(hidden)] pub use registry::{CollectionEntry, ContainerEntry, Exemption, LeafEntry, PatternKind, PatternProbe, Probe, Registration, ShowEntry}; @@ -115,7 +115,7 @@ use std::hash::Hash; use std::ops::Deref; pub use crate::runtime::drag::{DragPreview, DropMark, DropTarget, DropZone, OsFile, OsFiles, WindowDropTarget}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) use body::MOVE_BAND; pub use craft_behavior::ColumnKey; pub use craft_behavior::DropOperation; diff --git a/crates/ui-contract/src/contract/registry.rs b/crates/ui-contract/src/contract/registry.rs index d200a2e6ce..272fc37bea 100644 --- a/crates/ui-contract/src/contract/registry.rs +++ b/crates/ui-contract/src/contract/registry.rs @@ -370,12 +370,12 @@ impl Registration { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] inventory::collect!(Registration); /// Every registration in the running binary, by crate, module and type name. #[doc(hidden)] -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub fn registrations() -> Vec<&'static Registration> { let mut all: Vec<_> = inventory::iter::().collect(); all.sort_by_key(|registration| match registration { @@ -390,7 +390,7 @@ pub fn registrations() -> Vec<&'static Registration> { /// and the `$purpose` line of its doc comment. #[doc(hidden)] #[macro_export] -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] macro_rules! __register_contract { ($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], [], $purpose:expr) => { const _: () = { @@ -416,7 +416,7 @@ macro_rules! __register_contract { /// The registration static of `__register_contract!`; `$with` is the probe's further builder calls. #[doc(hidden)] #[macro_export] -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] macro_rules! __register_probe { ($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], $purpose:expr, $($with:tt)*) => { const EXEMPT: &[$crate::contract::Exemption] = &[$($crate::contract::Exemption::new($case, $reason)),*]; @@ -434,7 +434,7 @@ macro_rules! __register_probe { /// `PatternProbe` constructor of its kind: `PatternProbe::of`, `canvas::tool_probe` or `dialog::dialog_probe`. #[doc(hidden)] #[macro_export] -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] macro_rules! __register_pattern { ($ty:ty, $purpose:expr) => { $crate::__register_pattern!($ty, $purpose, $crate::contract::PatternProbe::of); @@ -448,18 +448,18 @@ macro_rules! __register_pattern { }; } -/// Registers the pattern type `$ty`; without the `testing` feature there is nothing to register. +/// Registers the pattern type `$ty`; without the `suite` feature there is nothing to register. #[doc(hidden)] #[macro_export] -#[cfg(not(feature = "testing"))] +#[cfg(not(feature = "suite"))] macro_rules! __register_pattern { ($ty:ty, $purpose:expr $(, $($probe:tt)+)?) => {}; } -/// Registers the component type `$ty`; without the `testing` feature there is nothing to register. +/// Registers the component type `$ty`; without the `suite` feature there is nothing to register. #[doc(hidden)] #[macro_export] -#[cfg(not(feature = "testing"))] +#[cfg(not(feature = "suite"))] macro_rules! __register_contract { ($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], [$($sample:path)?], $purpose:expr) => {}; } diff --git a/crates/ui-contract/src/runtime/egui/access.rs b/crates/ui-contract/src/runtime/egui/access.rs index 8eee24e44c..5f75798933 100644 --- a/crates/ui-contract/src/runtime/egui/access.rs +++ b/crates/ui-contract/src/runtime/egui/access.rs @@ -58,7 +58,7 @@ pub(crate) fn node_id(id: Id) -> NodeId { pub(crate) type NodeRole = accesskit::Role; /// The AccessKit vocabulary the testing kit reads a tree in. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) use accesskit::{Role, Toggled}; /// The AccessKit node number of `id`, the key an action request's target is matched by. diff --git a/crates/ui-contract/src/runtime/egui/areas.rs b/crates/ui-contract/src/runtime/egui/areas.rs index de412613fd..57079b8fa9 100644 --- a/crates/ui-contract/src/runtime/egui/areas.rs +++ b/crates/ui-contract/src/runtime/egui/areas.rs @@ -416,19 +416,19 @@ pub(crate) fn popup_open(ctx: &Context) -> bool { } /// A host's own egui popup `id` at `at`, shown while egui's memory holds it open. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn host_popup(ui: &Ui, id: egui::Id, at: Pos2) { egui::Popup::new(id, ui.ctx().clone(), at, ui.layer_id()).open_memory(None).show(|ui| ui.allocate_space(ui.spacing().interact_size)); } /// Opens the host's egui popup `id`. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn open_host_popup(ctx: &Context, id: egui::Id) { egui::Popup::open_id(ctx, id); } /// Whether the host's egui popup `id` is open. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn host_popup_open(ctx: &Context, id: egui::Id) -> bool { egui::Popup::is_id_open(ctx, id) } diff --git a/crates/ui-contract/src/runtime/egui/fixture.rs b/crates/ui-contract/src/runtime/egui/fixture.rs index c5f87706fd..7695a8ac78 100644 --- a/crates/ui-contract/src/runtime/egui/fixture.rs +++ b/crates/ui-contract/src/runtime/egui/fixture.rs @@ -305,6 +305,7 @@ pub(crate) fn allow_zoom_keys(ctx: &Context) { /// Sets egui's click options, as an app does for its own widgets: the longest movement and the longest press that /// still count as a click. +#[cfg(feature = "suite")] pub(crate) fn set_click_options(ctx: &Context, distance: f32, seconds: f64) { ctx.options_mut(|options| { options.input_options.max_click_dist = distance; @@ -314,17 +315,20 @@ pub(crate) fn set_click_options(ctx: &Context, distance: f32, seconds: f64) { /// Sets egui's surrender option, the app's rule for its own focused widgets: with `never`, a click elsewhere leaves /// their focus; otherwise egui's default, which surrenders it on a click elsewhere. +#[cfg(feature = "suite")] pub(crate) fn set_app_surrender(ctx: &Context, never: bool) { let rule = if never { egui::SurrenderFocusOn::Never } else { egui::SurrenderFocusOn::Clicks }; ctx.options_mut(|options| options.input_options.surrender_focus_on = rule); } /// Whether egui's surrender option is egui's default, a click elsewhere. +#[cfg(feature = "suite")] pub(crate) fn app_surrenders_on_click(ctx: &Context) -> bool { ctx.options(|options| options.input_options.surrender_focus_on == egui::SurrenderFocusOn::Clicks) } /// egui's click options: the longest movement and the longest press that still count as a click. +#[cfg(feature = "suite")] pub(crate) fn click_options(ctx: &Context) -> (f32, f64) { ctx.options(|options| (options.input_options.max_click_dist, options.input_options.max_click_duration)) } @@ -416,29 +420,34 @@ pub(crate) fn focusable_widget(ui: &mut Ui, id: egui::Id) -> Rect { /// A host's own single-line egui text field of `id` over `text`, as an app that keeps its own widgets beside the /// framework's draws it; returns its rect. +#[cfg(feature = "suite")] pub(crate) fn host_field(ui: &mut Ui, id: egui::Id, text: &mut String) -> Rect { ui.add(egui::TextEdit::singleline(text).id(id)).rect } /// Gives the host's own egui widget `id` key focus, as the host's code does. +#[cfg(feature = "suite")] pub(crate) fn host_focus(ctx: &Context, id: egui::Id) { ctx.memory_mut(|memory| memory.request_focus(id)); } /// A host's own clickable egui widget `id` at `rect`, a focus stop for egui's own focus moves; returns whether egui /// reports a click on it, by egui's click options. +#[cfg(feature = "suite")] pub(crate) fn host_button(ui: &Ui, id: egui::Id, rect: Rect) -> bool { ui.interact(rect, id, egui::Sense::click()).clicked() } /// A host's own egui drag area `id` at `rect`; returns whether egui reports it dragged and whether its drag stopped /// this pass. +#[cfg(feature = "suite")] pub(crate) fn host_drag_area(ui: &Ui, id: egui::Id, rect: Rect) -> (bool, bool) { let response = ui.interact(rect, id, egui::Sense::drag()); (response.dragged(), response.drag_stopped()) } /// A host's own selectable egui label of `text`; returns its rect. +#[cfg(feature = "suite")] pub(crate) fn host_label(ui: &mut Ui, text: &str) -> Rect { ui.add(egui::Label::new(text).selectable(true)).rect } diff --git a/crates/ui-contract/src/runtime/egui/widgets.rs b/crates/ui-contract/src/runtime/egui/widgets.rs index f5e916732d..1a972cad04 100644 --- a/crates/ui-contract/src/runtime/egui/widgets.rs +++ b/crates/ui-contract/src/runtime/egui/widgets.rs @@ -65,7 +65,7 @@ pub(crate) fn note_node(_: &Context, _: Id) {} /// A scroll region the runtime showed: `view` is the rect that shows it and cuts what lies outside, `content` the rect /// of what it holds, which scrolls through the view along the region's axes and lies within the view along the others. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[derive(Clone, Copy, Debug)] pub(crate) struct ScrollRegion { pub view: Rect, @@ -73,16 +73,16 @@ pub(crate) struct ScrollRegion { } /// Notes a scroll region of the running pass, for the suite's size cases. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn note_scroll_region(ctx: &Context, view: Rect, content: Rect) { noted::with(ctx, |pass| pass.scrolls.push(ScrollRegion { view, content })); } -#[cfg(not(feature = "testing"))] +#[cfg(not(feature = "suite"))] pub(crate) fn note_scroll_region(_: &Context, _: Rect, _: Rect) {} /// The scroll regions the runtime noted in the root viewport's latest pass. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn scroll_regions(ctx: &Context) -> Vec { noted::scrolls(ctx) } @@ -124,6 +124,7 @@ pub(crate) mod noted { pub(super) struct Pass { pub(super) widgets: HashSet, pub(super) nodes: HashSet, + #[cfg(feature = "suite")] pub(super) scrolls: Vec, } @@ -139,6 +140,7 @@ pub(crate) mod noted { } /// The root viewport's scroll regions of its latest pass. + #[cfg(feature = "suite")] pub(super) fn scrolls(ctx: &Context) -> Vec { crate::runtime::pass_state::with(ctx, |noted: &mut Noted| noted.pass.scrolls.clone()) } diff --git a/crates/ui-contract/src/runtime/keys.rs b/crates/ui-contract/src/runtime/keys.rs index 61f108ae86..f096cb2f25 100644 --- a/crates/ui-contract/src/runtime/keys.rs +++ b/crates/ui-contract/src/runtime/keys.rs @@ -32,7 +32,7 @@ pub(crate) use input::{input_hook, queue_nav, take_menu_keys, take_nav}; pub use intents::Intents; #[doc(hidden)] pub use intents::intents_of; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) use intents::lent_taken; #[doc(hidden)] pub use intents::settle; diff --git a/crates/ui-contract/src/runtime/keys/intents.rs b/crates/ui-contract/src/runtime/keys/intents.rs index 102d825249..ada5a65c60 100644 --- a/crates/ui-contract/src/runtime/keys/intents.rs +++ b/crates/ui-contract/src/runtime/keys/intents.rs @@ -393,7 +393,7 @@ pub(crate) fn give_back(ctx: &Context, to: Id, lent: Lent) { /// How many lent keys session members have taken so far in the current viewport: a check of keyboard parity reads /// it before and after its input, since a lent key is the session control's, not the focused component's. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn lent_taken(ctx: &Context) -> u64 { current(ctx, |stage| stage.lent_taken) } diff --git a/crates/ui-contract/src/runtime/overlay.rs b/crates/ui-contract/src/runtime/overlay.rs index 1553099a3a..6eec892104 100644 --- a/crates/ui-contract/src/runtime/overlay.rs +++ b/crates/ui-contract/src/runtime/overlay.rs @@ -412,7 +412,7 @@ pub fn family(ctx: &Context, id: Id) -> SmallVec<[Id; 4]> { } /// Every layer of the running viewport shown last frame, not exiting, parent first. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn open_entries(ctx: &Context) -> Vec { with_pass(ctx, |pass| pass.last.iter().filter(|entry| !entry.exiting).cloned().collect()) } diff --git a/crates/ui-contract/src/runtime/pointer.rs b/crates/ui-contract/src/runtime/pointer.rs index beeb9b20f4..352ebbdd5b 100644 --- a/crates/ui-contract/src/runtime/pointer.rs +++ b/crates/ui-contract/src/runtime/pointer.rs @@ -511,7 +511,7 @@ pub(crate) fn part_bounds(ctx: &Context, owner: Id, part: craft_behavior::PartRe } /// Whether the part `part` of `owner` (the arena root or a member) senses all of `sense` in last pass's shape record. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn part_senses(ctx: &Context, owner: Id, part: craft_behavior::PartRef, sense: craft_behavior::Sense) -> bool { let viewport = pass::current_viewport(ctx); PerViewport::::with(ctx, viewport, |record| { @@ -546,7 +546,7 @@ fn owned_part_bounds(ctx: &Context, owner: impl Fn(Id) -> bool, part: craft_beha /// The bounds of the part `part` that senses `sense`, on a component other than `subject` and lying inside the /// subject's own shapes in last pass's shape record: where a component's child keeps the part a drive acts on. When /// several children match, the first by top edge, then start edge, then root id. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(crate) fn child_part_bounds(ctx: &Context, subject: Id, part: craft_behavior::PartRef, sense: craft_behavior::Sense) -> Option { let viewport = pass::current_viewport(ctx); PerViewport::::with(ctx, viewport, |record| { diff --git a/crates/ui-contract/src/testing/mod.rs b/crates/ui-contract/src/testing/mod.rs index 90ed467dfd..75b5ebb8f5 100644 --- a/crates/ui-contract/src/testing/mod.rs +++ b/crates/ui-contract/src/testing/mod.rs @@ -13,24 +13,31 @@ pub mod dump; pub mod fixture; pub mod focus; pub mod frames; +#[cfg(feature = "suite")] mod host_key_trials; +#[cfg(feature = "suite")] mod icon_trials; +#[cfg(feature = "suite")] pub mod index; pub mod input; +#[cfg(feature = "suite")] mod key_trials; pub mod layout; pub mod memory; pub mod pictures; pub mod pointer; pub mod relations; +#[cfg(feature = "suite")] mod replay_trials; pub mod sensing; #[cfg(all(feature = "snapshot", not(target_arch = "wasm32")))] pub mod snapshot; mod stage; +#[cfg(feature = "suite")] mod stories; pub mod story; pub mod style; +#[cfg(feature = "suite")] pub mod suite; pub mod surface; pub mod text; @@ -48,9 +55,11 @@ pub use craft_ui_macros::{story, trial}; pub use fixture::{Fixture, Impure, Room, Target}; pub use frames::Frames; pub use stage::{room_height, stage, stage_fitting, stage_width}; +#[cfg(feature = "suite")] +pub use story::stories; #[doc(hidden)] pub use story::{ - CollectionKind, Drive, EditKind, Grip, Required, Story, StoryData, StoryOutput, StoryRegistration, StorySnapshot, show_as_only_item, stories, + CollectionKind, Drive, EditKind, Grip, Required, Story, StoryData, StoryOutput, StoryRegistration, StorySnapshot, show_as_only_item, }; pub use windows::install_spec; @@ -88,9 +97,11 @@ impl Trial { } } +#[cfg(feature = "suite")] inventory::collect!(Trial); /// Every `#[trial]` linked into the running binary, by full name. +#[cfg(feature = "suite")] pub fn trials() -> Vec<&'static Trial> { let mut all: Vec<_> = inventory::iter::().collect(); all.sort_by_key(|trial| trial.full_name()); @@ -100,6 +111,7 @@ pub fn trials() -> Vec<&'static Trial> { /// Runs a test executable and exits: the `#[trial]`s declared in the crate whose root module is `crate_root` or in /// `package`'s library crate, and the suite's trials over `registered`. Every test executable's `main` calls it, with /// its own `module_path!()`. +#[cfg(feature = "suite")] pub fn run(crate_root: &str, package: &'static str, registered: &[&'static Registration]) -> ! { let library = package.replace('-', "_"); let own = |module: &str| { @@ -126,6 +138,7 @@ pub fn run(crate_root: &str, package: &'static str, registered: &[&'static Regis /// Every registration declared in the library crate of the package `crate_name` and linked into the running /// binary, by module and type name. Types declared in the package's integration binaries are fixtures, not the package's. +#[cfg(feature = "suite")] pub fn registered_in(crate_name: &str) -> Vec<&'static Registration> { let library = crate_name.replace('-', "_"); crate::contract::registrations() @@ -148,6 +161,7 @@ macro_rules! testing_registered { }; } +#[cfg(feature = "suite")] testing_registered!(); #[doc(hidden)] diff --git a/crates/ui-contract/src/testing/story.rs b/crates/ui-contract/src/testing/story.rs index d58471713b..70d1639a6a 100644 --- a/crates/ui-contract/src/testing/story.rs +++ b/crates/ui-contract/src/testing/story.rs @@ -144,12 +144,14 @@ impl Story { /// The name of the story's group as a story of the type whose display name is `type_name`: its group, else its /// caption. + #[cfg(feature = "suite")] pub fn group_name(&self, type_name: &str) -> String { self.group.map_or_else(|| self.caption(type_name), str::to_owned) } /// The story's caption as a story of the type whose display name is `type_name`: its title, else the one its /// name makes ([`crate::contract::story_title`]). + #[cfg(feature = "suite")] pub fn caption(&self, type_name: &str) -> String { self.title.map_or_else(|| crate::contract::story_title(type_name, self.name), str::to_owned) } @@ -206,11 +208,13 @@ impl StoryRegistration { } } +#[cfg(feature = "suite")] inventory::collect!(StoryRegistration); /// Every story linked into the running binary, by type name; of each type, the stories of the package that registers /// it first, then those other packages declare; each in the order they are declared in. #[doc(hidden)] +#[cfg(feature = "suite")] pub fn stories() -> Vec<&'static StoryRegistration> { let homes: HashMap<&str, &str> = crate::contract::registrations() .into_iter() diff --git a/crates/ui-gallery/Cargo.toml b/crates/ui-gallery/Cargo.toml index 1e91675422..67727bdd67 100644 --- a/crates/ui-gallery/Cargo.toml +++ b/crates/ui-gallery/Cargo.toml @@ -48,7 +48,7 @@ review = ["dep:craft-review"] table = ["dep:craft-table"] text = ["dep:craft-text"] # The theme panels are linked in every build (the Theme workspace uses them); the feature adds their stories. -theme-editor = ["craft-theme-editor/screen-testing"] +theme-editor = ["craft-theme-editor/suite"] theme-store = ["dep:craft-theme-store"] timeline = ["dep:craft-timeline"] dialogs = ["dep:craft-dialogs"] @@ -64,7 +64,7 @@ harness = false workspace = true [dependencies] -craft-ui = { workspace = true, features = ["app", "testing"] } +craft-ui = { workspace = true, features = ["app", "suite"] } craft-i18n = { workspace = true } craft-theme = { workspace = true } craft-theme-editor = { workspace = true } @@ -82,27 +82,27 @@ serde = { workspace = true } serde_json = { workspace = true } web-time = "1.1" -# The domain crates' stories, registered under each crate's `screen-testing`. -craft-automation = { workspace = true, features = ["screen-testing"], optional = true } -craft-browse = { workspace = true, features = ["screen-testing"], optional = true } -craft-color-ui = { workspace = true, features = ["screen-testing"], optional = true } -craft-draw = { workspace = true, features = ["screen-testing"], optional = true } -craft-imaging = { workspace = true, features = ["screen-testing"], optional = true } -craft-layers = { workspace = true, features = ["screen-testing"], optional = true } -craft-menu = { workspace = true, features = ["screen-testing"], optional = true } -craft-pages = { workspace = true, features = ["screen-testing"], optional = true } -craft-print = { workspace = true, features = ["screen-testing"], optional = true } -craft-review = { workspace = true, features = ["screen-testing"], optional = true } -craft-table = { workspace = true, features = ["screen-testing"], optional = true } -craft-text = { workspace = true, features = ["screen-testing", "find"], optional = true } -craft-theme-store = { workspace = true, features = ["screen-testing"], optional = true } -craft-timeline = { workspace = true, features = ["screen-testing"], optional = true } +# The domain crates' stories, registered under each crate's `suite`. +craft-automation = { workspace = true, features = ["suite"], optional = true } +craft-browse = { workspace = true, features = ["suite"], optional = true } +craft-color-ui = { workspace = true, features = ["suite"], optional = true } +craft-draw = { workspace = true, features = ["suite"], optional = true } +craft-imaging = { workspace = true, features = ["suite"], optional = true } +craft-layers = { workspace = true, features = ["suite"], optional = true } +craft-menu = { workspace = true, features = ["suite"], optional = true } +craft-pages = { workspace = true, features = ["suite"], optional = true } +craft-print = { workspace = true, features = ["suite"], optional = true } +craft-review = { workspace = true, features = ["suite"], optional = true } +craft-table = { workspace = true, features = ["suite"], optional = true } +craft-text = { workspace = true, features = ["suite", "find"], optional = true } +craft-theme-store = { workspace = true, features = ["suite"], optional = true } +craft-timeline = { workspace = true, features = ["suite"], optional = true } # Native only: these crates do not build for the web, so their stories are not in the web gallery. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -craft-dialogs = { workspace = true, features = ["screen-testing"], optional = true } -craft-font-manager = { workspace = true, features = ["screen-testing"], optional = true } -craft-update = { workspace = true, features = ["screen-testing"], optional = true } +craft-dialogs = { workspace = true, features = ["suite"], optional = true } +craft-font-manager = { workspace = true, features = ["suite"], optional = true } +craft-update = { workspace = true, features = ["suite"], optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen-futures = "0.4" diff --git a/crates/ui-macros/src/component.rs b/crates/ui-macros/src/component.rs index 90e66c05ba..aa7f82897e 100644 --- a/crates/ui-macros/src/component.rs +++ b/crates/ui-macros/src/component.rs @@ -178,13 +178,13 @@ pub(crate) fn purpose_of(attrs: &[Attribute]) -> String { } /// The attributes on a registration block, from the crate being compiled. See `gate_for`. -fn registration_gate() -> TokenStream { +pub(crate) fn registration_gate() -> TokenStream { let manifest = std::env::var_os("CARGO_MANIFEST_DIR").and_then(|dir| std::fs::read_to_string(std::path::Path::new(&dir).join("Cargo.toml")).ok()); gate_for(manifest.as_deref().unwrap_or_default()) } /// The attributes on a registration block. The registration's types can exist only under the defining package's -/// `screen-testing` feature, which may be off while craft-ui's `testing` is on, so the block is gated on it (the cfg +/// `suite` feature, which may be off while craft-ui's `testing` is on, so the block is gated on it (the cfg /// is evaluated in the defining crate) when the package's `manifest` declares that feature, and is not gated otherwise. pub(crate) fn gate_for(manifest: &str) -> TokenStream { let mut in_features = false; @@ -193,9 +193,9 @@ pub(crate) fn gate_for(manifest: &str) -> TokenStream { in_features = line.trim_end_matches(|c: char| c.is_whitespace()) == "[features]"; return false; } - in_features && line.strip_prefix("screen-testing").is_some_and(|rest| rest.trim_start().starts_with('=')) + in_features && line.strip_prefix("suite").is_some_and(|rest| rest.trim_start().starts_with('=')) }); - if declares { quote!(#[cfg(feature = "screen-testing")]) } else { quote!() } + if declares { quote!(#[cfg(feature = "suite")]) } else { quote!() } } fn registrations(k: &TokenStream, types: &[Type], declared: &Declared, shape: Shape) -> syn::Result { diff --git a/crates/ui-macros/src/lib.rs b/crates/ui-macros/src/lib.rs index 06c321c094..c0c4ada83b 100644 --- a/crates/ui-macros/src/lib.rs +++ b/crates/ui-macros/src/lib.rs @@ -135,9 +135,12 @@ pub fn trial(attr: TokenStream, item: TokenStream) -> TokenStream { } let ident = &sig.ident; let name = ident.to_string(); + let gate = component::registration_gate(); quote! { + #gate #func + #gate #k::testing::__private::inventory::submit! { #k::testing::Trial::#register(module_path!(), #name, #ident) } @@ -213,9 +216,12 @@ pub fn story(attr: TokenStream, item: TokenStream) -> TokenStream { let title = args.title.as_ref().map(|title| quote!(.title(#title))); let group = args.group.as_ref().map(|group| quote!(.group(#group))); let commands = args.commands.as_ref().map(|commands| quote!(.commands(#commands))); + let gate = component::registration_gate(); quote! { + #gate #func + #gate #k::testing::__private::inventory::submit! { #k::testing::StoryRegistration::new( env!("CARGO_PKG_NAME"), diff --git a/crates/ui-macros/src/tests.rs b/crates/ui-macros/src/tests.rs index 6ced7341cc..b6ae5d5d6d 100644 --- a/crates/ui-macros/src/tests.rs +++ b/crates/ui-macros/src/tests.rs @@ -3,11 +3,11 @@ use proc_macro2::TokenStream; #[test] -fn registration_is_gated_only_when_the_package_declares_screen_testing() { +fn registration_is_gated_only_when_the_package_declares_suite() { let compact = |tokens: TokenStream| tokens.to_string().split_whitespace().collect::(); - let declared = "[package]\nname = \"app\"\n\n[features]\nscreen-testing = [\"craft-ui/testing\"]\n"; - assert_eq!(compact(crate::component::gate_for(declared)), "#[cfg(feature=\"screen-testing\")]"); - let undeclared = "[package]\nname = \"gallery\"\nscreen-testing = 1\n\n[dependencies]\nscreen-testing = \"1\"\n"; + let declared = "[package]\nname = \"app\"\n\n[features]\nsuite = [\"craft-ui/testing\"]\n"; + assert_eq!(compact(crate::component::gate_for(declared)), "#[cfg(feature=\"suite\")]"); + let undeclared = "[package]\nname = \"gallery\"\nsuite = 1\n\n[dependencies]\nsuite = \"1\"\n"; assert_eq!(compact(crate::component::gate_for(undeclared)), ""); assert_eq!(compact(crate::component::gate_for("")), ""); } diff --git a/crates/ui-panels/Cargo.toml b/crates/ui-panels/Cargo.toml index 2e2703415b..44aff9e898 100644 --- a/crates/ui-panels/Cargo.toml +++ b/crates/ui-panels/Cargo.toml @@ -15,6 +15,7 @@ test = false workspace = true [features] +suite = ["testing", "craft-ui-widgets/suite"] default = [] # `craft_ui::testing` with `testing::internals`. testing = ["craft-ui-widgets/testing"] @@ -34,7 +35,7 @@ serde = { workspace = true } serde_json = { workspace = true } [dev-dependencies] -craft-ui-panels = { path = ".", features = ["testing"] } +craft-ui-panels = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-keymap = { workspace = true, features = ["egui"] } egui = { workspace = true } diff --git a/crates/ui-panels/src/dialog/mod.rs b/crates/ui-panels/src/dialog/mod.rs index fb7f85e999..ca828462c5 100644 --- a/crates/ui-panels/src/dialog/mod.rs +++ b/crates/ui-panels/src/dialog/mod.rs @@ -14,10 +14,10 @@ mod prompts; mod recovery; mod serde_fields; mod stack; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[doc(hidden)] pub mod stories; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod trials; mod unsaved; mod words; diff --git a/crates/ui-panels/src/dialog/prompt.rs b/crates/ui-panels/src/dialog/prompt.rs index 7def4e717a..1a793086ef 100644 --- a/crates/ui-panels/src/dialog/prompt.rs +++ b/crates/ui-panels/src/dialog/prompt.rs @@ -14,7 +14,7 @@ use craft_keymap::{Chord, mnemonic}; use craft_theme::variant::Tone; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// One answer of a prompt before its button exists: the label, what the button means, whether it has a letter and diff --git a/crates/ui-panels/src/docking/dock_column.rs b/crates/ui-panels/src/docking/dock_column.rs index 190d78a496..75b3e6197b 100644 --- a/crates/ui-panels/src/docking/dock_column.rs +++ b/crates/ui-panels/src/docking/dock_column.rs @@ -22,7 +22,7 @@ use craft_behavior::{Axis, DockSide, Flow, Metrics, PartKey, Sense, Value}; use egui::{Context, Id, Pos2, Rect, Response, Ui}; use std::hash::Hash; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod bar; diff --git a/crates/ui-panels/src/docking/floating.rs b/crates/ui-panels/src/docking/floating.rs index 8e8d95d08d..a78f1511c3 100644 --- a/crates/ui-panels/src/docking/floating.rs +++ b/crates/ui-panels/src/docking/floating.rs @@ -31,7 +31,7 @@ use egui::{Id, Pos2, Rect, Response, Ui, Vec2}; use std::cell::RefCell; use std::hash::Hash; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The height of a floating group's title row: a strong `TitleRow`, which is as tall as a panel header. diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index a0b0fd26fb..d70fbec115 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -26,9 +26,9 @@ use craft_theme::ControlSize; use egui::{Id, Pos2, Rect, Response, Ui, Vec2}; use std::hash::Hash; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod trials; const CELL: PartKey = PartKey::new("cell"); diff --git a/crates/ui-panels/src/docking/mod.rs b/crates/ui-panels/src/docking/mod.rs index dc680bb41b..d7c7b098af 100644 --- a/crates/ui-panels/src/docking/mod.rs +++ b/crates/ui-panels/src/docking/mod.rs @@ -18,7 +18,7 @@ mod root; mod spec; mod splitter; pub mod stack; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub mod targets; pub mod tree; diff --git a/crates/ui-panels/src/docking/root.rs b/crates/ui-panels/src/docking/root.rs index 8b0c59c68f..0a3b07b561 100644 --- a/crates/ui-panels/src/docking/root.rs +++ b/crates/ui-panels/src/docking/root.rs @@ -13,7 +13,7 @@ use crate::style::{ComponentStyle, StyleCx}; use craft_behavior::{Metrics, Sense}; use egui::Response; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a dock root: the docking sizes of its drop bands, columns, groups and floating windows. Colours, diff --git a/crates/ui-panels/src/lib.rs b/crates/ui-panels/src/lib.rs index 8a7337eb45..57873fae17 100644 --- a/crates/ui-panels/src/lib.rs +++ b/crates/ui-panels/src/lib.rs @@ -9,7 +9,7 @@ // The derives' output names the crate as `craft_ui`, here as in every other crate. extern crate self as craft_ui; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[doc(hidden)] pub use craft_ui_widgets::story_kit; #[cfg(feature = "testing")] @@ -43,5 +43,6 @@ pub mod testing { pub use crate::testing_internals::*; } + #[cfg(feature = "suite")] crate::testing_registered!(); } diff --git a/crates/ui-panels/src/rails/drawer.rs b/crates/ui-panels/src/rails/drawer.rs index 833ba59a8a..1fcba24ff0 100644 --- a/crates/ui-panels/src/rails/drawer.rs +++ b/crates/ui-panels/src/rails/drawer.rs @@ -24,7 +24,7 @@ use craft_behavior::{DisplayOrder, IconId, ItemSource, Value}; use egui::{Rect, Response, Ui}; use std::borrow::Cow; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// A group of the drawer: a heading over the tools that belong under it. diff --git a/crates/ui-panels/src/rails/flyout.rs b/crates/ui-panels/src/rails/flyout.rs index 24d76a66da..64577d9d17 100644 --- a/crates/ui-panels/src/rails/flyout.rs +++ b/crates/ui-panels/src/rails/flyout.rs @@ -15,7 +15,7 @@ use craft_behavior::overlay::{Align, Side}; use craft_behavior::{HitLevel, HitPriority, IconId, Metrics, PartKey, PointerButton, PressPhase, Sense, Value}; use egui::{Rect, Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The face over the whole button. diff --git a/crates/ui-panels/src/rails/tool.rs b/crates/ui-panels/src/rails/tool.rs index 4484234a91..94db961fa4 100644 --- a/crates/ui-panels/src/rails/tool.rs +++ b/crates/ui-panels/src/rails/tool.rs @@ -23,9 +23,9 @@ use egui::{Response, Ui, Vec2}; mod data; mod drag; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] pub(super) mod stories; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod trials; use data::row_groups; diff --git a/crates/ui-panels/src/sections/footer.rs b/crates/ui-panels/src/sections/footer.rs index 517dbe2a4a..8b579722a9 100644 --- a/crates/ui-panels/src/sections/footer.rs +++ b/crates/ui-panels/src/sections/footer.rs @@ -25,7 +25,7 @@ use std::any::Any; use std::fmt; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a footer bar. A bar of panel actions sits under a divider rule along its top edge, with the control diff --git a/crates/ui-panels/src/sections/group_box.rs b/crates/ui-panels/src/sections/group_box.rs index a43d3a3d54..fcb41e24bc 100644 --- a/crates/ui-panels/src/sections/group_box.rs +++ b/crates/ui-panels/src/sections/group_box.rs @@ -10,7 +10,7 @@ use crate::style::{ComponentStyle, StyleCx, SurfaceKind}; use craft_behavior::{Metrics, Sense}; use egui::Ui; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The heading level AccessKit reports for a section header. diff --git a/crates/ui-panels/src/sections/mod.rs b/crates/ui-panels/src/sections/mod.rs index 84760feb1d..fc85268b7f 100644 --- a/crates/ui-panels/src/sections/mod.rs +++ b/crates/ui-panels/src/sections/mod.rs @@ -2,7 +2,7 @@ pub(crate) mod footer; mod group_box; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod sample; mod section; mod stack; diff --git a/crates/ui-panels/src/sections/panel.rs b/crates/ui-panels/src/sections/panel.rs index 4d4786d73d..ec1dd4cbba 100644 --- a/crates/ui-panels/src/sections/panel.rs +++ b/crates/ui-panels/src/sections/panel.rs @@ -18,7 +18,7 @@ use crate::style::{ComponentStyle, StyleColor, StyleCx, SurfaceKind, UiTokens}; use craft_behavior::{Metrics, Sense}; use egui::{CornerRadius, Id, Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a panel: the surface and padding come from the container. diff --git a/crates/ui-panels/src/sections/reorderable.rs b/crates/ui-panels/src/sections/reorderable.rs index 2fab48c838..2de08e6fe0 100644 --- a/crates/ui-panels/src/sections/reorderable.rs +++ b/crates/ui-panels/src/sections/reorderable.rs @@ -16,7 +16,7 @@ use egui::{Response, Ui}; use std::cell::RefCell; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The commands of a section, run on the section that holds the focus: its header menu rows and any chord the keymap diff --git a/crates/ui-panels/src/sections/section.rs b/crates/ui-panels/src/sections/section.rs index 31e3b09d8b..d9ac2829a0 100644 --- a/crates/ui-panels/src/sections/section.rs +++ b/crates/ui-panels/src/sections/section.rs @@ -15,7 +15,7 @@ use crate::style::{ComponentStyle, StyleCx}; use craft_behavior::{Metrics, PointerButton, PressPhase, Sense}; use egui::{Id, Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a section: no surface or padding of its own; the header and body carry the look. diff --git a/crates/ui-panels/src/sections/stack.rs b/crates/ui-panels/src/sections/stack.rs index d7ee0de3f2..6b70b0bf71 100644 --- a/crates/ui-panels/src/sections/stack.rs +++ b/crates/ui-panels/src/sections/stack.rs @@ -15,7 +15,7 @@ use craft_behavior::{Axis, EditEvent, Metrics, Mixed, Sense}; use egui::{Pos2, Rect, Response, Ui}; use std::sync::{Arc, Mutex, PoisonError}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// What a section of a stack is told about its place: `Section::in_stack` reads it. diff --git a/crates/ui-panels/src/sections/title_row.rs b/crates/ui-panels/src/sections/title_row.rs index 9e8764d996..a6b17e9ea6 100644 --- a/crates/ui-panels/src/sections/title_row.rs +++ b/crates/ui-panels/src/sections/title_row.rs @@ -20,7 +20,7 @@ use craft_theme::variant::Tone; use craft_theme::{ControlSize, Stateful, States}; use egui::{Id, Rect, Response, Ui, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// How much weight a header carries. diff --git a/crates/ui-patterns/Cargo.toml b/crates/ui-patterns/Cargo.toml index dc63a22b43..a7e70a5b60 100644 --- a/crates/ui-patterns/Cargo.toml +++ b/crates/ui-patterns/Cargo.toml @@ -15,6 +15,7 @@ test = false workspace = true [features] +suite = ["testing", "craft-ui-panels/suite"] default = [] # `craft_ui::testing`. testing = ["craft-ui-panels/testing"] @@ -40,7 +41,7 @@ craft-pdf = { path = "../pdf", version = "=0.1.0", default-features = false } zeroize = "1.9" [dev-dependencies] -craft-ui-patterns = { path = ".", features = ["testing"] } +craft-ui-patterns = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-theme = { workspace = true } craft-ui-test-kit = { workspace = true } diff --git a/crates/ui-patterns/src/lib.rs b/crates/ui-patterns/src/lib.rs index 906d4b1549..cd7982b158 100644 --- a/crates/ui-patterns/src/lib.rs +++ b/crates/ui-patterns/src/lib.rs @@ -10,7 +10,7 @@ extern crate self as craft_ui; #[doc(hidden)] pub use craft_ui_panels::canvas_data; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[doc(hidden)] pub use craft_ui_panels::story_kit; #[cfg(feature = "testing")] @@ -31,5 +31,6 @@ pub mod patterns; pub mod testing { pub use craft_ui_panels::testing::*; + #[cfg(feature = "suite")] crate::testing_registered!(); } diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 902dda70ed..7a7e50121a 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -35,7 +35,7 @@ use std::fmt::Debug; use std::hash::Hash; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// A layout the dock cannot show: the workspace failed `Workspace::validate`. The area draws nothing for it. diff --git a/crates/ui-patterns/src/patterns/dock/panes.rs b/crates/ui-patterns/src/patterns/dock/panes.rs index d4aa504b5a..ed31d02a5a 100644 --- a/crates/ui-patterns/src/patterns/dock/panes.rs +++ b/crates/ui-patterns/src/patterns/dock/panes.rs @@ -29,7 +29,7 @@ use std::cell::RefCell; use std::fmt::Debug; use std::hash::Hash; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Where a pane is shown. diff --git a/crates/ui-patterns/src/patterns/dock/switcher.rs b/crates/ui-patterns/src/patterns/dock/switcher.rs index 7a8b944971..a3bb100ffe 100644 --- a/crates/ui-patterns/src/patterns/dock/switcher.rs +++ b/crates/ui-patterns/src/patterns/dock/switcher.rs @@ -1,6 +1,6 @@ //! `WorkspaceSwitcher`: a select over the workspace set's names with the workspace commands in its list. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::contract::{Bind, Entry, NoValue, Outcome, Props as _, Show as _, Sizing}; diff --git a/crates/ui-patterns/src/patterns/dock/workspace_dialogs.rs b/crates/ui-patterns/src/patterns/dock/workspace_dialogs.rs index f711d7e582..8d744fd802 100644 --- a/crates/ui-patterns/src/patterns/dock/workspace_dialogs.rs +++ b/crates/ui-patterns/src/patterns/dock/workspace_dialogs.rs @@ -1,7 +1,7 @@ //! `NewWorkspaceDialog` and `DeleteWorkspaceDialog`: the questions `run_workspace` returns as `WorkspaceAsk::Name` //! and `WorkspaceAsk::Which`. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::words::WorkspaceDialogWords; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/about.rs b/crates/ui-patterns/src/patterns/form_dialogs/about.rs index 916387830d..4a695dbe05 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/about.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/about.rs @@ -3,7 +3,7 @@ mod contributors; mod credits; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use contributors::{CommitShare, ContributorSort, NameMode}; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs b/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs index 0a7b55ae09..e9faf5ab01 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs @@ -40,7 +40,7 @@ use serde_json::Value; use std::borrow::Cow; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/ui-patterns/src/patterns/form_dialogs/export.rs b/crates/ui-patterns/src/patterns/form_dialogs/export.rs index e589aa5dd1..1d18124f0f 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/export.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/export.rs @@ -8,7 +8,7 @@ mod as_dialog; mod options; mod path_row; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::PreviewRequest; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/file_list.rs b/crates/ui-patterns/src/patterns/form_dialogs/file_list.rs index a09eb5b825..eb0e095861 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/file_list.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/file_list.rs @@ -20,7 +20,7 @@ use std::borrow::Cow; use std::cell::RefCell; use std::path::{Path, PathBuf}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The list shows this many rows, then scrolls. diff --git a/crates/ui-patterns/src/patterns/form_dialogs/form.rs b/crates/ui-patterns/src/patterns/form_dialogs/form.rs index 3c3a8e50b2..ebaa050922 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/form.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/form.rs @@ -30,7 +30,7 @@ use std::ops::{Deref, DerefMut}; use std::rc::Rc; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/ui-patterns/src/patterns/form_dialogs/guides.rs b/crates/ui-patterns/src/patterns/form_dialogs/guides.rs index de5c16e2c7..70e260d73a 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/guides.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/guides.rs @@ -10,9 +10,9 @@ mod layout; mod new_guide; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod trials; pub use layout::{GuideGroup, GuideLayoutError, GuideLayoutOptions, GuideLayoutPreset, GuideLength, GuideRect, GuideTarget, GuideUnits, MAX_COUNT}; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/list_manager.rs b/crates/ui-patterns/src/patterns/form_dialogs/list_manager.rs index 045df006b8..5a68a116ac 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/list_manager.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/list_manager.rs @@ -20,7 +20,7 @@ use egui::{Response, Ui}; use std::borrow::Cow; use std::cell::{Cell, RefCell}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/ui-patterns/src/patterns/form_dialogs/navigator_options.rs b/crates/ui-patterns/src/patterns/form_dialogs/navigator_options.rs index 2bd2b187ec..29792fa9da 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/navigator_options.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/navigator_options.rs @@ -14,7 +14,7 @@ use crate::runtime::env::{Env, Label}; use crate::runtime::overlay::CloseReason; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The [`ColorRequest::key`](crate::runtime::requests::ColorRequest::key) of Panel Options' Custom… colour. diff --git a/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs b/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs index 95b449b177..00f53921e0 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs @@ -4,7 +4,7 @@ mod cards; mod details; mod presets; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::form::{read_bind, write_bind}; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/password.rs b/crates/ui-patterns/src/patterns/form_dialogs/password.rs index 907672343b..14f07a8ddd 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/password.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/password.rs @@ -21,7 +21,7 @@ use std::any::Any; use std::cell::{Cell, RefCell}; use std::fmt; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/ui-patterns/src/patterns/form_dialogs/path_row.rs b/crates/ui-patterns/src/patterns/form_dialogs/path_row.rs index 3ce657d83a..8748183a43 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/path_row.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/path_row.rs @@ -1,6 +1,6 @@ //! `PathRow`: a path typed in a text field, with a Browse button that asks the host to pick one. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::buttons::Button; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/pdf_export.rs b/crates/ui-patterns/src/patterns/form_dialogs/pdf_export.rs index 85a89d70d6..a3992f27fc 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/pdf_export.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/pdf_export.rs @@ -4,7 +4,7 @@ mod sections; mod summary; mod words; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use self::sections::{ArtboardChoice, PasswordSwitches, Sections}; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/preview.rs b/crates/ui-patterns/src/patterns/form_dialogs/preview.rs index 84fda5c1ef..da68bc79b2 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/preview.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/preview.rs @@ -21,7 +21,7 @@ use egui::load::SizedTexture; use egui::{Pos2, Rect, Response, Ui, Vec2, pos2}; use std::ops::RangeInclusive; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The well: a drag on it pans the picture and a click centres the view on the point clicked. diff --git a/crates/ui-patterns/src/patterns/form_dialogs/properties.rs b/crates/ui-patterns/src/patterns/form_dialogs/properties.rs index e4f5e105ab..69e596225b 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/properties.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/properties.rs @@ -15,7 +15,7 @@ use egui::{Response, Ui}; use std::borrow::Cow; use std::cell::RefCell; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// One row of a properties tab. diff --git a/crates/ui-patterns/src/patterns/form_dialogs/report.rs b/crates/ui-patterns/src/patterns/form_dialogs/report.rs index 570bc1d9ad..db3ed60403 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/report.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/report.rs @@ -16,7 +16,7 @@ use craft_theme::variant::Tone; use egui::{Response, Ui}; use serde_json::{Value, json}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; craft_ui::words! { diff --git a/crates/ui-patterns/src/patterns/form_dialogs/rows.rs b/crates/ui-patterns/src/patterns/form_dialogs/rows.rs index 2ee03c78a1..b1995c6089 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/rows.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/rows.rs @@ -38,7 +38,7 @@ use std::ops::RangeInclusive; use std::path::PathBuf; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Where a grid or point row's numbers go: whole numbers have no decimals. diff --git a/crates/ui-patterns/src/patterns/form_dialogs/save_for_web.rs b/crates/ui-patterns/src/patterns/form_dialogs/save_for_web.rs index 417d06a7e7..1732c17282 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/save_for_web.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/save_for_web.rs @@ -34,7 +34,7 @@ use std::path::{Path, PathBuf}; mod options; mod panes; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use panes::WebPane; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/sizing.rs b/crates/ui-patterns/src/patterns/form_dialogs/sizing.rs index 58d1626819..63ea9a59e4 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/sizing.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/sizing.rs @@ -22,7 +22,7 @@ use std::sync::Arc; mod canvas; mod image; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use canvas::{CanvasSize, CanvasSizeOutput, CanvasSizeResult, CanvasSizeValues, HostedCanvasSize}; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/watermark.rs b/crates/ui-patterns/src/patterns/form_dialogs/watermark.rs index 839add6fac..ee87b35991 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/watermark.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/watermark.rs @@ -25,7 +25,7 @@ use serde::{Deserialize, Serialize}; use std::ops::RangeInclusive; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The key of the image request the Choose button files. diff --git a/crates/ui-patterns/src/patterns/panels/history.rs b/crates/ui-patterns/src/patterns/panels/history.rs index 1028486df3..026ff0523b 100644 --- a/crates/ui-patterns/src/patterns/panels/history.rs +++ b/crates/ui-patterns/src/patterns/panels/history.rs @@ -20,7 +20,7 @@ use std::cell::RefCell; use std::collections::HashSet; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The column of the source marks. diff --git a/crates/ui-patterns/src/patterns/panels/inspector.rs b/crates/ui-patterns/src/patterns/panels/inspector.rs index aae2c3fe06..1bfcf73f00 100644 --- a/crates/ui-patterns/src/patterns/panels/inspector.rs +++ b/crates/ui-patterns/src/patterns/panels/inspector.rs @@ -9,7 +9,7 @@ use crate::sections::{HeaderAction, HeaderStrength, MenuRows, Panel, PanelOutput use craft_theme::variant::Tone; use egui::{AsIdSalt, IdSalt, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// A properties panel: a `Panel` whose header names the target (icon and name, and the kind at the end), and whose body diff --git a/crates/ui-patterns/src/patterns/panels/modifier_keys.rs b/crates/ui-patterns/src/patterns/panels/modifier_keys.rs index 96e951869f..cfdf1c14b6 100644 --- a/crates/ui-patterns/src/patterns/panels/modifier_keys.rs +++ b/crates/ui-patterns/src/patterns/panels/modifier_keys.rs @@ -9,7 +9,7 @@ use craft_keymap::{Mods, Platform}; use egui::{Response, Ui}; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The panel's buttons in their fixed order, each with the one modifier it latches: Shift, the command key (⌘ on diff --git a/crates/ui-patterns/src/patterns/panels/palette.rs b/crates/ui-patterns/src/patterns/panels/palette.rs index 3bcbcb44cd..494bb6f68d 100644 --- a/crates/ui-patterns/src/patterns/panels/palette.rs +++ b/crates/ui-patterns/src/patterns/panels/palette.rs @@ -22,7 +22,7 @@ use egui::{Response, Ui}; use std::hash::{Hash, Hasher}; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The most commands the empty query lists when the app has run none. diff --git a/crates/ui-patterns/src/patterns/panels/tour.rs b/crates/ui-patterns/src/patterns/panels/tour.rs index c782f43437..81c253cc3e 100644 --- a/crates/ui-patterns/src/patterns/panels/tour.rs +++ b/crates/ui-patterns/src/patterns/panels/tour.rs @@ -19,7 +19,7 @@ use craft_theme::variant::Variant; use egui::{Rect, Ui}; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The keys of a tour: Right goes to the next step and Left back (the keymap mirrors them in a right-to-left diff --git a/crates/ui-patterns/src/patterns/preferences/path_setting.rs b/crates/ui-patterns/src/patterns/preferences/path_setting.rs index 495eb85f4d..90ab8972a6 100644 --- a/crates/ui-patterns/src/patterns/preferences/path_setting.rs +++ b/crates/ui-patterns/src/patterns/preferences/path_setting.rs @@ -1,6 +1,6 @@ //! `PathSetting`: a path setting of Preferences, typed or picked through the host's file service, kept in the draft. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::SettingsDraft; diff --git a/crates/ui-patterns/src/patterns/preferences/window.rs b/crates/ui-patterns/src/patterns/preferences/window.rs index 29305e1488..5c880039f0 100644 --- a/crates/ui-patterns/src/patterns/preferences/window.rs +++ b/crates/ui-patterns/src/patterns/preferences/window.rs @@ -1,7 +1,7 @@ //! `PreferencesWindow`: the preferences body in an app-modal `Dialog` that opens in its own OS window where windows //! exist. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::body::{self, BodyOut}; diff --git a/crates/ui-patterns/src/patterns/presets/browser.rs b/crates/ui-patterns/src/patterns/presets/browser.rs index b8478dd70a..ead741bf48 100644 --- a/crates/ui-patterns/src/patterns/presets/browser.rs +++ b/crates/ui-patterns/src/patterns/presets/browser.rs @@ -7,7 +7,7 @@ //! presets as rows of the same collection in both views: the grid's tail rows, the list's last rows. mod reorder; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use reorder::PresetReorder; diff --git a/crates/ui-patterns/src/patterns/presets/footer.rs b/crates/ui-patterns/src/patterns/presets/footer.rs index 219eabf4fb..61e35f26e1 100644 --- a/crates/ui-patterns/src/patterns/presets/footer.rs +++ b/crates/ui-patterns/src/patterns/presets/footer.rs @@ -11,7 +11,7 @@ use egui::{Response, Ui}; use std::marker::PhantomData; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// What a [`PresetFooter`] reports. A browser's footer reports these as `PresetEvent::Footer`, in order with its diff --git a/crates/ui-patterns/src/patterns/presets/manager.rs b/crates/ui-patterns/src/patterns/presets/manager.rs index ff588d2680..12f7f2053a 100644 --- a/crates/ui-patterns/src/patterns/presets/manager.rs +++ b/crates/ui-patterns/src/patterns/presets/manager.rs @@ -1,7 +1,7 @@ //! `PresetManager`: a dialog body for managing the presets of several kinds: a kind select over the presets of that //! kind, with rename and delete, and the host's own action buttons. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::browser::PresetBrowser; diff --git a/crates/ui-patterns/src/patterns/presets/named.rs b/crates/ui-patterns/src/patterns/presets/named.rs index b5e03f2ed5..e57be96461 100644 --- a/crates/ui-patterns/src/patterns/presets/named.rs +++ b/crates/ui-patterns/src/patterns/presets/named.rs @@ -5,7 +5,7 @@ //! commits the name, Escape or Cancel closes it, and a name the host refuses shows its message under the field and //! keeps the prompt open. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::event::PresetEvent; diff --git a/crates/ui-patterns/src/patterns/presets/picker.rs b/crates/ui-patterns/src/patterns/presets/picker.rs index bbc5570080..08a4e44e30 100644 --- a/crates/ui-patterns/src/patterns/presets/picker.rs +++ b/crates/ui-patterns/src/patterns/presets/picker.rs @@ -5,7 +5,7 @@ //! (`keep_open`), give the browser a footer, set how far the thumbnails zoom, open the popover at a point without the //! field (`open_at`) and let the user resize it (`resizable`). -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use std::sync::Arc; diff --git a/crates/ui-shell/Cargo.toml b/crates/ui-shell/Cargo.toml index d55e80fcb4..828982e811 100644 --- a/crates/ui-shell/Cargo.toml +++ b/crates/ui-shell/Cargo.toml @@ -15,6 +15,7 @@ test = false workspace = true [features] +suite = ["testing", "craft-ui-panels/suite"] default = [] # `shell::app`: the eframe entry point. app = ["dep:eframe", "craft-window/ui"] @@ -45,7 +46,7 @@ web-time = "1.1" craft-window = { workspace = true, features = ["appkit"] } [dev-dependencies] -craft-ui-shell = { path = ".", features = ["testing"] } +craft-ui-shell = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-host = { workspace = true } craft-theme = { workspace = true } diff --git a/crates/ui-shell/src/lib.rs b/crates/ui-shell/src/lib.rs index c6db340596..267f8e077a 100644 --- a/crates/ui-shell/src/lib.rs +++ b/crates/ui-shell/src/lib.rs @@ -10,7 +10,7 @@ extern crate self as craft_ui; #[doc(hidden)] pub use craft_ui_panels::canvas_data; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[doc(hidden)] pub use craft_ui_panels::story_kit; #[cfg(feature = "testing")] @@ -31,5 +31,6 @@ pub mod shell; pub mod testing { pub use craft_ui_panels::testing::*; + #[cfg(feature = "suite")] crate::testing_registered!(); } diff --git a/crates/ui-shell/src/shell/app_shell.rs b/crates/ui-shell/src/shell/app_shell.rs index ef3c9bd833..345f37f6ee 100644 --- a/crates/ui-shell/src/shell/app_shell.rs +++ b/crates/ui-shell/src/shell/app_shell.rs @@ -3,7 +3,7 @@ //! name of each region come from the pipeline. mod dialogs; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use self::dialogs::{ShellDialogsCx, WindowDialogs}; diff --git a/crates/ui-shell/src/shell/canvas_shell.rs b/crates/ui-shell/src/shell/canvas_shell.rs index 5167630fc7..ebb3ade00a 100644 --- a/crates/ui-shell/src/shell/canvas_shell.rs +++ b/crates/ui-shell/src/shell/canvas_shell.rs @@ -18,7 +18,7 @@ //! +----------------------+ //! ``` -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::app_shell::{RegionBody, ShellRegion}; diff --git a/crates/ui-shell/src/shell/caption_button.rs b/crates/ui-shell/src/shell/caption_button.rs index c8e3f73a99..8ceafc2db2 100644 --- a/crates/ui-shell/src/shell/caption_button.rs +++ b/crates/ui-shell/src/shell/caption_button.rs @@ -15,7 +15,7 @@ use craft_theme::{Stateful, States}; use egui::emath::GuiRounding as _; use egui::{Color32, ColorImage, CornerRadius, Painter, Pos2, Rect, Response, Stroke, StrokeKind, Vec2, pos2, vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The button's one part: the whole slot. diff --git a/crates/ui-shell/src/shell/document_window.rs b/crates/ui-shell/src/shell/document_window.rs index 7425692b05..6aef5f4941 100644 --- a/crates/ui-shell/src/shell/document_window.rs +++ b/crates/ui-shell/src/shell/document_window.rs @@ -1,6 +1,6 @@ //! `DocumentWindow`: a document's window, a container in its own OS viewport. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::contract::overlay::OverlayFit; diff --git a/crates/ui-shell/src/shell/opening.rs b/crates/ui-shell/src/shell/opening.rs index d82b31ad3a..2f322695d7 100644 --- a/crates/ui-shell/src/shell/opening.rs +++ b/crates/ui-shell/src/shell/opening.rs @@ -10,7 +10,7 @@ use crate::runtime::env::{Env, Label}; use crate::style::{SurfaceKind, TypeRole}; use egui::{Layout, Response, Ui, UiBuilder}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// A centred card: "Opening {name}…" elided on one line with the full text on hover, the muted message, a progress bar diff --git a/crates/ui-shell/src/shell/screen_mode_button.rs b/crates/ui-shell/src/shell/screen_mode_button.rs index 3817ae02d8..0e2566b713 100644 --- a/crates/ui-shell/src/shell/screen_mode_button.rs +++ b/crates/ui-shell/src/shell/screen_mode_button.rs @@ -7,7 +7,7 @@ use crate::rails::{FlyoutButton, RailTool}; use crate::runtime::env::Env; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// A flyout button over the three screen modes, with `mode` marked: a click, Enter or Space cycles; a hold, a drag away diff --git a/crates/ui-shell/src/shell/start.rs b/crates/ui-shell/src/shell/start.rs index 311e101480..35d13a2888 100644 --- a/crates/ui-shell/src/shell/start.rs +++ b/crates/ui-shell/src/shell/start.rs @@ -1,7 +1,7 @@ //! `StartScreen`: the page an app shows with no document open: New and Open, the recent files as a grid or a list, //! pinned folders and templates. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::recent::{RecentFile, RecentSort, RecentView, Template, ThumbKey, sort_recent}; diff --git a/crates/ui-shell/src/shell/title_bar/bar.rs b/crates/ui-shell/src/shell/title_bar/bar.rs index 0cad197ed5..454a579c94 100644 --- a/crates/ui-shell/src/shell/title_bar/bar.rs +++ b/crates/ui-shell/src/shell/title_bar/bar.rs @@ -1,6 +1,6 @@ //! `TitleBar`: the app-drawn bar of a window, in the title slot of an `AppShell`. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::measure::{End, Ends, Strip}; diff --git a/crates/ui-shell/src/shell/viewport_window.rs b/crates/ui-shell/src/shell/viewport_window.rs index 90e8ad5a98..a6fbf287c8 100644 --- a/crates/ui-shell/src/shell/viewport_window.rs +++ b/crates/ui-shell/src/shell/viewport_window.rs @@ -1,6 +1,6 @@ //! `ViewportWindow`: an app window in its own OS window where windows exist, else a dialog layer over the parent. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::contract::{Bind, BodyCx, NoValue, Outcome, Overlay, Pattern, Props, SaveKey, ShowContainer as _}; diff --git a/crates/ui-widgets/Cargo.toml b/crates/ui-widgets/Cargo.toml index 1be428234f..3e5521ab08 100644 --- a/crates/ui-widgets/Cargo.toml +++ b/crates/ui-widgets/Cargo.toml @@ -15,6 +15,7 @@ test = false workspace = true [features] +suite = ["testing", "craft-ui-contract/suite"] default = [] # `craft_ui::testing` with the story helpers that show components. testing = ["craft-ui-contract/testing"] @@ -32,7 +33,7 @@ smallvec = { workspace = true } serde = { workspace = true } [dev-dependencies] -craft-ui-widgets = { path = ".", features = ["testing"] } +craft-ui-widgets = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-host = { workspace = true } craft-i18n = { workspace = true, features = ["collate"] } diff --git a/crates/ui-widgets/src/bars/align.rs b/crates/ui-widgets/src/bars/align.rs index 8f915e9eb7..c0b9f0d43f 100644 --- a/crates/ui-widgets/src/bars/align.rs +++ b/crates/ui-widgets/src/bars/align.rs @@ -10,7 +10,7 @@ use crate::style::GlyphRole; use craft_behavior::fit::FitKeep; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// One align or distribute command. The commands are app commands: the app gates them with command state and takes diff --git a/crates/ui-widgets/src/bars/breadcrumb.rs b/crates/ui-widgets/src/bars/breadcrumb.rs index 6e993e6221..90ae6e3d27 100644 --- a/crates/ui-widgets/src/bars/breadcrumb.rs +++ b/crates/ui-widgets/src/bars/breadcrumb.rs @@ -17,7 +17,7 @@ use craft_behavior::fit::{FitItem, FitKeep, fit_items}; use craft_behavior::{Axis, CursorIcon, Flow, IconId, Metrics, NavShape, PartKey, PartRef, Roving, Sense, Value}; use egui::{Rect, Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; const HIDDEN: PartKey = PartKey::new("hidden"); diff --git a/crates/ui-widgets/src/bars/constraint_fields.rs b/crates/ui-widgets/src/bars/constraint_fields.rs index c0dffc57e6..188f438b50 100644 --- a/crates/ui-widgets/src/bars/constraint_fields.rs +++ b/crates/ui-widgets/src/bars/constraint_fields.rs @@ -16,7 +16,7 @@ use egui::{Response, Ui}; use std::ops::RangeInclusive; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The three kinds of [`Constraint`], as the Style select lists them. diff --git a/crates/ui-widgets/src/bars/mod.rs b/crates/ui-widgets/src/bars/mod.rs index c9dc5bb6e7..0b4e4c2368 100644 --- a/crates/ui-widgets/src/bars/mod.rs +++ b/crates/ui-widgets/src/bars/mod.rs @@ -8,7 +8,7 @@ mod items; mod lead; mod status; mod status_readout; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/ui-widgets/src/bars/status_readout.rs b/crates/ui-widgets/src/bars/status_readout.rs index cf64231a63..2e0f2683ea 100644 --- a/crates/ui-widgets/src/bars/status_readout.rs +++ b/crates/ui-widgets/src/bars/status_readout.rs @@ -15,7 +15,7 @@ use craft_behavior::{CanvasView, EditEvents, IconId, Mixed, PixelSize}; use egui::{Response, Ui}; use std::time::Duration; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Shown for an item whose value the host does not know. diff --git a/crates/ui-widgets/src/buttons/mod.rs b/crates/ui-widgets/src/buttons/mod.rs index fc6299fb7a..0b3e133fc3 100644 --- a/crates/ui-widgets/src/buttons/mod.rs +++ b/crates/ui-widgets/src/buttons/mod.rs @@ -5,7 +5,7 @@ pub(crate) mod face; pub mod icon_button; pub mod link; pub mod split_button; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub mod toggle_button; mod words; diff --git a/crates/ui-widgets/src/choice/check.rs b/crates/ui-widgets/src/choice/check.rs index 2412a8bc1d..5aac81ec6c 100644 --- a/crates/ui-widgets/src/choice/check.rs +++ b/crates/ui-widgets/src/choice/check.rs @@ -92,5 +92,5 @@ impl Component for Checkbox<'_> { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/choice/radio.rs b/crates/ui-widgets/src/choice/radio.rs index 5183097802..8e2b846b02 100644 --- a/crates/ui-widgets/src/choice/radio.rs +++ b/crates/ui-widgets/src/choice/radio.rs @@ -223,5 +223,5 @@ impl Component for Radio { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/choice/rating.rs b/crates/ui-widgets/src/choice/rating.rs index 77202885ea..0db4d1c265 100644 --- a/crates/ui-widgets/src/choice/rating.rs +++ b/crates/ui-widgets/src/choice/rating.rs @@ -203,5 +203,5 @@ impl Component for Rating<'_> { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/choice/segmented.rs b/crates/ui-widgets/src/choice/segmented.rs index 2541c9458f..0ea652ad05 100644 --- a/crates/ui-widgets/src/choice/segmented.rs +++ b/crates/ui-widgets/src/choice/segmented.rs @@ -250,5 +250,5 @@ impl Component for Segment { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/choice/swatch.rs b/crates/ui-widgets/src/choice/swatch.rs index f65ad8def2..008cf2be50 100644 --- a/crates/ui-widgets/src/choice/swatch.rs +++ b/crates/ui-widgets/src/choice/swatch.rs @@ -14,7 +14,7 @@ use craft_behavior::{Metrics, Mixed, Sense, Value}; use craft_theme::{Rgba, Srgba, Stateful, States, over}; use egui::{Color32, CornerRadius, Rect, Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Opacity of the black or white ring that stands out from a well's colour. diff --git a/crates/ui-widgets/src/choice/swatch_table.rs b/crates/ui-widgets/src/choice/swatch_table.rs index e731a695e0..adf28392eb 100644 --- a/crates/ui-widgets/src/choice/swatch_table.rs +++ b/crates/ui-widgets/src/choice/swatch_table.rs @@ -12,7 +12,7 @@ use craft_behavior::{DisplayOrder, ItemSource, Metrics, Selection, TileLayout}; use craft_theme::Srgba; use egui::{Response, Ui, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The entries of a colour table as an item source: keyed by index, named for type-ahead. diff --git a/crates/ui-widgets/src/choice/switch.rs b/crates/ui-widgets/src/choice/switch.rs index 9bd4a6e20c..d000317222 100644 --- a/crates/ui-widgets/src/choice/switch.rs +++ b/crates/ui-widgets/src/choice/switch.rs @@ -113,5 +113,5 @@ impl Component for Switch<'_> { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/controls/mod.rs b/crates/ui-widgets/src/controls/mod.rs index 5fedaf35fe..c25e18cbca 100644 --- a/crates/ui-widgets/src/controls/mod.rs +++ b/crates/ui-widgets/src/controls/mod.rs @@ -1,5 +1,5 @@ //! Value controls: `Disclosure`. pub mod disclosure; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/display/badge.rs b/crates/ui-widgets/src/display/badge.rs index 40deb21494..ee54e59261 100644 --- a/crates/ui-widgets/src/display/badge.rs +++ b/crates/ui-widgets/src/display/badge.rs @@ -12,7 +12,7 @@ use craft_theme::{ use egui::{Response, Vec2}; use std::borrow::Cow; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The largest count a count badge shows; more reads `99+`. diff --git a/crates/ui-widgets/src/display/divider.rs b/crates/ui-widgets/src/display/divider.rs index c373f0506e..44efb3b5b6 100644 --- a/crates/ui-widgets/src/display/divider.rs +++ b/crates/ui-widgets/src/display/divider.rs @@ -5,7 +5,7 @@ use crate::style::{ComponentStyle, RuleWidth, StyleCx}; use craft_behavior::{Metrics, Sense}; use egui::{Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a divider. diff --git a/crates/ui-widgets/src/display/icon.rs b/crates/ui-widgets/src/display/icon.rs index 390af10d19..3a217dcdf1 100644 --- a/crates/ui-widgets/src/display/icon.rs +++ b/crates/ui-widgets/src/display/icon.rs @@ -8,7 +8,7 @@ use craft_theme::variant::Tone; use craft_theme::{Stateful, States}; use egui::{Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of an icon. diff --git a/crates/ui-widgets/src/display/inspect_overlay.rs b/crates/ui-widgets/src/display/inspect_overlay.rs index baacd2f6f5..96cde9cb10 100644 --- a/crates/ui-widgets/src/display/inspect_overlay.rs +++ b/crates/ui-widgets/src/display/inspect_overlay.rs @@ -10,7 +10,7 @@ use craft_theme::Opacity; use egui::{CornerRadius, Pos2, Rect, Response, Vec2}; use std::sync::Arc; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Which drawings an [`InspectOverlay`] shows. diff --git a/crates/ui-widgets/src/display/kbd.rs b/crates/ui-widgets/src/display/kbd.rs index 8649c36da7..b2e3ef5e32 100644 --- a/crates/ui-widgets/src/display/kbd.rs +++ b/crates/ui-widgets/src/display/kbd.rs @@ -12,7 +12,7 @@ use craft_keymap::{Chord, Layout, ReturnGlyph, Trigger}; use craft_theme::Stateful; use egui::{Rect, Response, Vec2, pos2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a chord. diff --git a/crates/ui-widgets/src/display/picture.rs b/crates/ui-widgets/src/display/picture.rs index dbd617fb8e..d47be3ec9f 100644 --- a/crates/ui-widgets/src/display/picture.rs +++ b/crates/ui-widgets/src/display/picture.rs @@ -9,7 +9,7 @@ use crate::style::{ComponentStyle, StyleCx}; use craft_behavior::{Metrics, Sense}; use egui::{ColorImage, Id, Pos2, Rect, Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// How large a picture is: its height, from a token. diff --git a/crates/ui-widgets/src/display/progress.rs b/crates/ui-widgets/src/display/progress.rs index 0d80c770e9..0e4061ed7c 100644 --- a/crates/ui-widgets/src/display/progress.rs +++ b/crates/ui-widgets/src/display/progress.rs @@ -8,7 +8,7 @@ use craft_theme::variant::{Emphasis, Tone}; use craft_theme::{Stateful, Variant}; use egui::{CornerRadius, Rect, Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Seconds for the unknown-extent segment to cross the track. diff --git a/crates/ui-widgets/src/display/spinner.rs b/crates/ui-widgets/src/display/spinner.rs index ad3b34b352..f9f28ccdd8 100644 --- a/crates/ui-widgets/src/display/spinner.rs +++ b/crates/ui-widgets/src/display/spinner.rs @@ -10,7 +10,7 @@ use craft_theme::Stateful; use egui::{Pos2, Response, Vec2, vec2}; use std::f32::consts::{PI, TAU}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// How long the spinner takes for a turn, in seconds. diff --git a/crates/ui-widgets/src/display/target_mark.rs b/crates/ui-widgets/src/display/target_mark.rs index 3f192b9cb4..20753fb94e 100644 --- a/crates/ui-widgets/src/display/target_mark.rs +++ b/crates/ui-widgets/src/display/target_mark.rs @@ -13,7 +13,7 @@ use craft_theme::Mix as _; use egui::{CornerRadius, Rect, Response, Ui}; use std::f32::consts::TAU; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The period of the pulse in seconds: a sine of four radians per second. diff --git a/crates/ui-widgets/src/display/text.rs b/crates/ui-widgets/src/display/text.rs index 666161ab61..cc84c50b9f 100644 --- a/crates/ui-widgets/src/display/text.rs +++ b/crates/ui-widgets/src/display/text.rs @@ -8,7 +8,7 @@ use craft_behavior::{Metrics, Proposal, Sense}; use craft_theme::{Stateful, States, variant::Tone}; use egui::{Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// How strongly the text reads against its surface. diff --git a/crates/ui-widgets/src/form/mod.rs b/crates/ui-widgets/src/form/mod.rs index da36f14f9d..efa196c15d 100644 --- a/crates/ui-widgets/src/form/mod.rs +++ b/crates/ui-widgets/src/form/mod.rs @@ -3,7 +3,7 @@ mod field; mod group; mod slider_field; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/ui-widgets/src/form/slider_field.rs b/crates/ui-widgets/src/form/slider_field.rs index 13b6b2a8fd..015429972c 100644 --- a/crates/ui-widgets/src/form/slider_field.rs +++ b/crates/ui-widgets/src/form/slider_field.rs @@ -1,6 +1,6 @@ //! `SliderField`: a slider and a number field over one value. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::contract::{ diff --git a/crates/ui-widgets/src/graph/mod.rs b/crates/ui-widgets/src/graph/mod.rs index ee9273e198..0d0793784c 100644 --- a/crates/ui-widgets/src/graph/mod.rs +++ b/crates/ui-widgets/src/graph/mod.rs @@ -6,7 +6,7 @@ mod kind; mod node; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use kind::{NodeEvent, NodeId, NodeKind, PortRef, Wire, WireDrag}; diff --git a/crates/ui-widgets/src/layout_components/mod.rs b/crates/ui-widgets/src/layout_components/mod.rs index c4cee2fa6a..78e0f94f3b 100644 --- a/crates/ui-widgets/src/layout_components/mod.rs +++ b/crates/ui-widgets/src/layout_components/mod.rs @@ -10,7 +10,7 @@ use crate::style::{ComponentStyle, StyleCx}; use craft_behavior::{ColumnWidth, Insets, Metrics, Sense}; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of the layout components: no minimum size, and padding only at the start edge, one diff --git a/crates/ui-widgets/src/lib.rs b/crates/ui-widgets/src/lib.rs index 3ec71b0eff..446d09a5e3 100644 --- a/crates/ui-widgets/src/lib.rs +++ b/crates/ui-widgets/src/lib.rs @@ -30,7 +30,7 @@ pub mod menu; pub mod notices; pub mod pickers; pub mod popover; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] #[doc(hidden)] pub mod story_kit; pub mod table; @@ -43,8 +43,10 @@ pub mod value_drag; /// `story_props`. #[cfg(feature = "testing")] pub mod testing { + #[cfg(feature = "suite")] pub use crate::story_kit::{props, story_props}; pub use craft_ui_contract::testing::*; + #[cfg(feature = "suite")] crate::testing_registered!(); } diff --git a/crates/ui-widgets/src/list/mod.rs b/crates/ui-widgets/src/list/mod.rs index 1f7c2930b8..b5d9824e52 100644 --- a/crates/ui-widgets/src/list/mod.rs +++ b/crates/ui-widgets/src/list/mod.rs @@ -5,13 +5,13 @@ mod findings; mod predicate; #[doc(hidden)] pub mod row; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod toggle; mod tree; mod undo; mod view; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod view_stories; mod view_words; mod words; diff --git a/crates/ui-widgets/src/menu/bar.rs b/crates/ui-widgets/src/menu/bar.rs index c8cdac79d6..87fee1fc61 100644 --- a/crates/ui-widgets/src/menu/bar.rs +++ b/crates/ui-widgets/src/menu/bar.rs @@ -15,7 +15,7 @@ //! The Help menu can start with a search field over a list of `HelpEntry` commands: typing lists up to `search::MAX_RESULTS` //! matches by label, English label or menu path, each as a command row with its path as detail. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::search::{HelpEntry, search_order}; diff --git a/crates/ui-widgets/src/menu/mod.rs b/crates/ui-widgets/src/menu/mod.rs index 3fc886ffe8..7271572a5b 100644 --- a/crates/ui-widgets/src/menu/mod.rs +++ b/crates/ui-widgets/src/menu/mod.rs @@ -8,7 +8,7 @@ pub mod level; mod panel; mod popup; pub mod search; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod words; diff --git a/crates/ui-widgets/src/notices/mod.rs b/crates/ui-widgets/src/notices/mod.rs index cdfb18bc36..386586e525 100644 --- a/crates/ui-widgets/src/notices/mod.rs +++ b/crates/ui-widgets/src/notices/mod.rs @@ -7,7 +7,7 @@ mod settings; mod toasts; mod words; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use center::{NoticeCenter, NoticeCenterOutput, NoticeEnd, PostedNotice}; diff --git a/crates/ui-widgets/src/pickers/combo_box.rs b/crates/ui-widgets/src/pickers/combo_box.rs index 0f9eb9247e..52dcd9f6f9 100644 --- a/crates/ui-widgets/src/pickers/combo_box.rs +++ b/crates/ui-widgets/src/pickers/combo_box.rs @@ -4,7 +4,7 @@ //! component's own popup on the dropdown preset, so focus stays in the text part and the host hands the list keys to //! the list. The option the keys make active puts its text in the field; the list's Escape puts back what was typed. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::dress::RowDress; diff --git a/crates/ui-widgets/src/pickers/date.rs b/crates/ui-widgets/src/pickers/date.rs index eb4e282f84..46327edbf1 100644 --- a/crates/ui-widgets/src/pickers/date.rs +++ b/crates/ui-widgets/src/pickers/date.rs @@ -7,7 +7,7 @@ mod calendar; mod codec; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; pub use calendar::{Calendar, CalendarOutput, CalendarStyle, CalendarView, local_month_grid, month_grid}; diff --git a/crates/ui-widgets/src/pickers/face.rs b/crates/ui-widgets/src/pickers/face.rs index c4afb34fb7..fff9d93f5e 100644 --- a/crates/ui-widgets/src/pickers/face.rs +++ b/crates/ui-widgets/src/pickers/face.rs @@ -249,7 +249,7 @@ impl Component for SelectFace<'_> { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// Opens the popup of a picker whose face part toggles it, from the keyboard: Enter and Space (an activation by key) diff --git a/crates/ui-widgets/src/pickers/icon_picker.rs b/crates/ui-widgets/src/pickers/icon_picker.rs index 6220a38396..0b556a4ca9 100644 --- a/crates/ui-widgets/src/pickers/icon_picker.rs +++ b/crates/ui-widgets/src/pickers/icon_picker.rs @@ -3,7 +3,7 @@ //! The pattern puts a `TextField::search` over a `TileGrid`. The field drives the grid: Up and Down move into the //! tiles, Enter picks the active tile, and focus stays in the field. A click on a tile picks it. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::words::PickerWords; diff --git a/crates/ui-widgets/src/pickers/reference_point.rs b/crates/ui-widgets/src/pickers/reference_point.rs index e66ee2a656..5e81624850 100644 --- a/crates/ui-widgets/src/pickers/reference_point.rs +++ b/crates/ui-widgets/src/pickers/reference_point.rs @@ -14,7 +14,7 @@ use crate::style::{ComponentStyle, Flags, FocusLook, Stateful, States, StyleColo use craft_behavior::{Anchor9, Metrics, NavShape, PartKey, PartRef, Roving, Sense}; use egui::{Pos2, Rect, Vec2, vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; const CELL: PartKey = PartKey::new("cell"); diff --git a/crates/ui-widgets/src/pickers/select.rs b/crates/ui-widgets/src/pickers/select.rs index b6ebb1f1e5..7a0f2fee3b 100644 --- a/crates/ui-widgets/src/pickers/select.rs +++ b/crates/ui-widgets/src/pickers/select.rs @@ -31,7 +31,7 @@ use craft_theme::{Stateful, States}; use egui::{Rect, Ui, Vec2}; use std::borrow::Cow; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The part that shows the face over the whole field and opens the list on a click. diff --git a/crates/ui-widgets/src/pickers/tree_picker.rs b/crates/ui-widgets/src/pickers/tree_picker.rs index 30b6fc81d1..2f41e422e5 100644 --- a/crates/ui-widgets/src/pickers/tree_picker.rs +++ b/crates/ui-widgets/src/pickers/tree_picker.rs @@ -4,7 +4,7 @@ //! list: folders open and close with Left, Right, Enter and a click, and an item is picked with Enter or a click. //! Typing lists the items whose path holds every typed word instead of the tree. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::SelectFace; diff --git a/crates/ui-widgets/src/pickers/unit_select.rs b/crates/ui-widgets/src/pickers/unit_select.rs index e303f33742..e0b7accc3d 100644 --- a/crates/ui-widgets/src/pickers/unit_select.rs +++ b/crates/ui-widgets/src/pickers/unit_select.rs @@ -11,7 +11,7 @@ use craft_behavior::{EditEvents, Flow, Metrics, Mixed, NumberCodec, Proposal, Se use egui::{Rect, Response, Vec2, pos2}; use std::ops::{Deref, RangeInclusive}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a unit select: the gap between the field and the select, and the number field's width. diff --git a/crates/ui-widgets/src/popover/anchored.rs b/crates/ui-widgets/src/popover/anchored.rs index 3c51a81c72..d3d158a84c 100644 --- a/crates/ui-widgets/src/popover/anchored.rs +++ b/crates/ui-widgets/src/popover/anchored.rs @@ -206,5 +206,5 @@ impl Container for Popover<'_> { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; diff --git a/crates/ui-widgets/src/popover/drop_veil.rs b/crates/ui-widgets/src/popover/drop_veil.rs index b27b9dbe92..26a2481839 100644 --- a/crates/ui-widgets/src/popover/drop_veil.rs +++ b/crates/ui-widgets/src/popover/drop_veil.rs @@ -12,7 +12,7 @@ use crate::style::{ComponentStyle, Corners, Insets, Stateful, StyleCx, SurfaceKi use craft_behavior::{Metrics, Proposal, Sense}; use egui::{Rect, Response}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a drop veil: the scrim comes from the surface kind; the card is a child. diff --git a/crates/ui-widgets/src/popover/popup_list.rs b/crates/ui-widgets/src/popover/popup_list.rs index 38465aa752..85533caca5 100644 --- a/crates/ui-widgets/src/popover/popup_list.rs +++ b/crates/ui-widgets/src/popover/popup_list.rs @@ -8,7 +8,7 @@ use crate::style::{ComponentStyle, StyleCx, SurfaceKind}; use craft_behavior::{Metrics, Sense}; use egui::Response; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The style of a popup list: the surface comes from the container. diff --git a/crates/ui-widgets/src/table/metadata.rs b/crates/ui-widgets/src/table/metadata.rs index 861b7a99ca..36183c8c4a 100644 --- a/crates/ui-widgets/src/table/metadata.rs +++ b/crates/ui-widgets/src/table/metadata.rs @@ -325,7 +325,7 @@ impl<'a> MetadataTable<'a> { } } -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The rows stamp of a filter query: the same query keeps the layout, another one rebuilds it. diff --git a/crates/ui-widgets/src/table/mod.rs b/crates/ui-widgets/src/table/mod.rs index 392a02dcff..be0a212ac6 100644 --- a/crates/ui-widgets/src/table/mod.rs +++ b/crates/ui-widgets/src/table/mod.rs @@ -2,7 +2,7 @@ mod metadata; mod sort; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod view; mod words; diff --git a/crates/ui-widgets/src/tabs/document.rs b/crates/ui-widgets/src/tabs/document.rs index 340dc95b72..8bb6147a3f 100644 --- a/crates/ui-widgets/src/tabs/document.rs +++ b/crates/ui-widgets/src/tabs/document.rs @@ -2,7 +2,7 @@ //! strip through the drag session, and tear off when released over no strip; the host areas at both ends of the strip //! are the caller's closures. Files from the OS drop between the tabs when the host takes them. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::{Tab, TabStrip}; diff --git a/crates/ui-widgets/src/tabs/strip.rs b/crates/ui-widgets/src/tabs/strip.rs index 0d7ef1981a..c1be1b4b36 100644 --- a/crates/ui-widgets/src/tabs/strip.rs +++ b/crates/ui-widgets/src/tabs/strip.rs @@ -6,7 +6,7 @@ //! `ItemSource::text` is each tab's name in the overflow menu. The drag payload of a tab is `ListDrag`; a dock that //! carries panels reads the same payload with the panel key as `K`. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::rules::{FitMode, OverflowMenu, OverflowPlace, TabKind}; diff --git a/crates/ui-widgets/src/tabs/tab.rs b/crates/ui-widgets/src/tabs/tab.rs index 2909a2577e..e54c3c6583 100644 --- a/crates/ui-widgets/src/tabs/tab.rs +++ b/crates/ui-widgets/src/tabs/tab.rs @@ -20,7 +20,7 @@ use craft_behavior::{Flow, IconId, Insets, Metrics, PartKey, PointerButton, Pres use craft_theme::{Contrast, Rgba, Stateful, States, TypeRole}; use egui::{Pos2, Rect, Response, Vec2}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// What a tab's own parts report, besides what the collection reads from the pointer. diff --git a/crates/ui-widgets/src/text/alt_text.rs b/crates/ui-widgets/src/text/alt_text.rs index a93a82aa13..1d4a3f4cfc 100644 --- a/crates/ui-widgets/src/text/alt_text.rs +++ b/crates/ui-widgets/src/text/alt_text.rs @@ -1,6 +1,6 @@ //! `AltTextField`: an object's description for people who cannot see it, with a Mark as decorative check. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::{FieldStyle, text_part}; diff --git a/crates/ui-widgets/src/text/chips.rs b/crates/ui-widgets/src/text/chips.rs index 9aeaae5978..d48f4e7f61 100644 --- a/crates/ui-widgets/src/text/chips.rs +++ b/crates/ui-widgets/src/text/chips.rs @@ -1,7 +1,7 @@ //! `ChipField`: a list of text chips in lines, each removable, with a draft text part after the last chip, "+N more" //! where a line limit stops the list, and Clear All. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::{FieldStyle, text_part}; diff --git a/crates/ui-widgets/src/text/hex.rs b/crates/ui-widgets/src/text/hex.rs index 08d6fbb6a6..9ea16d0b82 100644 --- a/crates/ui-widgets/src/text/hex.rs +++ b/crates/ui-widgets/src/text/hex.rs @@ -1,7 +1,7 @@ //! `HexField`: a text field over a colour's hex digits, the `#` side label its row shows before it, and `HexCodec`, //! the codec behind it. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::TextField; diff --git a/crates/ui-widgets/src/text/linked.rs b/crates/ui-widgets/src/text/linked.rs index 930533ba24..87bc66acd2 100644 --- a/crates/ui-widgets/src/text/linked.rs +++ b/crates/ui-widgets/src/text/linked.rs @@ -1,7 +1,7 @@ //! `LinkedFields`: number fields joined by a link toggle that keeps their values in proportion (width and height) or //! equal (four sides). -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::NumberField; diff --git a/crates/ui-widgets/src/text/number.rs b/crates/ui-widgets/src/text/number.rs index b7a0d27f7b..ef033a6ab4 100644 --- a/crates/ui-widgets/src/text/number.rs +++ b/crates/ui-widgets/src/text/number.rs @@ -4,7 +4,7 @@ //! range every written value stays in and the step that arrows, the wheel and a scrub move by. A drag on a field that //! is not in edit scrubs it; a click enters edit, where a drag selects text. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::adorn::{Adornment, Placed, place, reserve}; diff --git a/crates/ui-widgets/src/text/selectable_text.rs b/crates/ui-widgets/src/text/selectable_text.rs index e802598b64..c043930524 100644 --- a/crates/ui-widgets/src/text/selectable_text.rs +++ b/crates/ui-widgets/src/text/selectable_text.rs @@ -1,6 +1,6 @@ //! `SelectableText`: read-only text the user can focus, select and copy. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use crate::contract::{Access, Common, Component, Cx, MeasureCx, PaintUi, PartsCx, Props as _, Role, Styled as _}; diff --git a/crates/ui-widgets/src/text/text_field.rs b/crates/ui-widgets/src/text/text_field.rs index 439c90430a..a58112cf36 100644 --- a/crates/ui-widgets/src/text/text_field.rs +++ b/crates/ui-widgets/src/text/text_field.rs @@ -1,6 +1,6 @@ //! `TextField`: a text field over a codec, with the search form and the adornment layout. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::adorn::{self, Adornment}; diff --git a/crates/ui-widgets/src/text/zoom_field.rs b/crates/ui-widgets/src/text/zoom_field.rs index dc5db73cec..cf859db1e0 100644 --- a/crates/ui-widgets/src/text/zoom_field.rs +++ b/crates/ui-widgets/src/text/zoom_field.rs @@ -9,7 +9,7 @@ use craft_behavior::kurbo::Size; use craft_behavior::{CanvasView, EditEvents, ZoomLadder}; use egui::{Response, Ui}; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The decimals the zoom range's ends are written with in the message, as the field shows a zoom. diff --git a/crates/ui-widgets/src/tile_grid/grid.rs b/crates/ui-widgets/src/tile_grid/grid.rs index f02ea9d77a..06348f3b86 100644 --- a/crates/ui-widgets/src/tile_grid/grid.rs +++ b/crates/ui-widgets/src/tile_grid/grid.rs @@ -5,7 +5,7 @@ //! the item step that hold the lead), and the rating keys. It owns what its cards have in common: where the //! caption goes, whether a detail line is reserved, and the zoom. -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; use super::headers::Outline; diff --git a/crates/ui-widgets/src/tile_grid/mod.rs b/crates/ui-widgets/src/tile_grid/mod.rs index 19322017af..f3705281e9 100644 --- a/crates/ui-widgets/src/tile_grid/mod.rs +++ b/crates/ui-widgets/src/tile_grid/mod.rs @@ -7,7 +7,7 @@ mod grid; mod headers; mod layout; mod slider; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; mod tile; mod words; diff --git a/crates/ui-widgets/src/value_drag/angle_dial.rs b/crates/ui-widgets/src/value_drag/angle_dial.rs index a0518a233d..ce5b9060a1 100644 --- a/crates/ui-widgets/src/value_drag/angle_dial.rs +++ b/crates/ui-widgets/src/value_drag/angle_dial.rs @@ -17,7 +17,7 @@ use craft_theme::{Stateful, States}; use egui::{CornerRadius, Pos2, Rect, Vec2}; use std::ops::RangeInclusive; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The face: the circle the pointer points at. diff --git a/crates/ui-widgets/src/value_drag/point_picker.rs b/crates/ui-widgets/src/value_drag/point_picker.rs index 6f877c7256..89f5df8b3d 100644 --- a/crates/ui-widgets/src/value_drag/point_picker.rs +++ b/crates/ui-widgets/src/value_drag/point_picker.rs @@ -19,7 +19,7 @@ use craft_behavior::{ use egui::{Pos2, Rect, Vec2, pos2}; use std::ops::RangeInclusive; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The point: a drag on it follows the pointer. diff --git a/crates/ui-widgets/src/value_drag/range_slider.rs b/crates/ui-widgets/src/value_drag/range_slider.rs index 5ecce7e4bd..c97893c7a3 100644 --- a/crates/ui-widgets/src/value_drag/range_slider.rs +++ b/crates/ui-widgets/src/value_drag/range_slider.rs @@ -16,7 +16,7 @@ use craft_theme::Stateful; use egui::{Pos2, Rect, Vec2}; use std::ops::RangeInclusive; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The track both thumbs ride on. diff --git a/crates/ui-widgets/src/value_drag/slider.rs b/crates/ui-widgets/src/value_drag/slider.rs index e63553c078..54bbf032d1 100644 --- a/crates/ui-widgets/src/value_drag/slider.rs +++ b/crates/ui-widgets/src/value_drag/slider.rs @@ -17,7 +17,7 @@ use craft_theme::Stateful; use egui::{Pos2, Rect, Vec2}; use std::ops::RangeInclusive; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The track the thumb rides on. diff --git a/crates/ui-widgets/src/value_drag/thumb_row.rs b/crates/ui-widgets/src/value_drag/thumb_row.rs index f11da91d09..d96044e60a 100644 --- a/crates/ui-widgets/src/value_drag/thumb_row.rs +++ b/crates/ui-widgets/src/value_drag/thumb_row.rs @@ -32,7 +32,7 @@ use std::ops::RangeInclusive; /// How far a thumb's width runs past the standard handle side, in small handle sides (the old levels thumb: 8 + 6 / 2). const THUMB_WIDTH_IN_SMALL_HANDLES: f32 = 0.5; -#[cfg(feature = "testing")] +#[cfg(feature = "suite")] mod stories; /// The row-wide part: a press off the thumbs lands here. diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index 4bf5411586..5b8644d4e5 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -16,6 +16,7 @@ test = false workspace = true [features] +suite = ["testing", "craft-ui-contract/suite", "craft-ui-widgets/suite", "craft-ui-panels/suite", "craft-ui-canvas/suite", "craft-ui-patterns/suite", "craft-ui-shell/suite"] default = [] # `shell::app`: the eframe entry point. app = ["craft-ui-shell/app"] @@ -51,7 +52,7 @@ craft-ui-shell = { workspace = true } craft-cloud-ui = { workspace = true } [dev-dependencies] -craft-ui = { path = ".", features = ["testing"] } +craft-ui = { path = ".", features = ["suite"] } craft-behavior = { workspace = true } craft-i18n = { workspace = true, features = ["collate"] } egui = { workspace = true } diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs index bd7618f67f..0188f2d495 100644 --- a/crates/ui/src/lib.rs +++ b/crates/ui/src/lib.rs @@ -46,12 +46,15 @@ pub mod patterns { pub mod testing { pub use craft_ui_canvas::testing::*; + #[cfg(feature = "suite")] crate::testing_registered!(); /// A crate's `registered`. + #[cfg(feature = "suite")] type Registered = fn() -> Vec<&'static Registration>; /// The crates of the library, each with its `registered`. + #[cfg(feature = "suite")] const LIBRARY: [(&str, Registered); 7] = [ ("craft-ui", registered), ("craft-ui-contract", craft_ui_contract::testing::registered), @@ -64,6 +67,7 @@ pub mod testing { /// Every registration declared in the library crates of the library: this crate and the six it re-exports. /// Types declared in integration binaries are fixtures and are left out. + #[cfg(feature = "suite")] pub fn library_registrations() -> Vec<&'static Registration> { // A crate's registrations run only in a binary that links the crate; naming each crate's `registered` // links them all. diff --git a/crates/update/Cargo.toml b/crates/update/Cargo.toml index db6a8d8725..0325ea8f91 100644 --- a/crates/update/Cargo.toml +++ b/crates/update/Cargo.toml @@ -17,6 +17,7 @@ harness = false workspace = true [features] +suite = ["screen-testing", "craft-ui/suite"] # Opt-in migration of first party Flatpak bundles to the ArtCraft OCI remote. oci_migration = [] default = [] @@ -43,7 +44,7 @@ chrono = { workspace = true } semver = { version = "1", features = ["serde"] } [dev-dependencies] -craft-ui = { workspace = true, features = ["testing"] } +craft-ui = { workspace = true, features = ["suite"] } flate2 = "1" [target.'cfg(unix)'.dependencies] diff --git a/crates/update/src/lib.rs b/crates/update/src/lib.rs index 97ff5e3424..ebe40129b3 100644 --- a/crates/update/src/lib.rs +++ b/crates/update/src/lib.rs @@ -51,6 +51,7 @@ pub use version::{Version, is_newer, parse as parse_version}; #[cfg(feature = "screen-testing")] /// The registrations of this package for the integration binary. pub mod testing { + #[cfg(feature = "suite")] craft_ui::testing_registered!(); } diff --git a/crates/update/src/stack_dialogs.rs b/crates/update/src/stack_dialogs.rs index a66fa939cb..fa3c405eb4 100644 --- a/crates/update/src/stack_dialogs.rs +++ b/crates/update/src/stack_dialogs.rs @@ -23,7 +23,7 @@ use crate::release::{Release, safe_web_link}; use crate::self_update; use crate::updater::Status; -#[cfg(feature = "screen-testing")] +#[cfg(feature = "suite")] mod stories; const PROMPT_KEY: &str = "updateDialog.prompt"; diff --git a/docs/development.md b/docs/development.md index 0a5ec09112..0cf6e7a250 100644 --- a/docs/development.md +++ b/docs/development.md @@ -28,10 +28,12 @@ A fix to one gallery component, from the edit to its old/new picture on a page: cargo compiles a crate once per distinct feature set, and every crate above it once more, and it unifies features only over the packages a command selects. A framework crate's tests have no eframe in their graph; a domain crate's tests do; the gallery adds every domain crate, whose dependencies turn on more features of egui, wgpu, craft-window, image and others below the framework. Each kind of command would build its own copy of the framework, and wgpu with it. -`cl` selects the `feature-root` package beside the package of every command (`-p -p feature-root`). Its dependencies are the gallery's, with every domain crate's `screen-testing`, so every local build resolves features as the gallery does, and a target directory holds one build of each crate. Nothing of `feature-root` is compiled: its one target is a bin no `cl` command selects (`cl` names the crate's own targets), and only the targets a command names are built, so a render still links one domain crate and a framework crate's tests still link no app. On top, `cl` adds the crate's own test feature (`screen-testing`, else `testing`). The Mac's and CI's commands never select `feature-root` and are unaffected. +`cl` selects the `feature-root` package beside the package of every command (`-p -p feature-root`). Its dependencies are the gallery's, with every domain crate's `suite`, so every local build resolves features as the gallery does, and a target directory holds one build of each crate. Nothing of `feature-root` is compiled: its one target is a bin no `cl` command selects (`cl` names the crate's own targets), and only the targets a command names are built, so a render still links one domain crate and a framework crate's tests still link no app. On top, `cl` adds the crate's own test feature (`suite`, else `screen-testing`, else `testing`). The Mac's and CI's commands never select `feature-root` and are unaffected. Four manifest facts keep this true, and `cl doctor` checks them: `feature-root` lists every optional domain crate of the gallery with the gallery's features, and depends on the gallery without its default features (so the gallery lib's own features stay each command's: `apps` for the gallery, one crate for a render); the story renderer asks its shared dependencies for no feature the gallery's lines lack; dev-dependency lines ask egui for no features (a feature there differs between a crate's tests and everything else); the proc-macro crate pins syn's and proc-macro2's features to everything other derive crates may add, so the one syn every proc macro shares is the same with or without design-lint in the graph. `cl` names any new build of a framework crate in the target directory after each command; after a manifest change one is expected, otherwise run `cl doctor`. +The `testing` feature (or `screen-testing` on domain crates) supplies fixtures and helpers for app tests. The `suite` feature implies that kit and adds framework stories, registrations, trials, snapshots, and the suite runner. Framework and gallery tests enable `suite`; apps should use the kit without it. + ## App workspaces `tools/cl` finds its workspace with `git rev-parse --show-toplevel` from the current directory, so `/path/to/craft-libs/tools/cl` run inside an app's tree builds and tests that tree. An app workspace is one whose root `Cargo.toml` has a `[workspace.metadata.cl]` table. There every command selects the same packages (`selection`), in test mode, without `--features` (the test features come from the dev-dependencies). Each package brings features the others lack, so a command that drops one builds a second copy of the shared crates below it (in PhotoCraft egui, photocraft-io and craft-affinity) and of everything above them. The craft-libs workspace has no such table and keeps the commands above. diff --git a/tools/cl b/tools/cl index 76f421fca0..69f327c451 100755 --- a/tools/cl +++ b/tools/cl @@ -31,7 +31,7 @@ the story renderer each pull in different crates, which turn on different featur others below the framework, so each would build its own copy of the framework (minutes, and wgpu again). cl selects the `feature-root` package beside every command's package: its dependencies are the gallery's, with every domain crate, so every command resolves features as the gallery does and builds only the targets it names. The crate's own -test feature (`screen-testing`, else `testing`) is added on top. Builds that take other features (CI's +test feature (`suite`, else `screen-testing`, else `testing`) is added on top. Builds that take other features (CI's `--all-features`, wasm checks) belong on GitHub. docs/development.md has the whole picture. Records: every build cl composes passes cargo's --timings (a report per build in /cargo-timings/, the newest @@ -183,6 +183,8 @@ def package(packages, name): def canonical(packages, name): """The package's name and the features cl adds for it, qualified: its own test feature.""" p = package(packages, name) + if "suite" in p["features"]: + return p["name"], [p["name"] + "/suite"] if "screen-testing" in p["features"]: return p["name"], [p["name"] + "/screen-testing"] if "testing" in p["features"] and p["name"] != "craft-ui-test-kit": @@ -219,7 +221,7 @@ def doctor(top, packages, quiet=False): gallery = packages.get("craft-ui-gallery") if gallery: for d in gallery["dependencies"]: - if d["name"].startswith("craft-") and "screen-testing" in d["features"] and not d["optional"]: + if d["name"].startswith("craft-") and "suite" in d["features"] and not d["optional"]: problems.append(f"crates/ui-gallery/Cargo.toml: {d['name']} must be optional (one feature per domain crate), or the story renderer links every crate") root = packages.get(ROOT) if not root: