mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
202 upstream commits since 6cb00467a. Resolutions:
- craft-window, craft-platform: ours. Upstream's frame policy v2, restore
store and GNOME light/wait_first are the versions carried on 28 Oct;
ours moved place() to craft-behavior and kept LayoutWatch and the
appearance/portal.rs split.
- craft-timeline: ours. craft-time (crates/time) lands as upstream wrote
it and is not yet used by craft-timeline.
- Old crates/ui modules stay removed. Upstream's frosted backdrops, shape
gallery, dialog tabs and the iconic flyout top-edge rendering are not
carried. The #1094 model half is in craft-behavior's dock:
Group::flyout_offset and Action::MoveFlyoutTop.
- craft-update: #586 Save and Update, the install probe on the check
thread and quiet per-user MSI self-updates, carried into updater.rs,
stack_dialogs.rs, install/windows.rs and self_update/helper.rs.
- craft-jpeg: progressive Huffman decoding, carried into huffman.rs,
parse.rs and scan.rs.
- craft-print: the driver settings dialog's new tests and the bounded
XML parse's tests, as trials.
- Test-only conflicts: upstream tests from before the base that our side
cut stay cut; tests new upstream are kept.
77 lines
3.0 KiB
Rust
77 lines
3.0 KiB
Rust
//! Stories of the update dialogs.
|
|
|
|
use super::{UpdateCheckDialog, UpdatePromptDialog};
|
|
use crate::release::Release;
|
|
use crate::updater::Status;
|
|
use craft_ui::testing::{Drive, StoryData, StoryOutput, story};
|
|
use egui::Ui;
|
|
|
|
fn release() -> Release {
|
|
Release { tag: "v2.0.0".into(), html_url: "https://example.org/releases/v2.0.0".into(), ..Release::default() }
|
|
}
|
|
|
|
#[story(UpdatePromptDialog, covers = [], drive = Drive::Never)]
|
|
fn prompt_download(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
UpdatePromptDialog::new(release(), "1.0.0", false).present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdatePromptDialog, covers = [], drive = Drive::Never)]
|
|
fn prompt_self_update(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
UpdatePromptDialog::new(release(), "1.0.0", true).present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdatePromptDialog, covers = [], drive = Drive::Never)]
|
|
fn prompt_installing(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdatePromptDialog::new(release(), "1.0.0", true);
|
|
dialog.set_installing(true);
|
|
dialog.present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdatePromptDialog, covers = [], drive = Drive::Never)]
|
|
fn prompt_save_and_update(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdatePromptDialog::new(release(), "1.0.0", true);
|
|
dialog.set_offer_save(true);
|
|
dialog.present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdatePromptDialog, covers = [], drive = Drive::Never)]
|
|
fn prompt_saving(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdatePromptDialog::new(release(), "1.0.0", true);
|
|
dialog.set_offer_save(true);
|
|
dialog.set_saving(true);
|
|
dialog.present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdatePromptDialog, covers = [], drive = Drive::Never)]
|
|
fn prompt_failed(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdatePromptDialog::new(release(), "1.0.0", true);
|
|
dialog.set_status(Some("Not enough disk space to install the update.".into()));
|
|
dialog.present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdateCheckDialog, covers = [], drive = Drive::Never)]
|
|
fn check_checking(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
UpdateCheckDialog::new("1.0.0").present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdateCheckDialog, covers = [], drive = Drive::Never)]
|
|
fn check_up_to_date(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdateCheckDialog::new("1.0.0");
|
|
dialog.set_status(Status::UpToDate);
|
|
dialog.present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdateCheckDialog, covers = [], drive = Drive::Never)]
|
|
fn check_available(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdateCheckDialog::new("1.0.0").with_self_updating(true);
|
|
dialog.set_available(Some(release()));
|
|
dialog.present(ui).0.into()
|
|
}
|
|
|
|
#[story(UpdateCheckDialog, covers = [], drive = Drive::Never)]
|
|
fn check_failed(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
|
let mut dialog = UpdateCheckDialog::new("1.0.0");
|
|
dialog.set_status(Status::Failed("Could not reach api.github.com: connection timed out.".into()));
|
|
dialog.present(ui).0.into()
|
|
}
|