Skip to content

Commit

Permalink
Fix and test text-chunk backgrounds (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michi Huber committed Mar 30, 2021
1 parent 76b0e5a commit 8c42aaf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/clj/clj_pdf/section/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

(defn- text-chunk [style ^String content]
(let [ch (Chunk. ^String content ^Font (font style))]
(set-background ch style)
(doseq [{:keys [thickness y-position]} (:underlines style)]
(assert (number? thickness))
(assert (number? y-position))
Expand Down
Binary file added test/background.pdf
Binary file not shown.
4 changes: 4 additions & 0 deletions test/clj_pdf/test/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@
(eq? [{} [:line]]
"line.pdf"))

(deftest background
(eq? [{} [:chunk {:background [200 0 0]} "red bg"]]
"background.pdf"))

(deftest underlines
(eq? [{}
[:paragraph
Expand Down

0 comments on commit 8c42aaf

Please sign in to comment.