mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Merge pull request #2363 from storytold/perf/2332-explicit-ui-suite
Split the UI test kit and select suite registrations explicitly
This commit is contained in:
Generated
+1
@@ -4377,6 +4377,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn 2.0.119",
|
||||
"toml",
|
||||
"wasm-bindgen-futures",
|
||||
"web-time",
|
||||
]
|
||||
|
||||
@@ -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`,
|
||||
@@ -57,5 +58,5 @@ thiserror = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
craft-ui = { workspace = true, features = ["testing"] }
|
||||
craft-ui = { workspace = true, features = ["suite"] }
|
||||
egui = { workspace = true }
|
||||
|
||||
@@ -20,7 +20,7 @@ mod model;
|
||||
mod player;
|
||||
mod recording;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
pub use file::{ActionsFile, ActionsFileError};
|
||||
pub use list::{ActionList, ActionListError, LibraryEdit, MergedFile, moved_index};
|
||||
|
||||
@@ -118,4 +118,4 @@ enum Failure {
|
||||
|
||||
#[cfg(all(test, feature = "ui"))]
|
||||
#[path = "client_tests.rs"]
|
||||
mod client_tests;
|
||||
pub(crate) mod client_tests;
|
||||
|
||||
@@ -56,16 +56,19 @@ pub use security::AutomationError;
|
||||
/// The trials this crate registers, for its integration binary.
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub mod testing {
|
||||
craft_ui::testing_registered!();
|
||||
|
||||
#[cfg(feature = "suite")]
|
||||
craft_ui::registry!();
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
extern crate self as craft_automation;
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
#[path = "../tests/it/main.rs"]
|
||||
mod integration;
|
||||
pub(crate) mod integration;
|
||||
|
||||
#[cfg(test)]
|
||||
fn main() {
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::registered_in(env!("CARGO_PKG_NAME")));
|
||||
craft_ui::registry!();
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::Registry::of(&[register]));
|
||||
}
|
||||
|
||||
@@ -473,4 +473,4 @@ impl std::io::Read for AuthDeadlineStream {
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "security_tests.rs"]
|
||||
mod security_tests;
|
||||
pub(crate) mod security_tests;
|
||||
|
||||
@@ -14,11 +14,11 @@ mod footer;
|
||||
mod menu;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub mod mock;
|
||||
mod panel;
|
||||
pub(crate) mod panel;
|
||||
mod prompt;
|
||||
mod rows;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
pub use body::{ActionMove, ActionPlace};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `AgentsPage`: the Agents page of Preferences, over the agent settings in the Preferences draft.
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
pub use words::AgentsWords;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// Unwrapping, expecting and panicking on failure is fine in tests, unlike in shipped code.
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
|
||||
mod actions;
|
||||
mod agents;
|
||||
mod control;
|
||||
mod dialogs;
|
||||
mod screenshot;
|
||||
mod synthetic;
|
||||
pub(crate) mod actions;
|
||||
pub(crate) mod agents;
|
||||
pub(crate) mod control;
|
||||
pub(crate) mod dialogs;
|
||||
pub(crate) mod screenshot;
|
||||
pub(crate) mod synthetic;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -20,9 +20,10 @@ pub mod ui;
|
||||
extern crate self as craft_browse;
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
#[path = "../tests/it/main.rs"]
|
||||
mod integration;
|
||||
pub(crate) mod integration;
|
||||
|
||||
#[cfg(test)]
|
||||
fn main() {
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::registered_in(env!("CARGO_PKG_NAME")));
|
||||
craft_ui::registry!();
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::Registry::of(&[register]));
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//! ```
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::hash::Hash;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
mod cache;
|
||||
mod directories;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ mod free_view;
|
||||
mod icon;
|
||||
mod list;
|
||||
mod search;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hash::Hash;
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
mod arrange;
|
||||
mod caption;
|
||||
mod pill;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod pill;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod style;
|
||||
mod tile;
|
||||
pub(crate) mod tile;
|
||||
|
||||
pub use arrange::{ArrangeSpace, ComparePair, survey_cell, survey_columns};
|
||||
pub use caption::CompareCaption;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
//! 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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -21,5 +21,7 @@ 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 {
|
||||
craft_ui::testing_registered!();
|
||||
|
||||
#[cfg(feature = "suite")]
|
||||
craft_ui::registry!();
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
//! ```
|
||||
|
||||
mod badge;
|
||||
mod dialog;
|
||||
mod list;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod dialog;
|
||||
pub(crate) mod list;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
pub use badge::StatusBadge;
|
||||
pub use dialog::{CandidateChecker, RelinkCriterion, RelinkDialog, RelinkLayout, RelinkOptions, RelinkOutcome, RelinkRow, RelinkWords};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! The screen tests of craft-browse, folded into the lib's test target.
|
||||
|
||||
mod bin;
|
||||
mod freebin;
|
||||
mod places;
|
||||
mod relink;
|
||||
mod thumbs;
|
||||
pub(crate) mod bin;
|
||||
pub(crate) mod freebin;
|
||||
pub(crate) mod places;
|
||||
pub(crate) mod relink;
|
||||
pub(crate) mod thumbs;
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -298,7 +298,7 @@ impl DisplayCaches {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use craft_ui::testing::trial;
|
||||
|
||||
|
||||
@@ -27,9 +27,10 @@ pub use web::{not_web_safe, web_safe};
|
||||
extern crate self as craft_color_ui;
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
#[path = "../tests/it/main.rs"]
|
||||
mod integration;
|
||||
pub(crate) mod integration;
|
||||
|
||||
#[cfg(test)]
|
||||
fn main() {
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::registered_in(env!("CARGO_PKG_NAME")));
|
||||
craft_ui::registry!();
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::Registry::of(&[register]));
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ mod aco;
|
||||
mod ase;
|
||||
mod reader;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
mod text;
|
||||
|
||||
use aco::{AcoColor, act_used, from_aco, parse_aco, to_aco, write_aco};
|
||||
|
||||
@@ -13,8 +13,8 @@ use craft_ui::style::{ComponentStyle, StyleCx};
|
||||
use craft_ui::value_drag::{PointMark, PointPicker};
|
||||
use egui::{Mesh, Pos2, Rect, Vec2, pos2};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// Vertices along each side of the area's colour mesh (PhotoCraft's 32).
|
||||
const MESH: usize = 32;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! `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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use craft_theme::Srgba;
|
||||
use craft_ui::contract::{Bind, Entry, NoValue, Outcome, Props as _, Show as _};
|
||||
|
||||
@@ -12,8 +12,8 @@ use egui::{CornerRadius, Rect, Response, Vec2, pos2};
|
||||
use super::picker::ColorPickerWords;
|
||||
use super::warning::{ColorWarning, ColorWarningChip};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) 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
|
||||
/// caption and the block.
|
||||
|
||||
@@ -16,8 +16,8 @@ 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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The disc: a press on it grabs the nearest marker within reach.
|
||||
const DISC: PartKey = PartKey::new("disc");
|
||||
|
||||
@@ -31,8 +31,8 @@ use craft_ui::runtime::env::Label;
|
||||
use craft_ui::runtime::requests::EyedropperRequest;
|
||||
use egui::{Pos2, Response, Ui, Vec2};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The pipette icon's tip, in the icon's own 24-unit box.
|
||||
const HOTSPOT: [f32; 2] = [2.0, 22.0];
|
||||
|
||||
@@ -35,8 +35,8 @@ use craft_ui::runtime::env::{Env, Label};
|
||||
use craft_ui::style::DataColor;
|
||||
use egui::{Color32, Pos2, Response, Ui, Vec2, vec2};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
craft_ui::words! {
|
||||
/// The Eyedropper options bar's words, English by default.
|
||||
|
||||
@@ -17,8 +17,8 @@ use crate::gradient::{GradientStops, Sampler, StopRules};
|
||||
|
||||
mod bar;
|
||||
mod fields;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use bar::GradientBar;
|
||||
pub use bar::StopDrop;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! The model and the stop rules ([`GradientStops`], [`stops`]) need no egui and live in [`crate::gradient`]; they are
|
||||
//! re-exported here so a widget user imports the editor and its model from one path.
|
||||
|
||||
mod editor;
|
||||
pub(crate) mod editor;
|
||||
mod ramp;
|
||||
mod value;
|
||||
mod words;
|
||||
|
||||
@@ -19,8 +19,8 @@ use super::picker::{ChannelRow, ChannelRule};
|
||||
use crate::harmony::{Guide, GuideOptions, Harmony, Variation};
|
||||
use craft_ui::choice::{SwatchTable, SwatchTableOutput};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
craft_ui::words! {
|
||||
/// The words of the harmony controls and of the Color Guide panel menu.
|
||||
|
||||
@@ -17,8 +17,8 @@ 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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The model the HUD picks in: saturation and brightness across and down, hue in the strip.
|
||||
const MODE: AreaMode = AreaMode::Hue;
|
||||
|
||||
@@ -13,8 +13,8 @@ use egui::{Response, Ui};
|
||||
|
||||
use super::SamplerReadout;
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// What a missing value shows.
|
||||
const DASH: &str = "–";
|
||||
|
||||
@@ -19,8 +19,8 @@ use craft_ui::runtime::env::Label;
|
||||
use craft_ui::style::{ComponentStyle, StyleCx};
|
||||
use egui::{Response, Vec2};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
craft_ui::words! {
|
||||
/// The LUT picker's rows, English by default, and the built-in looks' names in
|
||||
|
||||
@@ -11,39 +11,39 @@
|
||||
//! Colour edits are values of a colour model ([`ModelValues`](craft_theme::ModelValues)) or of [`PickedColor`], and
|
||||
//! report through the edit lifecycle of the contract.
|
||||
|
||||
mod area;
|
||||
pub(crate) mod area;
|
||||
mod channels;
|
||||
mod choice;
|
||||
mod compare;
|
||||
mod disc;
|
||||
mod droppers;
|
||||
mod eyedropper;
|
||||
pub(crate) mod choice;
|
||||
pub(crate) mod compare;
|
||||
pub(crate) mod disc;
|
||||
pub(crate) mod droppers;
|
||||
pub(crate) mod eyedropper;
|
||||
pub mod gradient;
|
||||
mod harmony;
|
||||
pub(crate) mod harmony;
|
||||
mod hex;
|
||||
mod hud;
|
||||
mod info;
|
||||
mod lut_picker;
|
||||
mod paint_chip;
|
||||
mod pair;
|
||||
mod palette;
|
||||
mod panel;
|
||||
mod picker;
|
||||
mod picker_dialog;
|
||||
mod popover;
|
||||
mod profile_prompts;
|
||||
mod ramp;
|
||||
mod readout;
|
||||
mod sample_size;
|
||||
mod samplers;
|
||||
mod screen_picker;
|
||||
mod strip;
|
||||
mod swatches;
|
||||
pub(crate) mod hud;
|
||||
pub(crate) mod info;
|
||||
pub(crate) mod lut_picker;
|
||||
pub(crate) mod paint_chip;
|
||||
pub(crate) mod pair;
|
||||
pub(crate) mod palette;
|
||||
pub(crate) mod panel;
|
||||
pub(crate) mod picker;
|
||||
pub(crate) mod picker_dialog;
|
||||
pub(crate) mod popover;
|
||||
pub(crate) mod profile_prompts;
|
||||
pub(crate) mod ramp;
|
||||
pub(crate) mod readout;
|
||||
pub(crate) mod sample_size;
|
||||
pub(crate) mod samplers;
|
||||
pub(crate) mod screen_picker;
|
||||
pub(crate) mod strip;
|
||||
pub(crate) mod swatches;
|
||||
/// The stories and trials this crate registers for the integration binary.
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub mod testing;
|
||||
mod warning;
|
||||
mod wheel;
|
||||
pub(crate) mod warning;
|
||||
pub(crate) mod wheel;
|
||||
|
||||
pub use crate::AreaMode;
|
||||
pub use area::{AreaShape, ColorArea, ColorAreaStyle, smooth_mesh};
|
||||
|
||||
@@ -33,9 +33,9 @@ use super::popover::compact_picker;
|
||||
use super::{PickedColor, ScreenPickGesture, SwatchKey, SwatchPalette, SwatchesWords, swatch_rows};
|
||||
use crate::palette::{SwatchColor, SwatchGroup};
|
||||
|
||||
mod paint_list;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod paint_list;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
pub use paint_list::{PaintLink, PaintLinkKind, PaintList, PaintListEvent, PaintListOptions, PaintListOutput, PaintRow};
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ use egui::{Color32, CornerRadius, Painter, Pos2, Rect, Response, Shape, Stroke,
|
||||
use super::popover::compact_picker;
|
||||
use super::{ColorPicker, PickedColor, ScreenPickGesture};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// One of the wells, `WELL.at(0)` the primary and `WELL.at(1)` the secondary.
|
||||
const WELL: PartKey = PartKey::new("well");
|
||||
|
||||
@@ -10,8 +10,8 @@ use craft_ui::runtime::env::Label;
|
||||
use egui::{Response, Ui};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// What a [`SwatchPalette`] reports.
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -29,8 +29,8 @@ use super::{
|
||||
};
|
||||
use crate::{CmykModel, GrayModel, not_web_safe};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
craft_ui::words! {
|
||||
/// The Color panel's words.
|
||||
@@ -821,7 +821,7 @@ impl Body<'_> {
|
||||
const WEB_STEP: f64 = 51.0;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
pub(crate) mod tests {
|
||||
use craft_ui::testing::trial;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
//! host adds. A container: its body lays the parts out with the form layouts, the "Field shows" choice is a
|
||||
//! `RadioGroup` and the channel rows share one label column.
|
||||
|
||||
mod channel;
|
||||
pub(crate) mod channel;
|
||||
mod compact;
|
||||
mod full;
|
||||
mod screen_pick;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod screen_pick;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod value;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -11,8 +11,8 @@ use egui::{Response, Ui};
|
||||
|
||||
use super::{ColorPicker, ColorPickerLayout, ColorPickerOutput, PickedColor, ScreenPickGesture};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The setup closure of the picker in the popover.
|
||||
type Setup<'a> = Box<dyn for<'b> Fn(ColorPicker<'b>) -> ColorPicker<'b> + 'a>;
|
||||
|
||||
@@ -18,8 +18,8 @@ use serde_json::{Value, json};
|
||||
|
||||
use crate::display::MonitorProblem;
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
craft_ui::words! {
|
||||
/// The profile prompts' words, English by default.
|
||||
|
||||
@@ -17,8 +17,8 @@ use egui::{Color32, CornerRadius, Mesh, Pos2, Rect, Response, Vec2, pos2};
|
||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The bar: a press picks the colour under the pointer.
|
||||
const BAR: PartKey = PartKey::new("bar");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `ColorReadout`: a colour as a hex field and editable R, G and B fields (the readout of a Color panel).
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use craft_behavior::{EditEvent, EditEvents, Mixed};
|
||||
use craft_theme::{ColorModel as _, RgbModel, Rgba};
|
||||
|
||||
@@ -34,8 +34,8 @@ use super::{InfoColor, SampleSize, SampleSizeSelect};
|
||||
use craft_ui::style::{ComponentStyle, StyleColor, StyleCx};
|
||||
use egui::{Pos2, Response, Ui, Vec2, vec2};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
craft_ui::words! {
|
||||
/// The colour samplers' words, English by default.
|
||||
|
||||
@@ -32,9 +32,9 @@ use egui::{Color32, Context, Pos2, Rect, Ui, pos2, vec2};
|
||||
|
||||
use super::ScreenPickGesture;
|
||||
|
||||
mod capture;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod capture;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use capture::{CaptureView, CaptureWindow};
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ 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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The strip itself: a press on it sets the value there.
|
||||
const STRIP: PartKey = PartKey::new("strip");
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
use craft_ui::tile_grid::TileZoom;
|
||||
|
||||
mod library;
|
||||
pub(crate) mod library;
|
||||
mod menu;
|
||||
mod panel;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod panel;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
pub use library::{SwatchAt, SwatchEdit, SwatchKey, SwatchLibrary, SwatchesState, swatch_rows};
|
||||
pub use menu::{SwatchesCommand, SwatchesFileOutput, SwatchesMenu, SwatchesMenuOutput};
|
||||
|
||||
@@ -571,7 +571,7 @@ pub fn swatch_rows(groups: &[SwatchGroup], words: &SwatchesWords) -> Vec<PresetR
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use craft_ui::testing::trial;
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
craft_ui::testing_registered!();
|
||||
#[cfg(feature = "suite")]
|
||||
craft_ui::registry!();
|
||||
|
||||
@@ -11,8 +11,8 @@ use craft_ui::runtime::env::Label;
|
||||
use craft_ui::style::{ComponentStyle, StyleCx};
|
||||
use egui::{Rect, Response, Vec2};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) 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
|
||||
/// Picker and Color panel: an icon and a chip of the nearest colour that passes. A click on it sets that colour;
|
||||
|
||||
@@ -15,8 +15,8 @@ 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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The hue ring: a press on it sets the hue to the pointer's angle.
|
||||
const RING: PartKey = PartKey::new("ring");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! The screen tests of craft-color-ui, folded into the lib's test target.
|
||||
|
||||
mod color_parts;
|
||||
mod gradient_bar;
|
||||
mod paint_list;
|
||||
mod pair;
|
||||
mod panels;
|
||||
mod picker;
|
||||
mod profile_prompts;
|
||||
mod sampling;
|
||||
pub(crate) mod color_parts;
|
||||
pub(crate) mod gradient_bar;
|
||||
pub(crate) mod paint_list;
|
||||
pub(crate) mod pair;
|
||||
pub(crate) mod panels;
|
||||
pub(crate) mod picker;
|
||||
pub(crate) mod profile_prompts;
|
||||
pub(crate) mod sampling;
|
||||
|
||||
@@ -269,6 +269,28 @@ screen-testing = [
|
||||
"craft-timeline?/screen-testing",
|
||||
"craft-update?/screen-testing",
|
||||
]
|
||||
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",
|
||||
]
|
||||
aaf = ["dep:craft-aaf"]
|
||||
|
||||
aep = ["dep:craft-aep"]
|
||||
|
||||
@@ -8,7 +8,7 @@ use common::{Member, members};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// Crate features forwarded by their own rule, not as `<crate>-<feature>`.
|
||||
const SHARED: &[&str] = &["ui", "screen-testing"];
|
||||
const SHARED: &[&str] = &["ui", "screen-testing", "suite"];
|
||||
|
||||
/// Facade features that do not build for `wasm32-unknown-unknown`, noted on their line.
|
||||
const NATIVE_ONLY: &[(&str, &str)] = &[
|
||||
@@ -66,6 +66,11 @@ fn expected(members: &[Member]) -> String {
|
||||
out += &line("screen-testing", &testing, None);
|
||||
out += "\n";
|
||||
|
||||
let mut suite = vec!["screen-testing".to_owned(), "craft-ui/suite".to_owned()];
|
||||
suite.extend(forwarded_to_all(members, "suite").into_iter().filter(|entry| entry != "craft-ui?/suite"));
|
||||
out += &line("suite", &suite, None);
|
||||
out += "\n";
|
||||
|
||||
let mut seen: BTreeMap<String, String> = BTreeMap::new();
|
||||
for m in members {
|
||||
let mut group = String::new();
|
||||
|
||||
@@ -21,6 +21,7 @@ mod pipeline_only;
|
||||
mod platform;
|
||||
mod pointer;
|
||||
mod props;
|
||||
mod registry_expansion;
|
||||
mod runtime_egui;
|
||||
mod scope;
|
||||
mod shape;
|
||||
@@ -41,7 +42,7 @@ use crate::report::Finding;
|
||||
use sites::Site;
|
||||
|
||||
/// Every rule id of this module, for the marker and exemption validation in [`crate::RULES`].
|
||||
pub(crate) const IDS: [&str; 40] = [
|
||||
pub(crate) const IDS: [&str; 41] = [
|
||||
egui_import::ID,
|
||||
runtime_egui::ID,
|
||||
text_edit::ID,
|
||||
@@ -81,13 +82,14 @@ pub(crate) const IDS: [&str; 40] = [
|
||||
shape::OVERLAY_FLAG,
|
||||
shape::REGISTRATION,
|
||||
unsafe_allow::ID,
|
||||
registry_expansion::ID,
|
||||
global_state::ID,
|
||||
];
|
||||
|
||||
type Check = fn(&Cx<'_>, &mut Vec<Finding>);
|
||||
|
||||
/// REGISTRY: add a rule by adding its `check` here and its ids to [`IDS`].
|
||||
const REGISTRY: [Check; 22] = [
|
||||
const REGISTRY: [Check; 23] = [
|
||||
egui_import::check,
|
||||
runtime_egui::check,
|
||||
text_edit::check,
|
||||
@@ -109,6 +111,7 @@ const REGISTRY: [Check; 22] = [
|
||||
entry::check,
|
||||
shape::check,
|
||||
unsafe_allow::check,
|
||||
registry_expansion::check,
|
||||
global_state::check,
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
//! Reject suite registrations hidden from the source-tree registry walker.
|
||||
|
||||
use proc_macro2::{Delimiter, TokenStream, TokenTree};
|
||||
use std::str::FromStr as _;
|
||||
use syn::spanned::Spanned as _;
|
||||
use syn::visit::{self, Visit};
|
||||
|
||||
use super::Cx;
|
||||
use crate::report::Finding;
|
||||
|
||||
/// Suite items inside expansions cannot be discovered by `registry!`.
|
||||
pub const ID: &str = "registry/expansion";
|
||||
|
||||
fn attribute(tree: &TokenTree) -> Option<String> {
|
||||
match tree {
|
||||
TokenTree::Group(group) if group.delimiter() == Delimiter::Bracket => Some(group.stream().to_string()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn words(attr: &str) -> Vec<&str> {
|
||||
attr.split(|c: char| !c.is_alphanumeric() && c != '_').filter(|s| !s.is_empty()).collect()
|
||||
}
|
||||
|
||||
fn has_registration(tokens: TokenStream) -> bool {
|
||||
let trees: Vec<_> = tokens.into_iter().collect();
|
||||
let mut i = 0;
|
||||
while i < trees.len() {
|
||||
if matches!(&trees[i], TokenTree::Punct(p) if p.as_char() == '#') {
|
||||
let mut attrs = Vec::new();
|
||||
while i + 1 < trees.len() && matches!(&trees[i], TokenTree::Punct(p) if p.as_char() == '#') {
|
||||
let Some(attr) = attribute(&trees[i + 1]) else { break };
|
||||
attrs.push(attr);
|
||||
i += 2;
|
||||
}
|
||||
if attrs.is_empty() {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
if attrs.iter().any(|attr| words(attr).first().is_some_and(|word| *word == "story" || *word == "trial")) {
|
||||
return true;
|
||||
}
|
||||
let unregistered = attrs.iter().any(|attr| {
|
||||
let words = words(attr);
|
||||
words.first() == Some(&"component") && words.contains(&"unregistered")
|
||||
});
|
||||
if !unregistered
|
||||
&& attrs.iter().any(|attr| {
|
||||
let words = words(attr);
|
||||
words.first() == Some(&"derive") && (words.contains(&"Component") || words.contains(&"Pattern"))
|
||||
})
|
||||
{
|
||||
return true;
|
||||
}
|
||||
let story_set = attrs.iter().any(|attr| {
|
||||
let words = words(attr);
|
||||
words.first() == Some(&"command") && words.contains(&"story")
|
||||
});
|
||||
if story_set
|
||||
&& attrs.iter().any(|attr| {
|
||||
let words = words(attr);
|
||||
words.first() == Some(&"derive") && words.contains(&"CommandSet")
|
||||
})
|
||||
{
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if let TokenTree::Ident(ident) = &trees[i]
|
||||
&& ident == "register_contract"
|
||||
&& trees.get(i + 1).is_some_and(|t| matches!(t, TokenTree::Punct(p) if p.as_char() == '!'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if let TokenTree::Group(group) = &trees[i]
|
||||
&& has_registration(group.stream())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
struct Walk<'a, 'b> {
|
||||
cx: &'a Cx<'b>,
|
||||
out: &'a mut Vec<Finding>,
|
||||
}
|
||||
|
||||
impl<'ast> Visit<'ast> for Walk<'_, '_> {
|
||||
fn visit_item_macro(&mut self, item: &'ast syn::ItemMacro) {
|
||||
let hidden = if item.mac.path.is_ident("include") {
|
||||
syn::parse2::<syn::LitStr>(item.mac.tokens.clone())
|
||||
.ok()
|
||||
.and_then(|path| self.cx.path.parent().map(|parent| parent.join(path.value())))
|
||||
.and_then(|path| std::fs::read_to_string(path).ok())
|
||||
.and_then(|source| TokenStream::from_str(&source).ok())
|
||||
.is_some_and(has_registration)
|
||||
} else {
|
||||
has_registration(item.mac.tokens.clone())
|
||||
};
|
||||
if hidden {
|
||||
self.cx.flag_span(self.out, ID, ID, item.span(), "suite registration inside a macro or include is invisible to registry!".to_owned());
|
||||
}
|
||||
visit::visit_item_macro(self, item);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn check(cx: &Cx<'_>, out: &mut Vec<Finding>) {
|
||||
Walk { cx, out }.visit_file(cx.file);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn detects_story_attributes_inside_repeated_macro_expansions() {
|
||||
let source = r#"macro_rules! stories { ($($name:ident),*) => { $( #[story(Widget, covers = [])] fn $name() {} )* }; }"#;
|
||||
let file = syn::parse_file(source).expect("valid macro definition");
|
||||
let syn::Item::Macro(item) = &file.items[0] else { panic!("expected macro definition") };
|
||||
assert!(has_registration(item.mac.tokens.clone()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_trial_inside_a_proptest_invocation() {
|
||||
let source = "proptest! { #![proptest_config(ProptestConfig::with_cases(48))] #[trial] fn roundtrip(value in 0u8..4) {} }";
|
||||
let file = syn::parse_file(source).expect("valid macro invocation");
|
||||
let syn::Item::Macro(item) = &file.items[0] else { panic!("expected macro invocation") };
|
||||
assert!(has_registration(item.mac.tokens.clone()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_hidden_registrations_and_allows_unregistered_derive() {
|
||||
let hidden = TokenStream::from_str("#[derive(Component)] struct A; #[trial] fn t() {} ").unwrap_or_default();
|
||||
let ordinary = TokenStream::from_str("#[derive(Component)] #[component(unregistered)] struct A; ").unwrap_or_default();
|
||||
assert!(has_registration(hidden));
|
||||
assert!(!has_registration(ordinary));
|
||||
}
|
||||
}
|
||||
@@ -140,6 +140,8 @@ const NO_GLOBAL_STATE_PREFIXES: &[&str] = &[
|
||||
/// a `static` or `thread_local!` item or [`FS`] for `std::fs`. Each group names the settled fact or environment key that
|
||||
/// covers it, or the later task of craft-libs#2336 that removes the state. A new item in these files is flagged.
|
||||
const NO_GLOBAL_STATE: &[(&str, &str)] = &[
|
||||
// Compile-time registry discovery reads the defining crate's source, never a view input.
|
||||
("crates/ui-macros/src/registry.rs", FS),
|
||||
// The trait's home crate: it implements `MemoProps` by hand for std and framework value types, and for the
|
||||
// framework's own keys the derive cannot write: a binding by its source's address, its check and the check's `fn`
|
||||
// (values.rs), an icon's glyph by the type of its `dyn Glyph` (icon.rs), and the write-only `Outbox` (memo_view.rs).
|
||||
@@ -150,6 +152,8 @@ const NO_GLOBAL_STATE: &[(&str, &str)] = &[
|
||||
// Settled fact: a card's view of a story's state keys by the story value's revision, whether the start is taken, the
|
||||
// dialog's flags and the reset count; the view of every shown story's state is one fixed-size digest of those keys.
|
||||
// Both are props held as `&mut`, which the derive does not take.
|
||||
// A card keys its owned story registration by the name and show function the card reads.
|
||||
("crates/ui-gallery/src/chrome/card.rs", "MemoProps"),
|
||||
("crates/ui-gallery/src/viewer/picks.rs", "MemoProps"),
|
||||
// Settled fact: the names of a preset group key by a walk over the group and its folders (`dyn EachName`), which
|
||||
// the derive cannot see through.
|
||||
|
||||
@@ -48,6 +48,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-browse", "dep:craft-ui", "dep:egui", "dep:serde_json"]
|
||||
@@ -55,7 +56,7 @@ ui = ["dep:craft-behavior", "dep:craft-browse", "dep:craft-ui", "dep:egui", "dep
|
||||
screen-testing = ["ui", "craft-ui/testing"]
|
||||
|
||||
[dev-dependencies]
|
||||
craft-ui = { workspace = true, features = ["testing"] }
|
||||
craft-ui = { workspace = true, features = ["suite"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
mod filter;
|
||||
mod native;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd", target_os = "openbsd"))]
|
||||
mod portal;
|
||||
mod probe;
|
||||
pub(crate) mod portal;
|
||||
pub(crate) mod probe;
|
||||
pub mod save;
|
||||
#[cfg(test)]
|
||||
mod save_tests;
|
||||
pub(crate) mod save_tests;
|
||||
pub mod service;
|
||||
#[cfg(feature = "ui")]
|
||||
pub mod ui;
|
||||
@@ -34,14 +34,16 @@ pub mod ui;
|
||||
/// The registrations of this crate's UI types, for its integration binary.
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub mod testing {
|
||||
craft_ui::testing_registered!();
|
||||
|
||||
#[cfg(feature = "suite")]
|
||||
craft_ui::registry!();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::panic::{AssertUnwindSafe, catch_unwind};
|
||||
@@ -406,9 +408,10 @@ fn panic_text(panic: &(dyn std::any::Any + Send)) -> Option<&str> {
|
||||
extern crate self as craft_dialogs;
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
#[path = "../tests/it/main.rs"]
|
||||
mod integration;
|
||||
pub(crate) mod integration;
|
||||
|
||||
#[cfg(test)]
|
||||
fn main() {
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::registered_in(env!("CARGO_PKG_NAME")));
|
||||
craft_ui::registry!();
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::Registry::of(&[register]));
|
||||
}
|
||||
|
||||
@@ -434,4 +434,4 @@ pub(crate) fn save_as(mut req: SaveRequest, cancel: &Cancel) -> SaveOutcome {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
@@ -189,4 +189,4 @@ fn classify_error(e: &zbus::Error) -> Option<bool> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
@@ -741,7 +741,7 @@ impl Files for FileService {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod service_tests {
|
||||
pub(crate) mod service_tests {
|
||||
//! Behaviour tests with `Dialogs::set_override` standing in for the panels.
|
||||
|
||||
use craft_ui::testing::trial;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
mod accept;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub(crate) mod tests;
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex, PoisonError};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! The file service's UI part: [`PathField`], and the words of the service's native boxes.
|
||||
|
||||
mod chooser;
|
||||
mod path_field;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod chooser;
|
||||
pub(crate) mod path_field;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
pub use chooser::{ChooserWords, FileChooser};
|
||||
pub use path_field::{PathField, PathFieldOutput, PathFieldWords};
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
// Expecting on failure is fine here, unlike in shipped code.
|
||||
#![allow(clippy::expect_used)]
|
||||
|
||||
mod files;
|
||||
pub(crate) mod files;
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
pub mod artboard;
|
||||
#[cfg(test)]
|
||||
mod artboard_tests;
|
||||
pub(crate) mod artboard_tests;
|
||||
pub mod connector;
|
||||
#[cfg(test)]
|
||||
mod connector_tests;
|
||||
pub(crate) mod connector_tests;
|
||||
pub mod curvature;
|
||||
#[cfg(test)]
|
||||
mod curvature_tests;
|
||||
pub(crate) mod curvature_tests;
|
||||
pub mod fillet;
|
||||
#[cfg(test)]
|
||||
mod fillet_tests;
|
||||
pub(crate) mod fillet_tests;
|
||||
pub mod presets;
|
||||
pub mod shape;
|
||||
pub mod slice;
|
||||
|
||||
@@ -9,16 +9,19 @@ pub mod ui;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub mod testing {
|
||||
//! The registrations of this crate's stories, for the `tests/it` harness.
|
||||
craft_ui::testing_registered!();
|
||||
|
||||
#[cfg(feature = "suite")]
|
||||
craft_ui::registry!();
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
extern crate self as craft_draw;
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
#[path = "../tests/it/main.rs"]
|
||||
mod integration;
|
||||
pub(crate) mod integration;
|
||||
|
||||
#[cfg(test)]
|
||||
fn main() {
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::registered_in(env!("CARGO_PKG_NAME")));
|
||||
craft_ui::registry!();
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::Registry::of(&[register]));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use kurbo::{BezPath, CubicBez, Line, ParamCurve, ParamCurveArclen, PathEl, PathS
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(test)]
|
||||
mod dash_tests;
|
||||
pub(crate) mod dash_tests;
|
||||
|
||||
/// The shortest run (between corners and path ends) and the smallest pattern total `Corners` fits.
|
||||
const MIN_RUN: f64 = 1e-6;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ use craft_theme::Srgba;
|
||||
use std::sync::Arc;
|
||||
|
||||
mod background;
|
||||
mod bar;
|
||||
mod overlay;
|
||||
mod properties;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod bar;
|
||||
pub(crate) mod overlay;
|
||||
pub(crate) mod properties;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod tool;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
//! The app paints the tip and stroke images from its engine; the library never sees an engine type. Presets are
|
||||
//! keyed by the app's key type (PhotoCraft: `PresetKey<String>`, by name).
|
||||
|
||||
mod panel;
|
||||
mod picker;
|
||||
pub(crate) mod panel;
|
||||
pub(crate) mod picker;
|
||||
mod rows;
|
||||
mod settings;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
//! draws the frame and the shared rows, and every control reports edit events the app sends to its
|
||||
//! tool options host.
|
||||
|
||||
mod ellipse;
|
||||
mod panel;
|
||||
mod preview;
|
||||
mod rows;
|
||||
mod sections;
|
||||
mod size_field;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub(crate) mod ellipse;
|
||||
pub(crate) mod panel;
|
||||
pub(crate) mod preview;
|
||||
pub(crate) mod rows;
|
||||
pub(crate) mod sections;
|
||||
pub(crate) mod size_field;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
//! on an object, the handles (a canvas control) take a press on the selected connector's ends and
|
||||
//! bends before the tool sees it.
|
||||
|
||||
mod bar;
|
||||
mod handles;
|
||||
pub(crate) mod bar;
|
||||
pub(crate) mod handles;
|
||||
mod overlay;
|
||||
mod place;
|
||||
mod tool;
|
||||
mod words;
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use craft_behavior::EditEvent;
|
||||
use kurbo::{Point, Rect};
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
//! arc the app's engine draws.
|
||||
|
||||
mod geometry;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod style;
|
||||
mod widgets;
|
||||
pub(crate) mod widgets;
|
||||
mod words;
|
||||
|
||||
use kurbo::Point;
|
||||
|
||||
@@ -21,8 +21,8 @@ use craft_ui::runtime::requests::ColorRequest;
|
||||
use craft_ui::text::NumberField;
|
||||
use egui::{Response, Ui};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The ratio, a ratio field, a preset or W × H × Resolution changed.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
//! The tool reports events and never crops the document: the app crops on [`CropEvent::Apply`] with the
|
||||
//! [`CropCommit`] it carries.
|
||||
|
||||
mod bar;
|
||||
pub(crate) mod bar;
|
||||
mod bar_words;
|
||||
mod menus;
|
||||
pub(crate) mod menus;
|
||||
mod options;
|
||||
mod perspective_bar;
|
||||
mod perspective_crop;
|
||||
pub(crate) mod perspective_bar;
|
||||
pub(crate) mod perspective_crop;
|
||||
mod perspective_tool;
|
||||
mod preset_list;
|
||||
pub(crate) mod preset_list;
|
||||
mod session;
|
||||
mod size_cells;
|
||||
mod tool;
|
||||
pub(crate) mod tool;
|
||||
mod words;
|
||||
|
||||
pub use bar::{CropBar, CropBarOutput, CropRatioChange};
|
||||
|
||||
@@ -11,8 +11,8 @@ use craft_ui::layout_components::Row;
|
||||
use craft_ui::runtime::env::Env;
|
||||
use egui::{Response, Ui};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The Perspective Crop options: W × H × Resolution, Front Image, Clear, a divider and Show Grid.
|
||||
///
|
||||
|
||||
@@ -487,5 +487,5 @@ pub fn grid_lines(view: &CanvasView, q: &[Point; 4], step: f32) -> Vec<[Pos2; 2]
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
@@ -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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
@@ -222,5 +222,5 @@ impl<'a> GradientFillEditor<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
mod keys;
|
||||
mod parts;
|
||||
mod pointer;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
//! 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")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use craft_behavior::{EditEvent, Mixed};
|
||||
use craft_ui::buttons::Button;
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
//! there.
|
||||
|
||||
mod fill;
|
||||
mod fill_editor;
|
||||
pub(crate) mod fill_editor;
|
||||
pub mod gradient_line;
|
||||
pub mod gradient_overlay;
|
||||
pub mod map;
|
||||
mod palette;
|
||||
mod swatch;
|
||||
mod tile;
|
||||
pub(crate) mod palette;
|
||||
pub(crate) mod swatch;
|
||||
pub(crate) mod tile;
|
||||
|
||||
pub use fill::{GradientFill, GradientStyle};
|
||||
pub use fill_editor::{GradientFillEditor, GradientFillEditorOutput, GradientFillWords};
|
||||
|
||||
@@ -7,8 +7,8 @@ use craft_ui::patterns::presets::{CellShape, PresetBrowser, PresetEvent, PresetR
|
||||
use craft_ui::runtime::env::{Env, Label};
|
||||
use egui::{Response, Ui};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
use craft_color_ui::ui::gradient::{GradientRamp, GradientStops, Sampler, StopRows, default_sampler};
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ use craft_color_ui::ui::gradient::{GradientRamp, GradientStops, Sampler, StopRow
|
||||
|
||||
use super::GradientTile;
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The style of a gradient swatch: the colour swatch's height, corners and ring.
|
||||
#[derive(Clone, Debug, PartialEq, ComponentStyle)]
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
//! The Ruler line is document state outside the undo history: the tool reports `EditEvent<Option<RulerLine>>` and the
|
||||
//! app stores the line.
|
||||
|
||||
mod bar;
|
||||
pub(crate) mod bar;
|
||||
mod distances;
|
||||
mod model;
|
||||
mod overlay;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod overlay;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod tool;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ use craft_ui::runtime::env::{Env, Label, UnitKind};
|
||||
use craft_ui::text::{NumberField, RangeAlert};
|
||||
use egui::{Response, Ui};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
pub use words::PaintBarWords;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
mod footer;
|
||||
mod menu;
|
||||
mod model;
|
||||
mod panel;
|
||||
pub(crate) mod panel;
|
||||
mod rows;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
use craft_theme::Srgba;
|
||||
|
||||
mod dialog;
|
||||
mod editor;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub(crate) mod editor;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ mod hit_test;
|
||||
mod mark;
|
||||
mod model;
|
||||
mod ops;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod style;
|
||||
mod tools;
|
||||
mod words;
|
||||
|
||||
@@ -8,8 +8,8 @@ mod auto;
|
||||
pub(crate) mod bezier;
|
||||
mod curvature_mode;
|
||||
mod mode;
|
||||
mod options;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub(crate) mod options;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod tool;
|
||||
mod words;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
//! if let Some(request) = out.requests.take_path() { /* open the file dialog, store the picture, set `fill.source` */ }
|
||||
//! ```
|
||||
|
||||
mod editor;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod editor;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
pub use editor::{PICTURE_FILL_KEY, PictureFillEditor, PictureFillOutput};
|
||||
|
||||
@@ -10,14 +10,14 @@ use crate::stroke::StrokeStyle;
|
||||
|
||||
use super::shape_drag::{BoxConstraints, ShapeDragOptions, ShapeKind};
|
||||
|
||||
mod arrowheads;
|
||||
mod bar;
|
||||
mod gear;
|
||||
mod mode_select;
|
||||
mod panel;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
pub(crate) mod arrowheads;
|
||||
pub(crate) mod bar;
|
||||
pub(crate) mod gear;
|
||||
pub(crate) mod mode_select;
|
||||
pub(crate) mod panel;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod stroke_cells;
|
||||
pub(crate) mod stroke_cells;
|
||||
mod words;
|
||||
|
||||
pub use arrowheads::{ArrowheadsOutput, ArrowheadsPopover};
|
||||
|
||||
@@ -11,8 +11,8 @@ use craft_ui::style::UiTokens;
|
||||
use egui::{Color32, Mesh, Painter, Pos2, Rect, Shape, Stroke, Ui, pos2};
|
||||
use kurbo::{BezPath, PathEl};
|
||||
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
|
||||
/// The error bound, in points, when the glyph's curves are flattened.
|
||||
const FLATTEN_TOLERANCE: f64 = 0.1;
|
||||
|
||||
@@ -35,11 +35,11 @@ use craft_behavior::{Axis, CancelReason, EditEvent, GestureId, Mixed};
|
||||
use craft_keymap::Mods;
|
||||
use std::sync::Arc;
|
||||
|
||||
mod bar;
|
||||
pub(crate) mod bar;
|
||||
mod dialogs;
|
||||
mod overlay;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
mod stories;
|
||||
pub(crate) mod overlay;
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod tool;
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
//! and named stroke types. The editor edits geometry only; width, colour and paint are the host's
|
||||
//! controls. The value is [`StrokeStyle`], re-exported here.
|
||||
|
||||
mod button;
|
||||
mod editor;
|
||||
pub(crate) mod button;
|
||||
pub(crate) mod editor;
|
||||
mod preview;
|
||||
#[cfg(feature = "screen-testing")]
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
mod words;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user