Skip to content

Commit

Permalink
Adjust tests and add javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattking committed Oct 28, 2024
1 parent c256bb9 commit 31d5cf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 12 additions & 0 deletions src/main/kotlin/com/sainsburys/k2zpl/builder/ZplBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,21 @@ class ZplBuilder {
private var _zplDpiSetting: ZplDpiSetting = ZplDpiSetting.Unset
private var defaultFont: Font = Font(ZplFont.A, ZplFieldOrientation.NORMAL, 30.dots, 30.dots)

/**
* The current vertical or Y position of the label. This can be used
* as needed to keep track of a label height to be used in combination
* with the [com.sainsburys.k2zpl.command.LabelLength] command, as well as
* any command that requires a Y position value.
*/
var verticalPosition: Int = 0
private set

/**
* Advance the [verticalPosition] value by the amount specified.
* Can also be used in combination with the [cm], [mm], [dots] functions
* to indicate measurement type.
* @param byAmount The amount to increment the [verticalPosition] by.
*/
fun advancePosition(byAmount: Int) {
verticalPosition += byAmount
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ class ZplBuilderTest : DescribeSpec({
it("adds value to the vertical position") {
subject.advancePosition(100)
subject.verticalPosition shouldBe 100
}
it("adds cm value to the vertical position") {
subject.apply {
subject.dpiSetting = ZplDpiSetting.DPI_203
advancePosition(5.cm)
verticalPosition shouldBe 5.cm
}
subject.advancePosition(50)
subject.verticalPosition shouldBe 150
}
}
describe("Int mm extension") {
Expand Down

0 comments on commit 31d5cf5

Please sign in to comment.