Shrink tests (#4967)

This commit is contained in:
Laurenz 2024-09-16 16:41:18 +02:00 committed by GitHub
parent db71a178be
commit 16e67f8bea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
125 changed files with 618 additions and 764 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
tests/ref/image-jpg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
tests/ref/image-png.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
tests/ref/place-flush.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
tests/ref/smartquote-de.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
tests/ref/smartquote-es.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
tests/ref/smartquote-fi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
tests/ref/smartquote-fr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
tests/ref/smartquote-gr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
tests/ref/smartquote-he.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
tests/ref/smartquote-it.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
tests/ref/smartquote-la.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
tests/ref/smartquote-ro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
tests/ref/smartquote-ru.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -75,4 +75,6 @@ impl CliArguments {
pub enum Command {
/// Clears the on-disk test artifact store.
Clean,
/// Deletes all dangling reference images.
Undangle,
}

View File

@ -408,8 +408,8 @@ fn selected(name: &str, abs: PathBuf) -> bool {
/// An error in a test file.
pub struct TestParseError {
pos: FilePos,
message: String,
pub pos: FilePos,
pub message: String,
}
impl Display for TestParseError {

View File

@ -431,7 +431,7 @@ fn skippable_frame(frame: &Frame) -> bool {
})
}
/// Whether to pixel images are approximately equal.
/// Whether two pixel images are approximately equal.
fn approx_equal(a: &sk::Pixmap, b: &sk::Pixmap) -> bool {
a.width() == b.width()
&& a.height() == b.height()

View File

@ -38,7 +38,8 @@ fn main() {
match &ARGS.command {
None => test(),
Some(Command::Clean) => std::fs::remove_dir_all(STORE_PATH).unwrap(),
Some(Command::Clean) => clean(),
Some(Command::Undangle) => undangle(),
}
}
@ -120,3 +121,21 @@ fn test() {
std::process::exit(1);
}
}
fn clean() {
std::fs::remove_dir_all(STORE_PATH).unwrap();
}
fn undangle() {
match crate::collect::collect() {
Ok(_) => eprintln!("no danging reference images"),
Err(errors) => {
for error in errors {
if error.message == "dangling reference image" {
std::fs::remove_file(&error.pos.path).unwrap();
eprintln!("✅ deleted {}", error.pos.path.display());
}
}
}
}
}

View File

@ -3,13 +3,19 @@ use std::collections::HashMap;
use std::fs;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::OnceLock;
use comemo::Tracked;
use parking_lot::Mutex;
use typst::diag::{bail, FileError, FileResult, StrResult};
use typst::foundations::{func, Bytes, Datetime, NoneValue, Repr, Smart, Value};
use typst::diag::{bail, At, FileError, FileResult, SourceResult, StrResult};
use typst::engine::Engine;
use typst::foundations::{
func, Array, Bytes, Context, Datetime, IntoValue, NoneValue, Repr, Smart, Value,
};
use typst::layout::{Abs, Margin, PageElem};
use typst::syntax::{FileId, Source};
use typst::model::{Numbering, NumberingPattern};
use typst::syntax::{FileId, Source, Span};
use typst::text::{Font, FontBook, TextElem, TextSize};
use typst::utils::{singleton, LazyHash};
use typst::visualize::Color;
@ -176,40 +182,11 @@ fn library() -> Library {
// that it multiplies to nice round numbers.
let mut lib = Library::default();
#[func]
fn test(lhs: Value, rhs: Value) -> StrResult<NoneValue> {
if lhs != rhs {
bail!("Assertion failed: {} != {}", lhs.repr(), rhs.repr());
}
Ok(NoneValue)
}
#[func]
fn test_repr(lhs: Value, rhs: Value) -> StrResult<NoneValue> {
if lhs.repr() != rhs.repr() {
bail!("Assertion failed: {} != {}", lhs.repr(), rhs.repr());
}
Ok(NoneValue)
}
#[func]
fn print(#[variadic] values: Vec<Value>) -> NoneValue {
let mut out = std::io::stdout().lock();
write!(out, "> ").unwrap();
for (i, value) in values.into_iter().enumerate() {
if i > 0 {
write!(out, ", ").unwrap();
}
write!(out, "{value:?}").unwrap();
}
writeln!(out).unwrap();
NoneValue
}
// Hook up helpers into the global scope.
lib.global.scope_mut().define_func::<test>();
lib.global.scope_mut().define_func::<test_repr>();
lib.global.scope_mut().define_func::<print>();
lib.global.scope_mut().define_func::<lines>();
lib.global
.scope_mut()
.define("conifer", Color::from_u8(0x9f, 0xEB, 0x52, 0xFF));
@ -228,3 +205,50 @@ fn library() -> Library {
lib
}
#[func]
fn test(lhs: Value, rhs: Value) -> StrResult<NoneValue> {
if lhs != rhs {
bail!("Assertion failed: {} != {}", lhs.repr(), rhs.repr());
}
Ok(NoneValue)
}
#[func]
fn test_repr(lhs: Value, rhs: Value) -> StrResult<NoneValue> {
if lhs.repr() != rhs.repr() {
bail!("Assertion failed: {} != {}", lhs.repr(), rhs.repr());
}
Ok(NoneValue)
}
#[func]
fn print(#[variadic] values: Vec<Value>) -> NoneValue {
let mut out = std::io::stdout().lock();
write!(out, "> ").unwrap();
for (i, value) in values.into_iter().enumerate() {
if i > 0 {
write!(out, ", ").unwrap();
}
write!(out, "{value:?}").unwrap();
}
writeln!(out).unwrap();
NoneValue
}
/// Generates `count` lines of text based on the numbering.
#[func]
fn lines(
engine: &mut Engine,
context: Tracked<Context>,
span: Span,
count: usize,
#[default(Numbering::Pattern(NumberingPattern::from_str("A").unwrap()))]
numbering: Numbering,
) -> SourceResult<Value> {
(1..=count)
.map(|n| numbering.apply(engine, context, &[n]))
.collect::<SourceResult<Array>>()?
.join(Some('\n'.into_value()), None)
.at(span)
}

View File

@ -176,10 +176,10 @@
#let c = "value"
#let d = "conflict"
#assert.eq(((a): b), ("hello": "world"))
#assert.eq(((a): 1, (a): 2), ("hello": 2))
#assert.eq((hello: 1, (a): 2), ("hello": 2))
#assert.eq((a + b: c, (a + b): d, (a): "value2", a: "value3"), ("helloworld": "conflict", "hello": "value2", "a": "value3"))
#test(((a): b), ("hello": "world"))
#test(((a): 1, (a): 2), ("hello": 2))
#test((hello: 1, (a): 2), ("hello": 2))
#test((a + b: c, (a + b): d, (a): "value2", a: "value3"), ("helloworld": "conflict", "hello": "value2", "a": "value3"))
--- issue-1338-dictionary-underscore ---
#let foo = "foo"

View File

@ -1,57 +1,90 @@
--- repr ---
#test(repr(ltr), "ltr")
#test(repr((1, 2, false, )), "(1, 2, false)")
#let t(a, b) = test(repr(a), b.text)
--- repr-literals ---
// Literal values.
#auto \
#none (empty) \
#true \
#false
#t(auto, `auto`)
#t(true, `true`)
#t(false, `false`)
--- repr-numerical ---
// Numerical values.
#1 \
#1.0e-4 \
#3.15 \
#1e-10 \
#50.368% \
#0.0000012345pt \
#4.5cm \
#12e1pt \
#2.5rad \
#45deg \
#1.7em \
#(1cm + 0em) \
#(2em + 10pt) \
#(100% + (2em + 2pt)) \
#(100% + 0pt) \
#(100% - 2em + 2pt) \
#(100% - 2pt) \
#2.3fr
--- repr-misc ---
// Colors and strokes.
#set text(0.8em)
#rgb("f7a205") \
#(2pt + rgb("f7a205"))
#t(12.0, `12.0`)
#t(3.14, `3.14`)
#t(1234567890.0, `1234567890.0`)
#t(0123456789.0, `123456789.0`)
#t(0.0, `0.0`)
#t(-0.0, `-0.0`)
#t(-1.0, `-1.0`)
#t(-9876543210.0, `-9876543210.0`)
#t(-0987654321.0, `-987654321.0`)
#t(-3.14, `-3.14`)
#t(4.0 - 8.0, `-4.0`)
#t(float.inf, `float.inf`)
#t(-float.inf, `-float.inf`)
#t(float.nan, `float.nan`)
// Strings and escaping.
#raw(repr("hi"), lang: "typc")
#repr("a\n[]\"\u{1F680}string")
#t("hi", `"hi"`)
#t("a\n[]\"\u{1F680}string", `"a\n[]\"🚀string"`)
// Content.
#raw(lang: "typc", repr[*Hey*]) \
#raw(lang: "typc", repr[A _sequence_]) \
#raw(lang: "typc", repr[A _longer_ *sequence*!])
// Array and dictionary.
#t((1, 2, false, ), `(1, 2, false)`)
#t((a: 1, b: "2"), `(a: 1, b: "2")`)
// Functions.
#let f(x) = x
#f \
#rect \
#(() => none)
#t(f, `f`)
#t(rect , `rect`)
#t(() => none, `(..) => ..`)
// Types.
#int \
#type("hi") \
#type((a: 1))
#t(int, `integer`)
#t(type("hi"), `string`)
#t(type((a: 1)), `dictionary`)
// Constants.
#t(ltr, `ltr`)
#t(left, `left`)
// Content.
#t([*Hey*], `strong(body: [Hey])`)
#t([A _sequence_], `sequence([A], [ ], emph(body: [sequence]))`)
#t([A _longer_ *sequence*!], ```
sequence(
[A],
[ ],
emph(body: [longer]),
[ ],
strong(body: [sequence]),
[!],
)
```)
// Colors and strokes.
#t(rgb("f7a205"), `rgb("#f7a205")`)
#t(2pt + rgb("f7a205"), `2pt + rgb("#f7a205")`)
#t(blue, `rgb("#0074d9")`)
#t(color.linear-rgb(blue), `color.linear-rgb(0%, 17.46%, 69.39%)`)
#t(oklab(blue), `oklab(56.22%, -0.05, -0.17)`)
#t(oklch(blue), `oklch(56.22%, 0.177, 253.71deg)`)
#t(cmyk(blue), `cmyk(100%, 46.54%, 0%, 14.9%)`)
#t(color.hsl(blue), `color.hsl(207.93deg, 100%, 42.55%)`)
#t(color.hsv(blue), `color.hsv(207.93deg, 100%, 85.1%)`)
#t(luma(blue), `luma(45.53%)`)
// Gradients.
#t(
gradient.linear(blue, red),
`gradient.linear((rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
)
#t(
gradient.linear(blue, red, dir: ttb),
`gradient.linear(dir: rtl, (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
)
#t(
gradient.linear(blue, red, relative: "self", angle: 45deg),
`gradient.linear(angle: 45deg, relative: "self", (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
)
#t(
gradient.linear(blue, red, space: rgb, angle: 45deg),
`gradient.linear(angle: 45deg, space: rgb, (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
)

View File

@ -54,13 +54,13 @@ At Beta, it was #context {
--- counter-page ---
#set page(height: 50pt, margin: (bottom: 20pt, rest: 10pt))
#lorem(12)
#lines(4)
#set page(numbering: "(i)")
#lorem(6)
#lines(2)
#pagebreak()
#set page(numbering: "1 / 1")
#counter(page).update(1)
#lorem(20)
#lines(7)
--- counter-page-footer-before-set-page ---
#set page(numbering: "1", margin: (bottom: 20pt))

View File

@ -72,80 +72,11 @@
caption: [Tetrahedron],
)
--- query-before-after ---
// LARGE
#set page(
paper: "a7",
numbering: "1 / 1",
margin: (bottom: 1cm, rest: 0.5cm),
)
#show heading.where(level: 1, outlined: true): it => [
#it
#set text(size: 12pt, weight: "regular")
#outline(
title: none,
indent: true,
target: heading
.where(level: 1)
.or(heading.where(level: 2))
.after(it.location(), inclusive: true)
.before(
heading
.where(level: 1, outlined: true)
.after(it.location(), inclusive: false),
inclusive: false,
)
)
]
#set heading(outlined: true, numbering: "1.")
= Section 1
== Subsection 1
== Subsection 2
=== Subsubsection 1
=== Subsubsection 2
== Subsection 3
= Section 2
== Subsection 1
== Subsection 2
= Section 3
== Subsection 1
== Subsection 2
=== Subsubsection 1
=== Subsubsection 2
=== Subsubsection 3
== Subsection 3
--- query-and-or ---
#set page(
paper: "a7",
numbering: "1 / 1",
margin: (bottom: 1cm, rest: 0.5cm),
)
#set heading(outlined: true, numbering: "1.")
#context [
Non-outlined elements:
#(query(selector(heading).and(heading.where(outlined: false)))
.map(it => it.body).join(", "))
]
#heading("A", outlined: false)
#heading("B", outlined: true)
#heading("C", outlined: true)
#heading("D", outlined: false)
--- query-complex ---
= A
== B
#figure([Cat], kind: "cat", supplement: [Other])
=== D
#heading(level: 3, outlined: false)[D]
= E <first>
#figure([Frog], kind: "frog", supplement: none)
#figure([Giraffe], kind: "giraffe", supplement: none) <second>
@ -164,6 +95,11 @@
([A], [D], [E], [H]),
)
#test-selector(
selector(heading).and(heading.where(outlined: false)),
([D],)
)
#test-selector(
heading.where(level: 1).or(
heading.where(level: 3),

View File

@ -28,7 +28,7 @@ Was: #context {
#set page(width: 200pt)
#set text(8pt)
#let ls = state("lorem", lorem(1000).split("."))
#let ls = state("lorem", lorem(30).split(" "))
#let loremum(count) = {
context ls.get().slice(0, count).join(".").trim() + "."
ls.update(list => list.slice(count))

View File

@ -98,15 +98,15 @@ Paragraph
#set page(height: 100pt)
#set align(center)
#lorem(10)
#lines(3)
#block(width: 80%, height: 60pt, fill: aqua)
#lorem(6)
#lines(2)
#block(
breakable: false,
width: 100%,
inset: 4pt,
fill: aqua,
lorem(8) + colbreak(),
lines(3) + colbreak(),
)
--- block-consistent-width ---

View File

@ -11,11 +11,8 @@
// the rest moved down. The reason was that the second block resulted in
// overlarge frames because the region wasn't finished properly.
#set page(height: 70pt)
#block[This file tests a bug where an almost empty page occurs.]
#block[
The text in this second block was torn apart and split up for
some reason beyond my knowledge.
]
#block(lines(3))
#block(lines(5))
--- issue-flow-trailing-leading ---
// In this bug, the first part of the paragraph moved down to the second page
@ -48,13 +45,13 @@
// This bug caused an index-out-of-bounds panic when layouting paragraphs needed
// multiple reorderings.
#set page(height: 200pt)
#lorem(30)
#lines(10)
#figure(placement: auto, block(height: 100%))
#lorem(10)
#lines(3)
#lorem(10)
#lines(3)
--- issue-3641-float-loop ---
// Flow layout should terminate!
@ -64,7 +61,7 @@
#set page(height: 40pt)
= Heading
#lorem(6)
#lines(2)
--- issue-3355-metadata-weak-spacing ---
#set page(height: 50pt)

View File

@ -2,38 +2,37 @@
--- flow-heading-no-orphan ---
#set page(height: 100pt)
#lorem(12)
#lines(4)
= Introduction
This is the start and it goes on.
A
--- flow-par-no-orphan-and-widow-lines ---
// LARGE
#set page("a8", height: 140pt)
#set page(width: 60pt, height: 140pt)
#set text(weight: 700)
// Fits fully onto the first page.
#set text(blue)
#lorem(27)
#lines(8)
// The first line would fit, but is moved to the second page.
#lorem(20)
#lines(6, "1")
// The second-to-last line is moved to the third page so that the last is isn't
// as lonely.
#set text(maroon)
#lorem(11)
#lines(4)
#lorem(13)
#lines(4, "1")
// All three lines go to the next page.
#set text(olive)
#lorem(10)
#lines(3)
--- flow-widow-forced ---
// Ensure that a widow is allowed when the three lines don't all fit.
#set page(height: 50pt)
#lorem(10)
#lines(3)
--- issue-1445-widow-orphan-unnecessary-skip ---
// Ensure that widow/orphan prevention doesn't unnecessarily move things

View File

@ -0,0 +1,83 @@
--- place-float-flow-around ---
#set page(height: 80pt)
#set place(float: true)
#place(bottom + center, rect(height: 20pt))
#lines(4)
--- place-float-queued ---
#set page(height: 180pt)
#set figure(placement: auto)
#figure(rect(height: 60pt), caption: [I])
#figure(rect(height: 40pt), caption: [II])
#figure(rect(), caption: [III])
#figure(rect(), caption: [IV])
A
--- place-float-align-auto ---
#set page(height: 140pt)
#set place(clearance: 5pt)
#set place(auto, float: true)
#place(rect[A])
#place(rect[B])
1 \ 2
#place(rect[C])
#place(rect[D])
--- place-float-in-column-align-auto ---
#set page(height: 150pt, columns: 2)
#set place(auto, float: true, clearance: 10pt)
#set rect(width: 75%)
#place(rect[I])
#place(rect[II])
#place(rect[III])
#place(rect[IV])
#lines(6)
#place(rect[V])
--- place-float-in-column-queued ---
#set page(height: 100pt, columns: 2)
#set place(float: true, clearance: 10pt)
#set rect(width: 75%)
#set text(costs: (widow: 0%, orphan: 0%))
#lines(3)
#place(top, rect[I])
#place(top, rect[II])
#place(bottom, rect[III])
#lines(3)
--- place-float-missing ---
// Error: 2-20 automatic positioning is only available for floating placement
// Hint: 2-20 you can enable floating placement with `place(float: true, ..)`
#place(auto)[Hello]
--- place-float-center-horizon ---
// Error: 2-45 floating placement must be `auto`, `top`, or `bottom`
#place(center + horizon, float: true)[Hello]
--- place-float-horizon ---
// Error: 2-36 floating placement must be `auto`, `top`, or `bottom`
#place(horizon, float: true)[Hello]
--- place-float-default ---
// Error: 2-27 floating placement must be `auto`, `top`, or `bottom`
#place(float: true)[Hello]
--- place-float-right ---
// Error: 2-34 floating placement must be `auto`, `top`, or `bottom`
#place(right, float: true)[Hello]
--- issue-2595-float-overlap ---
#set page(height: 80pt)
1
#place(auto, float: true, block(height: 100%, width: 100%, fill: aqua))
#place(auto, float: true, block(height: 100%, width: 100%, fill: red))
#lines(7)

View File

@ -0,0 +1,29 @@
--- place-flush ---
#set page(height: 120pt)
#let floater(align, height) = place(
align,
float: true,
rect(width: 100%, height: height),
)
#floater(top, 30pt)
A
#floater(bottom, 50pt)
#place.flush()
B // Should be on the second page.
--- place-flush-figure ---
#set page(height: 120pt)
#let floater(align, height, caption) = figure(
placement: align,
caption: caption,
rect(width: 100%, height: height),
)
#floater(top, 30pt)[I]
A
#floater(bottom, 50pt)[II]
#place.flush()
B // Should be on the second page.

Some files were not shown because too many files have changed in this diff Show More