summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeedehai <18319900+Leedehai@users.noreply.github.com>2024-03-23 07:51:43 -0400
committerGitHub <noreply@github.com>2024-03-23 11:51:43 +0000
commitd1568a55831f4074c7bcfe7d0bb983055e1709d3 (patch)
tree25007c3b5cba2ecefc318c648030bde5aff55f85
parent0dba0e26587a663e1de66c88d511379fc16d3612 (diff)
Let `Repr` for `Relative<T>` print both abs + ratio (#3721)
-rw-r--r--crates/typst/src/layout/rel.rs6
-rw-r--r--tests/ref/compiler/content-field.pngbin8252 -> 8815 bytes
-rw-r--r--tests/ref/compiler/repr.pngbin64757 -> 32579 bytes
-rw-r--r--tests/ref/layout/grid-cell.pngbin45433 -> 47260 bytes
-rw-r--r--tests/ref/layout/table-cell.pngbin49090 -> 50913 bytes
-rw-r--r--tests/typ/compiler/repr.typ4
6 files changed, 5 insertions, 5 deletions
diff --git a/crates/typst/src/layout/rel.rs b/crates/typst/src/layout/rel.rs
index fa2a56e2..ed367588 100644
--- a/crates/typst/src/layout/rel.rs
+++ b/crates/typst/src/layout/rel.rs
@@ -100,11 +100,7 @@ impl<T: Numeric + Debug> Debug for Rel<T> {
impl<T: Numeric + Repr> Repr for Rel<T> {
fn repr(&self) -> EcoString {
- match (self.rel.is_zero(), self.abs.is_zero()) {
- (false, false) => eco_format!("{} + {}", self.rel.repr(), self.abs.repr()),
- (false, true) => self.rel.repr(),
- (true, _) => self.abs.repr(),
- }
+ eco_format!("{} + {}", self.rel.repr(), self.abs.repr())
}
}
diff --git a/tests/ref/compiler/content-field.png b/tests/ref/compiler/content-field.png
index 3095ba8c..d582cfa1 100644
--- a/tests/ref/compiler/content-field.png
+++ b/tests/ref/compiler/content-field.png
Binary files differ
diff --git a/tests/ref/compiler/repr.png b/tests/ref/compiler/repr.png
index c90cc3cd..3b1a571e 100644
--- a/tests/ref/compiler/repr.png
+++ b/tests/ref/compiler/repr.png
Binary files differ
diff --git a/tests/ref/layout/grid-cell.png b/tests/ref/layout/grid-cell.png
index 07508b40..563d6721 100644
--- a/tests/ref/layout/grid-cell.png
+++ b/tests/ref/layout/grid-cell.png
Binary files differ
diff --git a/tests/ref/layout/table-cell.png b/tests/ref/layout/table-cell.png
index 647a2e10..d0c39363 100644
--- a/tests/ref/layout/table-cell.png
+++ b/tests/ref/layout/table-cell.png
Binary files differ
diff --git a/tests/typ/compiler/repr.typ b/tests/typ/compiler/repr.typ
index 13593a86..0cdd4bcf 100644
--- a/tests/typ/compiler/repr.typ
+++ b/tests/typ/compiler/repr.typ
@@ -22,6 +22,10 @@
#1.7em \
#(1cm + 0em) \
#(2em + 10pt) \
+#(100% + (2em + 2pt)) \
+#(100% + 0pt) \
+#(100% - 2em + 2pt) \
+#(100% - 2pt) \
#2.3fr
---