mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:24:24 +00:00
Lints: ui-widgets trials, table, prepress, media, raw and update doc links
This commit is contained in:
@@ -383,7 +383,7 @@ fn hdrl(streams: &[StreamState], main: Option<usize>, max_riffs: u32, first_fram
|
||||
list(b"hdrl", &body)
|
||||
}
|
||||
|
||||
/// Writes an AVI file chunk by chunk; see the [module documentation](self).
|
||||
/// Writes an AVI file chunk by chunk; see the [module documentation](crate::avi).
|
||||
#[derive(Debug)]
|
||||
pub struct AviWriter<W: Write + Seek> {
|
||||
w: W,
|
||||
|
||||
@@ -197,7 +197,7 @@ pub struct FlacConfig {
|
||||
}
|
||||
|
||||
impl FlacConfig {
|
||||
/// Parses the payload of the `dfLa` full box (version and flags first), keeping the metadata blocks and decoding STREAMINFO when present. Fails with [`Error::Truncated`] when a field runs past the end of `data`.
|
||||
/// Parses the payload of the `dfLa` full box (version and flags first), keeping the metadata blocks and decoding STREAMINFO when present. Fails with [`crate::isobmff::Error::Truncated`] when a field runs past the end of `data`.
|
||||
pub fn parse(data: &[u8]) -> Result<Self> {
|
||||
let mut c = Cur::labeled(data, "dfLa");
|
||||
c.full_header()?;
|
||||
|
||||
@@ -1333,8 +1333,3 @@ fn closed(path: &BezPath) -> BezPath {
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//! the raw image IFD's fields and their encrypted `SR2SubIFD` copies into [`SonyLensCorrections`], and validated
|
||||
//! ILCE-7RM4A, ILCE-7M3 and ILCE-7CR distortion tables into DNG warps for the shared optics pipeline.
|
||||
//!
|
||||
//! Tag identity/layout: https://exiftool.org/TagNames/EXIF.html (`0x7031` to `0x7037`, signed shorts) and
|
||||
//! https://exiftool.org/TagNames/Sony.html#SR2SubIFD (`0x797d`, `0x7980`, `0x7982`). The `SR2SubIFD` setting tags
|
||||
//! Tag identity/layout: <https://exiftool.org/TagNames/EXIF.html> (`0x7031` to `0x7037`, signed shorts) and
|
||||
//! <https://exiftool.org/TagNames/Sony.html#SR2SubIFD> (`0x797d`, `0x7980`, `0x7982`). The `SR2SubIFD` setting tags
|
||||
//! `0x797c`, `0x797f` and `0x7981` sit next to those tables, unnamed there; they equal the raw IFD's settings in every
|
||||
//! file inspected. Geometry inferred independently from files and Sony Imaging Edge exports; see
|
||||
//! docs/sony-lens-corrections.md. No lens database and no external decoder code. The MakerNote's similarly named
|
||||
|
||||
@@ -385,8 +385,8 @@ pub struct PreviewRange {
|
||||
/// [`embedded_preview_from_range`], which returns exactly what [`embedded_preview`] returns for the
|
||||
/// whole file.
|
||||
///
|
||||
/// Pass a prefix that actually covers the pointer's range (read [`Self::offset`] +
|
||||
/// [`Self::window_len`] bytes, or start with [`PREVIEW_PREFIX`] and grow when it is not enough):
|
||||
/// Pass a prefix that actually covers the pointer's range (read [`PreviewRange::offset`] +
|
||||
/// [`PreviewRange::window_len`] bytes, or start with [`PREVIEW_PREFIX`] and grow when it is not enough):
|
||||
/// `raf::header` clamps a slice to the buffer it was given, so a prefix that stops
|
||||
/// inside the declared extent yields a shorter `window_len` than the file really holds.
|
||||
pub fn bounded_preview(bytes: &[u8]) -> Option<PreviewRange> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Fujifilm's striped predictive RAW compression.
|
||||
//!
|
||||
//! Clean-room implementation: Fabian's prose description of lossless RAF compression
|
||||
//! (https://capnfabs.net/posts/fuji-raf-compression-algorithm/) supplied the broad structure;
|
||||
//! (<https://capnfabs.net/posts/fuji-raf-compression-algorithm/>) supplied the broad structure;
|
||||
//! headers, colour-vector placement, predictors, contexts and adaptation were recovered
|
||||
//! from sample bytes and black-box comparisons of decoded sensor arrays. No other RAW
|
||||
//! decoder's source was consulted. See docs/raf-compression.md for verification details.
|
||||
|
||||
@@ -129,7 +129,7 @@ impl ClaimedKeys {
|
||||
let escape = cx.take_claimed(ESCAPE);
|
||||
let advance = ADVANCES.iter().find_map(|&(chord, along, back)| cx.take_claimed(chord).then_some((along, back)));
|
||||
let f2 = cx.take_claimed(F2);
|
||||
let edit_key = EDIT_KEYS.iter().fold(false, |any, &chord| cx.take_claimed(chord) || any);
|
||||
let edit_key = EDIT_KEYS.iter().filter(|&&chord| cx.take_claimed(chord)).count() > 0;
|
||||
let mut arrows = Vec::new();
|
||||
for shift in [false, true] {
|
||||
for (key, direction) in ARROWS {
|
||||
|
||||
@@ -205,7 +205,7 @@ fn a_child_with_a_running_animation_runs_every_frame() {
|
||||
#[non_exhaustive]
|
||||
enum Shown {
|
||||
#[command(label = "Shown", modal = "always")]
|
||||
Shown,
|
||||
Visible,
|
||||
#[command(label = "Beside", modal = "always")]
|
||||
Beside,
|
||||
#[command(label = "Measured", modal = "always")]
|
||||
@@ -252,7 +252,7 @@ impl CommandScene {
|
||||
in_region(ui, Rect::from_min_size(ORIGIN, ROOM), |ui| {
|
||||
Lazy::new("reader", 0.0).settles(true).show(ui, |ui| {
|
||||
self.runs[0].set(self.runs[0].get() + 1);
|
||||
self.buttons[0].set(Button::command(Shown::Shown).show(ui).id);
|
||||
self.buttons[0].set(Button::command(Shown::Visible).show(ui).id);
|
||||
self.buttons[2].set(Button::command(Scoped::Published).show(ui).id);
|
||||
Stack::new().sizing(Sizing::Content).id_salt("measured").show(ui, |ui, _| {
|
||||
self.buttons[3].set(Button::command(Shown::Measured).show(ui).id);
|
||||
@@ -295,7 +295,7 @@ fn an_app_command_state_runs_the_settled_child_that_shows_it() {
|
||||
let mut frames = Frames::new();
|
||||
scene.settle(&mut frames);
|
||||
assert!(!scene.disabled(&mut frames, 0), "Shown starts enabled");
|
||||
let disable = |enabled: bool| CommandInput::new().state(Shown::Shown, CommandState::new().enabled(enabled));
|
||||
let disable = |enabled: bool| CommandInput::new().state(Shown::Visible, CommandState::new().enabled(enabled));
|
||||
frames.commands(disable(false));
|
||||
let (_, [reader, beside]) = scene.frame(&mut frames);
|
||||
assert!(reader > 0 && beside == 0, "only the child that shows Shown runs: {reader}, {beside}");
|
||||
|
||||
@@ -8,6 +8,9 @@ use egui::{Id, Vec2};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// The events a list rig records.
|
||||
type Events = Rc<RefCell<Vec<CollectionEvent<usize, RowEvent>>>>;
|
||||
|
||||
const NAMES: [&str; 3] = ["Artboard 1", "Artboard 2", "Artboard 3"];
|
||||
|
||||
/// The list's id, which a rename request names.
|
||||
@@ -16,7 +19,7 @@ fn list_id() -> Id {
|
||||
}
|
||||
|
||||
/// A list of the three rows whose rename draft is `draft`, and what it reported.
|
||||
fn rig(draft: fn(&usize) -> Option<String>) -> (Fixture, Rc<RefCell<Vec<CollectionEvent<usize, RowEvent>>>>) {
|
||||
fn rig(draft: fn(&usize) -> Option<String>) -> (Fixture, Events) {
|
||||
let seen = Rc::new(RefCell::new(Vec::new()));
|
||||
let held = seen.clone();
|
||||
let mut fixture = Fixture::new(move |ui| {
|
||||
@@ -215,7 +218,7 @@ fn a_click_on_a_finding_activates_it() {
|
||||
}
|
||||
|
||||
/// A list of the three rows built by `row`, in `room`, and what it reported.
|
||||
fn rows_rig(room: Vec2, row: fn(usize) -> ListRow<'static>) -> (Fixture, Rc<RefCell<Vec<CollectionEvent<usize, RowEvent>>>>) {
|
||||
fn rows_rig(room: Vec2, row: fn(usize) -> ListRow<'static>) -> (Fixture, Events) {
|
||||
let seen = Rc::new(RefCell::new(Vec::new()));
|
||||
let held = seen.clone();
|
||||
let mut fixture = Fixture::new(move |ui| {
|
||||
@@ -790,7 +793,7 @@ fn a_right_click_below_the_rows_asks_for_the_lists_own_menu() {
|
||||
}
|
||||
|
||||
/// A list with the edge press `edge` (none without), and what it reported.
|
||||
fn edge_rig(edge: bool) -> (Fixture, Rc<RefCell<Vec<CollectionEvent<usize, RowEvent>>>>) {
|
||||
fn edge_rig(edge: bool) -> (Fixture, Events) {
|
||||
use craft_behavior::{Cursor, CursorIcon};
|
||||
use craft_keymap::Mods;
|
||||
let seen = Rc::new(RefCell::new(Vec::new()));
|
||||
|
||||
@@ -14,6 +14,9 @@ use egui::Id;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
|
||||
/// The fixture with the counter and the focused id the scoped trial reads back.
|
||||
type ScopedRig = (Fixture, Rc<Cell<u32>>, Rc<Cell<Option<Id>>>);
|
||||
|
||||
/// A menu bar with Edit (Undo, Redo) and Help (the search over Undo), then a text field holding "hello" that has
|
||||
/// focus and the typed run "abc".
|
||||
struct Rig {
|
||||
@@ -117,7 +120,7 @@ fn a_shortcut_pressed_on_the_focused_bar_runs_once_where_focus_was_and_gives_foc
|
||||
|
||||
/// A bar whose Help searches the target scope's Toggle, then the Target button inside that scope; returns the count
|
||||
/// of Toggle runs and the button's id.
|
||||
fn scoped_rig() -> (Fixture, Rc<Cell<u32>>, Rc<Cell<Option<Id>>>) {
|
||||
fn scoped_rig() -> ScopedRig {
|
||||
use craft_ui::contract::ShowContainer as _;
|
||||
use craft_ui::runtime::commands::Commands as _;
|
||||
let count = Rc::new(Cell::new(0));
|
||||
|
||||
@@ -299,8 +299,7 @@ fn a_value_the_check_calls_an_error_commits_and_shows_invalid_with_its_message()
|
||||
_ => Validity::Ok,
|
||||
};
|
||||
let shown = *held.borrow();
|
||||
let out =
|
||||
Field::new("Number").show(ui, |ui, _| NumberField::new("Number", Bind::given(shown).check(&check)).id_salt("number").show(ui)).inner;
|
||||
let out = Field::new("Number").show(ui, |ui, _| NumberField::new("Number", Bind::given(shown).check(check)).id_salt("number").show(ui)).inner;
|
||||
if let Some(out) = out {
|
||||
shown_id.set(out.response.id);
|
||||
if let Some(typed) = out.value().copied() {
|
||||
|
||||
@@ -318,7 +318,7 @@ pub(crate) fn record_failure(paths: &Paths, error: &str) {
|
||||
}
|
||||
|
||||
/// The error of the last update, if it failed, once. A long error is cut short at
|
||||
/// [`RECORD_LIMIT`] bytes.
|
||||
/// 4096 bytes.
|
||||
pub fn take_failure(paths: &Paths) -> Option<String> {
|
||||
let file = failure_file(paths);
|
||||
let error = read_record(&file);
|
||||
|
||||
Reference in New Issue
Block a user