diff options
Diffstat (limited to 'tests')
36 files changed, 260 insertions, 0 deletions
diff --git a/tests/ref/counter-page-between-pages.png b/tests/ref/counter-page-between-pages.png Binary files differnew file mode 100644 index 00000000..f79c586d --- /dev/null +++ b/tests/ref/counter-page-between-pages.png diff --git a/tests/ref/counter-page-footer-before-set-page.png b/tests/ref/counter-page-footer-before-set-page.png Binary files differnew file mode 100644 index 00000000..2c6cd4ad --- /dev/null +++ b/tests/ref/counter-page-footer-before-set-page.png diff --git a/tests/ref/counter-page-footer-only-update.png b/tests/ref/counter-page-footer-only-update.png Binary files differnew file mode 100644 index 00000000..e179face --- /dev/null +++ b/tests/ref/counter-page-footer-only-update.png diff --git a/tests/ref/counter-page-header-before-set-page.png b/tests/ref/counter-page-header-before-set-page.png Binary files differnew file mode 100644 index 00000000..960776cf --- /dev/null +++ b/tests/ref/counter-page-header-before-set-page.png diff --git a/tests/ref/counter-page-header-only-update.png b/tests/ref/counter-page-header-only-update.png Binary files differnew file mode 100644 index 00000000..07bb19d9 --- /dev/null +++ b/tests/ref/counter-page-header-only-update.png diff --git a/tests/ref/issue-1833-locate-place.png b/tests/ref/issue-1833-locate-place.png Binary files differnew file mode 100644 index 00000000..82b74e6d --- /dev/null +++ b/tests/ref/issue-1833-locate-place.png diff --git a/tests/ref/issue-1886-locate-after-metadata.png b/tests/ref/issue-1886-locate-after-metadata.png Binary files differnew file mode 100644 index 00000000..3fb4708d --- /dev/null +++ b/tests/ref/issue-1886-locate-after-metadata.png diff --git a/tests/ref/issue-2326-context-set-page.png b/tests/ref/issue-2326-context-set-page.png Binary files differnew file mode 100644 index 00000000..f0307d44 --- /dev/null +++ b/tests/ref/issue-2326-context-set-page.png diff --git a/tests/ref/issue-2841-pagebreak-to-weak.png b/tests/ref/issue-2841-pagebreak-to-weak.png Binary files differnew file mode 100644 index 00000000..b6404766 --- /dev/null +++ b/tests/ref/issue-2841-pagebreak-to-weak.png diff --git a/tests/ref/issue-4029-locate-after-pagebreak.png b/tests/ref/issue-4029-locate-after-pagebreak.png Binary files differnew file mode 100644 index 00000000..3b21c5d3 --- /dev/null +++ b/tests/ref/issue-4029-locate-after-pagebreak.png diff --git a/tests/ref/issue-4029-locate-after-par-and-pagebreak.png b/tests/ref/issue-4029-locate-after-par-and-pagebreak.png Binary files differnew file mode 100644 index 00000000..9d34677d --- /dev/null +++ b/tests/ref/issue-4029-locate-after-par-and-pagebreak.png diff --git a/tests/ref/issue-4029-locate-after-spacing.png b/tests/ref/issue-4029-locate-after-spacing.png Binary files differnew file mode 100644 index 00000000..d2e61435 --- /dev/null +++ b/tests/ref/issue-4029-locate-after-spacing.png diff --git a/tests/ref/issue-4363-set-page-after-tag.png b/tests/ref/issue-4363-set-page-after-tag.png Binary files differnew file mode 100644 index 00000000..4002b2dd --- /dev/null +++ b/tests/ref/issue-4363-set-page-after-tag.png diff --git a/tests/ref/list-item-styling.png b/tests/ref/list-item-styling.png Binary files differnew file mode 100644 index 00000000..72af2e1d --- /dev/null +++ b/tests/ref/list-item-styling.png diff --git a/tests/ref/list-items-context.png b/tests/ref/list-items-context.png Binary files differnew file mode 100644 index 00000000..a19cbec4 --- /dev/null +++ b/tests/ref/list-items-context.png diff --git a/tests/ref/locate-between-pages.png b/tests/ref/locate-between-pages.png Binary files differnew file mode 100644 index 00000000..aac6de86 --- /dev/null +++ b/tests/ref/locate-between-pages.png diff --git a/tests/ref/page-marginal-style-context.png b/tests/ref/page-marginal-style-context.png Binary files differnew file mode 100644 index 00000000..02c80bb1 --- /dev/null +++ b/tests/ref/page-marginal-style-context.png diff --git a/tests/ref/page-marginal-style-empty.png b/tests/ref/page-marginal-style-empty.png Binary files differnew file mode 100644 index 00000000..10183129 --- /dev/null +++ b/tests/ref/page-marginal-style-empty.png diff --git a/tests/ref/page-marginal-style-page-call.png b/tests/ref/page-marginal-style-page-call.png Binary files differnew file mode 100644 index 00000000..0d53a59f --- /dev/null +++ b/tests/ref/page-marginal-style-page-call.png diff --git a/tests/ref/page-marginal-style-shared-initial-interaction.png b/tests/ref/page-marginal-style-shared-initial-interaction.png Binary files differnew file mode 100644 index 00000000..76a76588 --- /dev/null +++ b/tests/ref/page-marginal-style-shared-initial-interaction.png diff --git a/tests/ref/page-marginal-style-show-rule-with-page-call.png b/tests/ref/page-marginal-style-show-rule-with-page-call.png Binary files differnew file mode 100644 index 00000000..17a17140 --- /dev/null +++ b/tests/ref/page-marginal-style-show-rule-with-page-call.png diff --git a/tests/ref/page-marginal-style-show-rule-with-pagebreak.png b/tests/ref/page-marginal-style-show-rule-with-pagebreak.png Binary files differnew file mode 100644 index 00000000..f05c64a7 --- /dev/null +++ b/tests/ref/page-marginal-style-show-rule-with-pagebreak.png diff --git a/tests/ref/page-marginal-style-show-rule-with-set-page.png b/tests/ref/page-marginal-style-show-rule-with-set-page.png Binary files differnew file mode 100644 index 00000000..138f2272 --- /dev/null +++ b/tests/ref/page-marginal-style-show-rule-with-set-page.png diff --git a/tests/ref/page-marginal-style-show-rule.png b/tests/ref/page-marginal-style-show-rule.png Binary files differnew file mode 100644 index 00000000..f05c64a7 --- /dev/null +++ b/tests/ref/page-marginal-style-show-rule.png diff --git a/tests/ref/page-marginal-style-text-call-around-page-call.png b/tests/ref/page-marginal-style-text-call-around-page-call.png Binary files differnew file mode 100644 index 00000000..d5a2fd64 --- /dev/null +++ b/tests/ref/page-marginal-style-text-call-around-page-call.png diff --git a/tests/ref/page-marginal-style-text-call-around-pagebreak.png b/tests/ref/page-marginal-style-text-call-around-pagebreak.png Binary files differnew file mode 100644 index 00000000..c154a6bd --- /dev/null +++ b/tests/ref/page-marginal-style-text-call-around-pagebreak.png diff --git a/tests/ref/page-marginal-style-text-call-around-set-page.png b/tests/ref/page-marginal-style-text-call-around-set-page.png Binary files differnew file mode 100644 index 00000000..f4174cd2 --- /dev/null +++ b/tests/ref/page-marginal-style-text-call-around-set-page.png diff --git a/tests/ref/page-marginal-style-text-call-code.png b/tests/ref/page-marginal-style-text-call-code.png Binary files differnew file mode 100644 index 00000000..1c8f155f --- /dev/null +++ b/tests/ref/page-marginal-style-text-call-code.png diff --git a/tests/ref/page-marginal-style-text-call.png b/tests/ref/page-marginal-style-text-call.png Binary files differnew file mode 100644 index 00000000..1c8f155f --- /dev/null +++ b/tests/ref/page-marginal-style-text-call.png diff --git a/tests/ref/page-marginal-style-text-set-first.png b/tests/ref/page-marginal-style-text-set-first.png Binary files differnew file mode 100644 index 00000000..6ede81de --- /dev/null +++ b/tests/ref/page-marginal-style-text-set-first.png diff --git a/tests/ref/page-marginal-style-text-set.png b/tests/ref/page-marginal-style-text-set.png Binary files differnew file mode 100644 index 00000000..6ede81de --- /dev/null +++ b/tests/ref/page-marginal-style-text-set.png diff --git a/tests/suite/introspection/counter.typ b/tests/suite/introspection/counter.typ index 0d2be6e2..8cae32a4 100644 --- a/tests/suite/introspection/counter.typ +++ b/tests/suite/introspection/counter.typ @@ -62,6 +62,46 @@ At Beta, it was #context { #counter(page).update(1) #lorem(20) +--- counter-page-footer-before-set-page --- +#set page(numbering: "1", margin: (bottom: 20pt)) +A +#pagebreak() +#counter(page).update(5) +#set page(fill: aqua) +B + +--- counter-page-header-before-set-page --- +#set page(numbering: "1", number-align: top + center, margin: (top: 20pt)) +A +#counter(page).update(4) +#set page(fill: aqua) +B + +--- counter-page-between-pages --- +// The update happens conceptually between the pages. +#set page(numbering: "1", margin: (bottom: 20pt)) +A +#pagebreak() +#counter(page).update(5) +#set page(number-align: top + center, margin: (top: 20pt, bottom: 10pt)) +B + +--- counter-page-header-only-update --- +// Header should not be affected by default. +// To affect it, put the counter update before the `set page`. +#set page( + numbering: "1", + number-align: top + center, + margin: (top: 20pt), +) + +#counter(page).update(5) + +--- counter-page-footer-only-update --- +// Footer should be affected by default. +#set page(numbering: "1 / 1", margin: (bottom: 20pt)) +#counter(page).update(5) + --- counter-figure --- // Count figures. #figure(numbering: "A", caption: [Four 'A's], kind: image, supplement: "Figure")[_AAAA!_] diff --git a/tests/suite/introspection/locate.typ b/tests/suite/introspection/locate.typ index b3a77fde..18611dde 100644 --- a/tests/suite/introspection/locate.typ +++ b/tests/suite/introspection/locate.typ @@ -37,3 +37,93 @@ // Error: 10-25 selector matches multiple elements #context locate(heading) + +--- locate-between-pages --- +// Test locating tags that are before or between pages. +#set page(height: 30pt) +#context [ + // Before the first page. + // (= at the very start of the first page, before the header) + #test(locate(<a>).position(), (page: 1, x: 0pt, y: 0pt)) + + // On the first page. + #test(locate(<b>).position(), (page: 1, x: 10pt, y: 10pt)) + + // Between the two pages. + // (= at the very start of the first page, before the header) + #test(locate(<c>).position(), (page: 2, x: 0pt, y: 0pt)) + + // After the last page. + // (= at the very end of the last page, after the footer) + #test(locate(<d>).position(), (page: 2, x: 0pt, y: 30pt)) + #test(locate(<e>).position(), (page: 2, x: 0pt, y: 30pt)) +] + +#metadata(none) <a> +#pagebreak(weak: true) +#metadata(none) <b> +A +#pagebreak() +#metadata(none) <c> +#pagebreak(weak: true) +B +#pagebreak(weak: true) +#metadata(none) <d> +#pagebreak(weak: true) +#metadata(none) <e> + +--- issue-4029-locate-after-spacing --- +#set page(margin: 10pt) +#show heading: it => v(40pt) + it + += Introduction +#context test( + locate(heading).position(), + (page: 1, x: 10pt, y: 50pt), +) + + +--- issue-4029-locate-after-pagebreak --- +#set page(margin: 10pt) +#show heading: it => pagebreak() + it + += Introduction +#context test( + locate(heading).position(), + (page: 2, x: 10pt, y: 10pt), +) + +--- issue-4029-locate-after-par-and-pagebreak --- +// Ensure that the heading's tag isn't stuck at the end of the paragraph. +#set page(margin: 10pt) +Par +#show heading: it => pagebreak() + it += Introduction +#context test(locate(heading).page(), 2) + +--- issue-1886-locate-after-metadata --- +#show heading: it => { + metadata(it.label) + pagebreak(weak: true, to: "odd") + it +} + +Hi += Hello <hello> += World <world> + +// The metadata's position does not migrate to the next page, but the heading's +// does. +#context { + test(locate(metadata.where(value: <hello>)).page(), 1) + test(locate(<hello>).page(), 3) + test(locate(metadata.where(value: <world>)).page(), 3) + test(locate(<world>).page(), 5) +} + +--- issue-1833-locate-place --- +#set page(height: 60pt) +#context { + place(right + bottom, rect()) + test(here().position(), (page: 1, x: 10pt, y: 10pt)) +} diff --git a/tests/suite/layout/page.typ b/tests/suite/layout/page.typ index 0e1f7729..a4abaec7 100644 --- a/tests/suite/layout/page.typ +++ b/tests/suite/layout/page.typ @@ -245,6 +245,98 @@ Look, ma, no page numbers! #set page(header: auto, footer: auto) Default page numbers now. +--- page-marginal-style-text-set --- +#set page(numbering: "1", margin: (bottom: 20pt)) +#set text(red) +Red + +--- page-marginal-style-text-set-first --- +#set text(red) +#set page(numbering: "1", margin: (bottom: 20pt)) +Red + +--- page-marginal-style-text-call --- +#set page(numbering: "1", margin: (bottom: 20pt)) +#text(red)[Red] + +--- page-marginal-style-text-call-code --- +#{ + set page(numbering: "1", margin: (bottom: 20pt)) + text(red)[Red] +} + +--- page-marginal-style-text-call-around-page-call --- +#text(red, page(numbering: "1", margin: (bottom: 20pt))[Hello]) + +--- page-marginal-style-text-call-around-set-page --- +#text(red, { + set page(numbering: "1", margin: (bottom: 20pt)) + text(style: "italic")[Hello] +}) + +--- page-marginal-style-text-call-around-pagebreak --- +#set page(numbering: "1", margin: (bottom: 20pt)) +A +#text(red)[ + #pagebreak(weak: true) + B +] + +--- page-marginal-style-show-rule --- +#set page(numbering: "1", margin: (bottom: 20pt)) += Introduction + +--- page-marginal-style-show-rule-with-set-page --- +#show heading: it => { + set page(numbering: "1", margin: (bottom: 20pt)) + it +} + += Introduction + +--- page-marginal-style-show-rule-with-page-call --- +#show heading: page.with(fill: aqua) + +A += Introduction +B + +--- page-marginal-style-show-rule-with-pagebreak --- +#set page(numbering: "1", margin: (bottom: 20pt)) +#show heading: it => { + pagebreak(weak: true) + it +} + += Introduction + +--- page-marginal-style-context --- +#set page(numbering: "1", margin: (bottom: 20pt)) +#show: it => context { + set text(red) + it +} +Hi + +--- page-marginal-style-shared-initial-interaction --- +#set page(numbering: "1", margin: (bottom: 20pt)) +A +#{ + set text(fill: red) + pagebreak() +} +#text(fill: blue)[B] + +--- page-marginal-style-empty --- +#set text(red) +#set page(numbering: "1", margin: (bottom: 20pt)) + +--- page-marginal-style-page-call --- +#page(numbering: "1", margin: (bottom: 20pt))[ + #set text(red) + A +] + --- issue-2631-page-header-ordering --- #set text(6pt) #show heading: set text(6pt, weight: "regular") @@ -272,3 +364,22 @@ Hi #set page(fill: gray) text #pagebreak() + +--- issue-2326-context-set-page --- +#context [ + #set page(fill: aqua) + On page #here().page() +] + +--- issue-3671-get-from-page-call --- +#set page(margin: 5pt) +#context test(page.margin, 5pt) +#page(margin: 10pt, context test(page.margin, 10pt)) + +--- issue-4363-set-page-after-tag --- +#set page(fill: aqua) +1 +#pagebreak() +#metadata(none) +#set page(fill: red) +2 diff --git a/tests/suite/layout/pagebreak.typ b/tests/suite/layout/pagebreak.typ index a1734596..3ca48b69 100644 --- a/tests/suite/layout/pagebreak.typ +++ b/tests/suite/layout/pagebreak.typ @@ -141,3 +141,12 @@ Some text on page 2 #set page(fill: orange) // This sets the color of the page starting from page 4 Some text on page 4 + +--- issue-2591-single-weak-pagebreak --- +#pagebreak(weak: true) + +--- issue-2841-pagebreak-to-weak --- +First +#pagebreak(to: "odd") +#pagebreak(weak: true) +Odd diff --git a/tests/suite/model/list.typ b/tests/suite/model/list.typ index f9275517..46f4621f 100644 --- a/tests/suite/model/list.typ +++ b/tests/suite/model/list.typ @@ -142,6 +142,16 @@ Hello #list(tight: false)[A][B] World +--- list-items-context --- +#context [+ A] +#context [+ B] +#context [+ C] + +--- list-item-styling --- +- Hello +#text(red)[- World] +#text(green)[- What up?] + --- issue-2530-list-item-panic --- // List item (pre-emptive) #list.item[Hello] |
