Skip to content

Commit

Permalink
refactor!: stabalised tests and removed measurment defaults for code …
Browse files Browse the repository at this point in the history
…blocks

# Conflicts:
#	tests/background/ref/1.png
#	tests/background/ref/10.png
#	tests/background/ref/11.png
#	tests/background/ref/12.png
#	tests/background/ref/13.png
#	tests/background/ref/14.png
#	tests/background/ref/15.png
#	tests/background/ref/16.png
#	tests/background/ref/2.png
#	tests/background/ref/3.png
#	tests/background/ref/4.png
#	tests/background/ref/5.png
#	tests/background/ref/6.png
#	tests/background/ref/7.png
#	tests/background/ref/8.png
#	tests/background/ref/9.png
#	tests/background/test.typ
#	tests/colors/ref/1.png
#	tests/colors/ref/2.png
#	tests/colors/ref/3.png
#	tests/colors/ref/4.png
  • Loading branch information
TimeTravelPenguin committed Jan 5, 2025
1 parent 34b8656 commit b680569
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions examples/requirements.typ
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#import "@preview/cetz:0.3.1"
#import "@preview/cetz-plot:0.1.0"
4 changes: 3 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ update-test-refs:
typst-test util export
for dir in tests/*/out; do
mv "$dir" "$(dirname "$dir")/ref"
refpath="$(dirname "$dir")/ref"
mkdir -p "$refpath"
mv "$dir"/* "$refpath"
done
8 changes: 6 additions & 2 deletions src/styling/code.typ
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@
#box(..config, it)
]

#show raw.where(block: true): it => (
#show raw.where(block: true): it => {
if not code-block {
return it
}

context [
#let config = default-code-block-config + (fill: palette.colors.crust.rgb) + block-config
#block(..config, it)
]
)
}

#body
]
Binary file modified tests/background/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/background/ref/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions tests/background/test.typ
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#import "/src/lib.typ": catppuccin, flavors, get-flavor, config-code-blocks

#set page(width: auto, height: auto)
#import "/src/lib.typ": catppuccin, flavors, get-flavor, config-code-blocks

#let perms = ()
#for flavor in flavors.keys() {
#for flavor in flavors.values() {
for code-block in (true, false) {
for syntax in (true, false) {
perms.push((flavor: flavor, code-block: code-block, syntax: syntax))
Expand All @@ -15,8 +14,8 @@
show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax)
pagebreak(weak: true)

[
= #get-flavor(p.flavor).name
block([
= #p.flavor.name
- Code block: #p.code-block
- Code syntax: #p.syntax

Expand All @@ -34,10 +33,10 @@
#for p in perms [
#show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax)
= #get-flavor(p.flavor).name
= #p.flavor.name
== Code block: #p.code-block
== Code syntax: #p.syntax
]
```
]
])
}
Binary file modified tests/colors/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/colors/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/colors/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/colors/ref/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 6 additions & 10 deletions tests/colors/test.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#import "/src/lib.typ": catppuccin, flavors, get-flavor

#set page(width: auto, height: auto)
#import "/src/lib.typ": catppuccin, flavors, get-flavor

#let color-swatches(palette) = {
let swatches = ()
Expand All @@ -24,11 +23,8 @@
)
}

#for flavor in flavors.keys() [
#pagebreak(weak: true)
#show: catppuccin.with(flavor)

#let palette = get-flavor(flavor)
#color-swatches(palette)
]

#for flavor in flavors.values() {
pagebreak(weak: true)
show: catppuccin.with(flavor)
color-swatches(flavor)
}

0 comments on commit b680569

Please sign in to comment.