summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-12-10 22:44:35 +0100
committerLaurenz <laurmaedje@gmail.com>2020-12-10 22:45:45 +0100
commit1cbd5f3051ba90b3f673bc2f6319192d05381719 (patch)
tree182134e9f355062a00a145fab3a988847c4ed13b /tests/typ
parentfdc1b378a3eb3cf325592b801c43e2ec2478ddff (diff)
Refine test infrastructure ✅
- Tests diagnostics - More and better separated image tests
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/empty.typ0
-rw-r--r--tests/typ/example-coma.typ (renamed from tests/typ/coma.typ)2
-rw-r--r--tests/typ/image-error.typ8
-rw-r--r--tests/typ/image-fit.typ21
-rw-r--r--tests/typ/image-jpeg.typ2
-rw-r--r--tests/typ/image-png.typ2
-rw-r--r--tests/typ/image.typ15
7 files changed, 35 insertions, 15 deletions
diff --git a/tests/typ/empty.typ b/tests/typ/empty.typ
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/typ/empty.typ
diff --git a/tests/typ/coma.typ b/tests/typ/example-coma.typ
index 839335b7..f841a122 100644
--- a/tests/typ/coma.typ
+++ b/tests/typ/example-coma.typ
@@ -1,3 +1,5 @@
+// Small integration test of syntax, page setup, box layout and alignment.
+
[page: width=450pt, height=300pt, margins=1cm]
[box][
diff --git a/tests/typ/image-error.typ b/tests/typ/image-error.typ
new file mode 100644
index 00000000..4fde4ab2
--- /dev/null
+++ b/tests/typ/image-error.typ
@@ -0,0 +1,8 @@
+// error: 5:9-5:30 failed to load image
+// error: 8:9-8:30 failed to load image
+
+// File does not exist.
+[image: "path/does/not/exist"]
+
+// File exists, but is no image.
+[image: "typ/image-error.typ"]
diff --git a/tests/typ/image-fit.typ b/tests/typ/image-fit.typ
new file mode 100644
index 00000000..b735f058
--- /dev/null
+++ b/tests/typ/image-fit.typ
@@ -0,0 +1,21 @@
+// Fit to width of page.
+[image: "res/rhino.png"]
+
+// Fit to height of page.
+[page: width=270pt][
+ [image: "res/rhino.png"]
+]
+
+// Set width explicitly.
+[image: "res/rhino.png", width=50pt]
+
+// Set height explicitly.
+[image: "res/rhino.png", height=50pt]
+
+// Set width and height explicitly and force stretching.
+[image: "res/rhino.png", width=25pt, height=50pt]
+
+// Make sure the bounding-box of the image is correct.
+[align: bottom, right][
+ [image: "res/tiger.jpg"]
+]
diff --git a/tests/typ/image-jpeg.typ b/tests/typ/image-jpeg.typ
new file mode 100644
index 00000000..48cf1a0d
--- /dev/null
+++ b/tests/typ/image-jpeg.typ
@@ -0,0 +1,2 @@
+// Load an RGB JPEG image.
+[image: "res/tiger.jpg"]
diff --git a/tests/typ/image-png.typ b/tests/typ/image-png.typ
new file mode 100644
index 00000000..482591e9
--- /dev/null
+++ b/tests/typ/image-png.typ
@@ -0,0 +1,2 @@
+// Load an RGBA PNG image.
+[image: "res/rhino.png"]
diff --git a/tests/typ/image.typ b/tests/typ/image.typ
deleted file mode 100644
index 6ae349a1..00000000
--- a/tests/typ/image.typ
+++ /dev/null
@@ -1,15 +0,0 @@
-[page: width=5cm, height=5cm, margins=0.25cm]
-
-[image: "res/tiger.jpg"]
-
-[pagebreak]
-
-# Tiger
-[image: "res/tiger.jpg", width=2cm]
-[image: "res/rhino.png", width=1cm]
-[image: "res/rhino.png", height=2cm]
-
-[pagebreak]
-
-[align: center, bottom]
-[image: "res/tiger.jpg", width=2cm, height=3.5cm]