Skip to content

Commit

Permalink
pyramid: Add tests (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf authored Nov 23, 2024
2 parents 414eae7 + 4050b30 commit 03657ab
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/chart/pyramid.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "/src/cetz.typ": draw, styles, palette, coordinate

// Piechart Label Kind
// Pyramid Chart Label Kind
#let label-kind = (value: "VALUE", percentage: "%", label: "LABEL")

// Pyramid Chart Default Style
Expand Down Expand Up @@ -464,4 +464,4 @@
}
})
})
}
}
Binary file added tests/chart/pyramid/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.
25 changes: 25 additions & 0 deletions tests/chart/pyramid/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#set page(width: auto, height: auto)
#import "/src/cetz.typ": *
#import "/src/lib.typ": *
#import "/tests/helper.typ": *

#let data = (
([Category A], 10),
([Category B], 20),
([Category C], 30),
)

#test-case(args => {
chart.pyramid(
data,
value-key: 1,
label-key: 0,
side-label: (content: (value, label) => [#value%]),
mode: args.mode
)
}, args: (
(mode: "REGULAR"),
(mode: "AREA-HEIGHT"),
(mode: "HEIGHT"),
(mode: "WIDTH"),
))

0 comments on commit 03657ab

Please sign in to comment.