Skip to content

Commit

Permalink
[#15] Use addParameters in tests as well, and update missed usages.
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattking committed Sep 20, 2024
1 parent cbededb commit 99e83b5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/com/sainsburys/k2zpl/command/Font.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal data class Font(

override val command: CharSequence = "^A${font}"
override val parameters: Map<CharSequence, Any?> =
linkedMapOf("o" to orientation, "h" to height, "w" to width)
addParameters("o" to orientation, "h" to height, "w" to width)
}


Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/sainsburys/k2zpl/command/GraphicBox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal data class GraphicBox(

override val command: CharSequence = "^GB"
override val parameters: Map<CharSequence, Any?> =
linkedMapOf(
addParameters(
"w" to width,
"h" to height,
"t" to thickness, "c" to color.code,
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/sainsburys/k2zpl/command/MediaMode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal data class MediaMode(
) : ZplCommand {
override val command: CharSequence = "^MM"
override val parameters: Map<CharSequence, Any?> =
linkedMapOf("m" to mediaMode, "p" to prePeelSelect)
addParameters("m" to mediaMode, "p" to prePeelSelect)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/sainsburys/k2zpl/command/ZplCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.sainsburys.k2zpl.command

interface ZplCommand {
val command: CharSequence
val parameters: Map<CharSequence, Any?> get() = linkedMapOf()
val parameters: Map<CharSequence, Any?> get() = addParameters()
fun build(stringBuilder: StringBuilder) = stringBuilder.apply {
append(command)
with(parameters.values.iterator()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@ class ZplCommandWithoutParameters : ZplCommand {

class ZplCommandWithOneParameter : ZplCommand {
override val command = "^ZCP"
override val parameters: Map<CharSequence, Any?> = linkedMapOf(
override val parameters: Map<CharSequence, Any?> = addParameters(
"param-one" to "value-one"
)
}

class ZplCommandWithMultipleParameters : ZplCommand {
override val command = "^ZCPS"
override val parameters: Map<CharSequence, Any?> = linkedMapOf(
override val parameters: Map<CharSequence, Any?> = addParameters(
"param-one" to "value-one",
"param-two" to "value-two"
)
}

class ZplCommandWitNullFirstParameter : ZplCommand {
override val command = "^ZCPN"
override val parameters: Map<CharSequence, Any?> = linkedMapOf(
override val parameters: Map<CharSequence, Any?> = addParameters(
"param-one" to null,
"param-two" to "value-two"
)
}

class ZplCommandWitNullSecondParameter : ZplCommand {
override val command = "^ZCPNS"
override val parameters: Map<CharSequence, Any?> = linkedMapOf(
override val parameters: Map<CharSequence, Any?> = addParameters(
"param-one" to "value-one",
"param-two" to null
)
Expand Down

0 comments on commit 99e83b5

Please sign in to comment.