mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
Merge commit 'refs/check/m1233-main' into feat/craft-mesh-ops
This commit is contained in:
7 files changed
+79
-4
No files matched your search
Generated
+3
@@ -1790,6 +1790,7 @@ dependencies = [
|
||||
"craft-drawingml",
|
||||
"craft-dwg",
|
||||
"craft-dxf",
|
||||
"craft-ease",
|
||||
"craft-ecproj-format",
|
||||
"craft-elf",
|
||||
"craft-eps",
|
||||
@@ -1830,6 +1831,7 @@ dependencies = [
|
||||
"craft-html",
|
||||
"craft-http-url",
|
||||
"craft-i18n",
|
||||
"craft-i18n-build",
|
||||
"craft-ical",
|
||||
"craft-idml",
|
||||
"craft-image-codecs",
|
||||
@@ -1873,6 +1875,7 @@ dependencies = [
|
||||
"craft-ora",
|
||||
"craft-pages",
|
||||
"craft-palette",
|
||||
"craft-pbr",
|
||||
"craft-pcap",
|
||||
"craft-pcraft-bundle",
|
||||
"craft-pcraft-format",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//! and status; code cites the row ids (R1 ...). Reading is bounded by [`Limits`], never recurses and does not
|
||||
//! panic.
|
||||
//!
|
||||
//! [`write`] writes a [`Drawing`] as a `.cdr` file of version 15, laying out each record as the
|
||||
//! [`write()`] writes a [`Drawing`] as a `.cdr` file of version 15, laying out each record as the
|
||||
//! reader reads it. Nothing here writes `.cmx` files.
|
||||
#![forbid(unsafe_code)]
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
|
||||
@@ -229,6 +229,9 @@ craft-ppt-binary = { workspace = true, optional = true }
|
||||
craft-sqlite = { workspace = true, optional = true }
|
||||
craft-audio-dsp = { workspace = true, optional = true }
|
||||
craft-sbs = { workspace = true, optional = true }
|
||||
craft-ease = { workspace = true, optional = true }
|
||||
craft-i18n-build = { workspace = true, optional = true }
|
||||
craft-pbr = { workspace = true, optional = true }
|
||||
|
||||
[features]
|
||||
ui = [
|
||||
@@ -442,6 +445,9 @@ dwg = ["dep:craft-dwg"]
|
||||
|
||||
dxf = ["dep:craft-dxf"]
|
||||
|
||||
ease = ["dep:craft-ease"]
|
||||
ease-serde = ["ease", "craft-ease/serde"]
|
||||
|
||||
ecproj-format = ["dep:craft-ecproj-format"]
|
||||
|
||||
elf = ["dep:craft-elf"]
|
||||
@@ -557,6 +563,8 @@ http-url = ["dep:craft-http-url"]
|
||||
|
||||
i18n-collate = ["craft-i18n/collate"]
|
||||
|
||||
i18n-build = ["dep:craft-i18n-build"]
|
||||
|
||||
ical = ["dep:craft-ical"]
|
||||
|
||||
idml = ["dep:craft-idml"]
|
||||
@@ -564,6 +572,7 @@ idml = ["dep:craft-idml"]
|
||||
image-codecs = ["dep:craft-image-codecs"]
|
||||
image-codecs-avif = ["image-codecs", "craft-image-codecs/avif"]
|
||||
image-codecs-avif-decode = ["image-codecs", "craft-image-codecs/avif-decode"]
|
||||
image-codecs-cms = ["image-codecs", "craft-image-codecs/cms"]
|
||||
image-codecs-corpus = ["image-codecs", "craft-image-codecs/corpus"]
|
||||
image-codecs-heif = ["image-codecs", "craft-image-codecs/heif"]
|
||||
image-codecs-jxl = ["image-codecs", "craft-image-codecs/jxl"]
|
||||
@@ -666,6 +675,7 @@ odf = ["dep:craft-odf"]
|
||||
odf-text = ["odf", "craft-odf/text"]
|
||||
|
||||
ods = ["dep:craft-ods"]
|
||||
ods-test-support = ["ods", "craft-ods/test-support"]
|
||||
|
||||
offcrypto = ["dep:craft-offcrypto"]
|
||||
|
||||
@@ -680,6 +690,9 @@ pages = ["dep:craft-pages", "keymap", "text"]
|
||||
|
||||
palette = ["dep:craft-palette"]
|
||||
|
||||
pbr = ["dep:craft-pbr"]
|
||||
pbr-parallel = ["pbr", "craft-pbr/parallel"]
|
||||
|
||||
pcap = ["dep:craft-pcap"]
|
||||
|
||||
pcraft-bundle = ["dep:craft-pcraft-bundle"]
|
||||
|
||||
@@ -103,6 +103,8 @@ pub use craft_drawingml as drawingml;
|
||||
pub use craft_dwg as dwg;
|
||||
#[cfg(feature = "dxf")]
|
||||
pub use craft_dxf as dxf;
|
||||
#[cfg(feature = "ease")]
|
||||
pub use craft_ease as ease;
|
||||
#[cfg(feature = "ecproj-format")]
|
||||
pub use craft_ecproj_format as ecproj_format;
|
||||
#[cfg(feature = "elf")]
|
||||
@@ -181,6 +183,8 @@ pub use craft_html as html;
|
||||
#[cfg(feature = "http-url")]
|
||||
pub use craft_http_url as http_url;
|
||||
pub use craft_i18n as i18n;
|
||||
#[cfg(feature = "i18n-build")]
|
||||
pub use craft_i18n_build as i18n_build;
|
||||
#[cfg(feature = "ical")]
|
||||
pub use craft_ical as ical;
|
||||
#[cfg(feature = "idml")]
|
||||
@@ -267,6 +271,8 @@ pub use craft_ora as ora;
|
||||
pub use craft_pages as pages;
|
||||
#[cfg(feature = "palette")]
|
||||
pub use craft_palette as palette;
|
||||
#[cfg(feature = "pbr")]
|
||||
pub use craft_pbr as pbr;
|
||||
#[cfg(feature = "pcap")]
|
||||
pub use craft_pcap as pcap;
|
||||
#[cfg(feature = "pcraft-bundle")]
|
||||
|
||||
@@ -24,6 +24,19 @@ fn recovery_charges_only_bytes_read_again() {
|
||||
assert_eq!(find_capture(&b"junk, no pattern".to_vec(), 0, 16, &mut r).unwrap(), Capture::End);
|
||||
}
|
||||
|
||||
/// A source that counts the bytes read from it.
|
||||
struct Counted(Vec<u8>, std::cell::Cell<u64>);
|
||||
|
||||
impl ByteSource for Counted {
|
||||
fn len(&self) -> u64 {
|
||||
self.0.len() as u64
|
||||
}
|
||||
fn read_at(&self, offset: u64, buf: &mut [u8]) -> io::Result<()> {
|
||||
self.1.set(self.1.get() + buf.len() as u64);
|
||||
self.0.read_at(offset, buf)
|
||||
}
|
||||
}
|
||||
|
||||
/// Write one page holding `segments` (lacing already computed by `lace`).
|
||||
fn page(out: &mut Vec<u8>, flags: u8, granule: i64, serial: u32, seq: u32, lacing: &[u8], body: &[u8]) {
|
||||
let start = out.len();
|
||||
@@ -129,6 +142,22 @@ fn packets_spanning_pages() {
|
||||
assert_eq!(t.total, 1920);
|
||||
}
|
||||
|
||||
/// Opus header pages for `serial` (with the beginning-of-stream flag), then data pages of one
|
||||
/// 960-sample packet of `pk_len` bytes each; sequence numbers continue from the header pages.
|
||||
fn opus_pages(f: &mut Vec<u8>, serial: u32, npk: usize, pk_len: usize, eos: bool) {
|
||||
let head = opus_head(0);
|
||||
let (l, b) = lace(&[&head], false);
|
||||
page(f, 0x02, 0, serial, 0, &l, &b);
|
||||
let (l, b) = lace(&[b"OpusTags\x00\x00\x00\x00\x00\x00\x00\x00"], false);
|
||||
page(f, 0, 0, serial, 1, &l, &b);
|
||||
for i in 0..npk {
|
||||
let p = pkt(i, pk_len);
|
||||
let (l, b) = lace(&[&p], false);
|
||||
let last = eos && i + 1 == npk;
|
||||
page(f, if last { 0x04 } else { 0 }, (i as i64 + 1) * 960, serial, i as u32 + 2, &l, &b);
|
||||
}
|
||||
}
|
||||
|
||||
fn page_starts(f: &[u8]) -> Vec<usize> {
|
||||
f.windows(4).enumerate().filter(|(_, w)| *w == b"OggS").map(|(i, _)| i).collect()
|
||||
}
|
||||
|
||||
@@ -283,11 +283,12 @@ impl BodyHooks<'_> {
|
||||
regions.footer.max.y = bottom + self.measured_footer.y;
|
||||
}
|
||||
let mut footer_rect = regions.footer;
|
||||
// The footer's start edge moves to the control column's, never past its own end edge.
|
||||
if props.label.is_some() {
|
||||
if rtl {
|
||||
footer_rect.max.x = body_rect.max.x.clamp(footer_rect.min.x, footer_rect.max.x);
|
||||
footer_rect.max.x = body_rect.max.x.min(footer_rect.max.x).max(footer_rect.min.x);
|
||||
} else {
|
||||
footer_rect.min.x = body_rect.min.x.clamp(footer_rect.min.x, footer_rect.max.x);
|
||||
footer_rect.min.x = body_rect.min.x.max(footer_rect.min.x).min(footer_rect.max.x);
|
||||
}
|
||||
}
|
||||
let offset = if rtl { regions.footer.max.x - footer_rect.max.x } else { footer_rect.min.x - regions.footer.min.x };
|
||||
@@ -473,7 +474,9 @@ impl<'b> BodyHooks<'b> {
|
||||
} else if !self.given.0 {
|
||||
self.shared_width(room.x, props).max(inner.width())
|
||||
} else {
|
||||
inner.width()
|
||||
// A container given less width than its padding has an inverted inner rect: its regions take no width,
|
||||
// at their start edge.
|
||||
inner.width().max(0.0)
|
||||
};
|
||||
// A measure with no room limit along x offers an unbounded width. Left to right the body runs from its start
|
||||
// edge to +inf as egui allows; right to left its start edge is the right one, and an unbounded width would put
|
||||
|
||||
@@ -564,3 +564,24 @@ fn a_scrolling_container_in_a_right_to_left_row_measures_and_shows_finite() {
|
||||
assert!(panel.min.x > beside.max.x - SLACK, "under RTL the container is right of the probe after it: {dump}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A labelled container with a footer, shown in a rect narrower than its padding, in either direction: its measuring
|
||||
/// run places the footer under the control column of a line with no room, and the container shows.
|
||||
#[trial]
|
||||
fn a_labelled_container_narrower_than_its_padding_places_its_footer() {
|
||||
use craft_ui::contract::{FooterRegion, Pad, SideLabel};
|
||||
use craft_ui_test_kit::body::Slab;
|
||||
for direction in [Direction::Ltr, Direction::Rtl] {
|
||||
let (_, rects) = lay_out(Some(direction), |ui| {
|
||||
let at = Rect::from_min_size(ui.available_rect_before_wrap().min, Vec2::new(4.0, 60.0));
|
||||
let props = ContainerProps::new().label(SideLabel::new()).footer(FooterRegion::new()).pad(Pad::Regular).sizing(Sizing::FillWidth);
|
||||
let narrow = ui.scope_builder(egui::UiBuilder::new().max_rect(at), |ui| {
|
||||
Slab::new(props).label("Balance").id_salt("field").show(ui, |ui, _| {
|
||||
Block::new(ITEM).show(ui);
|
||||
})
|
||||
});
|
||||
vec![narrow.inner.output.rect]
|
||||
});
|
||||
assert!(rects[0].min.is_finite() && rects[0].max.is_finite(), "{direction:?}: the container shows at {:?}", rects[0]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user