Merge remote-tracking branch 'origin/main' into perf/compositor-pipelines-test-15929

This commit is contained in:
RickiNano committed 2026-11-21 15:17:31 +01:00
commit 35425f0845
2 files changed
+33 -2

No files matched your search

+8 -2
View File
@@ -11,6 +11,10 @@ use super::PhotocraftApp;
/// Recent files listed on the Home screen.
const HOME_RECENT: usize = 11;
/// The recent cards keep one size, as many to a row as fit (six on a desktop window), instead of growing to fill it:
/// a factor on the card thumbnail.
const HOME_CARD_ZOOM: f32 = 1.65;
/// The Home screen in the document area. The recent list is empty on the web, which has no paths to reopen, and with
/// Show Home Recent Files off.
pub(super) fn start_screen(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
@@ -29,6 +33,7 @@ pub(super) fn start_screen(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
.links(&links[..])
.home_layout(Label::from(crate::native_menu::APP_NAME), &footer[..])
.max_recent(HOME_RECENT)
.card_zoom(HOME_CARD_ZOOM)
.drop_hint(Label::from(tl!("Drop an image or PSD anywhere to open it.")))
.show(ui)
.actions
@@ -75,8 +80,9 @@ fn links() -> [StartLink; 2] {
fn footer_links() -> [StartLink; 3] {
[
StartLink::url(tl!("Website"), Some(IconId::new("link")), crate::links::APP_PAGE),
StartLink::url(tl!("Discord"), Some(IconId::new("globe")), crate::links::DISCORD),
StartLink::url(tl!("GitHub"), Some(IconId::new("globe")), crate::links::GITHUB),
// A speech bubble and a chain link, as the rail showed before the framework move (#15449).
StartLink::url(tl!("Discord"), Some(IconId::new("note")), crate::links::DISCORD),
StartLink::url(tl!("GitHub"), Some(IconId::new("link_layers")), crate::links::GITHUB),
]
}
@@ -42,3 +42,28 @@ fn home_and_the_links_sit_in_a_rail_left_of_the_content_at_desktop_width() {
}
assert!(title.bottom() <= hint.top(), "the title is above the page");
}
/// The width of the first recent card on a Home screen `width` points wide, with six recent files.
fn card_width(width: f32) -> f32 {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
for n in 1..=6 {
app.push_recent(&format!("/tmp/photocraft-home/card-{n}.png"));
}
let mut h = Harness::builder()
.with_size(egui::vec2(width, 700.0))
.with_max_steps(64)
.with_context(app.ctx().clone())
.build_ui_state(|ui, app: &mut Box<PhotocraftApp>| super::start_screen(app, ui), app);
PhotocraftApp::setup_context(&h.ctx, Default::default());
h.run_steps(4);
rect(&h, "card-6.png").width()
}
/// #16172: the recent cards keep one size, as many to a row as fit, as before the framework move; they do not grow
/// to fill a wider window.
#[test]
fn recent_cards_keep_one_size_in_a_wider_window() {
let (narrow, wide) = (card_width(1100.0), card_width(1600.0));
assert!((narrow - wide).abs() < 1.0, "a card is {narrow} points wide at 1100 and {wide} at 1600");
assert!(wide < 300.0, "a card is a card, not a share of the row: {wide}");
}